1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace huo\logic\game;
- use huo\model\common\CommonModel;
- use huo\model\game\GamePriceModel;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\ModelNotFoundException;
- use think\exception\DbException;
- class GamePriceLogic extends CommonModel {
-
- public function getList($where = [], $page = '1,10', $order = '-update_time') {
- $_map = [];
- $_rdata = ['count' => 0, 'list' => []];
- if (!empty($where['app_id'])) {
- $_map['app_id'] = $where['app_id'];
- }
- if (!empty($where['product_code'])) {
- $_map['product_code'] = $where['product_code'];
- }
- $_gp_model = New GamePriceModel();
- $_count = $_gp_model->where($_map)->count('id');
- if (empty($_count)) {
- return $_rdata;
- }
- $_order = $this->orderFilter($order);
- try {
- $_list = $_gp_model->where($_map)->page($page)->order($_order)->select();
- if (is_object($_list)) {
- $_list = $_list->toArray();
- }
- $_rdata['count'] = $_count;
- $_rdata['list'] = $_list;
- return $_rdata;
- } catch (DataNotFoundException $e) {
- return $_rdata;
- } catch (ModelNotFoundException $e) {
- return $_rdata;
- } catch (DbException $e) {
- return $_rdata;
- }
- }
-
- public function getId($map = []) {
- return (new GamePriceModel())->where($map)->value('id');
- }
- }
|