params['log_id']]; $status = (isset($this->params['status']) && $this->params['status'] != '') ? $this->params['status'] : 0; $where[] = ['status','=',$status]; return $where; } /** * @notes 商品采集列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2023/3/14 10:02 上午 */ public function lists(): array { $lists = GoodsGather::field('id,gather_url,gather_info,gather_status,channel,create_time,status') ->append(['goods_info','gather_status_desc','channel_desc']) ->hidden(['gather_info','channel']) ->where(self::where()) ->limit($this->limitOffset, $this->limitLength) ->order('id desc') ->select() ->toArray(); return $lists; } /** * @notes 商品采集数量 * @return int * @author ljj * @date 2023/3/14 10:03 上午 */ public function count(): int { return GoodsGather::where(self::where())->count(); } /** * @notes 数据统计 * @return array * @author ljj * @date 2023/3/14 10:06 上午 */ public function extend() { return [ 'wait' => GoodsGather::where(['log_id'=>$this->params['log_id'],'status'=>YesNoEnum::NO])->count(), 'already' => GoodsGather::where(['log_id'=>$this->params['log_id'],'status'=>YesNoEnum::YES])->count(), ]; } }