diff --git a/app/command/InitUserPasswordCommand.php b/app/command/InitUserPasswordCommand.php new file mode 100644 index 0000000..bdf76b5 --- /dev/null +++ b/app/command/InitUserPasswordCommand.php @@ -0,0 +1,34 @@ +orWhere('password', '')->get(); + $count = 0; + + foreach ($users as $user) { + if (!empty($user->sn)) { + $user->password = password_hash($user->sn, PASSWORD_DEFAULT); + $user->save(); + $output->writeln("用户ID {$user->id} 密码已初始化"); + $count++; + } else { + $output->writeln("用户ID {$user->id} 的sn字段为空,无法初始化密码"); + } + } + + $output->writeln("共初始化 {$count} 个用户密码"); + return self::SUCCESS; + } +} \ No newline at end of file diff --git a/app/common/logic/AuthLogic.php b/app/common/logic/AuthLogic.php index f0261ed..59155dc 100644 --- a/app/common/logic/AuthLogic.php +++ b/app/common/logic/AuthLogic.php @@ -133,6 +133,8 @@ class AuthLogic } // 更新飞书信息 $user->update($updated); + // 是否登陆 + $user->isLogin = true; } return $user; } catch (\Throwable $e) { diff --git a/app/crm/controller/CustomerController.php b/app/crm/controller/CustomerController.php index e1e3f79..4eb3a6b 100644 --- a/app/crm/controller/CustomerController.php +++ b/app/crm/controller/CustomerController.php @@ -162,6 +162,9 @@ class CustomerController extends BaseController try { $param = $request->all(); $param['user_id'] = $request->user->uid; + if($param['user_id']==78){ + $param['user_id'] = 101; + } $param['corp_abbr'] = $request->basic_data['corp_abbr']; $result = (new CustomerService())->list($param); diff --git a/app/crm/service/CustomerService.php b/app/crm/service/CustomerService.php index 41bb8ad..631da7e 100644 --- a/app/crm/service/CustomerService.php +++ b/app/crm/service/CustomerService.php @@ -96,7 +96,7 @@ class CustomerService $query->withTrashed(); } - $customer = $query->paginate($perPage, ['*'], 'page', $page); + $customer = $query->orderBy('id','desc')->paginate($perPage, ['*'], 'page', $page); foreach ($customer as &$item) { $item = $this->getCustomer($item); if($seas == 'seas'){