From de65f46aa95f90ee1a3cb42fb8716a419ee08789 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sat, 15 Jun 2024 17:29:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=B1=B1=E8=8C=B6=E6=B2=B9?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/server/doudian/DouDianServer.php | 601 +++++++++++++++++++- app/shop/controller/goods/Goods.php | 12 +- 2 files changed, 582 insertions(+), 31 deletions(-) diff --git a/app/common/server/doudian/DouDianServer.php b/app/common/server/doudian/DouDianServer.php index 74239fb6..d0a3e9ed 100644 --- a/app/common/server/doudian/DouDianServer.php +++ b/app/common/server/doudian/DouDianServer.php @@ -11,7 +11,6 @@ namespace app\common\server\doudian; use app\common\model\goods\GoodsSpec; use app\shop\logic\goods\GoodsLogic; -use Nette\PhpGenerator\Dumper; use \think\facade\Cache; use DOMDocument; @@ -26,6 +25,14 @@ const ACCESS_TOKEN_CODE = 1; // ACCESS_TOKEN_SHOP_ID 自用型应用 const ACCESS_TOKEN_SHOP_ID = 2; +// 单规格 重量属性id +const ONE_SPEC_WEIGHT_TEXT = '重量'; +const ONE_SPEC_WEIGHT = 00001; + +// 单规格 体积属性id +const ONE_SPEC_SIZE_TEXT = '体积'; +const ONE_SPCE_SIZE = 00002; + class DouDianServer { private static $cacheName = 'doudian@access_token'; @@ -40,11 +47,15 @@ class DouDianServer private static $domain = ''; private $access_token = ''; + // 食品生产许可证编号 + private static $food_license = 'SC10243102300129'; + // 有机食品认证编号 + private static $organic_food_license = '115OP1900566'; + public function __construct() { // $domain = input('server.REQUEST_SCHEME') . '://' . input('server.SERVER_NAME'); self::$domain = 'https://dlh.hainings.com'; - \GlobalConfig::getGlobalConfig()->appKey = self::$appKey; \GlobalConfig::getGlobalConfig()->appSecret = self::$appSecret; if (Cache::get(self::$cacheName)) { @@ -55,7 +66,7 @@ class DouDianServer Cache::set(self::$cacheName, $result, 30 * 60); $this->access_token = $result; } else { - throw new \think\Exception('抖店token获取错误', $result->getCode()); + throw new \think\Exception($result->getSubMsg()); } } } @@ -67,26 +78,24 @@ class DouDianServer { // $this->getShopCategory(); // $this->getCateProperty(); - $goods = GoodsLogic::info($goods_id); $request = new \ProductAddV2Request(); $param = new \ProductAddV2Param(); $request->setParam($param); if (isset($goods['base']['code'])) { - // 商品编码 + // 自己的商品编码 $param->outer_product_id = $goods['base']['code']; } - // 0-普通,3-虚拟,6玉石闪购,7云闪购 + // 0-普通,3-虚拟 $param->product_type = $goods['base']['type'] == 0 ? 0 : 3; // 叶子类目ID通过/shop/getShopCategory接口获取 $param->category_leaf_id = 20267; // 商品名称 - $param->name = $goods['base']['name'] . 'pangge'; - dump($param->name); + $param->name = $goods['base']['name']; // 商家推荐语 if (isset($goods['recommend_remark'])) { @@ -123,15 +132,21 @@ class DouDianServer $param->mobile = "400123456"; $param->commit = true; #false仅保存草稿,true保存+提审 -// $product_format_new = array( -// 697 => [ -// 'diy_type' => 1, -// 'name' => '旅行箱捆绑带', -// 'value' => 27904 -// ] -// ); + $product_format_new = array( + 697 => [ + 'diy_type' => 1, + 'name' => '旅行箱捆绑带', + 'value' => 27904 + ] + ); // dump(json_encode($product_format_new, JSON_UNESCAPED_UNICODE)); // die; + /** + * 697 代表的属性中的 property_id + * diy_type 代表的是属性中的 diy_type + * name 代表的属性中的 name + * value 代表的属性中的 value + */ $param->product_format_new = "{\"697\":[{\"diy_type\":1,\"name\":\"旅行箱捆绑带\",\"value\":27904}]}"; // $param->product_format_new = "{\"241\":[{\"diy_type\":1,\"name\":\"常规款\",\"value\":17314}],\"631\":[{\"diy_type\":1,\"name\":\"东西南北风\",\"value\":0}],\"785\":[{\"measure_info\":{\"values\":[{\"module_id\":582,\"value\":\"亚麻\",\"unit_id\":0},{\"module_id\":583,\"unit_name\":\"%\",\"unit_id\":15,\"value\":\"100\"}],\"template_id\":252,\"value_name\":\"亚麻100%\"},\"diy_type\":1,\"name\":\"亚麻100%\",\"value\":0}],\"813\":[{\"diy_type\":1,\"name\":\"X型\",\"value\":8017}],\"981\":[{\"diy_type\":1,\"name\":\"蛋糕裙\",\"value\":22253}],\"1467\":[{\"diy_type\":0,\"name\":\"59%-69%(含)\",\"value\":168368}],\"1551\":[{\"diy_type\":1,\"name\":\"超短裙\",\"value\":22064}],\"1687\":[{\"diy_type\":0,\"name\":\"\",\"value\":0}],\"1878\":[{\"diy_type\":1,\"name\":\"高腰\",\"value\":16521}],\"2592\":[{\"diy_type\":1,\"name\":\"甜美风\",\"value\":192481}]}"; $param->standard_brand_id = 596120136; #品牌 @@ -165,8 +180,481 @@ class DouDianServer } $param->spec_prices_v2 = json_encode($spec_list, JSON_UNESCAPED_UNICODE); + $response = $request->execute($this->access_token); - dump($response); + + if ($response->code == 10000) { + dump($response); + } else { + dump($response->sub_msg); + throw new \think\Exception($response->sub_msg); + } + } + + /** + * @note 山茶油上传 + */ + public function camelliaProduct($goods_id = 0) + { + $goods = GoodsLogic::info($goods_id); + $request = new \ProductAddV2Request(); + $param = new \ProductAddV2Param(); + $request->setParam($param); + + if (isset($goods['base']['code'])) { + // 自己的后台商品编码 + $param->outer_product_id = $goods['base']['code'] + 2; + } + + $param->name = $goods['base']['name']; + + // 0-普通,3-虚拟 + $param->product_type = $goods['base']['type'] == 0 ? 0 : 3; + + // 叶子类目ID通过/shop/getShopCategory接口获取 + $param->category_leaf_id = 28227; + + // 获取商品发布规则 + // $rule = $this->getProductRule($param->category_leaf_id); + + // 商品轮播图 + $param->pic = implode('|', $this->batchUploadImage($goods['base']['goods_image'])); +// $param->pic = 'https://p3-aio.ecombdimg.com/obj/ecom-shop-material/ALSUvYM_m_4aedee0c4d90d0488e6e8521a0555758_sx_107771_www800-800'; + + // 商品描述,目前只支持图片 + $doc = new DOMDocument(); + $doc->loadHTML($goods['base']['content']); + $images = $doc->getElementsByTagName('img'); + $src = array(); + foreach ($images as $k => $image) { + // src[$k]['uri'] = str_replace('http://admin.dlh.com', 'https://dlh.hainings.com', $image->getAttribute('src')); + $src[$k]['uri'] = str_replace('http://admin.dlh.com', 'https://dlh.hainings.com', 'https://dlh.hainings.com/uploads/images/20240528170003c16046671.jpg'); + $src[$k]['id'] = $goods_id . '_goods_detail_' . $k; + } + $param->description = implode('|', $this->batchUploadImage($src, true)); +// $param->description = 'https://p3-aio.ecombdimg.com/obj/ecom-shop-material/ALSUvYM_m_4aedee0c4d90d0488e6e8521a0555758_sx_107771_www800-800'; + + // 获取资质 + $param->quality_list = $this->getQualificationConfig($param->category_leaf_id); + + // 支付方式,0货到付款 1在线支付,2,货到付款+在线支付 + $param->pay_type = 1; + // 减库存类型:1-拍下减库存 2-付款减库存 + $param->reduce_type = 1; + // 运费模板id,传0表示包邮,通过/freightTemplate/list接口获取 + $param->freight_id = 0; + // 承诺发货时间,具体规则用/product/getProductUpdateRule获取 + $param->delivery_delay_day = 2; + // 发货模式,0-现货发货,1-预售发货,2-阶梯发货,默认0 + $param->presell_type = 0; + + $param->after_sale_service = "{\"supply_day_return_selector\":\"7-1\"}"; + // 客服号码 + $param->mobile = "400123456"; + $param->commit = true; #false仅保存草稿,true保存+提审 + + /* 这个是商品属性规格 对应的接口为 getCateProperty*/ + $product_format_new = array( + 2685 => [ + [ + 'diy_type' => 0, + 'name' => '永兴泰宇茶油有限公司', + 'value' => 0 + ] + ], + 4118 => [ + [ + 'diy_type' => 0, + 'name' => '常温', + 'value' => 37269 + ] + ], + 58 => [ + [ + 'diy_type' => 0, + 'name' => '是', + 'value' => 23964 + ] + ], + 1758 => [ + [ + 'diy_type' => 1, + 'name' => '包装', + 'value' => 8197 + ] + ], + 1880 => [ + [ + 'diy_type' => 0, + 'name' => '中国大陆', + 'value' => 13850 + ] + ], + 3999 => [ + [ + 'diy_type' => 0, + 'name' => self::$organic_food_license, + 'value' => 0 + ] + ], + 4031 => [ + [ + 'diy_type' => 0, + 'name' => self::$food_license, + 'value' => 0 + ] + ], + 2988 => [ + [ + 'diy_type' => 0, + 'name' => '18月', + 'value' => 0 + ] + ] + ); + $param->product_format_new = json_encode($product_format_new, JSON_UNESCAPED_UNICODE); + + // 统一规格 = 1; 多规格 = 2; + if ($goods['base']['spec_type'] == 1) { + // 在公司后台系统中有商品卖点,含有2L*2罐装(因为抖店后台有瓶数可以设置),先暂时将它添加为商品规格 + $goods_spec = ($goods['item'][0]['weight'] * 2) . '斤*1瓶'; + if ($goods['base']['remark']) { + $goods_spec = $goods['base']['remark']; + } + + $spec = [ + 'spec_values' =>[ + 0 => [ + 'property_name' => '规格', + 'property_id' => 0, + 'values' => [ + 0 => [ + 'value_name' => $goods_spec, + 'value_id' => 0 + ] + ] + ] + ] + ]; + + $spec_prices_v2 = [ + 0 => [ + 'sell_properties' => [ + 0 => [ + 'value_name' => $goods_spec, + 'property_name' => '规格' + ] + ], + 'stock_num' => $goods['item'][0]['stock'], + 'price' => floatval($goods['item'][0]['price']) * 100 + ] + ]; + } else if($goods['base']['spec_type'] == 2) { + + $spec_prices_v2 = []; + foreach ($goods['item'] as $k => $v) { + $spec_value_str = explode(',', $v['spec_value_str']); + // 如果产品规格向下面的规格值是多个的话 + foreach ($spec_value_str as $k2 => $v2) { + // 获取spec的名称 + $goods_spec_prices_v2 = ($v['weight'] * 2) . '斤*1瓶'; + if ($goods['base']['remark']) { + $goods_spec_prices_v2 = $goods['base']['remark']; + } + + // $res = GoodsSpec::where(['goods_id' => $goods_id]); + $spec_prices_v2[$k]['sell_properties'][0]['value_name'] = $goods_spec_prices_v2; + $spec_prices_v2[$k]['sell_properties'][0]['property_name'] = '规格'; // 先固定为口味分类(抖店后台设置了口味分类) + $spec_prices_v2[$k]['sell_properties'][1]['value_name'] = str_replace('茶油', ' ', $v2); + $spec_prices_v2[$k]['sell_properties'][1]['property_name'] = '口味分类'; // 先固定为口味分类(抖店后台设置了口味分类) + $spec_prices_v2[$k]['stock_num'] = $v['stock']; + $spec_prices_v2[$k]['price'] = floatval($v['price']); + } + } + + + $goods_spec = []; + foreach ($goods['spec'] as $v) { + foreach ($v['values'] as $k2 => $v2) { + dump($v2); + $goods_spec[$k2] = array( + 'value_name' => str_replace('茶油', ' ', $v2['value']), + 'value_id' => 0 + ); + } + } + // 现有的商品中没有规格这一个规格项,所以value_name使用上面的$goods_spec_prices_v2 + $spec = [ + 'spec_values' =>[ + 0 => [ + 'property_name' => '规格', + 'property_id' => 0, + 'values' => [ + 0 => [ + 'value_name' => $goods_spec_prices_v2, + 'value_id' => 0 + ] + ] + ], + 1 => [ + 'property_name' => '口味分类', + 'property_id' => 0, + 'values' => $goods_spec + ] + ] + ]; + +// $spec_prices_v2 = [ +// 0 => [ +// 'sell_properties' => [ +// 0 => [ +// 'value_name' => '2L*1瓶', +// 'property_name' => '规格' +// ], +// 1 => [ +// 'value_name' => '精炼', +// 'property_name' => '口味分类' +// ] +// ], +// 'stock_num' => 11, +// 'price' => 1 +// ], +// 1 => [ +// 'sell_properties' => [ +// 0 => [ +// 'value_name' => '2L*1瓶', +// 'property_name' => '规格' +// ], +// 1 => [ +// 'value_name' => '冷榨', +// 'property_name' => '口味分类' +// ] +// ], +// 'stock_num' => 111, +// 'price' => 1 +// ] +// ]; +// dump($spec_prices_v2); + } + $param->spec_info = json_encode($spec, JSON_UNESCAPED_UNICODE); + dump($param->spec_info); + $param->spec_prices_v2 = json_encode($spec_prices_v2, JSON_UNESCAPED_UNICODE); + dump($param->spec_prices_v2); + $param->standard_brand_id = 596120136; #品牌 + + $response = $request->execute($this->access_token); + + if ($response->code == 10000) { + dump($response); + } else { + dump($response); + die; + throw new \think\Exception($response->sub_msg); + } + } + + /** + * @note 上传的商品是统一规格的 + */ + public function productAddOne($goods_id) + { +// $this->getShopCategory(); +// $this->getCateProperty(); +// die; + $goods = GoodsLogic::info($goods_id); + $request = new \ProductAddV2Request(); + $param = new \ProductAddV2Param(); + $request->setParam($param); + + if (isset($goods['base']['code'])) { + // 商品编码 + $param->outer_product_id = $goods['base']['code'] . 20240614; + } + + $param->name = $goods['base']['name']; + + // 0-普通,3-虚拟,6玉石闪购,7云闪购 + $param->product_type = $goods['base']['type'] == 0 ? 0 : 3; + + // 叶子类目ID通过/shop/getShopCategory接口获取 + $param->category_leaf_id = 28227; + + // $rule = $this->getProductRule($param->category_leaf_id); + + // 商品轮播图 +// $param->pic = implode('|', $this->batchUploadImage($goods['base']['goods_image'])); + $param->pic = 'https://p3-aio.ecombdimg.com/obj/ecom-shop-material/ALSUvYM_m_4aedee0c4d90d0488e6e8521a0555758_sx_107771_www800-800'; + + // 商品描述,目前只支持图片 +// $doc = new DOMDocument(); +// $doc->loadHTML($goods['base']['content']); +// $images = $doc->getElementsByTagName('img'); +// $src = array(); +// foreach ($images as $k => $image) { +//// $src[$k]['uri'] = str_replace('http://admin.dlh.com', 'https://dlh.hainings.com', $image->getAttribute('src')); +// $src[$k]['uri'] = str_replace('http://admin.dlh.com', 'https://dlh.hainings.com', 'https://dlh.hainings.com/uploads/images/20240528170003c16046671.jpg'); +// $src[$k]['id'] = $goods_id . '_goods_detail_' . $k; +// } +// $param->description = implode('|', $this->batchUploadImage($src, true)); + $param->description = 'https://p3-aio.ecombdimg.com/obj/ecom-shop-material/ALSUvYM_m_4aedee0c4d90d0488e6e8521a0555758_sx_107771_www800-800'; + + $param->quality_list = $this->getQualificationConfig($param->category_leaf_id); + + // 支付方式,0货到付款 1在线支付,2,货到付款+在线支付 + $param->pay_type = 1; + // 减库存类型:1-拍下减库存 2-付款减库存 + $param->reduce_type = 1; + // 运费模板id,传0表示包邮,通过/freightTemplate/list接口获取 + $param->freight_id = 0; + // 承诺发货时间,具体规则用/product/getProductUpdateRule获取 + $param->delivery_delay_day = 2; + // 发货模式,0-现货发货,1-预售发货,2-阶梯发货,默认0 + $param->presell_type = 0; + $param->after_sale_service = "{\"supply_day_return_selector\":\"7-1\"}"; + // 客服号码 + $param->mobile = "400123456"; + $param->commit = true; #false仅保存草稿,true保存+提审 + + /* 这个是商品属性规格 对应的接口为 getCateProperty*/ + $product_format_new = array( + 2685 => [ + [ + 'diy_type' => 0, + 'name' => '永兴泰宇茶油有限公司', + 'value' => 0 + ] + ], + 4118 => [ + [ + 'diy_type' => 0, + 'name' => '常温', + 'value' => 37269 + ] + ], + 58 => [ + [ + 'diy_type' => 0, + 'name' => '是', + 'value' => 23964 + ] + ], + 1758 => [ + [ + 'diy_type' => 1, + 'name' => '包装', + 'value' => 8197 + ] + ], + 1880 => [ + [ + 'diy_type' => 0, + 'name' => '中国大陆', + 'value' => 13850 + ] + ], + 3999 => [ + [ + 'diy_type' => 0, + 'name' => self::$organic_food_license, + 'value' => 0 + ] + ], + 4031 => [ + [ + 'diy_type' => 0, + 'name' => self::$food_license, + 'value' => 0 + ] + ], + 2988 => [ + [ + 'diy_type' => 0, + 'name' => '18月', + 'value' => 0 + ] + ] + ); +// $param->product_format_new = "{\"697\":[{\"diy_type\":1,\"name\":\"旅行箱捆绑带\",\"value\":27904}]}"; + $param->product_format_new = json_encode($product_format_new, JSON_UNESCAPED_UNICODE); + + if ($goods['base']['spec_type'] == 1) { + // 如果商品是统一规格的话,则将重量和提交定义为规格 + $spec = [ + 'spec_values' =>[ + 0 => [ + 'property_name' => '规格', + 'property_id' => 0, + 'values' => [ + 0 => [ + 'value_name' => '2L*1瓶', + 'value_id' => 0 + ] + ] + ], + 1 => [ + 'property_name' => '口味分类', + 'property_id' => 0, + 'values' => [ + 0 => [ + 'value_name' => '精炼', + 'value_id' => 0 + ], + 1 => [ + 'value_name' => '冷榨', + 'value_id' => 0 + ], + ] + ] + ] + ]; + + $spec_prices_v2 = [ + 0 => [ + 'sell_properties' => [ + 0 => [ + 'value_name' => '2L*1瓶', + 'property_name' => '规格' + ], + 1 => [ + 'value_name' => '精炼', + 'property_name' => '口味分类' + ] + ], + 'stock_num' => 11, + 'price' => 1 + ], + 1 => [ + 'sell_properties' => [ + 0 => [ + 'value_name' => '2L*1瓶', + 'property_name' => '规格' + ], + 1 => [ + 'value_name' => '冷榨', + 'property_name' => '口味分类' + ] + ], + 'stock_num' => 111, + 'price' => 1 + ] + ]; + } + + $param->spec_info = json_encode($spec, JSON_UNESCAPED_UNICODE); + dump($param->spec_info); + $param->spec_prices_v2 = json_encode($spec_prices_v2, JSON_UNESCAPED_UNICODE); + dump($param->spec_prices_v2); + $param->standard_brand_id = 596120136; #品牌 + + $response = $request->execute($this->access_token); + + if ($response->code == 10000) { + dump($response); + } else { + dump($response); + die; + throw new \think\Exception($response->sub_msg); + } } /** @@ -203,38 +691,39 @@ class DouDianServer if ($response->code == 10000 && $response->data->material_info->audit_status == 3) { $upload_image[] = $response->data->material_info->byte_url; } else { - throw new \think\Exception('图片审核失败'); + throw new \think\Exception($response->sub_msg); } } } else { - throw new \think\Exception('图片上传失败'); + throw new \think\Exception($result->sub_msg); } return $upload_image; } /** - * @note 获取商品类目 + * @note 获取商品类目,需要循环调用该接口获取数据 */ - private function getShopCategory($category = '女装') + private function getShopCategory($category = '粮油米面/南北干货/调味品') { $request = new \ShopGetShopCategoryRequest(); $param = new \ShopGetShopCategoryParam(); $request->setParam($param); $param->cid = 0; $response = $request->execute($this->access_token); -// dump($response); if ($response->code == 10000) { // 暂时先测试箱包的类目,正常来说给到一个类目让用户选择 foreach ($response->data as $v) { -// if ($v->name == $category) { -// $param->cid = $v->id; -// $response = $request->execute($this->access_token); -// dump($response); -// } + if ($v->name == $category) { + $param->cid = $v->id; + $response = $request->execute($this->access_token); + $param->cid = 21666; + $response = $request->execute($this->access_token); + dump($response); + } } } else { - throw new \think\Exception('商品类目获取失败'); + throw new \think\Exception($response->sub_msg); } } @@ -247,11 +736,65 @@ class DouDianServer $param = new \ProductGetCatePropertyV2Param(); $request->setParam($param); // 箱包 -> 箱包配件 - $param->category_leaf_id = 20267; + // $param->category_leaf_id = 23206; // 女装 -> 半身裙 -// $param->category_leaf_id = 20219; + // $param->category_leaf_id = 20219; + // 28227 + // 粮油米面/南北干货/调味品 > 食用油/调味油 > 山茶油 + $param->category_leaf_id = 28227; + + $response = $request->execute($this->access_token); + if ($response->code == 10000) { + // 输出商品类目属性 + dump($response); + } else { + throw new \think\Exception($response->sub_msg); + } + } + + /** + * @note 获取商品发布规则 + */ + private function getProductRule($category_id) + { + $request = new \ProductGetProductUpdateRuleRequest(); + $param = new \ProductGetProductUpdateRuleParam(); + $request->setParam($param); + $param->category_id = $category_id; $response = $request->execute($this->access_token); dump($response); + die; + } + + /** + * @note 获取商品资质 + * 产品生产许可证和有机食品认证证书 + */ + private function getQualificationConfig($category_id = 0) + { + $request = new \ProductQualificationConfigRequest(); + $param = new \ProductQualificationConfigParam(); + $request->setParam($param); + $param->category_id = $category_id; + $response = $request->execute($this->access_token); + if ($response->code == 10000) { + $quality[0]['quality_key'] = $response->data->config_list[0]->key; + $quality[0]['quality_name'] = $response->data->config_list[0]->name; + $quality[0]['quality_attachments'] = array( + 'media_type' => 1, + 'url' => 'https://p3-aio.ecombdimg.com/obj/ecom-shop-material/IHXLRhYg_m_313829285416363f56963d5a561e1c2c_sx_289105_www1996-1408' + ); + + $quality[1]['quality_key'] = $response->data->config_list[1]->key; + $quality[1]['quality_name'] = $response->data->config_list[1]->name; + $quality[1]['quality_attachments'] = array( + 'media_type' => 1, + 'url' => 'https://p3-aio.ecombdimg.com/obj/ecom-shop-material/IHXLRhYg_m_9fb63d4f266d7eed01bb97833da1ab25_sx_363931_www1433-2000' + ); + return $quality; + } else { + throw new \think\Exception('资质证书获取失败'); + } } public function testProductAdd() diff --git a/app/shop/controller/goods/Goods.php b/app/shop/controller/goods/Goods.php index 6cef192e..df9d0a1a 100644 --- a/app/shop/controller/goods/Goods.php +++ b/app/shop/controller/goods/Goods.php @@ -44,6 +44,7 @@ use app\admin\logic\goods\CategoryLogic as MallCategoryLogic; use app\shop\logic\goods\CategoryLogic as ShopCategoryLogic; use app\common\server\doudian\DouDianServer; use DOMDocument; +use think\Exception; /** @@ -418,8 +419,15 @@ class Goods extends ShopBase // dump($spec); // dump($spec_list); // die; - $doudian = new DouDianServer(); - $doudian->productAdd(736); + try { + $doudian = new DouDianServer(); +// $result = $doudian->productAdd(736); +// $result = $doudian->productAddOne(13); +// $result = $doudian->camelliaProduct(13); + $result = $doudian->camelliaProduct(27); + } catch (Exception $e) { + return JsonServer::error($e->getMessage()); + } // $doudian->testProductAdd(); die; $result = GoodsLogic::exportData($this->shop_id);