diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 85b6c74f5..a5f239089 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -1568,15 +1568,24 @@ class ApplyController extends BaseController $this->ajaxReturn($data); } - $save['game_id'] = $gameId; - $save['game_name'] = get_game_name($gameId); - $save['promote_id'] = $value; - $save['promote_account'] = session("promote_auth.account"); + $map['game_id'] = $gameId; + $map['promote_id'] = $value; + $applyData = M('apply', 'tab_')->field('id,offline_status')->where($map)->find(); + + $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['status'] = C('SET_AUTO_PACK'); - $save['sdk_version'] = $gameData['sdk_version']; $save['ratio'] = $gameData['ratio']; $save['money'] = $gameData['money']; + $save['offline_status'] = 0; $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) { @@ -1585,7 +1594,17 @@ class ApplyController extends BaseController $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) { $this->ajaxReturn(array("status" => -1, "msg" => "添加失败", 'ret' => $res));