diff --git a/LumenIM 同步SQL.sql b/LumenIM 同步SQL.sql index ce61447..8376088 100644 --- a/LumenIM 同步SQL.sql +++ b/LumenIM 同步SQL.sql @@ -22,11 +22,14 @@ ALTER TABLE `lar_emoticon` ADD `updated_at` datetime DEFAULT NULL COMMENT '更 ALTER TABLE `lar_emoticon` DROP INDEX `name`; ALTER TABLE `lar_emoticon` ADD UNIQUE uk_name (`name`); + # lar_emoticon_details 数据表同步SQL ALTER TABLE `lar_emoticon_details` RENAME `lar_emoticon_item`; ALTER TABLE `lar_emoticon_item` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '表情包详情ID'; ALTER TABLE `lar_emoticon_item` MODIFY `describe` varchar(20) DEFAULT '' COMMENT '表情描述'; ALTER TABLE `lar_emoticon_item` MODIFY `url` varchar(255) DEFAULT '' COMMENT '图片链接'; +ALTER TABLE `lar_emoticon_item` DROP COLUMN `created_at`; +ALTER TABLE `lar_emoticon_item` ADD `created_at` datetime DEFAULT NULL COMMENT '创建时间'; ALTER TABLE `lar_emoticon_item` ADD `updated_at` datetime DEFAULT NULL COMMENT '更新时间'; ALTER TABLE `lar_emoticon_item` comment '表情包详情表'; @@ -68,7 +71,9 @@ ALTER TABLE `lar_users_friends` DROP COLUMN `active`; ALTER TABLE `lar_users_friends` DROP COLUMN `user2_remark`; # lar_users_friends_apply 数据表同步SQL -ALTER TABLE `lar_users_friends_apply` MODIFY `status` tinyint(4) unsigned DEFAULT '0' COMMENT '申请状态[0:等待处理;1:已同意;2:已拒绝;]'; +ALTER TABLE `lar_users_friends_apply` CHANGE `remarks` `remark` varchar(50) DEFAULT '' COMMENT '申请备注'; +ALTER TABLE `lar_users_friends_apply` DROP COLUMN `updated_at`; +ALTER TABLE `lar_users_friends_apply` DROP COLUMN `status`; -- ---------------------------- -- 以下是新增数据表 diff --git a/app/Command/TestCommand.php b/app/Command/TestCommand.php index 9ec1fea..8a18d42 100644 --- a/app/Command/TestCommand.php +++ b/app/Command/TestCommand.php @@ -6,6 +6,7 @@ namespace App\Command; use App\Cache\VoteStatisticsCache; use App\Model\Talk\TalkRecordsVote; +use App\Model\UsersFriend; use Hyperf\Command\Command as HyperfCommand; use Hyperf\Command\Annotation\Command; use Hyperf\DbConnection\Db; @@ -39,18 +40,8 @@ class TestCommand extends HyperfCommand public function handle() { - //VoteStatisticsCache::getInstance()->updateVoteCache(15); - - $array = [ - 'name' => 'yuandong', - 'sex' => 1, - 'age' => 18 - ]; - - - - var_dump(Arr::only($array,['name','age','tt'])); + $this->updateData(); //$api = config('juhe_api.ip'); //$options = []; @@ -72,4 +63,26 @@ class TestCommand extends HyperfCommand // //var_dump($address); } + + + // 更新好友表数据 + public function updateData() + { + $max = UsersFriend::max('id'); + UsersFriend::where('id', '<=', $max)->chunk(1000, function ($rows) { + $arr = []; + foreach ($rows as $row) { + $arr[] = [ + 'user_id' => $row->friend_id, + 'friend_id' => $row->user_id, + 'status' => 1, + 'remark' => '', + 'updated_at' => date('Y-m-d H:i:s'), + 'created_at' => date('Y-m-d H:i:s'), + ]; + } + + UsersFriend::insert($arr); + }); + } } diff --git a/app/Controller/Api/V1/TalkController.php b/app/Controller/Api/V1/TalkController.php index 3bc274b..5c23291 100644 --- a/app/Controller/Api/V1/TalkController.php +++ b/app/Controller/Api/V1/TalkController.php @@ -86,7 +86,7 @@ class TalkController extends CController ]); $user_id = $this->uid(); - $string = join('-', [$user_id, $params['receiver_id'], $params['talk_type'], md5($request->getHeaderLine('user-agent'))]); + $string = join('-', [$user_id, $params['receiver_id'], $params['talk_type'], md5($this->request->getHeaderLine('user-agent'))]); $lock = 'talk:list:' . $string; // 防止前端并发请求 diff --git a/app/Service/Group/GroupService.php b/app/Service/Group/GroupService.php index ba29e43..d461be8 100644 --- a/app/Service/Group/GroupService.php +++ b/app/Service/Group/GroupService.php @@ -82,11 +82,11 @@ class GroupService extends BaseService ]; } - if (!Db::table('group_member')->insert($groupMember)) { + if (!GroupMember::insert($groupMember)) { throw new Exception('创建群成员信息失败'); } - if (!Db::table('talk_list')->insert($chatList)) { + if (!TalkList::insert($chatList)) { throw new Exception('创建群成员的聊天列表失败'); } @@ -249,7 +249,7 @@ class GroupService extends BaseService } if ($insertArr) { - Db::table('group_member')->insert($insertArr); + GroupMember::insert($insertArr); } if ($updateArr1) { @@ -260,7 +260,7 @@ class GroupService extends BaseService } if ($insertArr1) { - Db::table('talk_list')->insert($insertArr1); + TalkList::insert($insertArr1); } $result = TalkRecords::create([