mirror of
https://github.com/easychen/pushdeer.git
synced 2025-01-10 23:15:30 +08:00
修正账号合并逻辑,限制不能合并账号自己
This commit is contained in:
parent
b5f8c49a2d
commit
f9ddd46f59
@ -192,14 +192,19 @@ class PushDeerUserController extends Controller
|
|||||||
return send_error('错误的token 或者 code', ErrorCode('ARGS'));
|
return send_error('错误的token 或者 code', ErrorCode('ARGS'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user2delete = PushDeerUser::where($type_field, $identiy_string)->get()->first();
|
||||||
|
|
||||||
// 更新对应的字段到当前用户
|
// 更新对应的字段到当前用户
|
||||||
$current_user = PushDeerUser::where('id', uid())->get()->first();
|
$current_user = PushDeerUser::where('id', uid())->get()->first();
|
||||||
|
|
||||||
|
if ($user2delete && $user2delete['id'] == $current_user['id']) {
|
||||||
|
return send_error("不能合并当前账号本身", ErrorCode('ARGS'));
|
||||||
|
}
|
||||||
|
|
||||||
$current_user[$type_field] = $identiy_string;
|
$current_user[$type_field] = $identiy_string;
|
||||||
$current_user->save();
|
$current_user->save();
|
||||||
|
|
||||||
// 如果存在旧用户,合并并删除
|
// 如果存在旧用户,合并并删除
|
||||||
$user2delete = PushDeerUser::where($type_field, $identiy_string)->get()->first();
|
|
||||||
|
|
||||||
if ($user2delete) {
|
if ($user2delete) {
|
||||||
// 删除Key
|
// 删除Key
|
||||||
PushDeerKey::where('uid', $user2delete['id'])->delete();
|
PushDeerKey::where('uid', $user2delete['id'])->delete();
|
||||||
|
Loading…
Reference in New Issue
Block a user