load->_model('Model_weight','weight'); } /** * $type erp类目 如 126 127 128 */ public function getWeightByFeature($type,$features){ if(empty($type)){ return 0; } $sku = []; if($type == 126){ return 100; } //类目 蕾丝尺寸 长度 if($type == 127){ //发块 $flag = true; foreach($features as $v){ if($v['classid'] == 26){ $flag = false; } } if($flag){ //蕾丝尺寸1 $sku = ['16'=>127,'25'=>0,'14'=>0]; }else{ //蕾丝尺寸2 $sku = ['16'=>127,'26'=>0,'14'=>0]; } } //类目 头套类型 尺寸 密度 if($type == 128){ //头套类型 $sku = ['16'=>128,'18'=>0,'14'=>0,'10'=>0]; } //类目 尺寸 if($type == 130){ //接发类型 $sku = ['16'=>130,'33'=>0,'14'=>0]; } foreach($features as $k => $v){ if(isset($sku[$v['classid']])){ $sku[$v['classid']] = $v['id']; } } $sku_str = implode("-",$sku); $weight_info = $this->weight->get_features($sku_str); if(empty($weight_info)){ return 0; }else{ return $weight_info['weight']; } } }