* @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; } }