测试api商城快讯

This commit is contained in:
wangxiaowei 2024-08-09 02:51:50 +08:00
parent 3428c82fd6
commit d8fe88c1b0

@ -21,6 +21,7 @@ use think\facade\Db;
use app\common\model\activity_area\ActivityArea;
use think\facade\Event;
use app\common\model\MallNews;
use app\common\model\MallNewsShop;
class IndexLogic extends Logic
@ -220,14 +221,21 @@ class IndexLogic extends Logic
// 商城快讯
$mall_news = MallNews::where('delete_time', 0)->order('sort desc, create_time desc')->limit(3)->select();
foreach ($mall_news as &$v) {
if (isset($v['files'])) {
foreach ($v['files'] as &$v1) {
if ($v['type'] == 0) {
$v1['src'] = UrlServer::getFileUrl('uploads/images/' . $v1['src']);
} else {
$v1['src'] = Config::get('aliyunoss.domain') . self::$FILE_VIDEO_PATH . '/'. $v1['src'];
if ($v['mall_type'] == 0) {
if (isset($v['files'])) {
foreach ($v['files'] as &$v1) {
if ($v['type'] == 0) {
$v1['src'] = UrlServer::getFileUrl('uploads/images/' . $v1['src']);
} else {
$v1['src'] = Config::get('aliyunoss.domain') . self::$FILE_VIDEO_PATH . '/'. $v1['src'];
}
}
}
} else if ($v['mall_type'] == 1) {
$v['files'] = MallNewsShop::alias('mns')
->join('goods g', 'mns.shop_id = g.id')
->field('mns.id, g.id as gid, g.name')
->where(['mns.delete_time' => 0])->whereIn('mns.id', $v['mall_news_goods_id'])->select()->toArray();
}
}