diff --git a/webapp/classes/AddReward.php b/webapp/classes/AddReward.php index 89fb4c3..3ed8ac0 100644 --- a/webapp/classes/AddReward.php +++ b/webapp/classes/AddReward.php @@ -66,7 +66,7 @@ class AddReward { ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, - ':coin_num' => $item_num + $rowkey['keys_num'], + ':keys_num' => $item_num + $rowkey['keys_num'], ':modify_time' => time() )); if (!$ret) { diff --git a/webapp/controller/ShareController.class.php b/webapp/controller/ShareController.class.php index 7960af0..ce220c8 100644 --- a/webapp/controller/ShareController.class.php +++ b/webapp/controller/ShareController.class.php @@ -60,12 +60,12 @@ class ShareController{ protected function getParameter($para_id) { - $g_conf_para_cluster = require('../res/parameter@parameter.php'); - $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( - 'id' => $para_conf['id'], - 'param_name' => $para_conf['param_name'], - 'param_value' => $para_conf['param_value'], + 'id' => $parameter_meta['id'], + 'param_name' => $parameter_meta['param_name'], + 'param_value' => $parameter_meta['param_value'], ); return $p; } @@ -329,7 +329,6 @@ class ShareController{ if (!phpcommon\HttpClient::get($url, $params, $response)) { phpcommon\sendError(ERR_RETRY, '系统繁忙'); return; - } //领取奖励 $data = json_decode($response, true); @@ -342,7 +341,6 @@ class ShareController{ } else { $num = 1; } - error_log(json_encode($ach_list)); foreach($ach_list as $ach){ $ach_id = $ach['achievement_id']; $peo_num = $ach['invitee_num']; @@ -423,31 +421,10 @@ class ShareController{ $errcode = $data['errcode']; $errmsg = $data['errmsg']; if ($errcode == 0) { - $d = $this->getDrop(24005); - if (!$d) { - phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); - return; + foreach($data['attachments'] as $kefu){ + $item_id = $kefu['itemid']; + $item_num = $kefu['itemnum']; } - $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->addReward($item_id, $item_num, $account_id); array_push($item_list, array( @@ -456,11 +433,11 @@ class ShareController{ )); //更新状态 $ret = $conn->execScript('UPDATE user SET kefu_status=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - )); + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + )); if (!$ret) { die(); return;