Browse Source

金额不能超2位小数

shish 1 year ago
parent
commit
e1538e79d6
1 changed files with 7 additions and 0 deletions
  1. 7 0
      app-ghs/controllers/OrderController.php

+ 7 - 0
app-ghs/controllers/OrderController.php

@@ -897,6 +897,13 @@ class OrderController extends BaseController
             util::fail('请选择客户');
         }
 
+        $actPrice = $post['actPrice'] ?? 0;
+        $pattern = '/^\d+(\.\d{1,2})?$/';
+        if (preg_match($pattern, $actPrice) == false) {
+            //容错前端
+            util::fail('金额不能超2位小数');
+        }
+
         $custom = CustomClass::getCustom($customId);
         if (empty($custom)) {
             util::fail('请选客户哦');