批量添加下级游戏bug修复

master
chenxiaojun 5 years ago
commit 6fa45ff033

@ -197,7 +197,7 @@ class ApplyController extends BaseController
$this->display('index'); $this->display('index');
} }
//查看游戏资料专区 //查看游戏资料专区
public function feature($p = 0, $type = 0) public function feature($p = 0, $type = 0)
{ {
$promoteId = empty(I('promote_id')) ? PID : I('promote_id');//搜索的渠道ID $promoteId = empty(I('promote_id')) ? PID : I('promote_id');//搜索的渠道ID
@ -215,19 +215,19 @@ class ApplyController extends BaseController
$map['tab_game.game_status'] = 1;//游戏状态 $map['tab_game.game_status'] = 1;//游戏状态
$map['tab_game.developers'] = 0; //平台游戏(官网游戏,非开发者游戏) $map['tab_game.developers'] = 0; //平台游戏(官网游戏,非开发者游戏)
$applyPromote = M('apply','tab_')->field('game_id')->where(['promote_id' => $promoteId])->select(); $applyPromote = M('apply', 'tab_')->field('game_id')->where(['promote_id' => $promoteId])->select();
$noDeveloperGameArr = array(); $noDeveloperGameArr = array();
foreach ($applyPromote as $key => $value) { foreach ($applyPromote as $key => $value) {
$applyPromoteGameId = $value['game_id']; $applyPromoteGameId = $value['game_id'];
$gameInfo = M('Game','tab_') $gameInfo = M('Game', 'tab_')
->field('id,icon,game_name,features,sdk_version,game_size,game_type_name,relation_game_name,developers') ->field('id,icon,game_name,features,sdk_version,game_size,game_type_name,relation_game_name,developers')
->where(['id' => $applyPromoteGameId])->select(); ->where(['id' => $applyPromoteGameId])->select();
if($gameInfo[0]['developers'] > 0){ if ($gameInfo[0]['developers'] > 0) {
unset($gameInfo[0]['developers']); unset($gameInfo[0]['developers']);
$noDeveloperGameArr[] = $gameInfo[0]['id'] ; //非开发者游戏 $noDeveloperGameArr[] = $gameInfo[0]['id']; //非开发者游戏
} }
} }
$page = intval($p); $page = intval($p);
@ -244,12 +244,12 @@ class ApplyController extends BaseController
$map['tab_game.relation_game_name'] = ['like', $thisRelationGameName]; $map['tab_game.relation_game_name'] = ['like', $thisRelationGameName];
$where['_complex'] = $map; $where['_complex'] = $map;
// $where['tab_game.id'] = ['in',$noDeveloperGameArr]; // $where['tab_game.id'] = ['in',$noDeveloperGameArr];
// $where['_logic']='or'; // $where['_logic']='or';
}else { } else {
$where['_complex'] = $map; $where['_complex'] = $map;
$where['tab_game.id'] = ['in',$noDeveloperGameArr]; $where['tab_game.id'] = ['in', $noDeveloperGameArr];
$where['_logic']='or'; $where['_logic'] = 'or';
} }
$data = M('Game', 'tab_') $data = M('Game', 'tab_')
@ -283,13 +283,13 @@ class ApplyController extends BaseController
$this->assign('list_data', $data); $this->assign('list_data', $data);
$this->assign("count", $count); $this->assign("count", $count);
$this->assign("promoteId", $promoteId); $this->assign("promoteId", $promoteId);
// $this->assign('parentPromoteId', $parentPromoteId); // $this->assign('parentPromoteId', $parentPromoteId);
$this->assign('thisParentPromoteId', $thisParentPromoteId); $this->assign('thisParentPromoteId', $thisParentPromoteId);
// $this->assign('promoteRole', $promoteRole); // $this->assign('promoteRole', $promoteRole);
$this->assign('pID', PID); $this->assign('pID', PID);
//$this->assign('promoteData', getAllPromoteListByType($promoteRole)); //$this->assign('promoteData', getAllPromoteListByType($promoteRole));
// $this->assign('addPermission', $addPermission); // $this->assign('addPermission', $addPermission);
// $this->assign('type', $type); // $this->assign('type', $type);
$this->meta_title = "申请游戏"; $this->meta_title = "申请游戏";
@ -1622,7 +1622,7 @@ class ApplyController extends BaseController
$newPromoteData = []; $newPromoteData = [];
if (count($promoteIds) > 0) { if (count($promoteIds) > 0) {
foreach ($promoteIds as $value) { foreach ($promoteIds as $value) {
$thisPromote = M('apply', 'tab_')->where(array('game_id' => $gameId, 'promote_id' => $value['id']))->count('id'); $thisPromote = M('apply', 'tab_')->where(array('game_id' => $gameId, 'promote_id' => $value['id'], 'offline_status' => 0))->count('id');
if (!$thisPromote) { if (!$thisPromote) {
$newPromoteData[] = $value; $newPromoteData[] = $value;
@ -1667,15 +1667,24 @@ class ApplyController extends BaseController
$this->ajaxReturn($data); $this->ajaxReturn($data);
} }
$save['game_id'] = $gameId; $map['game_id'] = $gameId;
$save['game_name'] = get_game_name($gameId); $map['promote_id'] = $value;
$save['promote_id'] = $value; $applyData = M('apply', 'tab_')->field('id,offline_status')->where($map)->find();
$save['promote_account'] = session("promote_auth.account");
$updateStatus = 0;
if (!empty($applyData)) {
if ($applyData['offline_status'] == 0) {
continue;
} else {
$updateStatus = 1;
}
}
$save['promote_account'] = $thisPromoteData['account'];
$save['apply_time'] = NOW_TIME; $save['apply_time'] = NOW_TIME;
$save['status'] = C('SET_AUTO_PACK');
$save['sdk_version'] = $gameData['sdk_version'];
$save['ratio'] = $gameData['ratio']; $save['ratio'] = $gameData['ratio'];
$save['money'] = $gameData['money']; $save['money'] = $gameData['money'];
$save['offline_status'] = 0;
$gameSource = M('Game_source', 'tab_')->field('id,source_version')->where(['game_id' => $gameId])->find(); $gameSource = M('Game_source', 'tab_')->field('id,source_version')->where(['game_id' => $gameId])->find();
if (!file_exists(get_game_source_file_url($gameId)) || null == $gameSource) { if (!file_exists(get_game_source_file_url($gameId)) || null == $gameSource) {
@ -1684,7 +1693,17 @@ class ApplyController extends BaseController
$save['enable_status'] = 2; $save['enable_status'] = 2;
} }
$res = M('Apply', 'tab_')->add($save); if ($updateStatus == 0) {
$save['sdk_version'] = $gameData['sdk_version'];
$save['game_id'] = $gameId;
$save['game_name'] = get_game_name($gameId);
$save['promote_id'] = $value;
$save['status'] = C('SET_AUTO_PACK');
$res = M('Apply', 'tab_')->add($save);
} else {
$res = M('Apply', 'tab_')->where('id = ' . $applyData['id'])->save($save);
}
if (!$res) { if (!$res) {
$this->ajaxReturn(array("status" => -1, "msg" => "添加失败", 'ret' => $res)); $this->ajaxReturn(array("status" => -1, "msg" => "添加失败", 'ret' => $res));
@ -1708,16 +1727,17 @@ class ApplyController extends BaseController
$this->ajaxReturn(['status' => 1, 'data' => $enableStatus]); $this->ajaxReturn(['status' => 1, 'data' => $enableStatus]);
} }
public function backDetailData() { //返回详情数据 public function backDetailData()
$result = ['code' => 10001,'msg' => "该游戏信息不存在,请确认!",'error' => 1,'info' => '']; { //返回详情数据
$result = ['code' => 10001, 'msg' => "该游戏信息不存在,请确认!", 'error' => 1, 'info' => ''];
$id = $_POST['id']; $id = $_POST['id'];
if(empty($id)) { if (empty($id)) {
$this->ajaxReturn($result); $this->ajaxReturn($result);
} }
$gameInfo = M('Game','tab_')->where(['id' => $id])->getField('detail_content'); $gameInfo = M('Game', 'tab_')->where(['id' => $id])->getField('detail_content');
if(!$gameInfo) { if (!$gameInfo) {
$this->ajaxReturn($result); $this->ajaxReturn($result);
}else { } else {
$result['code'] = 10000; $result['code'] = 10000;
$result['msg'] = "获取信息成功"; $result['msg'] = "获取信息成功";
$result['error'] = -1; $result['error'] = -1;

Loading…
Cancel
Save