1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- /**
- * GamePriceLogic.php UTF-8
- * WWW
- *
- * @date : 2018/8/22 22:37
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : chenbingling <cbl@huosdk.com>
- * @version : HUOSDK 8.0
- */
- 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 {
- /**
- * 获取计费点列表
- *
- * @param array $where
- * @param string $page
- * @param string $order
- *
- * @return array
- */
- 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;
- }
- }
- /**
- * 查找记录
- *
- * @param array $map
- *
- * @return mixed
- */
- public function getId($map = []) {
- return (new GamePriceModel())->where($map)->value('id');
- }
- }
|