doAction(1,$arr); } public function sortByClass($arr){ return $this->doAction(2,$arr); } //根据已有的规格id 获取到对应主类id 转化为需要的规格序列 public function transferSku($arr){ $sku_list = $this->db->select('id,classid,classtitle,title')->from('typeclass')->where_in('id ',$arr)->get()->result_array(); $ret_final_list = []; foreach ($sku_list as $k => $v){ $ret_final_list[$v['classid']] = $v['id']; } return $ret_final_list; } //几种处理 排序的各种要求 private function doAction($type,$arr){ //1 除去真人发类型中的 if($type == 1){ if(isset($arr['hairtype']) && in_array($arr['hairtype'],[163,164,165,166])){ $arr['hairtype'] = 0; } }else{ if(isset($arr[22]) && in_array($arr[22],[163,164,165,166])){ $arr[22] = 0; } } $ret_list = $this->chooseCate($type,$arr); if(empty($ret_list)){ return [ 'code'=>-1, "msg"=>'没有找到对应的料品分类,请通知技术设置', ]; } $final_list = []; foreach ($ret_list as $k => $v){ if(empty($v)){ continue; } $final_list[$k] = $v; } return [ 'code'=>1, "msg"=>'ok', 'data'=>$final_list ]; } private function chooseCate($type,$arr){ if($type == 1){ $cate = $arr['category']; }else{ $cate = $arr[16]; } //发条 if($cate == 126){ return $this->fatiao($type,$arr); } //发块前头 if($cate == 127){ return $this->fakuai($type,$arr); } //头套 if($cate == 128){ return $this->toutao($type,$arr); } //Hair Extension - 接发 if($cate == 130){ return $this->jiefa($type,$arr); } //Gift - 礼物 if($cate == 131){ return $this->liwu($type,$arr); } //Accessories - 配件 if($cate == 133){ return $this->peijian($type,$arr); } //Synthetic Wig - 化纤头套 if($cate == 1297){ return $this->huaqiantoutao($type,$arr); } //Synthetic Hair - 化纤其它 if($cate == 1702){ return $this->huaqianqita($type,$arr); } return []; } /*******************$type 1 代表名称 2 代表classid**************************/ //发条 private function fatiao($type,$arr){ if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'], "grade"=>empty($arr['grade'])?0:$arr['grade'], "color"=>empty($arr['color'])?0:$arr['color'], "lowe"=>empty($arr['lowe'])?0:$arr['lowe'], "size"=>empty($arr['size'])?0:$arr['size'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 22=>empty($arr[22])?0:$arr[22],//真人发类型 13=>empty($arr[13])?0:$arr[13],//等 级 8=>empty($arr[8])?0:$arr[8],//头发颜色 15=>empty($arr[15])?0:$arr[15],//曲 度 14=>empty($arr[14])?0:$arr[14],//长 度 ]; } } //发块 private function fakuai($type,$arr){ //类型27 如果是195 Lace Closure - 发块 则类似尺寸 需要对应25 如果是197 Lace Frontal - 蕾丝前头 需要对应26 //都对应25 26 到时间过滤空 if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'], "grade"=>empty($arr['grade'])?0:$arr['grade'], "color"=>empty($arr['color'])?0:$arr['color'], "lowe"=>empty($arr['lowe'])?0:$arr['lowe'], "type"=>empty($arr['type'])?0:$arr['type'], "headroad"=>empty($arr['headroad'])?0:$arr['headroad'], "density"=>empty($arr['density'])?0:$arr['density'], 'lacesize'=>empty($arr['lacesize'])?0:$arr['lacesize'], 'lacecolor'=>empty($arr['lacecolor'])?0:$arr['lacecolor'], "lacetypes"=>empty($arr['lacetypes'])?0:$arr['lacetypes'], "size"=>empty($arr['size'])?0:$arr['size'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 22=>empty($arr[22])?0:$arr[22],//真人发类型 13=>empty($arr[13])?0:$arr[13],//等 级 8=>empty($arr[8])?0:$arr[8],//头发颜色 15=>empty($arr[15])?0:$arr[15],//曲 度 27=>empty($arr[27])?0:$arr[27],//类 型 12=>empty($arr[12])?0:$arr[12],//头路设计 10=>empty($arr[10])?0:$arr[10],//密 度 //到时间会去重处理 25=>empty($arr[25])?0:$arr[25],//蕾丝尺寸 26=>empty($arr[26])?0:$arr[26],//蕾丝尺寸 9=>empty($arr[9])?0:$arr[9],//蕾丝颜色 44=>empty($arr[44])?0:$arr[44],//蕾丝类型 14=>empty($arr[14])?0:$arr[14],//长 度 ]; } } //头套 private function toutao($type,$arr){ if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'], "grade"=>empty($arr['grade'])?0:$arr['grade'], "hairnumber"=>empty($arr['hairnumber'])?0:$arr['hairnumber'], "color"=>empty($arr['color'])?0:$arr['color'], "lowe"=>empty($arr['lowe'])?0:$arr['lowe'], "lacetype"=>empty($arr['lacetype'])?0:$arr['lacetype'], "haircap"=>empty($arr['haircap'])?0:$arr['haircap'], "density"=>empty($arr['density'])?0:$arr['density'], "lacecolor"=>empty($arr['lacecolor'])?0:$arr['lacecolor'], "lacetypes"=>empty($arr['lacetypes'])?0:$arr['lacetypes'], "wigother"=>empty($arr['wigother'])?0:$arr['wigother'], "wigother1"=>empty($arr['wigother1'])?0:$arr['wigother1'], "wigother2"=>empty($arr['wigother2'])?0:$arr['wigother2'], "size"=>empty($arr['size'])?0:$arr['size'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 22=>empty($arr[22])?0:$arr[22],//真人发类型 13=>empty($arr[13])?0:$arr[13],//等 级 43=>empty($arr[43])?0:$arr[43],//人发头套编号 8=>empty($arr[8])?0:$arr[8],//头发颜色 15=>empty($arr[15])?0:$arr[15],//曲 度 18=>empty($arr[18])?0:$arr[18],//头套种类 6=>empty($arr[6])?0:$arr[6],//发帽大小 10=>empty($arr[10])?0:$arr[10],//密 度 9=>empty($arr[9])?0:$arr[9],//蕾丝颜色 44=>empty($arr[44])?0:$arr[44],//蕾丝类型 39=>empty($arr[39])?0:$arr[39],//分缝及刘海 50=>empty($arr[50])?0:$arr[50],//头套其它1 51=>empty($arr[51])?0:$arr[51],//头套其它2 14=>empty($arr[14])?0:$arr[14],//长 度 ]; } } //接发 private function jiefa($type,$arr){ if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'], "grade"=>empty($arr['grade'])?0:$arr['grade'], "extension"=>empty($arr['extension'])?0:$arr['extension'], "color"=>empty($arr['color'])?0:$arr['color'], "lowe"=>empty($arr['lowe'])?0:$arr['lowe'], "items"=>empty($arr['items'])?0:$arr['items'], "weight"=>empty($arr['weight'])?0:$arr['weight'], "size"=>empty($arr['size'])?0:$arr['size'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 22=>empty($arr[22])?0:$arr[22],//真人发类型 13=>empty($arr[13])?0:$arr[13],//等 级 33=>empty($arr[33])?0:$arr[33],//Extension类型 8=>empty($arr[8])?0:$arr[8],//头发颜色 15=>empty($arr[15])?0:$arr[15],//曲 度 38=>empty($arr[38])?0:$arr[38],//单片片数 7=>empty($arr[7])?0:$arr[7],//重量 14=>empty($arr[14])?0:$arr[14],//长 度 ]; } } //礼物 private function liwu($type,$arr){ if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "gifttype"=>empty($arr['gifttype'])?0:$arr['gifttype'], "giftother"=>empty($arr['giftother'])?0:$arr['giftother'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 34=>empty($arr[34])?0:$arr[34],//礼物类型 49=>empty($arr[49])?0:$arr[49],//礼物其它 ]; } } //配件 private function peijian($type,$arr){ if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "grade"=>empty($arr['grade'])?0:$arr['grade'], "fittype"=>empty($arr['fittype'])?0:$arr['fittype'], "acother"=>empty($arr['acother'])?0:$arr['acother'], "color"=>empty($arr['color'])?0:$arr['color'], "lowe"=>empty($arr['lowe'])?0:$arr['lowe'], "items"=>empty($arr['items'])?0:$arr['items'], "weight"=>empty($arr['weight'])?0:$arr['weight'], 'size'=>empty($arr['size'])?0:$arr['size'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 13=>empty($arr[13])?0:$arr[13],//等 级 35=>empty($arr[35])?0:$arr[35],//配件类型 45=>empty($arr[45])?0:$arr[45],//配件其它 8=>empty($arr[8])?0:$arr[8],//头发颜色 15=>empty($arr[15])?0:$arr[15],//曲 度 38=>empty($arr[38])?0:$arr[38],//单片片数 7=>empty($arr[7])?0:$arr[7],//重量 14=>empty($arr[14])?0:$arr[14],//长 度 ]; } } //化纤头套 private function huaqiantoutao($type,$arr){ if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "grade"=>empty($arr['grade'])?0:$arr['grade'], "sywignumber"=>empty($arr['sywignumber'])?0:$arr['sywignumber'], "color"=>empty($arr['color'])?0:$arr['color'], "lowe"=>empty($arr['lowe'])?0:$arr['lowe'], "synthetictype"=>empty($arr['synthetictype'])?0:$arr['synthetictype'], "sywigother"=>empty($arr['sywigother'])?0:$arr['sywigother'], "size"=>empty($arr['size'])?0:$arr['size'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 13=>empty($arr[13])?0:$arr[13],//等 级 40=>empty($arr[40])?0:$arr[40],//化纤头套编号 8=>empty($arr[8])?0:$arr[8],//头发颜色 15=>empty($arr[15])?0:$arr[15],//曲 度 41=>empty($arr[41])?0:$arr[41],//化纤头套类型 42=>empty($arr[42])?0:$arr[42],//化纤头套其它 14=>empty($arr[14])?0:$arr[14],//长 度 ]; } } //化纤其它 private function huaqianqita($type,$arr){ if($type == 1){ return [ "category"=>empty($arr['category'])?0:$arr['category'], "grade"=>empty($arr['grade'])?0:$arr['grade'], "sywignumber"=>empty($arr['sywignumber'])?0:$arr['sywignumber'], "syother"=>empty($arr['syother'])?0:$arr['syother'], "color"=>empty($arr['color'])?0:$arr['color'], "lowe"=>empty($arr['lowe'])?0:$arr['lowe'], "items"=>empty($arr['items'])?0:$arr['items'], "syother"=>empty($arr['syother'])?0:$arr['syother'], "size"=>empty($arr['size'])?0:$arr['size'], ]; }else{ return [ 16=>empty($arr[16])?0:$arr[16],//类目 13=>empty($arr[13])?0:$arr[13],//等 级 47=>empty($arr[47])?0:$arr[47],//化纤发编号 46=>empty($arr[46])?0:$arr[46],//化纤其它分类 8=>empty($arr[8])?0:$arr[8],//头发颜色 15=>empty($arr[15])?0:$arr[15],//曲 度 38=>empty($arr[38])?0:$arr[38],//单包片数 48=>empty($arr[48])?0:$arr[48],//化纤发其它 14=>empty($arr[14])?0:$arr[14],//长 度 ]; } } }