1
This commit is contained in:
parent
146762afee
commit
0b0ea48a74
@ -53,11 +53,13 @@ class KefuController {
|
|||||||
die();
|
die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
error_log($response);
|
||||||
$ret = json_decode($response, true);
|
$ret = json_decode($response, true);
|
||||||
if ($ret['errcode'] == 0) {
|
if ($ret['errcode'] == 0) {
|
||||||
if ($gameid == 2001) {
|
if ($gameid == 2001) {
|
||||||
if (count($ret['items']) > 0) {
|
if (count($ret['items']) > 0) {
|
||||||
$item = $ret['items'][rand() % count($ret['items'])];
|
$item = $ret['items'][rand() % count($ret['items'])];
|
||||||
|
error_log(json_encode($item));
|
||||||
return array($item);
|
return array($item);
|
||||||
} else {
|
} else {
|
||||||
return $ret['items'];
|
return $ret['items'];
|
||||||
@ -81,7 +83,6 @@ class KefuController {
|
|||||||
foreach ($config as $attachment) {
|
foreach ($config as $attachment) {
|
||||||
$attachments .= $attachment['item_id'] . ':' . $attachment['count'] . ';';
|
$attachments .= $attachment['item_id'] . ':' . $attachment['count'] . ';';
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'to' => $accountid,
|
'to' => $accountid,
|
||||||
'game_id' => phpcommon\extractGameId($accountid),
|
'game_id' => phpcommon\extractGameId($accountid),
|
||||||
@ -133,7 +134,7 @@ class KefuController {
|
|||||||
$msg_str);
|
$msg_str);
|
||||||
if ($errcode == 0) {
|
if ($errcode == 0) {
|
||||||
$msg = json_decode($msg_str, true);
|
$msg = json_decode($msg_str, true);
|
||||||
//error_log(json_encode($msg));
|
error_log(json_encode($msg));
|
||||||
$accountid = phpcommon\createAccountId(WEIXIN_CHANNEL, $_REQUEST['gameid'], $msg['FromUserName']);
|
$accountid = phpcommon\createAccountId(WEIXIN_CHANNEL, $_REQUEST['gameid'], $msg['FromUserName']);
|
||||||
switch ($msg['MsgType']) {
|
switch ($msg['MsgType']) {
|
||||||
case 'event':
|
case 'event':
|
||||||
@ -215,6 +216,7 @@ class KefuController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$ret_info = json_decode($response, true);
|
$ret_info = json_decode($response, true);
|
||||||
|
//error_log(json_encode($response));
|
||||||
return !empty($ret_info) && $ret_info['errcode'] == 0;
|
return !empty($ret_info) && $ret_info['errcode'] == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +263,7 @@ class KefuController {
|
|||||||
} else {
|
} else {
|
||||||
$text = $msg['Content'];
|
$text = $msg['Content'];
|
||||||
}
|
}
|
||||||
|
//error_log(json_encode($gameid));
|
||||||
$awardConfig = $this->getAwardConfig($gameid, $text);
|
$awardConfig = $this->getAwardConfig($gameid, $text);
|
||||||
if (!isset($awardConfig)) {
|
if (!isset($awardConfig)) {
|
||||||
$this->sendKefuMsg($accountid, array (
|
$this->sendKefuMsg($accountid, array (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user