调整与触客宝数据交换用户的密码加密方式

This commit is contained in:
柳清爽
2025-04-22 09:54:03 +08:00
parent 05cee48a3d
commit da5e01e856
4 changed files with 29 additions and 26 deletions

View File

@@ -93,7 +93,7 @@ class CreateCompanyController extends BaseController
}
return array_merge($params, [
'companyId' => $department['departmentId'],
'companyId' => $department['departmentId'],
's2_accountId' => $department['id'],
]);
}
@@ -125,14 +125,15 @@ class CreateCompanyController extends BaseController
protected function ckbCreateUser(array $params): void
{
$params = ArrHelper::getValue(
'username,account,password=passwordLocal,companyId,s2_accountId,status,realName',
'username,account,password,companyId,s2_accountId,status,realName',
$params
);
$result = UsersModel::create(array_merge($params, [
'passwordMd5' => md5($params['passwordLocal']),
'passwordLocal' => localEncrypt($params['password']),
'passwordMd5' => md5($params['password']),
'isAdmin' => 1, // 主要账号默认1
'typeId' => 1, // 类型:运营后台/操盘手传1、 门店传2
'typeId' => 1, // 类型:运营后台/操盘手传1、 门店传2
]));
if (!$result) {

View File

@@ -39,7 +39,8 @@ class GetCompanyDetailForUpdateController extends BaseController
{
$detail = CompanyModel::alias('c')
->field([
'c.id', 'c.name', 'c.status', 'c.memo', 'c.companyId', 'u.account', 'u.username', 'u.phone',
'c.id', 'c.name', 'c.status', 'c.memo', 'c.companyId',
'u.account', 'u.username', 'u.phone', 'u.s2_accountId'
])
->leftJoin('users u', 'c.companyId = u.companyId')
->find($id);

View File

@@ -84,11 +84,12 @@ class UpdateCompanyController extends BaseController
*/
protected function updateUserAccount(array $params): void
{
$params = ArrHelper::getValue('username,account,password=passwordLocal,realName,status', $params);
$params = ArrHelper::getValue('username,account,password,realName,status', $params);
$params = ArrHelper::rmValue($params);
if (isset($params['passwordLocal'])) {
$params['passwordMd5'] = md5($params['passwordLocal']);
if (isset($params['password'])) {
$params['passwordMd5'] = md5($params['password']);
$params['passwordLocal'] = localEncrypt($params['passwordLocal']);
}
$user = $this->getUserDetailByCompanyId();

View File

@@ -152,16 +152,14 @@ export default function EditProjectPage({ params }: { params: { id: string } })
</div>
<div className="space-y-2">
<Label htmlFor="status"></Label>
<select
id="status"
value={status}
onChange={(e) => setStatus(e.target.value)}
className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
>
<option value="1"></option>
<option value="0"></option>
</select>
<Label htmlFor="nickname"></Label>
<Input
id="nickname"
value={nickname}
onChange={(e) => setNickname(e.target.value)}
placeholder="用于账号登录后显示的用户名,可以填真实姓名"
required
/>
</div>
<div className="space-y-2">
@@ -199,14 +197,16 @@ export default function EditProjectPage({ params }: { params: { id: string } })
</div>
<div className="space-y-2">
<Label htmlFor="nickname"></Label>
<Input
id="nickname"
value={nickname}
onChange={(e) => setNickname(e.target.value)}
placeholder="请输入昵称"
required
/>
<Label htmlFor="status"></Label>
<select
id="status"
value={status}
onChange={(e) => setStatus(e.target.value)}
className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
>
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>