mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
user modify migrate
This commit is contained in:
@@ -177,6 +177,9 @@ class DashboardRepository extends BaseRepository
|
||||
|
||||
$statGender = User::query()->groupBy('gender')->selectRaw('gender, count(*) as counts')->get()->pluck('counts','gender');
|
||||
foreach ($statGender as $gender => $value) {
|
||||
if (!isset(User::$genders[$gender])) {
|
||||
$gender = User::GENDER_UNKNOWN;
|
||||
}
|
||||
$name = "gender_$gender";
|
||||
$result[$name] = [
|
||||
'name' => $name,
|
||||
|
||||
@@ -360,7 +360,9 @@ class HitAndRunRepository extends BaseRepository
|
||||
}
|
||||
$users = User::query()
|
||||
->with('language')
|
||||
->where('class', '<', User::CLASS_VIP)
|
||||
->where('enabled', User::ENABLED_YES)
|
||||
->where('donor', 'no')
|
||||
->find($result->pluck('uid')->toArray(), ['id', 'username', 'lang']);
|
||||
do_log("$logPrefix, Going to disable user: " . json_encode($users->toArray()));
|
||||
foreach ($users as $user) {
|
||||
|
||||
@@ -468,9 +468,22 @@ class UserRepository extends BaseRepository
|
||||
public function addMeta($user, array $metaData, array $keyExistsUpdates = [])
|
||||
{
|
||||
$user = $this->getUser($user);
|
||||
$locale = $user->locale;
|
||||
$metaKey = $metaData['meta_key'];
|
||||
$metaName = nexus_trans("label.user_meta.meta_keys.$metaKey", [], $locale);
|
||||
$allowMultiple = UserMeta::$metaKeys[$metaKey]['multiple'];
|
||||
$log = "user: {$user->id}, metaKey: $metaKey, allowMultiple: $allowMultiple";
|
||||
$log = "user: {$user->id}, locale: $locale, metaKey: $metaKey, allowMultiple: $allowMultiple";
|
||||
$message = [
|
||||
'receiver' => $user->id,
|
||||
'added' => now(),
|
||||
'subject' => nexus_trans('user.grant_props_notification.subject', ['name' => $metaName], $locale),
|
||||
];
|
||||
if (!empty($keyExistsUpdates['duration']) && $metaKey != UserMeta::META_KEY_CHANGE_USERNAME) {
|
||||
$durationText = $keyExistsUpdates['duration'] . " Days";
|
||||
} else {
|
||||
$durationText = nexus_trans('label.permanent', [], $locale);
|
||||
}
|
||||
$message['msg'] = nexus_trans('user.grant_props_notification.body', ['name' => $metaName, 'operator' => Auth::user()->username, 'duration' => $durationText], $locale);
|
||||
if ($allowMultiple) {
|
||||
//Allow multiple, just insert
|
||||
$result = $user->metas()->create($metaData);
|
||||
@@ -503,6 +516,7 @@ class UserRepository extends BaseRepository
|
||||
}
|
||||
if ($result) {
|
||||
clear_user_cache($user->id, $user->passkey);
|
||||
Message::query()->insert($message);
|
||||
}
|
||||
do_log($log);
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user