shish 1 жил өмнө
parent
commit
e5f2f4be10

+ 11 - 5
app-hd/controllers/CustomController.php

@@ -76,17 +76,20 @@ class CustomController extends BaseController
         } else {
             $birthday = date("Y") . '-' . $birthdayMonth . '-' . $birthdayDate;
         }
+        $birthdayTime = strtotime($birthday);
 
         $custom->lunar = $lunar;
         $custom->birthdayDate = $birthdayDate;
         $custom->birthdayMonth = $birthdayMonth;
         $custom->birthday = $birthday;
+        $custom->birthdayTime = $birthdayTime;
         $custom->save();
 
         $user->lunar = $lunar;
         $user->birthdayDate = $birthdayDate;
         $user->birthdayMonth = $birthdayMonth;
         $user->birthday = $birthday;
+        $user->birthdayTime = $birthdayTime;
         $user->save();
         util::complete('修改成功');
     }
@@ -223,16 +226,19 @@ class CustomController extends BaseController
     public function actionList()
     {
         $get = Yii::$app->request->get();
-        $type = isset($get['type']) ? $get['type'] : 0;
-        $name = isset($get['name']) ? $get['name'] : '';
+        $type = $get['type'] ?? 0;
+        $name = $get['name'] ?? '';
         $where = ['shopId' => $this->shopId];
         if ($type == 1) {
             //消费排行
             $sort = 'buyAmount DESC';
         } else if ($type == 2) {
-            //欠款客户
-            $where['isDebt'] = 1;
-            $sort = 'debtAmount DESC';
+            //余额客户
+            $sort = 'balance DESC';
+        } else if ($type == 3) {
+            //生日
+            $sort = 'birthdayTime ASC';
+            $where['birthdayTime>'] = 0;
         } else {
             $sort = 'visitTime DESC';
         }