|
@@ -12,10 +12,41 @@ namespace App\Http\Controllers\Bside\Gpt; |
|
@@ -12,10 +12,41 @@ namespace App\Http\Controllers\Bside\Gpt; |
|
12
|
use App\Enums\Common\Code;
|
12
|
use App\Enums\Common\Code;
|
|
13
|
use App\Http\Controllers\Bside\BaseController;
|
13
|
use App\Http\Controllers\Bside\BaseController;
|
|
14
|
use App\Http\Logic\Bside\Gpt\ChatLogic;
|
14
|
use App\Http\Logic\Bside\Gpt\ChatLogic;
|
|
|
|
15
|
+use App\Models\Gpt\Chat;
|
|
|
|
16
|
+use App\Models\Gpt\ChatItem;
|
|
15
|
|
17
|
|
|
16
|
class ChatController extends BaseController
|
18
|
class ChatController extends BaseController
|
|
17
|
{
|
19
|
{
|
|
18
|
/**
|
20
|
/**
|
|
|
|
21
|
+ * @remark :获取消息列表
|
|
|
|
22
|
+ * @name :list
|
|
|
|
23
|
+ * @author :lyh
|
|
|
|
24
|
+ * @method :post
|
|
|
|
25
|
+ * @time :2025/4/2 15:51
|
|
|
|
26
|
+ */
|
|
|
|
27
|
+ public function list(Chat $chat){
|
|
|
|
28
|
+ $list = $chat->lists(['user_id'=>$this->user['id'],'status'=>1],$this->page,$this->row);
|
|
|
|
29
|
+ $this->response('success',Code::SUCCESS,$list);
|
|
|
|
30
|
+ }
|
|
|
|
31
|
+
|
|
|
|
32
|
+ /**
|
|
|
|
33
|
+ * @remark :获取所有子消息
|
|
|
|
34
|
+ * @name :itemList
|
|
|
|
35
|
+ * @author :lyh
|
|
|
|
36
|
+ * @method :post
|
|
|
|
37
|
+ * @time :2025/4/2 15:55
|
|
|
|
38
|
+ */
|
|
|
|
39
|
+ public function itemList(ChatItem $chatItem){
|
|
|
|
40
|
+ $this->request->validate([
|
|
|
|
41
|
+ 'chat_id'=>['required'],
|
|
|
|
42
|
+ ],[
|
|
|
|
43
|
+ 'chat_id.required' => 'chat_id不能为空',
|
|
|
|
44
|
+ ]);
|
|
|
|
45
|
+ $list = $chatItem->list(['user_id'=>$this->user['id'],'chat_id'=>$this->map['chat_id'],'status'=>1]);
|
|
|
|
46
|
+ $this->response('success',Code::SUCCESS,$list);
|
|
|
|
47
|
+ }
|
|
|
|
48
|
+
|
|
|
|
49
|
+ /**
|
|
19
|
* @remark :发送消息
|
50
|
* @remark :发送消息
|
|
20
|
* @name :sendMessage
|
51
|
* @name :sendMessage
|
|
21
|
* @author :lyh
|
52
|
* @author :lyh
|
|
@@ -31,4 +62,21 @@ class ChatController extends BaseController |
|
@@ -31,4 +62,21 @@ class ChatController extends BaseController |
|
31
|
$data = $logic->sendMessage();
|
62
|
$data = $logic->sendMessage();
|
|
32
|
$this->response('success',Code::SUCCESS,$data);
|
63
|
$this->response('success',Code::SUCCESS,$data);
|
|
33
|
}
|
64
|
}
|
|
|
|
65
|
+
|
|
|
|
66
|
+ /**
|
|
|
|
67
|
+ * @remark :删除消息
|
|
|
|
68
|
+ * @name :del
|
|
|
|
69
|
+ * @author :lyh
|
|
|
|
70
|
+ * @method :post
|
|
|
|
71
|
+ * @time :2025/4/2 15:54
|
|
|
|
72
|
+ */
|
|
|
|
73
|
+ public function del(Chat $chat){
|
|
|
|
74
|
+ $this->request->validate([
|
|
|
|
75
|
+ 'id'=>['required'],
|
|
|
|
76
|
+ ],[
|
|
|
|
77
|
+ 'id.required' => 'id不能为空',
|
|
|
|
78
|
+ ]);
|
|
|
|
79
|
+ $data = $chat->edit(['status'=>0],['id'=>$this->param['id']]);
|
|
|
|
80
|
+ $this->response('success',Code::SUCCESS,$data);
|
|
|
|
81
|
+ }
|
|
34
|
} |
82
|
} |