老数据副表

This commit is contained in:
2025-12-22 16:01:11 +08:00
parent 079a945e93
commit 90218d8ae3
3 changed files with 113 additions and 39 deletions
+24
View File
@@ -3,6 +3,8 @@
namespace app\common\service;
use app\common\logic\AuthLogic;
use app\common\model\Post;
use app\common\model\PostOld;
use app\common\model\UserOld;
use app\common\validate\UserValidate;
use app\common\traits\crud\CrudServiceTrait;
@@ -300,6 +302,28 @@ class UserService
$uinfo->mobile = $mobile;
$uinfo->save();
$postOld = PostOld::where('mobile', $mobile)->get();
if (!empty($postOld)) {
foreach ($postOld as $item) {
$post = [
"id" => $item->id,
"user_id" => $uinfo->id,
"category_id" => $item->id,
"sku_id" => $item->sku_id,
"content" => $item->content,
"shop_name" => $item->shop_name,
"location_name" => $item->location_name,
"status" => 1,
"is_free" => $item->is_free,
"model" => $item->model,
"browse" => $item->browse,
"price" => $item->price,
"age" => $item->age,
];
Post::firstOrCreate($post);
}
}
return $wxinfo;
}