['paid','status','source'], 'between_time' => 'create_time', '%like%' => ['number'], ]; } /** * @notes 零售订单列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @date 2024/04/27 11:26 */ public function lists(): array { $userId=$this->request->userId; if(!$userId) return []; return Cashierclass::where($this->searchWhere)->where('uid',$userId) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->each(function($item){ $item['goods_list']=Cashierinfo::where('pid',$item['id'])->with('goodsName')->field('goods,nums,price sell')->limit(3)->select(); $item['goods_count']=count(explode(',',$item['cart_id'])); }) ->toArray(); } /** * @notes 零售订单数量 * @return int * @date 2024/04/27 11:26 */ public function count(): int { return Cashierclass::where($this->searchWhere)->count(); } }