2021-07-05 21:52:44 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare (strict_types=1);
|
|
|
|
|
2021-07-09 22:57:19 +08:00
|
|
|
namespace App\Model\Talk;
|
|
|
|
|
|
|
|
use App\Model\BaseModel;
|
2021-07-05 21:52:44 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 聊天列表组数据表模型
|
|
|
|
*
|
2021-08-09 20:58:13 +08:00
|
|
|
* @property integer $id 聊天列表ID
|
|
|
|
* @property integer $talk_type 聊天类型[1:好友;2:群聊;]
|
|
|
|
* @property integer $user_id 用户ID或消息发送者ID
|
|
|
|
* @property integer $receiver_id 接收者ID[好友ID或群ID]
|
|
|
|
* @property integer $is_delete 是否删除
|
|
|
|
* @property integer $is_top 是否置顶
|
|
|
|
* @property integer $is_disturb 消息免打扰
|
|
|
|
* @property integer $is_robot 是否机器人
|
|
|
|
* @property string $created_at 创建时间
|
|
|
|
* @property \Carbon\Carbon $updated_at 更新时间
|
2022-01-17 21:27:27 +08:00
|
|
|
*
|
2021-07-05 21:52:44 +08:00
|
|
|
* @package App\Model
|
|
|
|
*/
|
2022-01-16 14:22:53 +08:00
|
|
|
class TalkSession extends BaseModel
|
2021-07-05 21:52:44 +08:00
|
|
|
{
|
2022-01-16 10:29:16 +08:00
|
|
|
protected $table = 'talk_session';
|
2021-07-05 21:52:44 +08:00
|
|
|
|
2021-07-06 23:32:14 +08:00
|
|
|
public $timestamps = true;
|
|
|
|
|
2021-07-05 21:52:44 +08:00
|
|
|
protected $fillable = [
|
|
|
|
'talk_type',
|
|
|
|
'user_id',
|
|
|
|
'receiver_id',
|
|
|
|
'is_top',
|
|
|
|
'is_disturb',
|
2022-01-17 21:27:27 +08:00
|
|
|
'is_delete',
|
|
|
|
'is_robot',
|
2021-07-05 21:52:44 +08:00
|
|
|
'created_at',
|
|
|
|
'updated_at'
|
|
|
|
];
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
'id' => 'integer',
|
|
|
|
'talk_type' => 'integer',
|
|
|
|
'user_id' => 'integer',
|
|
|
|
'receiver_id' => 'integer',
|
|
|
|
'is_delete' => 'integer',
|
|
|
|
'is_top' => 'integer',
|
|
|
|
'is_robot' => 'integer',
|
|
|
|
'is_disturb' => 'integer',
|
|
|
|
'created_at' => 'datetime',
|
|
|
|
'updated_at' => 'datetime'
|
|
|
|
];
|
2021-07-12 22:00:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $params
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function item(array $params): array
|
|
|
|
{
|
|
|
|
$item = [
|
|
|
|
'id' => 0,
|
|
|
|
'talk_type' => 0,
|
|
|
|
'receiver_id' => 0,
|
|
|
|
'is_top' => 0,
|
|
|
|
'is_disturb' => 0,
|
2021-09-12 16:23:43 +08:00
|
|
|
'is_online' => 0,
|
|
|
|
'is_robot' => 0,
|
2021-07-12 22:00:48 +08:00
|
|
|
'avatar' => '',
|
|
|
|
'name' => '',
|
|
|
|
'remark_name' => '',
|
|
|
|
'unread_num' => 0,
|
|
|
|
'msg_text' => '',
|
|
|
|
'updated_at' => date('Y-m-d H:i:s')
|
|
|
|
];
|
|
|
|
|
|
|
|
return array_merge($item, array_intersect_key($params, $item));
|
|
|
|
}
|
2021-07-05 21:52:44 +08:00
|
|
|
}
|