| xqd
@@ -570,6 +570,11 @@ if (!function_exists('send_wechat_message')) {
|
|
|
//先发送模板消息
|
|
|
$data = config('config.wechat_official_message_template')[$type];
|
|
|
$json = json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
|
+ foreach ($official_arr as $k => &$v) {
|
|
|
+ $escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
|
|
|
+ $replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t","\\f", "\\b");
|
|
|
+ $v = str_replace($escapers, $replacements, $v);
|
|
|
+ }
|
|
|
$json = vsprintf($json, $official_arr);
|
|
|
$data = json_decode($json, true);
|
|
|
$ret = $app->uniform_message->send($data);
|
| xqd
@@ -580,6 +585,11 @@ if (!function_exists('send_wechat_message')) {
|
|
|
if (!empty($subscribe_arr) && isset($ret['errcode']) && $ret['errcode'] != 0) {
|
|
|
$data = config('config.wechat_subscribe_message_template')[$type];
|
|
|
$json = json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
|
+ foreach ($subscribe_arr as $k => &$v) {
|
|
|
+ $escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
|
|
|
+ $replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t","\\f", "\\b");
|
|
|
+ $v = str_replace($escapers, $replacements, $v);
|
|
|
+ }
|
|
|
$json = vsprintf($json, $subscribe_arr);
|
|
|
$data = json_decode($json, true);
|
|
|
$ret = $app->subscribe_message->send($data);
|