1
This commit is contained in:
parent
c7044d3805
commit
6c4fe9f9cf
@ -66,7 +66,7 @@ class AddReward {
|
|||||||
' WHERE accountid=:accountid;',
|
' WHERE accountid=:accountid;',
|
||||||
array(
|
array(
|
||||||
':accountid' => $account_id,
|
':accountid' => $account_id,
|
||||||
':coin_num' => $item_num + $rowkey['keys_num'],
|
':keys_num' => $item_num + $rowkey['keys_num'],
|
||||||
':modify_time' => time()
|
':modify_time' => time()
|
||||||
));
|
));
|
||||||
if (!$ret) {
|
if (!$ret) {
|
||||||
|
@ -60,12 +60,12 @@ class ShareController{
|
|||||||
|
|
||||||
protected function getParameter($para_id)
|
protected function getParameter($para_id)
|
||||||
{
|
{
|
||||||
$g_conf_para_cluster = require('../res/parameter@parameter.php');
|
$parameter_meta_cluster = require('../res/parameter@parameter.php');
|
||||||
$para_conf = getParameterConfig($g_conf_para_cluster, $para_id);
|
$parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id);
|
||||||
$p = array(
|
$p = array(
|
||||||
'id' => $para_conf['id'],
|
'id' => $parameter_meta['id'],
|
||||||
'param_name' => $para_conf['param_name'],
|
'param_name' => $parameter_meta['param_name'],
|
||||||
'param_value' => $para_conf['param_value'],
|
'param_value' => $parameter_meta['param_value'],
|
||||||
);
|
);
|
||||||
return $p;
|
return $p;
|
||||||
}
|
}
|
||||||
@ -329,7 +329,6 @@ class ShareController{
|
|||||||
if (!phpcommon\HttpClient::get($url, $params, $response)) {
|
if (!phpcommon\HttpClient::get($url, $params, $response)) {
|
||||||
phpcommon\sendError(ERR_RETRY, '系统繁忙');
|
phpcommon\sendError(ERR_RETRY, '系统繁忙');
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
//领取奖励
|
//领取奖励
|
||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
@ -342,7 +341,6 @@ class ShareController{
|
|||||||
} else {
|
} else {
|
||||||
$num = 1;
|
$num = 1;
|
||||||
}
|
}
|
||||||
error_log(json_encode($ach_list));
|
|
||||||
foreach($ach_list as $ach){
|
foreach($ach_list as $ach){
|
||||||
$ach_id = $ach['achievement_id'];
|
$ach_id = $ach['achievement_id'];
|
||||||
$peo_num = $ach['invitee_num'];
|
$peo_num = $ach['invitee_num'];
|
||||||
@ -423,31 +421,10 @@ class ShareController{
|
|||||||
$errcode = $data['errcode'];
|
$errcode = $data['errcode'];
|
||||||
$errmsg = $data['errmsg'];
|
$errmsg = $data['errmsg'];
|
||||||
if ($errcode == 0) {
|
if ($errcode == 0) {
|
||||||
$d = $this->getDrop(24005);
|
foreach($data['attachments'] as $kefu){
|
||||||
if (!$d) {
|
$item_id = $kefu['itemid'];
|
||||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
$item_num = $kefu['itemnum'];
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
$item_id_array = $this->getExplode($d['item_id']);
|
|
||||||
$weight_sum = 0;
|
|
||||||
$keys = 0;
|
|
||||||
$item_num_array = $this->getExplode($d['num']);
|
|
||||||
$weight_array = $this->getExplode($d['weight']);
|
|
||||||
for ($i = 0; $i < count($weight_array); $i++) {
|
|
||||||
$weight_sum += $weight_array[$i][0];
|
|
||||||
}
|
|
||||||
srand(crc32($account_id . $mail_id));
|
|
||||||
$random = Rand(0, $weight_sum);
|
|
||||||
$weight = 0;
|
|
||||||
for ($i = 0; $i < count($weight_array); $i++) {
|
|
||||||
$weight += $weight_array[$i][0];
|
|
||||||
if ($weight > $random) {
|
|
||||||
$keys = $i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$item_id = $item_id_array[$keys][0];
|
|
||||||
$item_num = $item_num_array[$keys][0];
|
|
||||||
$addreward = new classes\AddReward();
|
$addreward = new classes\AddReward();
|
||||||
$addreward->addReward($item_id, $item_num, $account_id);
|
$addreward->addReward($item_id, $item_num, $account_id);
|
||||||
array_push($item_list, array(
|
array_push($item_list, array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user