|
|
@@ -202,12 +202,20 @@ class WeChatOaService
|
|
|
$noticeSetting = NoticeSetting::where('scene_id', $params['scene_id'])->findOrEmpty()->toArray();
|
|
|
Log::info('WeChatOa-sendTemplateMessage:'.json_encode([$noticeSetting,$params,$this->getTemplateMessageParams($noticeSetting, $params)]));
|
|
|
// 发送
|
|
|
- $result = $this->app->getClient()->postJson('cgi-bin/message/template/send', [
|
|
|
+ $wx_data = [
|
|
|
'touser' => $params['params']['openid'],
|
|
|
'template_id' => $noticeSetting['oa_notice']['template_id'],
|
|
|
- 'url' => '',
|
|
|
+ 'url' => (isset($params['url']) && !empty($params['url']))?$params['url']:'',
|
|
|
'data' => $this->getTemplateMessageParams($noticeSetting, $params)
|
|
|
- ]);
|
|
|
+ ];
|
|
|
+ // 可跳小程序
|
|
|
+ if(isset($params['page']) && !empty($params['page'])) {
|
|
|
+ $wx_data["miniprogram"]=[
|
|
|
+ "appid" => 'wx8e44db3741ea212c',
|
|
|
+ "pagepath" => $params['page']
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $result = $this->app->getClient()->postJson('cgi-bin/message/template/send', $wx_data);
|
|
|
if (intval($result["errcode"]) > 0) {
|
|
|
throw new \Exception('微信通知发送失败:'.$result["errmsg"]);
|
|
|
}
|