修改商城快讯关联
This commit is contained in:
parent
fcce6c2bd4
commit
8dd20100ad
@ -22,7 +22,7 @@ use app\common\model\activity_area\ActivityArea;
|
||||
use think\facade\Event;
|
||||
use app\common\model\MallNews;
|
||||
use app\common\model\MallNewsShop;
|
||||
|
||||
use app\common\model\MallNewsFile;
|
||||
|
||||
class IndexLogic extends Logic
|
||||
{
|
||||
@ -220,6 +220,7 @@ class IndexLogic extends Logic
|
||||
|
||||
// 商城快讯
|
||||
$mall_news = MallNews::where('delete_time', 0)->order('sort desc, create_time desc')->limit(3)->select();
|
||||
$arr = [];
|
||||
foreach ($mall_news as &$v) {
|
||||
if ($v['mall_type'] == 0) {
|
||||
if (isset($v['files'])) {
|
||||
@ -232,11 +233,17 @@ class IndexLogic extends Logic
|
||||
}
|
||||
}
|
||||
} else if ($v['mall_type'] == 1) {
|
||||
$v['shop'] = MallNewsShop::alias('mns')
|
||||
->join('goods g', 'mns.shop_id = g.id')
|
||||
->join('mall_news_file mnf', 'mns.id = mnf.mall_news_shop_id')
|
||||
->field('mns.id, g.id as gid, g.name, mnf.src')
|
||||
->where(['mns.delete_time' => 0])->whereIn('mns.id', $v['mall_news_goods_id'])->select()->toArray();
|
||||
// $v['shop'] = MallNewsShop::alias('mns')
|
||||
// ->join('goods g', 'mns.shop_id = g.id')
|
||||
// ->join('mall_news_file mnf', 'mns.id = mnf.mall_news_shop_id')
|
||||
// ->field('mns.id, g.id as gid, g.name, mnf.src')
|
||||
// ->where(['mns.delete_time' => 0])->whereIn('mns.id', $v['mall_news_goods_id'])->group('mns.id')->select()->toArray();
|
||||
$ids = explode(',', $v['mall_news_goods_id']);
|
||||
foreach ($ids as $k => &$v2) {
|
||||
$arr[$k] = MallNewsFile::where('mall_news_shop_id', $v2)->select()->toArray();
|
||||
}
|
||||
|
||||
$v['shop'] = $arr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user