feat: 更新系统商店逻辑以处理管理员密码和员工信息
This commit is contained in:
parent
e7fef4b83d
commit
3a82a0f435
@ -30,8 +30,8 @@ class SystemStoreLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password=create_password($params['password'], $passwordSalt);
|
||||
$store=SystemStore::create([
|
||||
$password = create_password($params['password'], $passwordSalt);
|
||||
$store = SystemStore::create([
|
||||
'name' => $params['name'],
|
||||
'introduction' => $params['introduction'],
|
||||
'phone' => $params['phone'],
|
||||
@ -47,15 +47,15 @@ class SystemStoreLogic extends BaseLogic
|
||||
'area' => $params['area_code'],
|
||||
'street' => $params['street_code'],
|
||||
]);
|
||||
$taff=[
|
||||
'store_id'=>$store['id'],
|
||||
'account'=>$params['phone'],
|
||||
'pwd'=>$password,
|
||||
'avatar'=>$params['image'],
|
||||
'staff_name'=>$params['name'],
|
||||
'phone'=>$params['phone'],
|
||||
'is_admin'=>1,
|
||||
'status'=>1,
|
||||
$taff = [
|
||||
'store_id' => $store['id'],
|
||||
'account' => $params['phone'],
|
||||
'pwd' => $password,
|
||||
'avatar' => $params['image'],
|
||||
'staff_name' => $params['name'],
|
||||
'phone' => $params['phone'],
|
||||
'is_admin' => 1,
|
||||
'status' => 1,
|
||||
|
||||
];
|
||||
SystemStoreStaff::create($taff);
|
||||
@ -80,16 +80,31 @@ class SystemStoreLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
SystemStore::where('id', $params['id'])->update([
|
||||
$store = SystemStore::where('id',$params['id'])->update([
|
||||
'name' => $params['name'],
|
||||
'introduction' => $params['introduction'],
|
||||
'phone' => $params['phone'],
|
||||
'detailed_address' => $params['detailed_address'],
|
||||
'image' => $params['image'],
|
||||
'latitude' => $params['latitude'],
|
||||
'is_show' => $params['is_show'],
|
||||
'longitude' => $params['longitude'],
|
||||
'is_show' => $params['is_show']
|
||||
'latitude' => $params['latitude'],
|
||||
'day_start' => $params['day_start'],
|
||||
'day_end' => $params['day_end'],
|
||||
'province' => $params['province_code'],
|
||||
'city' => $params['city_code'],
|
||||
'area' => $params['area_code'],
|
||||
'street' => $params['street_code'],
|
||||
]);
|
||||
if($params['password']!=''){
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password = create_password($params['password'], $passwordSalt);
|
||||
$taff = [
|
||||
'pwd' => $password,
|
||||
'avatar' => $params['image'],
|
||||
'staff_name' => $params['name'],
|
||||
];
|
||||
SystemStoreStaff::where('store_id', $params['id'])->where('is_admin', 1)->where('account', $params['phone'])->update($taff);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
@ -125,4 +140,4 @@ class SystemStoreLogic extends BaseLogic
|
||||
{
|
||||
return SystemStore::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user