瀏覽代碼

开关会员权限提示

shish 3 月之前
父節點
當前提交
9accd0fa97
共有 1 個文件被更改,包括 12 次插入13 次删除
  1. 12 13
      app-hd/controllers/CustomController.php

+ 12 - 13
app-hd/controllers/CustomController.php

@@ -170,7 +170,7 @@ class CustomController extends BaseController
         util::complete('修改成功');
     }
 
-    //客户vip切换
+    //会员权限开关
     public function actionChangeVip()
     {
         $post = Yii::$app->request->post();
@@ -182,16 +182,15 @@ class CustomController extends BaseController
             util::fail('没有找到客户信息');
         }
         if ($custom->shopId != $this->shopId) {
-            util::fial('无权限修改');
+            util::fial('你不能操作');
         }
-        if (isset($this->shopAdmin->founder) == false || $this->shopAdmin->founder != 2) {
-            util::fail('管理员才能操作');
+        if (!isset($this->shopAdmin->founder) || $this->shopAdmin->founder != 2) {
+            util::fail('管才能操作');
         }
-
         $custom->vip = $vip;
         $custom->save();
-
-        util::complete('修改成功');
+        $hint = $vip == 1 ? '已开启' : '已关闭';
+        util::complete($hint);
     }
 
     //修改名称 ssh 2022096
@@ -279,7 +278,7 @@ class CustomController extends BaseController
             //已经删除的客户
             $sort = 'id ASC';
             $where['delStatus'] = 1;
-        }  else if ($type == 5) {
+        } else if ($type == 5) {
             //只显示VIP用户
             $sort = 'id ASC';
             $where['vip'] = 1;
@@ -310,8 +309,8 @@ class CustomController extends BaseController
         $list['balance'] = $all; //余额排行的总人数
         $list['buyAmount'] = $all; //消费排行的总人数
         $list['birth'] = CustomClass::getCount(array_merge(['shopId' => $this->shopId], ['birthdayTime>' => 0])); //有设置生日的总人数
-        $list['deleted']   = CustomClass::getCount(array_merge(['shopId' => $this->shopId], ['delStatus' => 1])); //被删除的总人数
-        $list['vip']   = CustomClass::getCount(array_merge(['shopId' => $this->shopId], ['vip' => 1])); //是vip的总人数
+        $list['deleted'] = CustomClass::getCount(array_merge(['shopId' => $this->shopId], ['delStatus' => 1])); //被删除的总人数
+        $list['vip'] = CustomClass::getCount(array_merge(['shopId' => $this->shopId], ['vip' => 1])); //是vip的总人数
 
         util::success($list);
     }
@@ -756,7 +755,7 @@ class CustomController extends BaseController
         // 1.重新统计客户的消费总额
         $orderList = OrderClass::getAllByCondition(['customId' => $customId], null, 'id, forward, actPrice');
 
-        $buyAmount= 0;
+        $buyAmount = 0;
         if (!empty($orderList)) {
             foreach ($orderList as $order) {
                 if ($order['forward'] == 0) { //0 常规订单
@@ -774,8 +773,8 @@ class CustomController extends BaseController
         $c->save();
 
         // 2.更新此客户所对应花店的消费金额 expendAmount ---- xhHd -> expendAmount
-        HdClass::updateById($c->hdId, ['expendAmount'=>$buyAmount]);
+        HdClass::updateById($c->hdId, ['expendAmount' => $buyAmount]);
 
-        util::success(['customId'=>$customId, 'buyAmount'=>$buyAmount]);
+        util::success(['customId' => $customId, 'buyAmount' => $buyAmount]);
     }
 }