Jelajahi Sumber

社区群发消息

wanghaijun 4 tahun lalu
induk
melakukan
71fa51d600

+ 7 - 3
app/Admin/Actions/Community/Notice/sendNotice.php

xqd xqd xqd xqd
@@ -2,6 +2,8 @@
 
 namespace App\Admin\Actions\Community\Notice;
 
+use App\Models\OrderPatient;
+use App\Models\Patient;
 use App\User;
 use EasyWeChat\Factory;
 use Encore\Admin\Actions\BatchAction;
@@ -16,7 +18,10 @@ class sendNotice extends BatchAction
         $info = $collection->toArray();
         $ids = array_unique(array_column($info,'id'));
         foreach ($ids as $id) {
-            $openid = User::where('id',$id)->value('openid');
+            $user_id = Patient::where('id',$id)->value('user_id');
+            if(empty($user_id)) continue;
+
+            $openid = User::where('id',$user_id)->value('openid');
             $content = request('content');
             $remark= request('remark');
             $stime= request('stime');
@@ -24,7 +29,6 @@ class sendNotice extends BatchAction
 //            $openid = 'oYmUA5A1OIqtpA1XSrw35tbjtv1w';
             $service_arr = [1=>'儿保服务',2=>'疫苗接种服务'];
             $service_name = $service_arr[$type];
-
             //没有openid 直接不发送
             if(empty($openid)) continue;
             $template_arr = [
@@ -38,7 +42,7 @@ class sendNotice extends BatchAction
             $msg['remark'] = $remark;
             $msg['service_name'] = $service_name;
 
-            $this->send($openid,$tempId,$msg);
+            $res = $this->send($openid,$tempId,$msg);
         }
 
         return $this->response()->success('发送成功')->refresh();

+ 1 - 1
app/Community/Controllers/UserNoticeController.php

xqd
@@ -49,7 +49,7 @@ class UserNoticeController extends AdminController
             $flter->like('user.nickname','请输入监护人姓名');
             $flter->like('phone','电话');
             $flter->between('birthday','生日')->datetime();
-            $flter->timestampBetween('orderPatient.appoint_start_time','预约时间')->datetime();
+//            $flter->timestampBetween('orderPatient.appoint_start_time','预约时间')->datetime();
             $flter->equal('order.product_type','用户类型')->select([4=>'计免',5=>'儿保']);
         });