添加文本消息接口

main
gzydong 2021-08-09 21:58:36 +08:00
parent 44b2ddfd91
commit e298f3f950
2 changed files with 19 additions and 5 deletions

View File

@ -47,7 +47,21 @@ class TalkMessageController extends CController
*/
public function text()
{
// todo 待开发
$params = $this->request->inputs(['talk_type', 'receiver_id', 'text']);
$this->validate($params, [
'talk_type' => 'required|in:1,2',
'receiver_id' => 'required|integer|min:1',
'text' => 'required|max:65535',
]);
di()->get(TalkMessageService::class)->insertTextMessage([
'talk_type' => $params['talk_type'],
'user_id' => $this->uid(),
'receiver_id' => $params['receiver_id'],
'content' => $params['text'],
]);
return $this->response->success();
}
/**

View File

@ -44,8 +44,8 @@ class ReceiveHandleService
* 对话文本消息
*
* @param Response|Server $server
* @param Frame $frame
* @param array|string $data 解析后数据
* @param Frame $frame
* @param array|string $data 解析后数据
* @return void
*/
public function onTalk($server, Frame $frame, $data)
@ -77,8 +77,8 @@ class ReceiveHandleService
* 键盘输入消息
*
* @param Response|Server $server
* @param Frame $frame
* @param array|string $data 解析后数据
* @param Frame $frame
* @param array|string $data 解析后数据
* @return false
*/
public function onKeyboard($server, Frame $frame, $data)