no message
This commit is contained in:
parent
908ab1642e
commit
c74fdb18e6
@ -138,8 +138,6 @@ class DialogController extends AbstractController
|
|||||||
* 发送消息
|
* 发送消息
|
||||||
*
|
*
|
||||||
* @apiParam {Number} dialog_id 对话ID
|
* @apiParam {Number} dialog_id 对话ID
|
||||||
* @apiParam {Number} [extra_int] 额外参数(数字)
|
|
||||||
* @apiParam {String} [extra_str] 额外参数(字符)
|
|
||||||
* @apiParam {String} text 消息内容
|
* @apiParam {String} text 消息内容
|
||||||
*/
|
*/
|
||||||
public function msg__sendtext()
|
public function msg__sendtext()
|
||||||
@ -147,8 +145,6 @@ class DialogController extends AbstractController
|
|||||||
$user = User::auth();
|
$user = User::auth();
|
||||||
//
|
//
|
||||||
$dialog_id = intval(Request::input('dialog_id'));
|
$dialog_id = intval(Request::input('dialog_id'));
|
||||||
$extra_int = intval(Request::input('extra_int'));
|
|
||||||
$extra_str = trim(Request::input('extra_str'));
|
|
||||||
$text = trim(Request::input('text'));
|
$text = trim(Request::input('text'));
|
||||||
//
|
//
|
||||||
if (mb_strlen($text) < 1) {
|
if (mb_strlen($text) < 1) {
|
||||||
@ -169,15 +165,13 @@ class DialogController extends AbstractController
|
|||||||
'text' => $text
|
'text' => $text
|
||||||
];
|
];
|
||||||
//
|
//
|
||||||
return WebSocketDialogMsg::sendMsg($dialog_id, 'text', $msg, $user->userid, $extra_int, $extra_str);
|
return WebSocketDialogMsg::sendMsg($dialog_id, 'text', $msg, $user->userid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {post}文件上传
|
* {post}文件上传
|
||||||
*
|
*
|
||||||
* @apiParam {Number} dialog_id 对话ID
|
* @apiParam {Number} dialog_id 对话ID
|
||||||
* @apiParam {Number} [extra_int] 额外参数(数字)
|
|
||||||
* @apiParam {String} [extra_str] 额外参数(字符)
|
|
||||||
* @apiParam {String} [filename] post-文件名称
|
* @apiParam {String} [filename] post-文件名称
|
||||||
* @apiParam {String} [image64] post-base64图片(二选一)
|
* @apiParam {String} [image64] post-base64图片(二选一)
|
||||||
* @apiParam {File} [files] post-文件对象(二选一)
|
* @apiParam {File} [files] post-文件对象(二选一)
|
||||||
@ -187,8 +181,6 @@ class DialogController extends AbstractController
|
|||||||
$user = User::auth();
|
$user = User::auth();
|
||||||
//
|
//
|
||||||
$dialog_id = Base::getPostInt('dialog_id');
|
$dialog_id = Base::getPostInt('dialog_id');
|
||||||
$extra_int = Base::getPostInt('extra_int');
|
|
||||||
$extra_str = Base::getPostValue('extra_str');
|
|
||||||
//
|
//
|
||||||
if (!WebSocketDialogUser::whereDialogId($dialog_id)->whereUserid($user->userid)->exists()) {
|
if (!WebSocketDialogUser::whereDialogId($dialog_id)->whereUserid($user->userid)->exists()) {
|
||||||
return Base::retError('不在成员列表内');
|
return Base::retError('不在成员列表内');
|
||||||
@ -242,7 +234,7 @@ class DialogController extends AbstractController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$result = WebSocketDialogMsg::sendMsg($dialog_id, 'file', $fileData, $user->userid, $extra_int, $extra_str);
|
$result = WebSocketDialogMsg::sendMsg($dialog_id, 'file', $fileData, $user->userid);
|
||||||
if (Base::isSuccess($result)) {
|
if (Base::isSuccess($result)) {
|
||||||
if (isset($task)) {
|
if (isset($task)) {
|
||||||
$result['data']['task_id'] = $task->id;
|
$result['data']['task_id'] = $task->id;
|
||||||
|
@ -19,8 +19,6 @@ use Hhxsv5\LaravelS\Swoole\Task\Task;
|
|||||||
* @property array|mixed $msg 详细消息
|
* @property array|mixed $msg 详细消息
|
||||||
* @property int|null $read 已阅数量
|
* @property int|null $read 已阅数量
|
||||||
* @property int|null $send 发送数量
|
* @property int|null $send 发送数量
|
||||||
* @property int|null $extra_int 额外数字参数
|
|
||||||
* @property string|null $extra_str 额外字符参数
|
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property-read int|mixed $percentage
|
* @property-read int|mixed $percentage
|
||||||
@ -29,8 +27,6 @@ use Hhxsv5\LaravelS\Swoole\Task\Task;
|
|||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg query()
|
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg query()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereCreatedAt($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereDialogId($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereDialogId($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereExtraInt($value)
|
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereExtraStr($value)
|
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereId($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereId($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereMsg($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereMsg($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereRead($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereRead($value)
|
||||||
@ -134,19 +130,15 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
* @param string $type 消息类型
|
* @param string $type 消息类型
|
||||||
* @param array $msg 发送的消息
|
* @param array $msg 发送的消息
|
||||||
* @param int $sender 发送的会员ID(默认自己,0为系统)
|
* @param int $sender 发送的会员ID(默认自己,0为系统)
|
||||||
* @param int $extra_int
|
|
||||||
* @param string $extra_str
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function sendMsg($dialog_id, $type, $msg, $sender = 0, $extra_int = 0, $extra_str = '')
|
public static function sendMsg($dialog_id, $type, $msg, $sender = 0)
|
||||||
{
|
{
|
||||||
$dialogMsg = self::createInstance([
|
$dialogMsg = self::createInstance([
|
||||||
'userid' => $sender ?: User::token2userid(),
|
'userid' => $sender ?: User::token2userid(),
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
'read' => 0,
|
'read' => 0,
|
||||||
'extra_int' => $extra_int,
|
|
||||||
'extra_str' => $extra_str,
|
|
||||||
]);
|
]);
|
||||||
return AbstractModel::transaction(function () use ($dialog_id, $msg, $dialogMsg) {
|
return AbstractModel::transaction(function () use ($dialog_id, $msg, $dialogMsg) {
|
||||||
$dialog = WebSocketDialog::checkDialog($dialogMsg->userid, $dialog_id);
|
$dialog = WebSocketDialog::checkDialog($dialogMsg->userid, $dialog_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user