1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- /**
- * GamePlayModel.php UTF-8
- * WWW
- *
- * @date : 2018/7/13 20:18
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : chenbingling <cbl@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\model\game;
- use huo\model\common\CommonModel;
- class GameQqModel extends CommonModel {
- protected $name = 'game_qq';
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = true;
- /**
- * 基础查询
- *
- * @param $query
- */
- protected function base($query) {
- $query->where('delete_time', 0)->where('is_delete', 2);
- }
- /**
- * 关联game表
- *
- * @return mixed
- */
- public function game() {
- return $this->belongsTo('huo\model\game\GameModel', 'app_id')->field('id,name game_name');
- }
- /**
- * 关联game表
- *
- * @return mixed
- */
- public function qq() {
- return $this->belongsTo('huo\model\conf\QqConfModel', 'qq_id')->field('id,qq,idkey,ios_key,and_key');
- }
- /**
- * 更新信息
- *
- * @param $game_data
- * @param $id
- *
- * @return bool
- */
- public function updateGame($game_data, $id) {
- $_map['id'] = $id;
- $_data = $game_data;
- $_rs = self::update($_data, $_map, true);
- if (false == $_rs) {
- return false;
- }
- return true;
- }
- /**
- * 添加一条记录
- *
- * @param $data
- *
- * @return bool|mixed
- */
- public function addGame($data) {
- if (empty($data)) {
- return false;
- }
- $_obj = self::create($data, true);
- if (false == $_obj) {
- return false;
- }
- return true;
- }
- }
|