feat:优化代码

main
gzydong 2021-12-10 23:47:46 +08:00
parent 8a5073f8c2
commit 9c4a8b4c04
1 changed files with 2 additions and 3 deletions

View File

@ -55,10 +55,9 @@ class FriendRemark extends HashRedis
*/
public function reload()
{
UsersFriend::select(['id', 'user1', 'user2', 'user1_remark', 'user2_remark'])->chunk(200, function ($rows) {
UsersFriend::select(['id', 'user_id', 'friend_id', 'remark'])->chunk(200, function ($rows) {
foreach ($rows as $row) {
$row->user1_remark && $this->save($row->user1, $row->user2, $row->user1_remark);
$row->user2_remark && $this->save($row->user2, $row->user1, $row->user2_remark);
$row->remark && $this->save($row->user_id, $row->friend_id, $row->remark);
}
});
}