rename sendMsg -> sendKefuMsg

This commit is contained in:
aozhiwei 2019-01-27 20:50:02 +08:00
parent 6ce1837ec1
commit 07f28b3c05

View File

@ -187,9 +187,9 @@ class KefuController {
} }
} }
public function sendMsgAllUser() public function sendKefuMsgAllUser()
{ {
error_log('sendMsgAllUser:'); error_log('sendKefuMsgAllUser:');
error_log('request:' . json_encode($_REQUEST)); error_log('request:' . json_encode($_REQUEST));
if (phpcommon\md5Sign(array if (phpcommon\md5Sign(array
( (
@ -247,7 +247,7 @@ class KefuController {
} }
} }
private function sendMsg($accountid, $data) private function sendKefuMsg($accountid, $data)
{ {
$postarray = json_encode($data, JSON_UNESCAPED_UNICODE); $postarray = json_encode($data, JSON_UNESCAPED_UNICODE);
//POST发送https请求客服接口api //POST发送https请求客服接口api
@ -260,16 +260,14 @@ class KefuController {
return; return;
} }
$ret_info = json_decode($response, true); $ret_info = json_decode($response, true);
#error_log('sendMsgRet:' . $response); #error_log('sendKefuMsgRet:' . $response);
if ($ret_info['errcode'] == 0) { if ($ret_info['errcode'] == 0) {
} else { } else {
#error_log('sendMsg发送失败');
echo(0); echo(0);
} }
} }
private function sendMsgSomeUser($arrayInfo) private function sendKefuMsgSomeUser($arrayInfo)
{ {
foreach($arrayInfo as $userInfo) { foreach($arrayInfo as $userInfo) {
$shareInfo = require('../config/kefu.share.config.php'); $shareInfo = require('../config/kefu.share.config.php');
@ -279,7 +277,7 @@ class KefuController {
"msgtype" => "miniprogrampage", "msgtype" => "miniprogrampage",
"miniprogrampage" => $miniprogrampateInfo "miniprogrampage" => $miniprogrampateInfo
); );
$this->sendMsg($userInfo['accountid'], $data); $this->sendKefuMsg($userInfo['accountid'], $data);
} }
} }
@ -296,7 +294,7 @@ class KefuController {
for ($i = 0; $i < $selectTimes; $i++ ) { for ($i = 0; $i < $selectTimes; $i++ ) {
#error_log('selectMin:' . $selectMin); #error_log('selectMin:' . $selectMin);
$arrayInfo = $this->getAccountsKefuInfo($selectMin, $selectMin + $selectOneCount, $conn); $arrayInfo = $this->getAccountsKefuInfo($selectMin, $selectMin + $selectOneCount, $conn);
$this->sendMsgSomeUser($arrayInfo); $this->sendKefuMsgSomeUser($arrayInfo);
$selectMin = $selectMin + $selectOneCount; $selectMin = $selectMin + $selectOneCount;
} }
} }
@ -309,7 +307,7 @@ class KefuController {
$gameid = phpcommon\extractGameId($accountid); $gameid = phpcommon\extractGameId($accountid);
$awardConfig = $this->getAwardConfig($gameid, $text); $awardConfig = $this->getAwardConfig($gameid, $text);
if (!isset($awardConfig)) { if (!isset($awardConfig)) {
$this->sendMsg($accountid, array ( $this->sendKefuMsg($accountid, array (
"touser" => $openid, "touser" => $openid,
"msgtype" => "text", "msgtype" => "text",
"text" => array ("content" => '回复指定文字领取奖励!') "text" => array ("content" => '回复指定文字领取奖励!')
@ -323,7 +321,7 @@ class KefuController {
':accountid' => $accountid, ':accountid' => $accountid,
)); ));
if ($row && time() - $row['awardtime'] < 3600 * 24) { if ($row && time() - $row['awardtime'] < 3600 * 24) {
$this->sendMsg($accountid, array ( $this->sendKefuMsg($accountid, array (
"touser" => $openid, "touser" => $openid,
"msgtype" => "text", "msgtype" => "text",
"text" => array ("content" => "一天内只能领取一次奖励!\n请明天再来!") "text" => array ("content" => "一天内只能领取一次奖励!\n请明天再来!")
@ -340,7 +338,7 @@ class KefuController {
':awardtime' => time() ':awardtime' => time()
)); ));
if ($ret) { if ($ret) {
$this->sendMsg($accountid, array ( $this->sendKefuMsg($accountid, array (
"touser" => $openid, "touser" => $openid,
"msgtype" => "text", "msgtype" => "text",
"text" => array ("content" => '奖励领取成功,请查收邮件!') "text" => array ("content" => '奖励领取成功,请查收邮件!')
@ -370,7 +368,7 @@ class KefuController {
':awardtime' => 0 ':awardtime' => 0
)); ));
if ($ret) { if ($ret) {
$this->sendMsg($accountid, array( $this->sendKefuMsg($accountid, array(
"touser" => $msg['FromUserName'], "touser" => $msg['FromUserName'],
"msgtype" => "text", "msgtype" => "text",
"text" => array("content" => "您好,有什么能帮助你? \n回复指定文字领取奖励。 ") "text" => array("content" => "您好,有什么能帮助你? \n回复指定文字领取奖励。 ")