Преглед изворни кода

修改erp选择dhl快递信息

lvhao пре 4 месеци
родитељ
комит
830047bdf7
2 измењених фајлова са 48 додато и 3 уклоњено
  1. 9 3
      core/CoreApp/controllers/Fullorder.php
  2. 39 0
      core/CoreApp/models/Model_logic_order.php

+ 9 - 3
core/CoreApp/controllers/Fullorder.php

@@ -48,6 +48,7 @@ class Fullorder extends Start_Controller {
 		$this->load->_model('Model_afspaypal','afspaypal');
 		$this->load->_model('Model_returngoods','returngoods');
 		$this->load->_model('Model_message','message');
+		$this->load->_model("Model_logic_order","logic_order");
 	}
 	//定义方法的调用规则 获取URI第二段值
     public function _remap($arg,$arg_array)
@@ -1021,10 +1022,15 @@ class Fullorder extends Start_Controller {
 			{
 				echo json_encode(array('msg'=>'此快递方式必须选择美国仓!','success'=>false));exit;
 			}
-			if($post['express'] == 42 && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 || 
-			{
-				echo json_encode(array('msg'=>'此快递方式必须选择Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
+			//减少代码复用吧
+			$lo_ret = $this->logic_order->checkEditExpress($post);
+			if($lo_ret['code'] != 1){
+				echo json_encode(array('msg'=>$lo_ret['msg'],'success'=>false));exit;
 			}
+			// if($post['express'] == 42 && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 || 
+			// {
+			// 	echo json_encode(array('msg'=>'此快递方式必须选择Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
+			// }
 			if($post['express'] == 24 && $post['sbpm'] != 'Hair Sample' && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 || 
 			{
 				echo json_encode(array('msg'=>'此快递方式必须选择Hair Sample/Human Hair Wigs/Human Hair Goods!','success'=>false));exit;

+ 39 - 0
core/CoreApp/models/Model_logic_order.php

@@ -148,5 +148,44 @@ class Model_logic_order extends Lin_Model {
             'pmen_list'=>$pmen_list,
         ];
     }
+ 
+    //根据提交信息 校验一下快递是够满足对应条件
+    public function checkEditExpress($post){
+        //1 dhl官方只允许提交6个申报名字
+        if($post['express'] == 1){
+            if(!in_array($post['sbpm'],[
+                'Human Hair Wigs',
+                'Human Hair Goods',
+                'Human Hair Weave',
+                'Synthetic Hair',
+                'Synthetic Hair Wigs',
+                'Synthetic Hair Goods',
+            ])){
+                //'此快递方式必须选择Human Hair Wigs/Human Hair Goods!'
+                return [
+                    'code'=>-1,
+                    "msg"=>"此快递方式必须选择Human Hair Wigs | Human Hair Goods | Human Hair Weave | Synthetic Hair | Synthetic Hair Wigs | Synthetic Hair Goods"
+                ];
+            }
 
+        }
+
+        // 42 dhl官方美国只允许提交3个申报名字
+        if($post['express'] == 42){
+            if(!in_array($post['sbpm'],[
+                'Human Hair Wigs',
+                'Human Hair Goods',
+                'Human Hair Weave',
+            ])){
+                return [
+                    'code'=>-1,
+                    "msg"=>"此快递方式必须选择Human Hair Wigs | Human Hair Goods | Human Hair Weave"
+                ];
+            }
+        }
+        return [
+            'code'=>1,
+            "msg"=>"ok"
+        ];
+    }
 }