Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信订单付款通知后,不能立刻发送模板消息,怎么处理? #356

Open
jili3221058001 opened this issue Jun 16, 2018 · 0 comments

Comments

@jili3221058001
Copy link

jili3221058001 commented Jun 16, 2018

订单付款通知
1.1、微信回调URL: ******demo.php
1.2、微信回调参数:
image

1.3 返回参数:(必须:微信要求必须有返回)
echo '
<return_code></return_code>
<return_msg></return_msg>
';

1.4 这时不能立刻发送模板消息,怎么处理?

以下代码:

include( "wechat.class.php");
$options = array(
	'token'=>'**', //填写你设定的key
    'encodingaeskey'=>'n0kxbvKBGd7i6COnIlXSS5**', //填写加密用的EncodingAESKey,如接口为明文模式可忽略
'appid'=>'wx13465e0d704**', //填写高级调用功能的app id
'appsecret'=>'42cf2e89643f5f**' //填写高级调用功能的密钥
);
$weObj = new Wechat($options);
$type = $weObj->getRev()->getRevType();
switch($type) {
case Wechat::MSGTYPE_EVENT:
                     // 返回微信成功标记
	echo echoResult("SUCCESS", "OK");
	
    	//定义模板消息(模板肯定没问题)
	$template11=array(*******
	);
	//发送不成功
	$ref=$weObj->sendTemplateMessage($template11)->reply();
   		break;
case Wechat::MSGTYPE_IMAGE:
		break;
default:
		$weObj->text("help info")->reply();

}
//接口输出
function echoResult($returnCode = '', $returnMsg = '')
{
$arr = array(
'return_code' => $returnCode,
'return_msg' => $returnMsg,
);
exit(json_encode($arr));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant