From 7dafc964626102fc4fc9f6414c44c1a45202024d Mon Sep 17 00:00:00 2001 From: gzydong Date: Sat, 14 Nov 2020 18:10:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/Emoticon.php | 10 ++++---- app/Model/EmoticonDetail.php | 40 +++++++++++++++++++++-------- app/Model/FileSplitUpload.php | 45 +++++++++++++++++++++++---------- app/Model/User.php | 3 ++- app/Model/UsersChatList.php | 41 +++++++++++++++++------------- app/Model/UsersEmoticon.php | 21 +++++++++++---- app/Model/UsersFriend.php | 29 ++++++++++++++------- app/Model/UsersFriendsApply.php | 27 ++++++++++++++------ app/Service/FriendService.php | 1 - 9 files changed, 146 insertions(+), 71 deletions(-) diff --git a/app/Model/Emoticon.php b/app/Model/Emoticon.php index 0922228..1863d51 100644 --- a/app/Model/Emoticon.php +++ b/app/Model/Emoticon.php @@ -5,12 +5,12 @@ declare (strict_types=1); namespace App\Model; /** - * Class Emoticon + * 表情包分组数据表模型 * - * @property int $id - * @property string $name - * @property string $url - * @property \Carbon\Carbon $created_at + * @property int $id 分组ID + * @property string $name 分组名称 + * @property string $url 默认表情 + * @property string $created_at 创建时间 * * @package App\Model */ diff --git a/app/Model/EmoticonDetail.php b/app/Model/EmoticonDetail.php index 94ea42d..0bfde8a 100644 --- a/app/Model/EmoticonDetail.php +++ b/app/Model/EmoticonDetail.php @@ -5,14 +5,18 @@ declare (strict_types=1); namespace App\Model; /** - * @property int $id - * @property int $emoticon_id - * @property int $user_id - * @property string $describe - * @property string $url - * @property string $file_suffix - * @property int $file_size - * @property \Carbon\Carbon $created_at + * 表情包数据表模型 + * + * @property int $id 表情包ID + * @property int $emoticon_id 分组ID + * @property int $user_id 用户ID + * @property string $describe 表情描述 + * @property string $url 表情链接 + * @property string $file_suffix 文件前缀 + * @property int $file_size 表情包文件大小 + * @property string $created_at 创建时间 + * + * @package App\Model */ class EmoticonDetail extends BaseModel { @@ -22,16 +26,32 @@ class EmoticonDetail extends BaseModel * @var string */ protected $table = 'emoticon_details'; + /** * The attributes that are mass assignable. * * @var array */ - protected $fillable = []; + protected $fillable = [ + 'emoticon_id', + 'user_id', + 'describe', + 'url', + 'file_suffix', + 'file_size', + 'created_at', + ]; + /** * The attributes that should be cast to native types. * * @var array */ - protected $casts = ['id' => 'integer', 'emoticon_id' => 'integer', 'user_id' => 'integer', 'file_size' => 'integer', 'created_at' => 'datetime']; + protected $casts = [ + 'id' => 'integer', + 'emoticon_id' => 'integer', + 'user_id' => 'integer', + 'file_size' => 'integer', + 'created_at' => 'datetime' + ]; } diff --git a/app/Model/FileSplitUpload.php b/app/Model/FileSplitUpload.php index d27ae57..677bb5e 100644 --- a/app/Model/FileSplitUpload.php +++ b/app/Model/FileSplitUpload.php @@ -5,18 +5,22 @@ declare (strict_types=1); namespace App\Model; /** - * @property int $id - * @property int $file_type - * @property int $user_id - * @property string $hash_name - * @property string $original_name - * @property int $split_index - * @property int $split_num - * @property string $save_dir - * @property string $file_ext - * @property int $file_size - * @property int $is_delete - * @property int $upload_at + * 文件拆分上传数据表模型 + * + * @property int $id 临时文件ID + * @property int $file_type 上传类型[1:合并文件;2:拆分文件] + * @property int $user_id 上传的用户ID + * @property string $hash_name 临时文件hash名 + * @property string $original_name 原文件名 + * @property int $split_index 当前索引块 + * @property int $split_num 总上传索引块 + * @property string $save_dir 文件的临时保存路径 + * @property string $file_ext 文件后缀名 + * @property int $file_size 临时文件大小 + * @property int $is_delete 文件是否已被删除[1:是;0:否;] + * @property int $upload_at 文件上传时间 + * + * @package App\Model */ class FileSplitUpload extends BaseModel { @@ -26,16 +30,29 @@ class FileSplitUpload extends BaseModel * @var string */ protected $table = 'file_split_upload'; + /** * The attributes that are mass assignable. * * @var array */ - protected $fillable = []; + protected $fillable = [ + + ]; + /** * The attributes that should be cast to native types. * * @var array */ - protected $casts = ['id' => 'integer', 'file_type' => 'integer', 'user_id' => 'integer', 'split_index' => 'integer', 'split_num' => 'integer', 'file_size' => 'integer', 'is_delete' => 'integer', 'upload_at' => 'integer']; + protected $casts = [ + 'id' => 'integer', + 'file_type' => 'integer', + 'user_id' => 'integer', + 'split_index' => 'integer', + 'split_num' => 'integer', + 'file_size' => 'integer', + 'is_delete' => 'integer', + 'upload_at' => 'integer' + ]; } diff --git a/app/Model/User.php b/app/Model/User.php index 44c6b3d..64f922d 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -1,6 +1,7 @@ save(); return [ - 'id'=>$result->id, - 'type'=>$result->type, - 'friend_id'=>$result->friend_id, - 'group_id'=>$result->group_id, + 'id' => $result->id, + 'type' => $result->type, + 'friend_id' => $result->friend_id, + 'group_id' => $result->group_id, ]; } @@ -86,10 +91,10 @@ class UsersChatList extends BaseModel } return [ - 'id'=>$result->id, - 'type'=>$result->type, - 'friend_id'=>$result->friend_id, - 'group_id'=>$result->group_id, + 'id' => $result->id, + 'type' => $result->type, + 'friend_id' => $result->friend_id, + 'group_id' => $result->group_id, ]; } diff --git a/app/Model/UsersEmoticon.php b/app/Model/UsersEmoticon.php index d80c05d..d15b715 100644 --- a/app/Model/UsersEmoticon.php +++ b/app/Model/UsersEmoticon.php @@ -1,12 +1,17 @@ 'integer', 'user_id' => 'integer']; + protected $casts = [ + 'id' => 'integer', + 'user_id' => 'integer' + ]; } diff --git a/app/Model/UsersFriend.php b/app/Model/UsersFriend.php index 90507db..46f4790 100644 --- a/app/Model/UsersFriend.php +++ b/app/Model/UsersFriend.php @@ -7,15 +7,19 @@ namespace App\Model; use Hyperf\DbConnection\Db; /** + * 表情包收藏数据表模型 + * * @property int $id - * @property int $user1 - * @property int $user2 - * @property string $user1_remark - * @property string $user2_remark - * @property int $active - * @property int $status - * @property string $agree_time - * @property \Carbon\Carbon $created_at + * @property int $user1 用户1ID + * @property int $user2 用户2ID + * @property string $user1_remark 用户1好友备注 + * @property string $user2_remark 用户2好友备注 + * @property int $active 主动邀请方[1:user1;2:user2;] + * @property int $status 好友状态[1:好友状态;0:已解除好友关系] + * @property string $agree_time 成为好友时间 + * @property string $created_at 创建时间 + * + * @package App\Model */ class UsersFriend extends BaseModel { @@ -38,7 +42,14 @@ class UsersFriend extends BaseModel * * @var array */ - protected $casts = ['id' => 'integer', 'user1' => 'integer', 'user2' => 'integer', 'active' => 'integer', 'status' => 'integer', 'created_at' => 'datetime']; + protected $casts = [ + 'id' => 'integer', + 'user1' => 'integer', + 'user2' => 'integer', + 'active' => 'integer', + 'status' => 'integer', + 'created_at' => 'datetime' + ]; /** * 获取用户所有好友 diff --git a/app/Model/UsersFriendsApply.php b/app/Model/UsersFriendsApply.php index 4a2664d..5163f52 100644 --- a/app/Model/UsersFriendsApply.php +++ b/app/Model/UsersFriendsApply.php @@ -5,13 +5,17 @@ declare (strict_types=1); namespace App\Model; /** - * @property int $id - * @property int $user_id - * @property int $friend_id - * @property int $status - * @property string $remarks - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at + * 好友添加申请数据表模型 + * + * @property int $id 申请ID + * @property int $user_id 用户ID + * @property int $friend_id 朋友ID + * @property int $status 申请状态 + * @property string $remarks 备注说明 + * @property string $created_at 创建时间 + * @property string $updated_at 更新时间 + * + * @package App\Model */ class UsersFriendsApply extends BaseModel { @@ -41,5 +45,12 @@ class UsersFriendsApply extends BaseModel * * @var array */ - protected $casts = ['id' => 'integer', 'user_id' => 'integer', 'friend_id' => 'integer', 'status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; + protected $casts = [ + 'id' => 'integer', + 'user_id' => 'integer', + 'friend_id' => 'integer', + 'status' => 'integer', + 'created_at' => 'datetime', + 'updated_at' => 'datetime' + ]; } diff --git a/app/Service/FriendService.php b/app/Service/FriendService.php index 008673f..4fbd5a9 100644 --- a/app/Service/FriendService.php +++ b/app/Service/FriendService.php @@ -13,7 +13,6 @@ class FriendService extends BaseService { use PagingTrait; - /** * 创建好友的申请 *