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