alias('c'); $model = $model->field('c.*,p.store_name,p.price as ot_price'); $model = $model->join('StoreProduct p', 'p.id=c.product_id', 'LEFT'); if (isset($where['is_show']) && $where['is_show'] != '') $model = $model->where('c.is_show', $where['is_show']); if (isset($where['is_host']) && $where['is_host'] != '') $model = $model->where('c.is_host', $where['is_host']); if (isset($where['store_name']) && $where['store_name'] != '') $model = $model->where('p.store_name|p.id|c.id|c.title', 'LIKE', "%$where[store_name]%"); return $model->order('c.id desc')->where('c.is_del', 0); } /** * @param $where * @return array */ public static function systemPage($where) { $model = self::setWhere($where)->where('c.is_del=0')->limit(bcmul($where['page'], $where['limit'], 0), $where['limit']); return self::page($model, function ($item) { $item['count_people_all'] = StoreOrder::where('live_id', $item['id'])->count();//参与人数 }, $where, $where['limit']); } }