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