|
|
@@ -6,6 +6,7 @@ use App\Constants\HttpStatus;
|
|
|
use App\Http\Controllers\Controller;
|
|
|
use App\Services\RoomService;
|
|
|
use App\Services\SecretService;
|
|
|
+use App\Services\TopUpService;
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
@@ -16,13 +17,12 @@ use Illuminate\Validation\ValidationException;
|
|
|
use App\Services\AddressService;
|
|
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
+use App\Models\User as UserModel;
|
|
|
|
|
|
class User extends Controller
|
|
|
{
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* @api {get} /admin/user 会员列表
|
|
|
* @apiGroup 会员管理
|
|
|
@@ -70,8 +70,6 @@ class User extends Controller
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* @api {post} /admin/user/merge 账户合并
|
|
|
* @apiGroup 会员管理
|
|
|
@@ -92,10 +90,27 @@ class User extends Controller
|
|
|
'member_id' => ['required', 'string', 'min:1'],
|
|
|
'secret_key' => ['required', 'string', 'min:1'],
|
|
|
]);
|
|
|
+
|
|
|
$res = SecretService::migration($params['member_id'], $params['secret_key']);
|
|
|
if (!$res) {
|
|
|
throw new Exception("迁移失败", HttpStatus::CUSTOM_ERROR);
|
|
|
}
|
|
|
+ $oldUser = UserModel::where('secret_key', $params['secret_key'])->first();
|
|
|
+ $newUser = UserModel::where('member_id', $params['member_id'])->first();
|
|
|
+ $text = "账户转移通知:\n";
|
|
|
+ $text .= "管理员已将您的账户转移至新用户\n\n";
|
|
|
+ $text .= "新用户信息\n";
|
|
|
+ $text .= "用户ID:{$newUser->getMemberId()}\n";
|
|
|
+ $text .= "用户名:{$newUser->getUsername()}\n";
|
|
|
+ $text .= "昵称:{$newUser->getFirstName()}\n";
|
|
|
+ TopUpService::notifyTransferSuccess($oldUser->getMemberId(), $text);
|
|
|
+ $text = "账户转移通知:\n";
|
|
|
+ $text .= "管理员已将指定账户转移至您的账户\n\n";
|
|
|
+ $text .= "原账户信息\n\n";
|
|
|
+ $text .= "用户ID:{$oldUser->getMemberId()}\n";
|
|
|
+ $text .= "用户名:{$oldUser->getUsername()}\n";
|
|
|
+ $text .= "昵称:{$oldUser->getFirstName()}\n";
|
|
|
+ TopUpService::notifyTransferSuccess($newUser->getMemberId(), $text);
|
|
|
DB::commit();
|
|
|
} catch (ValidationException $e) {
|
|
|
DB::rollBack();
|