|
|
@@ -19,6 +19,7 @@ use app\common\logic\NoticeLogic;
|
|
|
use app\common\model\notice\NoticeSetting;
|
|
|
use EasyWeChat\Kernel\Exceptions\Exception;
|
|
|
use EasyWeChat\OfficialAccount\Application;
|
|
|
+use think\facade\Log;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -199,10 +200,6 @@ class WeChatOaService
|
|
|
try {
|
|
|
// 通知设置
|
|
|
$noticeSetting = NoticeSetting::where('scene_id', $params['scene_id'])->findOrEmpty()->toArray();
|
|
|
- // 替换通知模板参数
|
|
|
- $content = $this->contentFormat($noticeSetting, $params);
|
|
|
- // 添加通知记录
|
|
|
- $this->notice = NoticeLogic::addNotice($params, $noticeSetting, NoticeEnum::OA, $content);
|
|
|
// 发送
|
|
|
$result = $this->app->getClient()->postJson('cgi-bin/message/template/send', [
|
|
|
'touser' => $params['params']['openid'],
|
|
|
@@ -213,8 +210,13 @@ class WeChatOaService
|
|
|
if (intval($result["errcode"]) > 0) {
|
|
|
throw new \Exception('微信通知发送失败:'.$result["errmsg"]);
|
|
|
}
|
|
|
+ // 替换通知模板参数
|
|
|
+ $content = $this->contentFormat($noticeSetting, $params);
|
|
|
+ // 添加通知记录
|
|
|
+ NoticeLogic::addNotice($params, $noticeSetting, NoticeEnum::OA, $content);
|
|
|
return true;
|
|
|
} catch (\Exception $e) {
|
|
|
+ Log::info('WeChatOa-sendTemplateMessage:'.$e->getMessage());
|
|
|
throw new \Exception($e->getMessage());
|
|
|
}
|
|
|
}
|