adminId, $this->merchantId); util::success($auth); } //员工列表 shish 2019.12.8 public function actionList() { $get = Yii::$app->request->get(); $where = []; $where['merchantId'] = $this->merchantId; $where['delStatus'] = 0; $list = AdminService::getAdminList($where); util::success($list); } //添加员工 shish 2019.12.8 public function actionAdd() { $post = Yii::$app->request->post(); $post['merchantId'] = $this->merchantId; $admin = AdminService::addAdmin($post); $id = $admin['id']; $info = AdminService::getDetail($id); util::success($info); } //删除员工 shish 2019.12.9 public function actionDelete() { $id = Yii::$app->request->post('id'); $admin = AdminClass::getById($id); AdminService::valid($admin, $this->merchantId); AdminService::deleteAdmin($admin, $this->adminId); util::complete(); } //修改员工 shish 2019.12.9 public function actionUpdate() { $post = Yii::$app->request->post(); $id = isset($post['id']) && is_numeric($post['id']) ? $post['id'] : 0; unset($post['id']); $originalAdmin = AdminService::getById($id); $post['merchantId'] = $this->merchantId; AdminService::updateAdmin($originalAdmin, $post); util::complete('修改成功'); } //查看员工详情 shish 2019.12.9 public function actionDetail() { $id = Yii::$app->request->get('id'); $admin = AdminService::getDetail($id); AdminService::valid($admin, $this->merchantId); util::success($admin); } //密码修改 public function actionPassword() { $post = Yii::$app->request->post(); $old = isset($post['old']) ? $post['old'] : ''; $new = isset($post['new']) ? $post['new'] : ''; $confirm = isset($post['confirm']) ? $post['confirm'] : ''; if (empty($new)) { util::fail('请输入新密码'); } if ($new != $confirm) { util::fail('二次密码不一致'); } $admin = $this->admin; $adminId = $this->adminId; if (!empty($admin['password'])) { if (empty($old)) { util::fail('请填写旧密码'); } if (password_verify($old, $admin['password']) == false) { util::fail('旧密码错误'); } } AdminService::updateById($adminId, ['password' => password_hash($new, PASSWORD_BCRYPT)]); util::complete('修改成功'); } //确认密码修改 public function actionConfirmPassword() { $post = Yii::$app->request->post(); $old = isset($post['old']) ? $post['old'] : ''; $new = isset($post['new']) ? $post['new'] : ''; $confirm = isset($post['confirm']) ? $post['confirm'] : ''; if (empty($new)) { util::fail('请输入新密码'); } if ($new != $confirm) { util::fail('二次密码不一致'); } $admin = $this->admin; $adminId = $this->adminId; if (!empty($admin['confirmPassword'])) { if (empty($old)) { util::fail('请填写旧密码'); } if (password_verify($old, $admin['confirmPassword']) == false) { util::fail('旧密码错误'); } } AdminService::updateById($adminId, ['confirmPassword' => password_hash($new, PASSWORD_BCRYPT)]); util::complete('修改成功'); } //登陆员工的详情 shish 2019.12.26 public function actionLoginDetail() { $detail = AdminService::getDetail($this->adminId); util::success($detail); } //收款通知 shish 2020.1.4 public function actionUpdateRemind() { $get = Yii::$app->request->get(); $id = isset($get['id']) ? $get['id'] : 0; $remind = isset($get['remind']) && is_numeric($get['remind']) ? $get['remind'] : 0; $admin = AdminService::getAdminById($id); AdminService::valid($admin, $this->merchantId); AdminService::updateById($id, ['remind' => $remind]); util::complete(); } //启用与停用 shish 2020.1.4 public function actionUpdateStatus() { $get = Yii::$app->request->get(); $id = isset($get['id']) && is_numeric($get['id']) ? $get['id'] : 0; $status = isset($get['status']) ? $get['status'] : 0; $admin = AdminService::getAdminById($id); AdminService::valid($admin, $this->merchantId); AdminService::updateById($id, ['status' => $status]); util::complete(); } }