123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\api\logic;
-
- use app\common\model\goods\Goods;
- use app\common\model\activity_area\ActivityAreaGoods;
- use app\common\basics\Logic;
- use think\Db;
-
-
- class ActivityAreaLogic extends Logic
- {
-
-
-
- public static function activityGoodsList($id, $page, $size)
- {
-
- $where[] = ['AG.del', '=', 0];
- $where[] = ['G.del', '=', 0];
- $where[] = ['G.status', '=', 1];
- $where[] = ['AG.audit_status', '=', 1];
- $where[] = ['AG.activity_area_id', '=', $id];
-
- $goods = new ActivityAreaGoods();
- $count = $goods->alias('AG')
- ->join('goods G', 'G.id = AG.goods_id')
- ->where($where)
- ->count();
-
- $list = $goods->alias('AG')
- ->join('goods G', 'G.id = AG.goods_id')
- ->where($where)
- ->field('AG.id as agid,G.id,G.name,G.image,G.min_price as price,
- (G.clicks + G.clicks_virtual) as views,G.market_price,AG.activity_area_id,(G.sales_actual + G.sales_virtual) as sales_total')
- ->page($page,$size)
- ->select();
-
- $more = is_more($count, $page, $size);
-
- $data = [
- 'list' => $list,
- 'page_no' => $page,
- 'page_size' => $size,
- 'count' => $count,
- 'more' => $more
- ];
-
- return $data;
- }
-
- }
|