123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- /**
- * GameextModel.php UTF-8
- *
- *
- * @date : 2017/11/21 21:21
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @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;
- }
- }
|