Commit 9285b85a authored by suntengda's avatar suntengda

update 发送订阅通知消息格式修改

parent 80cad87e
......@@ -11,6 +11,7 @@ use Api\PhpServices\Wechat\Msg;
class Pindan implements DaemonServiceInterface
{
const DEFAULT_DESC = '9.9元吃午餐开始预定啦,戳这里点餐吧';
public function run()
{
......@@ -41,9 +42,9 @@ class Pindan implements DaemonServiceInterface
$type = 2; // 1 公众号 2 小程序
//活动信息
$params = [
$list['result'][0]['marketing_name'],
self::emojiFilter($list['result'][0]['marketing_name']),
$list['result'][0]['create_time'],
$list['result'][0]['pindan_desc']
$list['result'][0]['pindan_desc'] ?: self::DEFAULT_DESC
];
//发送消息
Msg::send(999, $app_id, $template_id, $page_url, $type, $params);
......@@ -60,5 +61,16 @@ class Pindan implements DaemonServiceInterface
}
}
/**
* 过滤emoji表情
* @param string $str
* @return string
*/
private function emojiFilter($str) {
$str = preg_replace_callback('/./u',function(array $match){
return strlen($match[0]) >= 4 ? '' : $match[0];
},$str);
return $str;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment