Merge branch 'feature/new_game_auth' of wmtx/platform into release

新增游戏自动授权
master
廖金灵 4 years ago committed by Gogs
commit d48e90e1db

@ -237,6 +237,15 @@ class GameController extends ThinkController
];
$gameService->saveBaseGame($baseData);
M('promote_company', 'tab_')
->where('1=1')
->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['relation_game_id'] . '))']]);
$subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['not in', [1, 2]]])->select(false);
M('promote', 'tab_')
->where(['_string' => 'company_id in (' . $subSql . ') or company_id=0'])
->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]);
\Think\Log::actionLog('Game/add', 'Game', 1);
//操作日志
addOperationLog(array(
@ -312,6 +321,11 @@ class GameController extends ThinkController
];
$gameService->saveBaseGame($baseData);
$subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['not in', [1, 2]]])->select(false);
M('promote', 'tab_')
->where(['_string' => 'company_id in (' . $subSql . ') or company_id=0'])
->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]);
addOperationLog(array(
"op_type"=>0,
"key"=>$_POST['game_name'],

@ -1231,16 +1231,23 @@ class PromoteController extends ThinkController
$promote = M('promote', 'tab_')->field('id,account,game_ids,company_id')->where(['id'=>$promoteId])->find();
$company = M('promote_company', 'tab_')->field('game_ids')->where(['id' => $promote['company_id']])->find();
$data = [];
if (!$company || $company['game_ids'] == '') {
if (is_null($company)) {
$games = M('game', 'tab_')
->field('relation_game_id id,relation_game_name game_name,short')
->where(['game_status'=>1, 'down_port'=>1])
->group("relation_game_id")
->select();
$data['data']['game_list'] = empty($games) ? '' : $games;
} elseif ($company['game_ids'] == '') {
$data['data']['game_list'] = [];
} else {
$companyGameIds = explode(',', $company['game_ids']);
$game_list = M('game', 'tab_')
$games = M('game', 'tab_')
->field('relation_game_id id,relation_game_name game_name,short')
->where(['game_status'=>1, 'down_port'=>1, 'id' => ['in', $companyGameIds]])
->group("relation_game_id")
->select();
$data['data']['game_list'] = empty($game_list) ? '' : $game_list;
$data['data']['game_list'] = empty($games) ? '' : $games;
}
if (empty($promote['game_ids'])) {

@ -143,6 +143,7 @@ class GameModel extends Model{
}else{
if(!isset($data['relation_game_id'])){
$relation = M('Game','tab_')->where(array('id'=>$id))->save(array('relation_game_id'=>$id));
$data['relation_game_id'] = $id;
if(!$relation){
$this->error('关联id添加失败');//游戏添加完成
}

Loading…
Cancel
Save