* @version : HUOSDK 8.0 */ namespace huo\model\game; use huo\model\common\CommonModel; use huolib\constant\CommonConst; class GameextModel extends CommonModel { protected $name = 'game_ext'; /** * @return \think\model\relation\BelongsTo */ public function game() { return $this->belongsTo('huo\model\game\GameModel', 'app_id', 'id')->field('id,name'); } /** * @return \think\model\relation\BelongsTo */ public function joingame() { return $this->belongsTo('huo\model\game\GameModel', 'app_id', 'id')->setEagerlyType(0); } /** * 获取游戏充值排行 * * @param string $page * * @param string $order * * @return array|false * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function getChargeRank($page = '1,6', $order = '-sum_money') { $_field = 'sum_money total_money,app_id'; $_map['joingame.is_delete']=CommonConst::CONST_NOT_DELETE; $_order = $this->orderFilter($order); $_data = $this->with('joingame') ->field($_field) ->where($_map) ->order($_order) ->page($page) ->select(); if (is_object($_data)) { $_data = $_data->toArray(); } return $_data; } /** * 更新游戏 * * @param array $ge_data * @param string $app_id * * @return bool */ public function updateData($ge_data, $app_id) { $_map['app_id'] = $app_id; $_data = $ge_data; $_rs = self::update($_data, $_map, true); if (false == $_rs) { return false; } else { return true; } } /** * 获取游戏扩信息 * * @param int $app_id * * @return false|array */ public function getDetail($app_id) { $_map['app_id'] = $app_id; $_data = $this->where($_map)->find(); if (is_object($_data)) { $_data = $_data->toArray(); } if (false == $_data) { return false; } return $_data; } }