...
|
...
|
@@ -328,9 +328,10 @@ class Api |
|
|
* @param string $open_id 用户openid
|
|
|
* @param array $data 模板消息内容
|
|
|
* @param string $templateId 模板消息id
|
|
|
* @param string $templateId 模板消息id
|
|
|
* @return bool
|
|
|
*/
|
|
|
public function wxsendmessage($open_id, $data, $templateId)
|
|
|
public function wxsendmessage($open_id, $data, $templateId,$url)
|
|
|
{
|
|
|
if (empty($open_id) || empty($data) || empty($templateId)) {
|
|
|
return false;
|
...
|
...
|
@@ -338,8 +339,12 @@ class Api |
|
|
$app = new Application(ConfigService::load());
|
|
|
$notice = $app->notice;
|
|
|
$userId = $open_id;
|
|
|
$url = config('option.vue_url').'/index/order/index.html';
|
|
|
$notice->uses($templateId)->withUrl($url)->andData($data)->andReceiver($userId)->send();
|
|
|
$userService = $app->user;
|
|
|
$user = $userService->get($open_id);
|
|
|
// 判断是否关注公众号
|
|
|
if($user->subscribe == 1) {
|
|
|
$notice->uses($templateId)->withUrl($url)->andData($data)->andReceiver($userId)->send();
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
} |
...
|
...
|
|