Prechádzať zdrojové kódy

增加升级单开关,decorder增加从什么级别到什么级别

root 3 rokov pred
rodič
commit
991fe6c7f3

+ 1 - 0
backendApi/config/urlManagerRules.php

@@ -260,6 +260,7 @@ return [
             'POST,GET other' => 'other',
             'GET dec-level' => 'dec-level',
             'GET,POST month-limit' => 'month-limit',
+            'POST open-upgrade' => 'open-upgrade',
             'POST dec-level-add' => 'dec-level-add',
             'POST,GET dec-level-edit/<id>' => 'dec-level-edit',
             'GET dec-level-delete/<selected>' => 'dec-level-delete',

+ 29 - 2
backendApi/modules/v1/controllers/ConfigController.php

@@ -475,8 +475,35 @@ class ConfigController extends BaseController {
                 return static::notice('更新观察期失败,请重试');
             }
         }
-        $data = Config::find()->where("CONFIG_NAME='observePeriodLimit'")->asArray()->one();
-        return static::notice($data);
+        $data = Config::find()
+        ->where("CONFIG_NAME='observePeriodLimit'")
+        ->asArray()
+        ->one();
+        $isSwitchUpgrade = Config::find()
+        ->where("CONFIG_NAME='isOpenUpgrade'")
+        ->asArray()
+        ->one();
+
+        return static::notice([
+            'observe' => $data,
+            'isOpenUpgrade' => $isSwitchUpgrade
+        ]);
+    }
+
+    // 开关会员升级单功能
+    public function actionOpenUpgrade() {
+        if (Yii::$app->request->isPost) {
+            $postData = Yii::$app->request->post();
+            $isOpen = $postData['isOpen'];
+            $ret = Config::updateAll(['VALUE' => $isOpen, 'UPDATED_AT' => Date::nowTime()], "CONFIG_NAME=:CONFIG_NAME", [':CONFIG_NAME' => 'isOpenUpgrade']);
+            if ($ret) {
+                $msg = $isOpen == 1 ? '开启' : '关闭';
+                return static::notice("$msg,操作成功");
+            } else {
+                return static::notice('操作失败,请重试');
+            }
+        }
+        return static::notice('非法请求');
     }
 
     /**

+ 31 - 2
backendEle/src/views/config/dec-level.vue

@@ -75,6 +75,12 @@
           <el-button type="primary" @click="onSubmit" :loading="submitButtonStat">更新观察期</el-button>
         </div></el-form-item>
       </el-form>
+      <el-switch
+        v-model="value1"
+        :active-text="value1Text"
+        @change="switchUpgrade"
+      >
+      </el-switch>
     </div>
 
   </div>
@@ -96,12 +102,17 @@ export default {
       this.loading = false
     })
     network.getData('config/month-limit').then(response => {
-      this.form.monthLimitTITLE = response.TITLE
-      this.form.monthLimitVALUE = response.VALUE
+      this.form.monthLimitTITLE = response.observe.TITLE
+      this.form.monthLimitVALUE = response.observe.VALUE
+      // 是否开启会员升级功能
+      this.value1 = response.isOpenUpgrade.VALUE == 0 ? false : true
+      this.value1Text = response.isOpenUpgrade.TITLE
     })
   },
   data () {
     return {
+      value1:true,
+      value1Text: '',
       submitButtonStat: false,
       form:{
         monthLimitTITLE:'',
@@ -114,6 +125,24 @@ export default {
     }
   },
   methods: {
+    // 切换开关
+    switchUpgrade() {
+      network.postData('config/open-upgrade', {
+          isOpen: this.value1 === true ? 1 : 0, // 0关闭 1开启
+        }).then(response => {
+          this.$message({
+            message: response,
+            type: 'success'
+          })
+          this.submitButtonStat = false
+        
+        }).catch(response => {
+          this.submitButtonStat = false
+  
+      })
+      
+      console.log('sss',this.value1)
+    },
     onSubmit() {
         this.submitButtonStat = true
         network.postData('config/month-limit', {

+ 2 - 0
common/models/forms/DeclarationUpgradeForm.php

@@ -236,6 +236,8 @@ class DeclarationUpgradeForm extends Model
             $decOrderModel->CREATED_AT = Date::nowTime();
             $decOrderModel->UPGRADE_TYPE = $upgradeType;
             $decOrderModel->REMARK = $remark;
+            $decOrderModel->ORI_LV = $oriDecLv; // 变更前的级别
+            $decOrderModel->UPGRADE_LV = $this->decLv; // 变更后的级别
             if(!$decOrderModel->save()){
                 $transaction->rollBack();
                 throw new Exception(Form::formatErrorsForApi($decOrderModel->getErrors()));

+ 1 - 1
frontendApi/config/menu.php

@@ -48,7 +48,7 @@ return [
 //            ['name'=>'点位绑定列表', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'bind', 'routePath'=>'user/bind', 'show'=>1,],
 //            ['name'=>'点位绑定编辑', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'bind-edit', 'routePath'=>'user/bind-edit', 'show'=>0,],
             ['name'=>'重置密码', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'password', 'routePath'=>'user/password', 'show'=>1],
-            //['name'=>'升级管理', 'class'=>'', 'icon'=>'', 'controller'=>'upgrade', 'action'=>'dec', 'routePath'=>'user/upgrade', 'show'=>1,'allow'=>'declarer',],
+            ['name'=>'升级管理', 'class'=>'', 'icon'=>'', 'controller'=>'upgrade', 'action'=>'dec', 'routePath'=>'user/upgrade', 'show'=>1,'allow'=>'declarer',],
             ['name'=>'报单管理', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'dec', 'routePath'=>'user/dec', 'show'=>1,'allow'=>'declarer',],
         ]
     ],

+ 16 - 2
frontendApi/modules/v1/controllers/UserController.php

@@ -206,7 +206,14 @@ class UserController extends BaseController {
 
     // 会员升级,通过会员的编号,获取会员信息
     public function actionUpgradeInfo() {
-        return static::notice('功能暂未开放',400);
+        $isSwitchUpgrade = Config::find()
+        ->where("CONFIG_NAME='isOpenUpgrade'")
+        ->asArray()
+        ->one();
+        $isOpen = !empty($isSwitchUpgrade) && isset($isSwitchUpgrade['VALUE']) ? $isSwitchUpgrade['VALUE'] : 0;
+        if ($isOpen < 1) {
+            return static::notice('功能暂未开放',400);
+        }
         $userNumber = \Yii::$app->request->request('userName');
         $baseInfo = Info::baseInfoZhByUserName($userNumber);
         if ($baseInfo['STATUS'] != 1) {
@@ -273,7 +280,14 @@ class UserController extends BaseController {
 
     // 会员升级管理
     public function actionUpgrade() {
-        return static::notice('功能暂未开放',400);
+        $isSwitchUpgrade = Config::find()
+        ->where("CONFIG_NAME='isOpenUpgrade'")
+        ->asArray()
+        ->one();
+        $isOpen = !empty($isSwitchUpgrade) && isset($isSwitchUpgrade['VALUE']) ? $isSwitchUpgrade['VALUE'] : 0;
+        if ($isOpen < 1) {
+            return static::notice('功能暂未开放',400);
+        }
         if (\Yii::$app->request->isPost) {
             // 开始升级
             $formModel = new DeclarationUpgradeForm();