作者 lyh

gx

@@ -42,7 +42,7 @@ class ChatController extends BaseController @@ -42,7 +42,7 @@ class ChatController extends BaseController
42 ],[ 42 ],[
43 'chat_id.required' => 'chat_id不能为空', 43 'chat_id.required' => 'chat_id不能为空',
44 ]); 44 ]);
45 - $list = $chatItem->list(['user_id'=>$this->user['id'],'chat_id'=>$this->map['chat_id'],'status'=>1]); 45 + $list = $chatItem->list(['user_id'=>$this->user['id'],'chat_id'=>$this->map['chat_id']]);
46 $this->response('success',Code::SUCCESS,$list); 46 $this->response('success',Code::SUCCESS,$list);
47 } 47 }
48 48
@@ -52,6 +52,13 @@ class ChatLogic extends BaseLogic @@ -52,6 +52,13 @@ class ChatLogic extends BaseLogic
52 } 52 }
53 $message[] = ['role' => 'user', 'content' => $this->param['message']]; 53 $message[] = ['role' => 'user', 'content' => $this->param['message']];
54 $chatId = $chatInfo['id']; 54 $chatId = $chatInfo['id'];
  55 + }else{
  56 + $chatId = $this->saveChat($this->param['message']);
  57 + $this->saveChatItem($chatId, $this->param['message']);
  58 + $message = [
  59 + ['role' => 'system', 'content' => "You are now the marketing customer service of 深圳创贸集团"],
  60 + ['role' => 'user', 'content' => $this->param['message']],
  61 + ];
55 } 62 }
56 } else { 63 } else {
57 $chatId = $this->saveChat($this->param['message']); 64 $chatId = $this->saveChat($this->param['message']);