params), ['page_no', 'page_size']); } /** * @notes 服务列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2022/2/17 5:17 下午 */ public function lists(): array { $lists = Goods::field('id,name,image,scribing_price,duration,tags,price') ->withSearch($this->setSearch(), $this->params) ->where(['status'=>GoodsEnum::SHELVE]) ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); foreach ($lists as &$list) { $list['price'] = trim(rtrim(sprintf("%.4f", $list['price'] ), '0'),'.'); } return $lists; } /** * @notes 服务总数 * @return int * @author ljj * @date 2022/2/17 5:17 下午 */ public function count(): int { return Goods::withSearch($this->setSearch(), $this->params) ->where(['status'=>GoodsEnum::SHELVE]) ->count(); } }