|
|
@@ -49,10 +49,27 @@ class NoticeLogic extends BaseLogic
|
|
|
if (empty($noticeSetting)) {
|
|
|
throw new \Exception('找不到对应场景的配置');
|
|
|
}
|
|
|
- $noticeSetting['designated_user'] && $params['params']['user_id'] = $noticeSetting['designated_user'];
|
|
|
- /*if(empty($params['params']['user_id']) && (!isset($params['params']['mobile']) && !isset($params['params']['openid']))){
|
|
|
- throw new \Exception('发送对象不能为空');
|
|
|
- }*/
|
|
|
+ //$noticeSetting['designated_user'] && $params['params']['user_id'] = $noticeSetting['designated_user'];
|
|
|
+ if($noticeSetting['designated_user']){
|
|
|
+ $designated_users = explode(',', $noticeSetting['designated_user']);
|
|
|
+ foreach ($designated_users as $user_id) {
|
|
|
+ $params['params']['user_id'] = $user_id;
|
|
|
+ self::noticeBySceneOne($params,$noticeSetting);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ self::noticeBySceneOne($params,$noticeSetting);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Log::info('NoticeLogic-noticeByScene:'.$e->getMessage());
|
|
|
+ self::setError($e->getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function noticeBySceneOne($params,$noticeSetting)
|
|
|
+ {
|
|
|
+ try {
|
|
|
// 合并额外参数
|
|
|
$params = self::mergeParams($params,$noticeSetting['recipient']);
|
|
|
$res = false;
|
|
|
@@ -75,7 +92,6 @@ class NoticeLogic extends BaseLogic
|
|
|
$res = (new WeChatOaService())->sendTemplateMessage($params);
|
|
|
Log::info('NoticeLogic-noticeByScene-sendTemplateMessage:'.json_encode([$res]));
|
|
|
}
|
|
|
-
|
|
|
return $res;
|
|
|
} catch (\Exception $e) {
|
|
|
Log::info('NoticeLogic-noticeByScene:'.$e->getMessage());
|
|
|
@@ -84,7 +100,6 @@ class NoticeLogic extends BaseLogic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* @notes 整理参数
|
|
|
* @param $params
|