|
|
@@ -95,7 +95,7 @@ class ShopAdminController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$id = isset($get['id']) ? $get['id'] : 0;
|
|
|
$respond = ShopAdminService::getAdminInfo($id);
|
|
|
- ShopAdminClass::valid($respond, $this->sjId);
|
|
|
+ ShopAdminClass::valid($respond, $this->shopId);
|
|
|
util::success($respond);
|
|
|
}
|
|
|
|
|
|
@@ -103,17 +103,23 @@ class ShopAdminController extends BaseController
|
|
|
public function actionUpdate()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $id = isset($post['id']) && is_numeric($post['id']) ? $post['id'] : 0;
|
|
|
+ $id = $post['id'] ?? 0;
|
|
|
+ if (empty($id)) {
|
|
|
+ util::fail('请选择员工');
|
|
|
+ }
|
|
|
$relation = ShopAdminClass::getById($id, true);
|
|
|
+ if (empty($relation)) {
|
|
|
+ util::fail('没有找到员工');
|
|
|
+ }
|
|
|
unset($post['id']);
|
|
|
- $roleId = isset($post['roleId']) && !empty($post['roleId']) ? $post['roleId'] : 0;
|
|
|
- $remind = isset($post['remind']) && !empty($post['remind']) ? $post['remind'] : 0;
|
|
|
+ $roleId = $post['roleId'] ?? 0;
|
|
|
+ $remind = $post['remind'] ?? 0;
|
|
|
+ $status = $post['status'] ?? 1;
|
|
|
$relation->roleId = $roleId;
|
|
|
$relation->remind = $remind;
|
|
|
+ $relation->status = $status;
|
|
|
$relation->save();
|
|
|
- $adminId = isset($relation->adminId) ? $relation->adminId : 0;
|
|
|
- ShopAdminClass::valid($relation, $this->sjId);
|
|
|
- AdminClass::updateById($adminId, $post);
|
|
|
+ ShopAdminClass::valid($relation, $this->shopId);
|
|
|
util::complete('修改成功');
|
|
|
}
|
|
|
|