123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace huo\model\game;
- use huo\model\common\CommonModel;
- use huolib\constant\CommonConst;
- class GameextModel extends CommonModel {
- protected $name = 'game_ext';
-
- public function game() {
- return $this->belongsTo('huo\model\game\GameModel', 'app_id', 'id')->field('id,name');
- }
-
- public function joingame() {
- return $this->belongsTo('huo\model\game\GameModel', 'app_id', 'id')->setEagerlyType(0);
- }
-
- 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;
- }
-
- 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;
- }
- }
-
- 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;
- }
- }
|