shish 5 mesiacov pred
rodič
commit
73f70594b3
1 zmenil súbory, kde vykonal 17 pridanie a 29 odobranie
  1. 17 29
      app-hd/controllers/CustomController.php

+ 17 - 29
app-hd/controllers/CustomController.php

@@ -75,6 +75,7 @@ class CustomController extends BaseController
                 $msg = $e->getMessage();
                 util::fail($msg);
             }
+            //阴历转阳历
             $month = $result['gregorian_month'] ?? 1;
             $date = $result['gregorian_day'] ?? 1;
             $birthday = date("Y") . '-' . $month . '-' . $date;
@@ -83,36 +84,23 @@ class CustomController extends BaseController
         }
         $birthdayTime = strtotime($birthday);
 
-        if ($user->birthdaySet == 0) {
-            //用户自己没有设置过生日,直接改
-            $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();
-        } else {
-            //用户设置过,按用户设置的生日来走
-            $lunar = $user->lunar;
-            $birthdayDate = $user->birthdayDate;
-            $birthdayMonth = $user->birthdayMonth;
-            $birthday = $user->birthday;
-            $birthdayTime = $user->birthdayTime;
-
-            $custom->lunar = $lunar;
-            $custom->birthdayDate = $birthdayDate;
-            $custom->birthdayMonth = $birthdayMonth;
-            $custom->birthday = $birthday;
-            $custom->birthdayTime = $birthdayTime;
-            $custom->save();
+        if ($user->birthdaySet == 1) {
+            util::fail('客户已填写,不能修改');
         }
+        //用户自己没有设置过生日,直接改
+        $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('修改成功');
     }