Model_logic_zhlp.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <?php
  2. /**
  3. * 此类就是为了针对erp的料品组合,以后都用这个类进行组合排序 将来后边需要转化erp的sku相关信息的时候 都调用这个类 到时间方便统一管理
  4. * 前边已有的代码都不动了 稳定压倒一切!!!
  5. * 目前erp有两种排序的方案 1 按照名称排序 2 按照规格的classid
  6. * 此类仅用于排序 后续的u9编写等 请到logic_u9tools中找对应的方法
  7. * 其实如果真要搞成erp的那种插入长度排序的话 就记住 长度跟在等级后边
  8. */
  9. class Model_logic_zhlp extends Lin_Model {
  10. function __construct(){
  11. parent::__construct();
  12. }
  13. public function sortByName($arr){
  14. return $this->doAction(1,$arr);
  15. }
  16. public function sortByClass($arr){
  17. return $this->doAction(2,$arr);
  18. }
  19. //只有id 然后转化为字段名 + 值
  20. public function sortByColume($arr){
  21. return $this->doAction(3,$arr);
  22. }
  23. //根据已有的规格id 获取到对应主类id 转化为需要的规格序列
  24. public function transferSku($arr){
  25. $sku_list = $this->db->select('id,classid,classtitle,title')->from('typeclass')->where_in('id ',$arr)->get()->result_array();
  26. $ret_final_list = [];
  27. foreach ($sku_list as $k => $v){
  28. $ret_final_list[$v['classid']] = $v['id'];
  29. }
  30. return $ret_final_list;
  31. }
  32. //几种处理 排序的各种要求
  33. private function doAction($type,$arr){
  34. //1 除去真人发类型中的
  35. if($type == 1){
  36. if(isset($arr['hairtype']) && in_array($arr['hairtype'],[163,164,165,166])){
  37. $arr['hairtype'] = 0;
  38. }
  39. }elseif($type == 3){
  40. if(isset($arr[22]) && in_array($arr[22],[163,164,165,166])){
  41. $arr[22] = 0;
  42. }
  43. }else{
  44. if(isset($arr[22]) && in_array($arr[22],[163,164,165,166])){
  45. $arr[22] = 0;
  46. }
  47. }
  48. $ret_list = $this->chooseCate($type,$arr);
  49. if(empty($ret_list)){
  50. return [
  51. 'code'=>-1,
  52. "msg"=>'没有找到对应的料品分类,请通知技术设置',
  53. ];
  54. }
  55. $final_list = [];
  56. foreach ($ret_list as $k => $v){
  57. if(empty($v)){
  58. continue;
  59. }
  60. $final_list[$k] = $v;
  61. }
  62. return [
  63. 'code'=>1,
  64. "msg"=>'ok',
  65. 'data'=>$final_list
  66. ];
  67. }
  68. private function chooseCate($type,$arr){
  69. if($type == 1){
  70. $cate = $arr['category'];
  71. }elseif($type == 3){
  72. $cate = $arr[16];
  73. }else{
  74. $cate = $arr[16];
  75. }
  76. //发条
  77. if($cate == 126){
  78. return $this->fatiao($type,$arr);
  79. }
  80. //发块前头
  81. if($cate == 127){
  82. return $this->fakuai($type,$arr);
  83. }
  84. //头套
  85. if($cate == 128){
  86. return $this->toutao($type,$arr);
  87. }
  88. //Hair Extension - 接发
  89. if($cate == 130){
  90. return $this->jiefa($type,$arr);
  91. }
  92. //Gift - 礼物
  93. if($cate == 131){
  94. return $this->liwu($type,$arr);
  95. }
  96. //Accessories - 配件
  97. if($cate == 133){
  98. return $this->peijian($type,$arr);
  99. }
  100. //Synthetic Wig - 化纤头套
  101. if($cate == 1297){
  102. return $this->huaqiantoutao($type,$arr);
  103. }
  104. //Synthetic Hair - 化纤其它
  105. if($cate == 1702){
  106. return $this->huaqianqita($type,$arr);
  107. }
  108. return [];
  109. }
  110. /*******************$type 1 代表名称 2 代表classid**************************/
  111. //发条
  112. private function fatiao($type,$arr){
  113. if($type == 1){
  114. return [
  115. "category"=>empty($arr['category'])?0:$arr['category'],
  116. "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'],
  117. "grade"=>empty($arr['grade'])?0:$arr['grade'],
  118. "color"=>empty($arr['color'])?0:$arr['color'],
  119. "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
  120. "size"=>empty($arr['size'])?0:$arr['size'],
  121. ];
  122. }elseif($type == 3){
  123. return [
  124. "category"=>empty($arr[16])?0:$arr[16],//类目
  125. "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
  126. "grade"=>empty($arr[13])?0:$arr[13],//等 级
  127. "color"=>empty($arr[8])?0:$arr[8],//头发颜色
  128. "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
  129. "size"=>empty($arr[14])?0:$arr[14],//长 度
  130. ];
  131. }else{
  132. return [
  133. 16=>empty($arr[16])?0:$arr[16],//类目
  134. 22=>empty($arr[22])?0:$arr[22],//真人发类型
  135. 13=>empty($arr[13])?0:$arr[13],//等 级
  136. 8=>empty($arr[8])?0:$arr[8],//头发颜色
  137. 15=>empty($arr[15])?0:$arr[15],//曲 度
  138. 14=>empty($arr[14])?0:$arr[14],//长 度
  139. ];
  140. }
  141. }
  142. //发块
  143. private function fakuai($type,$arr){
  144. //类型27 如果是195 Lace Closure - 发块 则类似尺寸 需要对应25 如果是197 Lace Frontal - 蕾丝前头 需要对应26
  145. //都对应25 26 到时间过滤空
  146. if($type == 1){
  147. return [
  148. "category"=>empty($arr['category'])?0:$arr['category'],
  149. "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'],
  150. "grade"=>empty($arr['grade'])?0:$arr['grade'],
  151. "color"=>empty($arr['color'])?0:$arr['color'],
  152. "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
  153. "type"=>empty($arr['type'])?0:$arr['type'],
  154. "headroad"=>empty($arr['headroad'])?0:$arr['headroad'],
  155. "density"=>empty($arr['density'])?0:$arr['density'],
  156. 'lacesize'=>empty($arr['lacesize'])?0:$arr['lacesize'],
  157. 'lacecolor'=>empty($arr['lacecolor'])?0:$arr['lacecolor'],
  158. "lacetypes"=>empty($arr['lacetypes'])?0:$arr['lacetypes'],
  159. "size"=>empty($arr['size'])?0:$arr['size'],
  160. ];
  161. }elseif($type == 3){
  162. $lacesize = 0;
  163. if(!empty($arr[25])){
  164. $lacesize = $arr[25];
  165. }
  166. if(!empty($arr[26])){
  167. $lacesize = $arr[26];
  168. }
  169. return [
  170. "category"=>empty($arr[16])?0:$arr[16],//类目
  171. "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
  172. "grade"=>empty($arr[13])?0:$arr[13],//等 级
  173. "color"=>empty($arr[8])?0:$arr[8],//头发颜色
  174. "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
  175. "type"=>empty($arr[27])?0:$arr[27],//类 型
  176. "headroad"=>empty($arr[12])?0:$arr[12],//头路设计
  177. "density"=>empty($arr[10])?0:$arr[10],//密 度
  178. //到时间会去重处理
  179. 'lacesize'=> $lacesize,
  180. 'lacecolor'=>empty($arr[9])?0:$arr[9],//蕾丝颜色
  181. "lacetypes"=>empty($arr[44])?0:$arr[44],//蕾丝类型
  182. "size"=>empty($arr[14])?0:$arr[14],//长 度
  183. ];
  184. }else{
  185. return [
  186. 16=>empty($arr[16])?0:$arr[16],//类目
  187. 22=>empty($arr[22])?0:$arr[22],//真人发类型
  188. 13=>empty($arr[13])?0:$arr[13],//等 级
  189. 8=>empty($arr[8])?0:$arr[8],//头发颜色
  190. 15=>empty($arr[15])?0:$arr[15],//曲 度
  191. 27=>empty($arr[27])?0:$arr[27],//类 型
  192. 12=>empty($arr[12])?0:$arr[12],//头路设计
  193. 10=>empty($arr[10])?0:$arr[10],//密 度
  194. //到时间会去重处理
  195. 25=>empty($arr[25])?0:$arr[25],//蕾丝尺寸
  196. 26=>empty($arr[26])?0:$arr[26],//蕾丝尺寸
  197. 9=>empty($arr[9])?0:$arr[9],//蕾丝颜色
  198. 44=>empty($arr[44])?0:$arr[44],//蕾丝类型
  199. 14=>empty($arr[14])?0:$arr[14],//长 度
  200. ];
  201. }
  202. }
  203. //头套
  204. private function toutao($type,$arr){
  205. if($type == 1){
  206. return [
  207. "category"=>empty($arr['category'])?0:$arr['category'],
  208. "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'],
  209. "grade"=>empty($arr['grade'])?0:$arr['grade'],
  210. "hairnumber"=>empty($arr['hairnumber'])?0:$arr['hairnumber'],
  211. "color"=>empty($arr['color'])?0:$arr['color'],
  212. "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
  213. "lacetype"=>empty($arr['lacetype'])?0:$arr['lacetype'],
  214. "haircap"=>empty($arr['haircap'])?0:$arr['haircap'],
  215. "density"=>empty($arr['density'])?0:$arr['density'],
  216. "lacecolor"=>empty($arr['lacecolor'])?0:$arr['lacecolor'],
  217. "lacetypes"=>empty($arr['lacetypes'])?0:$arr['lacetypes'],
  218. "wigother"=>empty($arr['wigother'])?0:$arr['wigother'],
  219. "wigother1"=>empty($arr['wigother1'])?0:$arr['wigother1'],
  220. "wigother2"=>empty($arr['wigother2'])?0:$arr['wigother2'],
  221. "product_related"=>empty($arr['product_related'])?0:$arr['product_related'],
  222. "size"=>empty($arr['size'])?0:$arr['size'],
  223. ];
  224. }elseif($type == 3){
  225. return [
  226. "category"=>empty($arr[16])?0:$arr[16],//类目
  227. "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
  228. "grade"=>empty($arr[13])?0:$arr[13],//等 级
  229. "hairnumber"=>empty($arr[43])?0:$arr[43],//人发头套编号
  230. "color"=>empty($arr[8])?0:$arr[8],//头发颜色
  231. "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
  232. "lacetype"=>empty($arr[18])?0:$arr[18],//头套种类
  233. "haircap"=>empty($arr[6])?0:$arr[6],//发帽大小
  234. "density"=>empty($arr[10])?0:$arr[10],//密 度
  235. "lacecolor"=>empty($arr[9])?0:$arr[9],//蕾丝颜色
  236. "lacetypes"=>empty($arr[44])?0:$arr[44],//蕾丝类型
  237. "wigother"=>empty($arr[39])?0:$arr[39],//分缝及刘海
  238. "wigother1"=>empty($arr[50])?0:$arr[50],//头套其它1
  239. "wigother2"=>empty($arr[51])?0:$arr[51],//头套其它2
  240. "product_related"=>empty($arr[53])?0:$arr[53],//生产方式/配比
  241. "size"=>empty($arr[14])?0:$arr[14],//长 度
  242. ];
  243. }else{
  244. return [
  245. 16=>empty($arr[16])?0:$arr[16],//类目
  246. 22=>empty($arr[22])?0:$arr[22],//真人发类型
  247. 13=>empty($arr[13])?0:$arr[13],//等 级
  248. 43=>empty($arr[43])?0:$arr[43],//人发头套编号
  249. 8=>empty($arr[8])?0:$arr[8],//头发颜色
  250. 15=>empty($arr[15])?0:$arr[15],//曲 度
  251. 18=>empty($arr[18])?0:$arr[18],//头套种类
  252. 6=>empty($arr[6])?0:$arr[6],//发帽大小
  253. 10=>empty($arr[10])?0:$arr[10],//密 度
  254. 9=>empty($arr[9])?0:$arr[9],//蕾丝颜色
  255. 44=>empty($arr[44])?0:$arr[44],//蕾丝类型
  256. 39=>empty($arr[39])?0:$arr[39],//分缝及刘海
  257. 50=>empty($arr[50])?0:$arr[50],//头套其它1
  258. 51=>empty($arr[51])?0:$arr[51],//头套其它2
  259. 53=>empty($arr[53])?0:$arr[53],//生产方式/配比
  260. 14=>empty($arr[14])?0:$arr[14],//长 度
  261. ];
  262. }
  263. }
  264. //接发
  265. private function jiefa($type,$arr){
  266. if($type == 1){
  267. return [
  268. "category"=>empty($arr['category'])?0:$arr['category'],
  269. "hairtype"=>empty($arr['hairtype'])?0:$arr['hairtype'],
  270. "grade"=>empty($arr['grade'])?0:$arr['grade'],
  271. "extension"=>empty($arr['extension'])?0:$arr['extension'],
  272. "color"=>empty($arr['color'])?0:$arr['color'],
  273. "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
  274. "items"=>empty($arr['items'])?0:$arr['items'],
  275. "weight"=>empty($arr['weight'])?0:$arr['weight'],
  276. 'jfother'=>(empty($arr['jfother'])?0:$arr['jfother']),
  277. "size"=>empty($arr['size'])?0:$arr['size'],
  278. ];
  279. }elseif($type == 3){
  280. return [
  281. "category"=>empty($arr[16])?0:$arr[16],//类目
  282. "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
  283. "grade"=>empty($arr[13])?0:$arr[13],//等 级
  284. "extension"=>empty($arr[33])?0:$arr[33],//Extension类型
  285. "color"=>empty($arr[8])?0:$arr[8],//头发颜色
  286. "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
  287. "items"=>empty($arr[38])?0:$arr[38],//单片片数
  288. "weight"=>empty($arr[7])?0:$arr[7],//重量
  289. "jfother"=>(empty($arr[52])?0:$arr[52]),//接发其它
  290. "size"=>empty($arr[14])?0:$arr[14],//长 度
  291. ];
  292. }else{
  293. return [
  294. 16=>empty($arr[16])?0:$arr[16],//类目
  295. 22=>empty($arr[22])?0:$arr[22],//真人发类型
  296. 13=>empty($arr[13])?0:$arr[13],//等 级
  297. 33=>empty($arr[33])?0:$arr[33],//Extension类型
  298. 8=>empty($arr[8])?0:$arr[8],//头发颜色
  299. 15=>empty($arr[15])?0:$arr[15],//曲 度
  300. 38=>empty($arr[38])?0:$arr[38],//单片片数
  301. 7=>empty($arr[7])?0:$arr[7],//重量
  302. 52=>empty($arr[52])?0:$arr[52],//接发其它
  303. 14=>empty($arr[14])?0:$arr[14],//长 度
  304. ];
  305. }
  306. }
  307. //礼物
  308. private function liwu($type,$arr){
  309. if($type == 1){
  310. return [
  311. "category"=>empty($arr['category'])?0:$arr['category'],
  312. "gifttype"=>empty($arr['gifttype'])?0:$arr['gifttype'],
  313. "giftother"=>empty($arr['giftother'])?0:$arr['giftother'],
  314. ];
  315. }elseif($type == 3){
  316. return [
  317. "category"=>empty($arr[16])?0:$arr[16],//类目
  318. "gifttype"=>empty($arr[34])?0:$arr[34],//礼物类型
  319. "giftother"=>empty($arr[49])?0:$arr[49],//礼物其它
  320. ];
  321. }else{
  322. return [
  323. 16=>empty($arr[16])?0:$arr[16],//类目
  324. 34=>empty($arr[34])?0:$arr[34],//礼物类型
  325. 49=>empty($arr[49])?0:$arr[49],//礼物其它
  326. ];
  327. }
  328. }
  329. //配件
  330. private function peijian($type,$arr){
  331. if($type == 1){
  332. return [
  333. "category"=>empty($arr['category'])?0:$arr['category'],
  334. "grade"=>empty($arr['grade'])?0:$arr['grade'],
  335. "fittype"=>empty($arr['fittype'])?0:$arr['fittype'],
  336. "acother"=>empty($arr['acother'])?0:$arr['acother'],
  337. "color"=>empty($arr['color'])?0:$arr['color'],
  338. "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
  339. "items"=>empty($arr['items'])?0:$arr['items'],
  340. "weight"=>empty($arr['weight'])?0:$arr['weight'],
  341. 'size'=>empty($arr['size'])?0:$arr['size'],
  342. ];
  343. }elseif($type == 3){
  344. return [
  345. "category"=>empty($arr[16])?0:$arr[16],//类目
  346. "grade"=>empty($arr[13])?0:$arr[13],//等 级
  347. "fittype"=>empty($arr[35])?0:$arr[35],//配件类型
  348. "acother"=>empty($arr[45])?0:$arr[45],//配件其它
  349. "color"=>empty($arr[8])?0:$arr[8],//头发颜色
  350. "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
  351. "items"=>empty($arr[38])?0:$arr[38],//单片片数
  352. "weight"=>empty($arr[7])?0:$arr[7],//重量
  353. 'size'=>empty($arr[14])?0:$arr[14],//长 度
  354. ];
  355. }else{
  356. return [
  357. 16=>empty($arr[16])?0:$arr[16],//类目
  358. 13=>empty($arr[13])?0:$arr[13],//等 级
  359. 35=>empty($arr[35])?0:$arr[35],//配件类型
  360. 45=>empty($arr[45])?0:$arr[45],//配件其它
  361. 8=>empty($arr[8])?0:$arr[8],//头发颜色
  362. 15=>empty($arr[15])?0:$arr[15],//曲 度
  363. 38=>empty($arr[38])?0:$arr[38],//单片片数
  364. 7=>empty($arr[7])?0:$arr[7],//重量
  365. 14=>empty($arr[14])?0:$arr[14],//长 度
  366. ];
  367. }
  368. }
  369. //化纤头套
  370. private function huaqiantoutao($type,$arr){
  371. if($type == 1){
  372. return [
  373. "category"=>empty($arr['category'])?0:$arr['category'],
  374. "grade"=>empty($arr['grade'])?0:$arr['grade'],
  375. "sywignumber"=>empty($arr['sywignumber'])?0:$arr['sywignumber'],
  376. "color"=>empty($arr['color'])?0:$arr['color'],
  377. "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
  378. "synthetictype"=>empty($arr['synthetictype'])?0:$arr['synthetictype'],
  379. "sywigother"=>empty($arr['sywigother'])?0:$arr['sywigother'],
  380. "size"=>empty($arr['size'])?0:$arr['size'],
  381. ];
  382. }elseif($type == 3){
  383. return [
  384. "category"=>empty($arr[16])?0:$arr[16],//类目
  385. "grade"=>empty($arr[13])?0:$arr[13],//等 级
  386. "sywignumber"=>empty($arr[40])?0:$arr[40],//化纤头套编号
  387. "color"=>empty($arr[8])?0:$arr[8],//头发颜色
  388. "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
  389. "synthetictype"=>empty($arr[41])?0:$arr[41],//化纤头套类型
  390. "sywigother"=>empty($arr[42])?0:$arr[42],//化纤头套其它
  391. "size"=>empty($arr[14])?0:$arr[14],//长 度
  392. ];
  393. }else{
  394. return [
  395. 16=>empty($arr[16])?0:$arr[16],//类目
  396. 13=>empty($arr[13])?0:$arr[13],//等 级
  397. 40=>empty($arr[40])?0:$arr[40],//化纤头套编号
  398. 8=>empty($arr[8])?0:$arr[8],//头发颜色
  399. 15=>empty($arr[15])?0:$arr[15],//曲 度
  400. 41=>empty($arr[41])?0:$arr[41],//化纤头套类型
  401. 42=>empty($arr[42])?0:$arr[42],//化纤头套其它
  402. 14=>empty($arr[14])?0:$arr[14],//长 度
  403. ];
  404. }
  405. }
  406. //化纤其它
  407. private function huaqianqita($type,$arr){
  408. if($type == 1){
  409. return [
  410. "category"=>empty($arr['category'])?0:$arr['category'],
  411. "grade"=>empty($arr['grade'])?0:$arr['grade'],
  412. "sywignumber"=>empty($arr['sywignumber'])?0:$arr['sywignumber'],
  413. "syother"=>empty($arr['syother'])?0:$arr['syother'],
  414. "color"=>empty($arr['color'])?0:$arr['color'],
  415. "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
  416. "items"=>empty($arr['items'])?0:$arr['items'],
  417. "syother"=>empty($arr['syother'])?0:$arr['syother'],
  418. "size"=>empty($arr['size'])?0:$arr['size'],
  419. ];
  420. }elseif($type == 3){
  421. return [
  422. "category"=>empty($arr[16])?0:$arr[16],//类目
  423. "grade"=>empty($arr[13])?0:$arr[13],//等 级
  424. "sywignumber"=>empty($arr[47])?0:$arr[47],//化纤发编号
  425. "syother"=>empty($arr[46])?0:$arr[46],//化纤其它分类
  426. "color"=>empty($arr[8])?0:$arr[8],//头发颜色
  427. "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
  428. "items"=>empty($arr[38])?0:$arr[38],//单包片数
  429. "syother"=>empty($arr[48])?0:$arr[48],//化纤发其它
  430. "size"=>empty($arr[14])?0:$arr[14],//长 度
  431. ];
  432. }else{
  433. return [
  434. 16=>empty($arr[16])?0:$arr[16],//类目
  435. 13=>empty($arr[13])?0:$arr[13],//等 级
  436. 47=>empty($arr[47])?0:$arr[47],//化纤发编号
  437. 46=>empty($arr[46])?0:$arr[46],//化纤其它分类
  438. 8=>empty($arr[8])?0:$arr[8],//头发颜色
  439. 15=>empty($arr[15])?0:$arr[15],//曲 度
  440. 38=>empty($arr[38])?0:$arr[38],//单包片数
  441. 48=>empty($arr[48])?0:$arr[48],//化纤发其它
  442. 14=>empty($arr[14])?0:$arr[14],//长 度
  443. ];
  444. }
  445. }
  446. /**
  447. * 功能:将特征数组转换
  448. */
  449. public function featureTransferColumn($post,$classid){
  450. $list = [];
  451. $category = $post['category'];
  452. $list['category'] = $category;
  453. $list['hairtype'] = empty($post['hairtype'])?'':$post['hairtype'];
  454. $list['grade'] = empty($post['grade'])?'':$post['grade'];
  455. $list['size'] = empty($post['size'])?'':$post['size'];
  456. $list['hairnumber'] = empty($post['hairnumber'])?'':$post['hairnumber'];
  457. $list['extension'] = empty($post['extension'])?'':$post['extension'];
  458. if ($category == 1297) {
  459. $list['sywignumber'] = empty($post['sywignumber'])?'':$post['sywignumber'];
  460. }
  461. if ($category == 1702) {
  462. $list['syhairnumber'] = empty($post['syhairnumber'])?'':$post['syhairnumber'];
  463. $list['syother'] = empty($post['syother'])?'':$post['syother'];
  464. }
  465. if ($category == 133) {
  466. $list['fittype'] = empty($post['fittype'])?'':$post['fittype'];
  467. $list['acother'] = empty($post['acother'])?'':$post['acother'];
  468. }
  469. $list['color'] = empty($post['color'])?'':$post['color'];
  470. $list['lowe'] = empty($post['lowe'])?'':$post['lowe'];
  471. if ($category == 127) {
  472. $list['type'] = empty($post['type'])?'':$post['type'];
  473. $list['headroad'] = empty($post['headroad'])?'':$post['headroad'];
  474. $list['density'] =empty($post['density'])?'':$post['density'];
  475. if ($list['type'] == 195 || $list['type'] == 197 || $list['type'] == 199) {
  476. $list['lacesize'] = empty($post['lacesize'])?'':$post['lacesize'];
  477. }
  478. $list['lacecolor'] = empty($post['lacecolor'])?'':$post['lacecolor'];
  479. $list['lacetypes'] = empty($post['lacetypes'])?'':$post['lacetypes'];
  480. }
  481. if ($category == 128) {
  482. $list['lacetype'] =empty($post['lacetype'])?'':$post['lacetype'];
  483. $list['haircap'] = empty($post['haircap'])?'':$post['haircap'];
  484. $list['density'] = empty($post['density'])?'':$post['density'];
  485. $list['lacecolor'] = empty($post['lacecolor'])?'':$post['lacecolor'];
  486. $list['lacetypes'] = empty($post['lacetypes'])?'':$post['lacetypes'];
  487. $list['wigother'] = empty($post['wigother'])?'':$post['wigother'];
  488. $list['wigother1'] = empty($post['wigother1'])?'':$post['wigother1'];
  489. $list['wigother2'] = empty($post['wigother2'])?'':$post['wigother2'];
  490. $list['product_related'] = empty($post['product_related'])?'':$post['product_related'];
  491. }
  492. if ($category == 129) {
  493. $list['wide'] = empty($post['wide'])?'':$post['wide'];
  494. }
  495. if ($category == 131) {
  496. $list['gifttype'] = empty($post['gifttype'])?'':$post['gifttype'];
  497. $list['giftother'] = empty($post['giftother'])?'':$post['giftother'];
  498. }
  499. if ($category == 134) {
  500. $list['pieceweight'] = empty($post['pieceweight'])?'':$post['pieceweight'];
  501. }
  502. if ($category == 1297) {
  503. $list['synthetictype'] = empty($post['synthetictype'])?'':$post['synthetictype'];
  504. $list['sywigother'] = empty($post['sywigother'])?'':$post['sywigother'];
  505. }
  506. if ($category == 130 || $category == 133 || $category == 1702) {
  507. $list['items'] = empty($post['items'])?'':$post['items'];
  508. $list['weight'] = empty($post['weight'])?'':$post['weight'];
  509. }
  510. if ($category == 130 ) {
  511. $list['jfother'] = empty($post['jfother'])?'':$post['jfother'];
  512. }
  513. if ($category == 1702) {
  514. $list['syhairther'] = empty($post['syhairther'])?'':$post['syhairther'];
  515. }
  516. $pm = $scsku = $classid;
  517. $number = $features = $title = "";
  518. foreach ($list as $k => $v) {
  519. if ($v != 0) {
  520. $number .= $v;
  521. $features .= $v . '-';
  522. $typeclass = $this->typeclass->read($v);
  523. if (isset($pm[$typeclass['classid']])) {
  524. if (stripos($typeclass['zh'], '|') !== false) {
  525. $exzh = explode('|', $typeclass['zh']);
  526. $pm[$typeclass['classid']] = $exzh[0];
  527. } else {
  528. $pm[$typeclass['classid']] = $typeclass['zh'];
  529. }
  530. }
  531. $scsku[$typeclass['classid']] = $typeclass['bqsku'];
  532. if ($k != 'size') {
  533. $title .= $typeclass['title'] . " ";
  534. }
  535. }
  536. }
  537. $typeclass = $this->typeclass->read($list['size']);
  538. $title .= $typeclass['title'];
  539. $scsku = implode("-", $scsku);
  540. $pm = array_filter($pm);
  541. $zh = implode(" ", $pm);
  542. $scsku = str_replace('- ', '-', trim($scsku, '-'));
  543. $scsku = str_replace(array('--------', '-------', '------', '-----', '----', '---', '--'), '-', $scsku);
  544. $bqsku = $scsku;
  545. return [
  546. 'sku'=>$bqsku,
  547. 'title'=>$title,
  548. 'zh'=>$zh,
  549. ];
  550. }
  551. }