public function actionSalestore() { $request = \Yii::$app->request; $identity = Identity::checkIdentity('salestore', '/app-backend/backend/store/salestore'); if (is_array($identity)) { return $identity; } $saleId = intval($request->get('saleId', '')); if (!$saleId) { return ['code' => 1, 'msg' => '数据非法', 'data' => []]; } $data = StoreSale::getSaleStore($saleId); if ($data !== false) { return ['code' => 0, 'msg' => '操作成功', 'data' => ['store' => $data]]; } else { return ['code' => 2, 'msg' => '操作失败,请重试', 'data' => []]; } }
/** * 意见反馈处理 */ public function actionChangestatus() { $request = \Yii::$app->request; $identity = Identity::checkIdentity('changestatus', '/app-backend/backend/feedback/changestatus'); if (is_array($identity)) { return $identity; } $id = $request->_get('id', 0); $status = $request->_get('status', 0); if (!$id || !$status) { return ['code' => 1, 'msg' => '数据非法', 'data' => []]; } $res = Feedback::changeStatus($id, $status); if ($res !== false) { return ['code' => 0, 'msg' => '操作成功', 'data' => ['status' => $res]]; } else { return ['code' => 2, 'msg' => '操作失败,请重试', 'data' => []]; } }
/** * 密码重置 * @return type */ public function actionResetpwd() { $request = \Yii::$app->request; $identity = Identity::checkIdentity('resetpwd', '/app-backend/backend/adminmanage/resetpwd'); if (is_array($identity)) { return $identity; } $userId = $request->_get('userId', 0); if (!$userId) { return ['code' => 2, 'msg' => '数据非法', 'data' => []]; } $user = \common\models\UserAdmin::findOne(['id' => $userId]); if (!$user) { return ['code' => 2, 'msg' => '用户不存在', 'data' => []]; } $user->password = \common\helpers\EasyHelpers::encrypty($user->username, \Yii::$app->params['backend_key']); $res = $user->save(); if ($res !== false) { return ['code' => 0, 'msg' => '操作成功', 'data' => []]; } else { return ['code' => 2, 'msg' => '操作失败,请重试', 'data' => []]; } }
/** * 组管理(编辑组权限) */ public function actionSaveprivilege() { $request = \Yii::$app->request; $identity = Identity::checkIdentity('saveprivilege', '/app-backend/backend/adminmanage/saveprivilege'); if (is_array($identity)) { return $identity; } $groupId = $request->_get('groupId', 0); $moduleId = $request->_get('moduleId', 0); $module = $request->_get('module', 0); $controller = $request->_get('controller', 0); $method = $request->_get('method', 0); $app = $request->_get('app', 0); if (!$groupId || !$moduleId || !$app) { return ['code' => 1, 'msg' => '数据非法', 'data' => []]; } $check = GroupPrivilege::find()->where('groupId=' . $groupId . ' And moduleId=' . $moduleId)->one(); if ($check) { $res = GroupPrivilege::deleteAll('groupId=' . $groupId . ' And moduleId=' . $moduleId); } else { $privilege = new GroupPrivilege(); $privilege->moduleId = $moduleId; $privilege->groupId = $groupId; $privilege->module = $module; $privilege->controller = $controller; $privilege->method = $method; $privilege->app = $app; $res = $privilege->save(); } if ($res !== false) { return ['code' => 0, 'msg' => '操作成功', 'data' => []]; } else { return ['code' => 2, 'msg' => '操作失败,请重试', 'data' => []]; } }
/** * 删除属性及其属性选项值 * @return type */ public function actionDelattr() { $identity = Identity::checkIdentity('delattr', '/app-backend/backend/category/delattr'); if (is_array($identity)) { return $identity; } $request = \Yii::$app->request; $attributeId = intval($request->get('attributeId', 0)); $attribute = Attribute::findOne($attributeId); if ($attribute) { \Yii::$app->db->createCommand()->delete('attribute_value', 'attributeId=' . $attributeId)->execute(); $attribute->delete(); } return ['code' => 0, 'msg' => 'ok']; }