Model_logic_zhlp.php 28 KB

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