1
This commit is contained in:
parent
730a7e4df6
commit
c47a35f050
@ -307,6 +307,7 @@ class ShareController{
|
|||||||
phpcommon\sendError(ERR_USER_BASE + 3, '奖励已领取');
|
phpcommon\sendError(ERR_USER_BASE + 3, '奖励已领取');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//获取奖励信息
|
||||||
$url = '';
|
$url = '';
|
||||||
if (SERVER_ENV == _ONLINE) {
|
if (SERVER_ENV == _ONLINE) {
|
||||||
$url = 'https://service.kingsome.cn/webapp/index.php?c=AchievementShare&a=getInviteeNumSvr&';
|
$url = 'https://service.kingsome.cn/webapp/index.php?c=AchievementShare&a=getInviteeNumSvr&';
|
||||||
@ -315,7 +316,7 @@ class ShareController{
|
|||||||
}
|
}
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
$params = array(
|
$params = array(
|
||||||
'account_id' => $REQUEST['account_id'],
|
'account_id' => $_REQUEST['account_id'],
|
||||||
'achievement_ids' => $ach_id,
|
'achievement_ids' => $ach_id,
|
||||||
);
|
);
|
||||||
$sign = phpcommon\md5Sign($params,
|
$sign = phpcommon\md5Sign($params,
|
||||||
@ -329,6 +330,7 @@ class ShareController{
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//领取奖励
|
||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
$ach_list = $data['invitee_nums'];
|
$ach_list = $data['invitee_nums'];
|
||||||
$peo_num = 0;
|
$peo_num = 0;
|
||||||
@ -339,20 +341,9 @@ class ShareController{
|
|||||||
} else {
|
} else {
|
||||||
$num = 1;
|
$num = 1;
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < count($ach_list); $i++) {
|
foreach($ach_list as $ach){
|
||||||
$delim = ",";
|
$ach_id = $ach['achievement_id'];
|
||||||
$drop_multiply = explode($delim, $string);
|
$peo_num = $ach['invitee_num'];
|
||||||
$delim1 = ":";
|
|
||||||
$arr = array();
|
|
||||||
for ($i = 0; $i < count($drop_multiply); $i++) {
|
|
||||||
$mul = explode($delim1, $drop_multiply[$i]);
|
|
||||||
array_push($arr, $mul);
|
|
||||||
}
|
|
||||||
error_log(json_encode($arr));
|
|
||||||
if ($ach_id == $arr[0][1]) {
|
|
||||||
$peo_num = $arr[1][1];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($peo_num < $sh['people']) {
|
if ($peo_num < $sh['people']) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 4, '未达到人数要求');
|
phpcommon\sendError(ERR_USER_BASE + 4, '未达到人数要求');
|
||||||
@ -361,6 +352,18 @@ class ShareController{
|
|||||||
$array = $this->getExplode($sh['rewards']);
|
$array = $this->getExplode($sh['rewards']);
|
||||||
$addreward = new classes\AddReward();
|
$addreward = new classes\AddReward();
|
||||||
$addreward->addReward($array[0][0], $array[0][1] * $num, $account_id);
|
$addreward->addReward($array[0][0], $array[0][1] * $num, $account_id);
|
||||||
|
//更新状态
|
||||||
|
$ret = $conn->execScript('UPDATE share_achievement SET status=1, modify_time=:modify_time ' .
|
||||||
|
' WHERE accountid=:accountid AND ach_id=:ach_id;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
':modify_time' => time(),
|
||||||
|
':ach_id' => $ach_id
|
||||||
|
));
|
||||||
|
if (!$ret) {
|
||||||
|
die();
|
||||||
|
return;
|
||||||
|
}
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
'errmsg' => '',
|
'errmsg' => '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user