['title', 'type', 'type2', 'is_show', 'create_time'], ]; } /** * @notes 获取积分、抽奖奖品列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author BD * @date 2024/10/14 23:57 */ public function lists(): array { $items = MallGoods::where($this->searchWhere) ->field(['id', 'title', 'image', 'price', 'content', 'money', 'point', 'win_rate', 'num', 'type', 'type2', 'is_show', 'sort', 'langs', 'create_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['type' => 'desc','sort' => 'desc','id' => 'desc']) ->select() ->toArray(); foreach ($items as &$item) { $item['langs'] = json_decode($item['langs'], JSON_UNESCAPED_UNICODE); } return $items; } /** * @notes 获取积分、抽奖奖品数量 * @return int * @author BD * @date 2024/10/14 23:57 */ public function count(): int { return MallGoods::where($this->searchWhere)->count(); } }