|
@@ -330,6 +330,11 @@ class Model_logic_order extends Lin_Model {
|
|
|
if($res['code'] == -1){
|
|
|
return $res;
|
|
|
}
|
|
|
+ // 特殊规则要求
|
|
|
+ $res = $this->checkSpecialRule($post['fpdata']);
|
|
|
+ if($res['code'] == -1){
|
|
|
+ return $res;
|
|
|
+ }
|
|
|
return [
|
|
|
'code'=>1,
|
|
|
"msg"=>"ok"
|
|
@@ -513,6 +518,11 @@ class Model_logic_order extends Lin_Model {
|
|
|
if($res['code'] == -1){
|
|
|
return $res;
|
|
|
}
|
|
|
+ // 特殊规则要求
|
|
|
+ $res = $this->checkSpecialRule($post['fpdata']);
|
|
|
+ if($res['code'] == -1){
|
|
|
+ return $res;
|
|
|
+ }
|
|
|
return [
|
|
|
'code'=>1,
|
|
|
"msg"=>"ok"
|
|
@@ -671,6 +681,58 @@ class Model_logic_order extends Lin_Model {
|
|
|
}
|
|
|
return ['code'=>1,'msg'=>'ok'];
|
|
|
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 判断根据要求的特殊规则是否满足
|
|
|
+ */
|
|
|
+ public function checkSpecialRule($fpdata_str){
|
|
|
+ $fpdata = $this->transferFpdata($fpdata_str);
|
|
|
+ //规则1 曲度NAWavy 1153 和 颜色 #NAColor 2383 如果有前边两个 需要有人发头套编码 43
|
|
|
+ foreach($fpdata as $k=>$v){
|
|
|
+ if((strpos($v[0],"-1153")!= false) || (strpos($v[0],"-2383")!= false)){
|
|
|
+ $ids = explode('-',trim($v[0]));
|
|
|
+
|
|
|
+ $ids = array_filter($ids);
|
|
|
+ $ids_str = implode(',',$ids);
|
|
|
+ $tmp_list = $this->typeclass->find_all('id in ('.$ids_str.')');
|
|
|
+ $classid_arr = array_column($tmp_list,'classid');
|
|
|
+ if(!in_array(43,$classid_arr)){
|
|
|
+ return [
|
|
|
+ "code"=>-1,
|
|
|
+ "msg"=>"曲度NAWavy或颜色#NAColor必须要有人发头套编码"
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ return ["code"=>1,"msg"=>"ok"];
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function transferFpdata($fpdata_str){
|
|
|
+ $fpdata = explode(';',rtrim($fpdata_str,';'));
|
|
|
+ foreach ($fpdata as $k=>$v)
|
|
|
+ {
|
|
|
+ $xxv = explode('|',$v);
|
|
|
+ if(strpos($xxv[0],',') !== false){
|
|
|
+ $tmp_arr = explode(',',$xxv[0]);
|
|
|
+ $xxv[0] = $tmp_arr[1].$tmp_arr[0]."-";
|
|
|
+ }
|
|
|
+ $fpdata[$k] = $xxv;
|
|
|
+ }
|
|
|
+ return $fpdata;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取产品sku分组信息
|
|
|
+ */
|
|
|
+ public function getTypeClassArr(){
|
|
|
+ //and classid != 11 and classid != 16 and classid != 17 and classid != 20 and classid != 21 and classid != 23 and classid != 24 and classid != 29 and classid != 30 and classid != 31 and classid != 32 and classid != 36
|
|
|
+ $typeclass_list = $this->typeclass->find_all(' 1 = 1','id,classid');
|
|
|
+ $typeclass_arr = [];
|
|
|
+ foreach($typeclass_list as $k=>$v){
|
|
|
+ $typeclass_arr[$v['id']] = $v['classid'];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//订单审核编辑提交时 校验订单产品规格
|
|
|
/**
|