lvhao hai 1 día
pai
achega
c38325315f
Modificáronse 1 ficheiros con 111 adicións e 0 borrados
  1. 111 0
      core/CoreApp/models/Model_logic_zhlp.php

+ 111 - 0
core/CoreApp/models/Model_logic_zhlp.php

@@ -453,4 +453,115 @@ class Model_logic_zhlp extends Lin_Model {
         }
 
     }
+    /**
+     * 功能:将特征数组转换
+     */
+    public function featureTransferColumn($post,$classid){
+        $list = [];
+		$category = $post['category'];
+		$list['category'] = $category;
+		$list['hairtype'] = empty($post['hairtype'])?'':$post['hairtype'];
+		$list['grade'] = empty($post['grade'])?'':$post['grade'];
+		$list['size'] = empty($post['size'])?'':$post['size'];
+		$list['hairnumber'] = empty($post['hairnumber'])?'':$post['hairnumber'];
+		$list['extension'] = empty($post['extension'])?'':$post['extension'];
+		if ($category == 1297) {
+			$list['sywignumber'] = empty($post['sywignumber'])?'':$post['sywignumber'];
+		}
+		if ($category == 1702) {
+			$list['syhairnumber'] = empty($post['syhairnumber'])?'':$post['syhairnumber'];
+			$list['syother'] = empty($post['syother'])?'':$post['syother'];
+		}
+		if ($category == 133) {
+			$list['fittype'] = empty($post['fittype'])?'':$post['fittype'];
+			$list['acother'] = empty($post['acother'])?'':$post['acother'];
+		}
+		$list['color'] = empty($post['color'])?'':$post['color'];
+		$list['lowe'] = empty($post['lowe'])?'':$post['lowe'];
+
+		if ($category == 127) {
+			$list['type'] = empty($post['type'])?'':$post['type'];
+			$list['headroad'] = empty($post['headroad'])?'':$post['headroad'];
+			$list['density'] =empty($post['density'])?'':$post['density'];
+			if ($list['type'] == 195 || $list['type'] == 197 || $list['type'] == 199) {
+				$list['lacesize'] = empty($post['lacesize'])?'':$post['lacesize'];
+			}
+			$list['lacecolor'] = empty($post['lacecolor'])?'':$post['lacecolor'];
+			$list['lacetypes'] = empty($post['lacetypes'])?'':$post['lacetypes'];
+		}
+		if ($category == 128) {
+			$list['lacetype'] =empty($post['lacetype'])?'':$post['lacetype'];
+			$list['haircap'] = empty($post['haircap'])?'':$post['haircap'];
+			$list['density'] = empty($post['density'])?'':$post['density'];
+			$list['lacecolor'] = empty($post['lacecolor'])?'':$post['lacecolor'];
+			$list['lacetypes'] = empty($post['lacetypes'])?'':$post['lacetypes'];
+			$list['wigother'] = empty($post['wigother'])?'':$post['wigother'];
+			$list['wigother1'] = empty($post['wigother1'])?'':$post['wigother1'];
+			$list['wigother2'] = empty($post['wigother2'])?'':$post['wigother2'];
+		}
+		if ($category == 129) {
+			$list['wide'] = empty($post['wide'])?'':$post['wide'];
+		}
+
+		if ($category == 131) {
+			$list['gifttype'] = empty($post['gifttype'])?'':$post['gifttype'];
+			$list['giftother'] = empty($post['giftother'])?'':$post['giftother'];
+		}
+
+		if ($category == 134) {
+			$list['pieceweight'] = empty($post['pieceweight'])?'':$post['pieceweight'];
+		}
+		if ($category == 1297) {
+			$list['synthetictype'] = empty($post['synthetictype'])?'':$post['synthetictype'];
+			$list['sywigother'] = empty($post['sywigother'])?'':$post['sywigother'];
+		}
+		if ($category == 130 || $category == 133 || $category == 1702) {
+			$list['items'] = empty($post['items'])?'':$post['items'];
+			$list['weight'] = empty($post['weight'])?'':$post['weight'];
+		}
+		if ($category == 130 ) {
+			$list['jfother'] = empty($post['jfother'])?'':$post['jfother'];
+		}
+		if ($category == 1702) {
+			$list['syhairther'] = empty($post['syhairther'])?'':$post['syhairther'];
+		}
+        $pm =  $scsku = $classid;
+
+        $number = $features = $title = "";
+		foreach ($list as $k => $v) {
+			if ($v != 0) {
+				$number .= $v;
+				$features .= $v . '-';
+				$typeclass = $this->typeclass->read($v);
+				if (isset($pm[$typeclass['classid']])) {
+					if (stripos($typeclass['zh'], '|') !== false) {
+						$exzh = explode('|', $typeclass['zh']);
+						$pm[$typeclass['classid']] = $exzh[0];
+					} else {
+						$pm[$typeclass['classid']] = $typeclass['zh'];
+					}
+				}
+				$scsku[$typeclass['classid']] = $typeclass['bqsku'];
+				if ($k != 'size') {
+					$title .= $typeclass['title'] . " ";
+				}
+			}
+		}
+		$typeclass = $this->typeclass->read($list['size']);
+		$title .= $typeclass['title'];
+
+		$scsku = implode("-", $scsku);
+        $pm = array_filter($pm);
+		$zh = implode(" ", $pm);
+		$scsku = str_replace('- ', '-', trim($scsku, '-'));
+		$scsku = str_replace(array('--------', '-------', '------', '-----', '----', '---', '--'), '-', $scsku);
+		$bqsku =  $scsku;
+		
+		
+        return [
+            'sku'=>$bqsku,
+            'title'=>$title,
+            'zh'=>$zh,
+        ];
+    }
 }