Browse Source

聊天模板修改

刘远航 4 years ago
parent
commit
3197ce5e49
1 changed files with 7 additions and 6 deletions
  1. 7 6
      app/Http/Controllers/Api/V2/CommonController.php

+ 7 - 6
app/Http/Controllers/Api/V2/CommonController.php

@@ -1194,7 +1194,7 @@ class CommonController extends Controller
                         $list[$k]['payload'] = $v['payload'];
                         $list[$k]['payload'] = $v['payload'];
                         $list[$k]['text'] = $req['content'];
                         $list[$k]['text'] = $req['content'];
                         $list[$k]['create_time'] = time();
                         $list[$k]['create_time'] = time();
-                        if (substr($v['senderId'], 0, 6) == 'doctor') {
+                        if (substr($v['senderId'], 0, 6) == 'member') {
                             // 说明是用户给医生发的, 就给医生端发消息
                             // 说明是用户给医生发的, 就给医生端发消息
                             $docter_id = substr($v['senderId'], 7);
                             $docter_id = substr($v['senderId'], 7);
                             $docter = Docter::where('id', $docter_id)->first()->toArray();
                             $docter = Docter::where('id', $docter_id)->first()->toArray();
@@ -1214,10 +1214,13 @@ class CommonController extends Controller
 
 
                         } else {
                         } else {
                             // 说明是医生给用户发的, 就给用户端发消息
                             // 说明是医生给用户发的, 就给用户端发消息
-                            $this->ReplyReminder(substr($v['receiverId'], 7), substr($v['senderId'], 7));
+                            $this->ReplyReminder(substr($v['senderId'], 7), substr($v['receiverId'], 7));
                         }
                         }
                     }
                     }
-                    ImMessage::insert($list);
+                }
+                if ($list){
+                    $add = ImMessage::insert($list);
+                    order_trace(['聊天信息入库'=>$add, '请求参数' => $list ?? ''], 'info');
                 }
                 }
                 return json_encode(['code' => 200, 'content' => 'success']);
                 return json_encode(['code' => 200, 'content' => 'success']);
             } catch (\Exception $e) {
             } catch (\Exception $e) {
@@ -1239,9 +1242,7 @@ class CommonController extends Controller
      */
      */
     public function ReplyReminder($docter_id,$user_id){
     public function ReplyReminder($docter_id,$user_id){
 
 
-        $list = Docter::with(['DocterOrganization','organization'])->where(['id'=>$docter_id,'is_open'=>2])->first();
-        order_trace(['消息回复1', '请求参数' => $docter_id.'-'.$user_id ?? '', 'list数据' => $list ?? ''], 'info');
-
+        $list = Docter::with(['DocterOrganization','organization'])->where(['id'=>$docter_id])->first();
         $user = User::where('id',$user_id)->first();
         $user = User::where('id',$user_id)->first();
         if ($list){
         if ($list){
             order_trace(['消息回复2', '请求参数' => $docter_id.'-'.$user_id ?? '', 'list数据' => $list->toArray() ?? ''], 'info');
             order_trace(['消息回复2', '请求参数' => $docter_id.'-'.$user_id ?? '', 'list数据' => $list->toArray() ?? ''], 'info');