@ -166,6 +166,8 @@ class GameController extends ThinkController
{
{
if (IS_POST) {
if (IS_POST) {
$gameService = new GameService();
$_POST['introduction'] = str_replace(array("\r\n", "\r", "\n"), "~~", $_POST['introduction']);
$_POST['introduction'] = str_replace(array("\r\n", "\r", "\n"), "~~", $_POST['introduction']);
if ($_POST['game_name'] == '') {
if ($_POST['game_name'] == '') {
$this->error('游戏名称不能为空!');
$this->error('游戏名称不能为空!');
@ -184,6 +186,9 @@ class GameController extends ThinkController
return $this->error("请填写正确的极速版下载链接");
return $this->error("请填写正确的极速版下载链接");
}
}
}
}
if ($_POST['unique_code'] & & $gameService->isUniqueCodeExists($_POST['unique_code'])) {
return $this->error("聚合游戏标识已存在");
}
$_POST['relation_game_name'] = $_POST['game_name'];
$_POST['relation_game_name'] = $_POST['game_name'];
if ($_POST['sdk_version'] == 1) {
if ($_POST['sdk_version'] == 1) {
unset($_POST['ios_game_address']);
unset($_POST['ios_game_address']);
@ -217,7 +222,6 @@ class GameController extends ThinkController
$_POST['discount'] == '' ? $_POST['discount'] = 10 : $_POST['discount'];
$_POST['discount'] == '' ? $_POST['discount'] = 10 : $_POST['discount'];
$_POST['short'] = $short;
$_POST['short'] = $short;
$gameService = new GameService();
$_POST['download_ways'] = $gameService->getDownLoadWaysValue($downloadWays);
$_POST['download_ways'] = $gameService->getDownLoadWaysValue($downloadWays);
$game = D(self::model_name);//M('$this->$model_name','tab_');
$game = D(self::model_name);//M('$this->$model_name','tab_');
@ -344,32 +348,10 @@ class GameController extends ThinkController
public function edit($id = null)
public function edit($id = null)
{
{
if (IS_POST) {
if (IS_POST) {
if(!empty($_REQUEST['apply_auth'])) {
$game = M('game', 'tab_')->where(['id' => $id])->find();
$gameData['apply_auth'] = $_REQUEST['apply_auth'];
if (!$game) {
$game_appid = $_REQUEST['game_appid'];
$this->error('游戏不存在!');
$gameId = M('game','tab_')->where(['game_appid' => $game_appid])->getField('id');
exit;
M('game','tab_')->where(['id'=>$gameId])->save($gameData);
if($_REQUEST['apply_auth'] == 1) {
M('sociaty_games','tab_')->where(['game_id'=>$gameId])->delete();
}
if(!empty($_REQUEST['promote_data'])) {
$promote_data = json_decode($_REQUEST['promote_data'],TRUE);
$game_appid = $_REQUEST['game_appid'];
$gameId = M('game','tab_')->where(['game_appid' => $game_appid])->getField('id');
$gameInfo = M('game','tab_')->field('game_name,game_status')->where(['id'=>$gameId])->select();
$dataList = array();
foreach($promote_data as $key => $promoteInfo) {
$isSociaty = M('sociaty_games','tab_')->where(['promote_id'=>intval($promoteInfo['value']),'game_id'=>intval($gameId)])->getField('id');
if(!empty($isSociaty)) {
// $this->error("选择会长中有已存在会长");
}else {
$dataList[] = ['promote_id' => intval($promoteInfo['value']),'game_id' => intval($gameId),'status'=>$gameInfo[0]['game_status'],'create_time'=>time()];
}
}
M('sociaty_games','tab_')->addAll($dataList);
}
// $_REQUEST['apply_auth'] == 1 ? $this->success('开放全部会长权限成功') : $this->success('设置会长权限成功');
}
}
if ($_POST['game_score'] < 0 | | $ _POST [ ' game_score ' ] > 5) {
if ($_POST['game_score'] < 0 | | $ _POST [ ' game_score ' ] > 5) {
$this->error('游戏评分只能为0-5之间的数字! ');
$this->error('游戏评分只能为0-5之间的数字! ');
@ -389,6 +371,11 @@ class GameController extends ThinkController
return $this->error("请填写正确的极速版下载链接");
return $this->error("请填写正确的极速版下载链接");
}
}
}
}
$gameService = new GameService();
if ($_POST['unique_code'] & & $gameService->isUniqueCodeExists($_POST['unique_code'], $game['relation_game_id'], 'relation_game_id')) {
return $this->error("聚合游戏标识已存在");
}
/*if($_POST['apply_status']==0& & $_POST['game_status']==1){
/*if($_POST['apply_status']==0& & $_POST['game_status']==1){
$this->error('游戏未审核不允许显示');//游戏添加完成
$this->error('游戏未审核不允许显示');//游戏添加完成
}*/
}*/
@ -400,15 +387,14 @@ class GameController extends ThinkController
$_POST['display_site'] = '';
$_POST['display_site'] = '';
}
}
$content = $_POST['content'];
$content = $_POST['content'];
$gameRatio = M('Game', 'tab_')->where(array('id' => I('post.id', 0)))->getField('ratio');//游戏推广分成比例
$gameModel = D(self::model_name);//M('$this->$model_name','tab_');
$game = D(self::model_name);//M('$this->$model_name','tab_');
$_POST['discount'] == '' ? $_POST['discount'] = 10 : $_POST['discount'];
$_POST['discount'] == '' ? $_POST['discount'] = 10 : $_POST['discount'];
$_POST['detail_content'] = $content;
$_POST['detail_content'] = $content;
$_POST['pay_config'] = json_encode($_POST['pay_config']);
$_POST['pay_config'] = json_encode($_POST['pay_config']);
$gameService = new GameService();
$_POST['download_ways'] = $gameService->getDownLoadWaysValue($downloadWays);
$_POST['download_ways'] = $gameService->getDownLoadWaysValue($downloadWays);
unset($_POST['apply_auth']);
unset($_POST['apply_auth']);
$res = $game->update();
$res = $gameModel ->update();
$id = $res["id"];
$id = $res["id"];
$sibling = D("Game")->find($id);
$sibling = D("Game")->find($id);
@ -425,36 +411,37 @@ class GameController extends ThinkController
];
];
$gameService->saveBaseGame($baseData);
$gameService->saveBaseGame($baseData);
$phone['apply_auth'] = $sibling['apply_auth'];
$otherData = [];
$phone['game_type_id'] = $sibling['game_type_id'];
$otherData['apply_auth'] = $sibling['apply_auth'];
$phone['dow_num'] = $sibling['dow_num'];
$otherData['game_type_id'] = $sibling['game_type_id'];
$phone['game_type_name'] = $sibling['game_type_name'];
$otherData['dow_num'] = $sibling['dow_num'];
$phone['category'] = $sibling['category'];
$otherData['game_type_name'] = $sibling['game_type_name'];
$phone['recommend_status'] = $sibling['recommend_status'];
$otherData['category'] = $sibling['category'];
//$phone['game_status']= $sibling['game_status'];
$otherData['recommend_status'] = $sibling['recommend_status'];
$phone['sort'] = $sibling['sort'];
$otherData['sort'] = $sibling['sort'];
$phone['game_score'] = $sibling['game_score'];
$otherData['game_score'] = $sibling['game_score'];
$phone['features'] = $sibling['features'];
$otherData['features'] = $sibling['features'];
$phone['flooring_page_imgs'] = $sibling['flooring_page_imgs'];
$otherData['flooring_page_imgs'] = $sibling['flooring_page_imgs'];
$phone['introduction'] = $sibling['introduction'];
$otherData['introduction'] = $sibling['introduction'];
$phone['icon'] = $sibling['icon'];
$otherData['icon'] = $sibling['icon'];
$phone['cover'] = $sibling['cover'];
$otherData['cover'] = $sibling['cover'];
$phone['screenshot'] = $sibling['screenshot'];
$otherData['screenshot'] = $sibling['screenshot'];
$phone['material_url'] = $sibling['material_url'];
$otherData['material_url'] = $sibling['material_url'];
$phone['game_detail_cover'] = $sibling['game_detail_cover'];
$otherData['game_detail_cover'] = $sibling['game_detail_cover'];
$phone['first_level_name'] = $sibling['first_level_name'];
$otherData['first_level_name'] = $sibling['first_level_name'];
$phone['second_level_name'] = $sibling['second_level_name'];
$otherData['second_level_name'] = $sibling['second_level_name'];
$phone['third_level_name'] = $sibling['third_level_name'];
$otherData['third_level_name'] = $sibling['third_level_name'];
$phone['first_level'] = $sibling['first_level'];
$otherData['first_level'] = $sibling['first_level'];
$phone['second_level'] = $sibling['second_level'];
$otherData['second_level'] = $sibling['second_level'];
$phone['third_level'] = $sibling['third_level'];
$otherData['third_level'] = $sibling['third_level'];
$phone['display_site'] = $sibling['display_site'];
$otherData['display_site'] = $sibling['display_site'];
$phone['back_describe'] = $sibling['back_describe'];
$otherData['back_describe'] = $sibling['back_describe'];
$phone['dow_icon'] = $sibling['dow_icon'];
$otherData['dow_icon'] = $sibling['dow_icon'];
$phone['back_map'] = $sibling['back_map'];
$otherData['back_map'] = $sibling['back_map'];
$phone['flooring_page_video'] = $sibling['flooring_page_video'];
$otherData['unique_code'] = $sibling['unique_code'];
$phone['flooring_page_video_cover'] = $sibling['flooring_page_video_cover'];
$otherData['flooring_page_video'] = $sibling['flooring_page_video'];
M('Game', 'tab_')->data($phone)->where(array('id' => $another['id']))->save();
$otherData['flooring_page_video_cover'] = $sibling['flooring_page_video_cover'];
M('Game', 'tab_')->data($otherData)->where(array('id' => $another['id']))->save();
//同时修改代充游戏折扣
//同时修改代充游戏折扣
$set_fidel['status'] = 1;
$set_fidel['status'] = 1;
$set_fidel['game_id'] = $id;
$set_fidel['game_id'] = $id;
@ -462,7 +449,7 @@ class GameController extends ThinkController
$promoteModel = new \Admin\Model\PromoteWelfareModel();
$promoteModel = new \Admin\Model\PromoteWelfareModel();
$promoteModel->set_game_discount($set_fidel);
$promoteModel->set_game_discount($set_fidel);
if (!$res) {
if (!$res) {
$this->error($game->getError());
$this->error($gameModel ->getError());
} else {
} else {
\Think\Log::actionLog('Game/edit', 'Game', 1);
\Think\Log::actionLog('Game/edit', 'Game', 1);
addOperationLog(array(
addOperationLog(array(