params['type'] ?? ''; $where[] = ['shop_id','=',$this->shopId]; switch ($type){ case 1: $where[] = ['change_type','in',ShopAccountLogEnum::MONEY_DESC]; break; case 2: $where[] = ['change_type','in',ShopAccountLogEnum::DEPOSIT_DESC]; break; } return $where; } public function lists(): array { $lists = ShopAccountLog::where(['shop_id'=>$this->shopId]) ->where($this->setWhere()) ->field('id,sn,action,change_object,change_type,change_amount,left_amount,create_time') ->append(['change_type_desc']) ->order('id desc') ->limit($this->limitOffset, $this->limitLength) ->select()->toArray(); return $lists; } public function count(): int { return ShopAccountLog::where(['shop_id'=>$this->shopId]) ->where($this->setWhere()) ->count(); } public function extend() { $shop = Shop::where(['id'=>$this->shopId])->field('money,deposit')->findOrEmpty(); return [ 'money' => $shop['money'], 'deposit' => $shop['deposit'], ]; } }