...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
namespace app\common\controller;
|
|
|
|
|
|
use app\common\library\Auth;
|
|
|
use EasyWeChat\Foundation\Application;
|
|
|
use think\Config;
|
|
|
use think\exception\HttpResponseException;
|
|
|
use think\exception\ValidateException;
|
...
|
...
|
@@ -320,4 +321,25 @@ class Api |
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送模板消息
|
|
|
* @param string $open_id 用户openid
|
|
|
* @param array $data 模板消息内容
|
|
|
* @param string $templateId 模板消息id
|
|
|
* @return bool
|
|
|
*/
|
|
|
public function wxsendmessage($open_id, $data, $templateId)
|
|
|
{
|
|
|
if (empty($open_id) || empty($data) || empty($templateId)) {
|
|
|
return false;
|
|
|
}
|
|
|
$options = get_addon_config('wechat');
|
|
|
$app = new Application($options);
|
|
|
$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();
|
|
|
return true;
|
|
|
}
|
|
|
} |
...
|
...
|
|