/**
  * 功能:上传并保存待刊登的料号
  */
 public function saveWaitProduct()
 {
     set_time_limit(0);
     //print_r($_REQUEST);
     if (empty($_REQUEST['account'])) {
         self::$errCode = '1507';
         self::$errMsg = '请填写需要刊登的账号...';
         return false;
     }
     $tags = explode(',', $_REQUEST['tags']);
     if (count($tags) < 10) {
         self::$errCode = '1508';
         self::$errMsg = '商品关键字的数据少于10个, 请重新输入!!!';
         return false;
     }
     $accountAbbr = C('ACCOUNTABBR')[$_REQUEST['account']];
     $spu = str_ireplace($accountAbbr, '', $_REQUEST['spu']);
     $spu = str_ireplace('#', '', $spu);
     $productInfo = self::getProductBySpu($spu, $_REQUEST['account']);
     if (!empty($productInfo)) {
         self::updateWaitData($spu, $_REQUEST['account']);
         //将上传状态更改已上传
         self::$errCode = '1509';
         self::$errMsg = '此料号已经刊登,请不要重复刊登!';
         return false;
     }
     $wishProductApi = new WishProductApi($_REQUEST['account'], 1);
     //$wishProductApi->setSandbox();		//设置从沙盒刊登
     $productAct = new WishProductAct();
     $extraImage = $productAct->imageReplace($_REQUEST['extra_images']);
     $spuImage = isset($_REQUEST['skuImg']) ? current($_REQUEST['skuImg']) : $_REQUEST['main_image'];
     $mainImage = $productAct->imageReplace($spuImage);
     $spuData = array('name' => $_REQUEST['title'], 'description' => $_REQUEST['description'], 'tags' => $_REQUEST['tags'], 'sku' => $_REQUEST['sku'][0], 'color' => $_REQUEST['color'][0], 'size' => $_REQUEST['size'][0], 'inventory' => $_REQUEST['inventory'][0], 'price' => $_REQUEST['price'][0], 'shipping' => $_REQUEST['shipping'][0], 'msrp' => $_REQUEST['msrp'][0], 'shipping_time' => $_REQUEST['shipping_time'][0], 'main_image' => end($mainImage), 'parent_sku' => count($_REQUEST['sku']) > 1 ? $_REQUEST['spu'] : $_REQUEST['sku'][0], 'extra_images' => implode('|', $extraImage));
     $skuData = array();
     if (count($_REQUEST['sku']) > 1) {
         foreach ($_REQUEST['sku'] as $skuKey => $skuVal) {
             if ($skuKey === 0) {
                 continue;
             }
             $mainImage = $productAct->imageReplace($_REQUEST['skuImg'][$skuKey]);
             $skuData[] = array('parent_sku' => $_REQUEST['spu'], 'sku' => $_REQUEST['sku'][$skuKey], 'color' => $_REQUEST['color'][$skuKey], 'size' => $_REQUEST['size'][$skuKey], 'inventory' => $_REQUEST['inventory'][$skuKey], 'price' => $_REQUEST['price'][$skuKey], 'shipping' => $_REQUEST['shipping'][$skuKey], 'msrp' => $_REQUEST['msrp'][$skuKey], 'shipping_time' => $_REQUEST['shipping_time'][$skuKey], 'main_image' => end($mainImage));
         }
     }
     //		print_r($spuData);
     //		print_r($skuData);exit;
     $spuStatus = $wishProductApi->createProductSpu($spuData);
     errorLog($_REQUEST['spu'] . ':' . json_encode($spuStatus), 'uploadStatus', 'uploadProduct');
     if (!empty($spuStatus)) {
         //上传成功,已经返回了数据
         self::updateWaitData($_REQUEST['spu'], $_REQUEST['account']);
     }
     if (!empty($skuData)) {
         foreach ($skuData as $skuKey => $skuVal) {
             $skuStatus = $wishProductApi->createProductSku($skuVal);
             errorLog($_REQUEST['spu'] . ':' . json_encode($skuStatus), 'uploadStatus', 'uploadProduct');
         }
     }
     return $spuStatus;
 }
 /**
  * 功能: 保存并刊登待刊登料号
  */
 public function act_saveWaitProduct()
 {
     set_time_limit(0);
     WishProductModel::$errCode = 0;
     $status = WishProductModel::saveWaitProduct();
     if (!$status) {
         self::$errCode = WishProductModel::$errCode;
         self::$errMsg = WishProductModel::$errMsg;
         return false;
     }
     return $status;
 }