Merge branch 'dev' of 47.111.118.107:/srv/git/sdk into dev

master
tpingzhang 5 years ago
commit d8525504e6

@ -143,7 +143,7 @@ class GameGiftPageController extends Controller{
public function receive_gift($user_token = 0,$gift_id = 0,$game_id = 0,$game_name = ""){ public function receive_gift($user_token = 0,$gift_id = 0,$game_id = 0,$game_name = ""){
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组 #获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
$post = I('post.'); $post = I('request.');
$user_id = $this->userId; $user_id = $this->userId;
$gift_id = $post['gift_id']; $gift_id = $post['gift_id'];
$game_id = $post['game_id']; $game_id = $post['game_id'];
@ -152,7 +152,12 @@ class GameGiftPageController extends Controller{
$user_token = $this->userToken; $user_token = $this->userToken;
$novice = $gift->where(["id" => $gift_id])->field("id,giftbag_name,novice")->find(); $novice = $gift->where(["id" => $gift_id])->field("id,giftbag_name,novice")->find();
if(empty($novice['novice'])){ if(empty($novice['novice'])){
echo "该礼包已被领完";die(); echo json_encode([
'code' => 0,
'status' => 1,
'msg' => '礼包已被领完'
]);
exit();
} }
else{ else{
#将激活码分成数据 #将激活码分成数据
@ -172,7 +177,12 @@ class GameGiftPageController extends Controller{
$act['novice_num'] = count($novice_arr); $act['novice_num'] = count($novice_arr);
$gift->where("id=".$gift_id)->save($act); $gift->where("id=".$gift_id)->save($act);
$ddd['novice'] = $data_record['novice']; $ddd['novice'] = $data_record['novice'];
echo "领取成功"; echo json_encode([
'code' => 1,
'status' => 1,
'msg' => '领取成功'
]);
exit();
} }
} }
@ -187,7 +197,12 @@ class GameGiftPageController extends Controller{
$isReceive = $record->where($map)->find(); $isReceive = $record->where($map)->find();
if(!empty($isReceive)){ if(!empty($isReceive)){
$ddd['novice'] = $isReceive['novice']; $ddd['novice'] = $isReceive['novice'];
echo "您已经领取过该礼包";die(); echo json_encode([
'code' => 0,
'status' => 1,
'msg' => '您已领取过该礼包'
]);
exit();
} }
$user_data = get_user_entity($data['user_id']); $user_data = get_user_entity($data['user_id']);
$data_record['game_id'] = $data['game_id']; $data_record['game_id'] = $data['game_id'];

@ -76,11 +76,10 @@
success: function (r) { success: function (r) {
if (r.code == 200) { if (r.code == 200) {
window.location.href = r.url; window.location.href = r.url;
} else { } else if(r.code == 1){
if (r == "领取成功") {
window.location.href = "{:U('details',['user_token' => $user_token,'gift_id' => $gift_id,'game_id' => $game_id,'game_name' => $game_name])}"; window.location.href = "{:U('details',['user_token' => $user_token,'gift_id' => $gift_id,'game_id' => $game_id,'game_name' => $game_name])}";
} }else {
// alert(r.msg); alert(r.msg);
} }
} }
@ -96,10 +95,11 @@
if(data == '领取成功') if(data == '领取成功')
{ {
window.location.href = "{:U('details',['user_token' => $user_token,'gift_id' => $gift_id,'game_id' => $game_id,'game_name' => $game_name])}"; window.location.href = "{:U('details',['user_token' => $user_token,'gift_id' => $gift_id,'game_id' => $game_id,'game_name' => $game_name])}";
}else if(data.code == 200) }else
{ {
$("#errormsg").html(data);
window.location.href = data.url; $("#iosDialog").show();
// window.location.href = "{:U('details',['user_token' => $user_token,'gift_id' => $gift_id,'game_id' => $game_id,'game_name' => $game_name])}";
} }
}); */ }); */
}) })

Loading…
Cancel
Save