diff --git a/app/admin/logic/system_store/SystemStoreLogic.php b/app/admin/logic/system_store/SystemStoreLogic.php index 464b334b4..c07cc136f 100644 --- a/app/admin/logic/system_store/SystemStoreLogic.php +++ b/app/admin/logic/system_store/SystemStoreLogic.php @@ -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(); } -} \ No newline at end of file +}