This commit is contained in:
2025-03-24 15:22:13 +08:00
parent 8cee9fa81b
commit 1773ab9863
+11 -2
View File
@@ -5,6 +5,7 @@ namespace app\controller;
use app\model\Country;
use app\model\FeishuUser;
use app\model\User;
use app\model\UserSn;
use app\service\MailService;
use app\util\JwtUtil;
use app\util\Util;
@@ -153,12 +154,20 @@ class UserController
'role' => 1,
'password' => $hashedPassword,
'status' => 0,
'avatar' => 'vehicle_album/20250322/175585eeebcf44e8c2a2d50a5e8b5388_67ded58ca1011.jpg',
'sn' => substr(uniqid(), -8)
'avatar' => 'lingke_crm/lingke.png'
];
if (Util::isEmpty($id)) {
// 获取编号
$userSnModel = new UserSn();
$sn = $userSnModel->where('user_id', '=', 0)->inRandomOrder()->first();
if (!$sn) {
throw new BusinessException('未找到适用编号');
}
$data['sn'] = $sn['user_sn'];
$res = User::create($data);
UserSn::where(['user_sn'=>$data['sn']])->update(['user_id'=>$res['id']]);
} else {
$res = User::where('id', $id)
->update($data);