From 8bc764deee98556064e3376c32bea7a4736c871a Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Thu, 13 Jun 2024 21:54:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=95=86=E5=93=81=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/server/doudian/DouDianServer.php | 31 +++++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/app/common/server/doudian/DouDianServer.php b/app/common/server/doudian/DouDianServer.php index 395a6b3c..74239fb6 100644 --- a/app/common/server/doudian/DouDianServer.php +++ b/app/common/server/doudian/DouDianServer.php @@ -66,8 +66,8 @@ class DouDianServer public function productAdd($goods_id = 0) { // $this->getShopCategory(); - $this->getCateProperty(); -// die; +// $this->getCateProperty(); + $goods = GoodsLogic::info($goods_id); $request = new \ProductAddV2Request(); $param = new \ProductAddV2Param(); @@ -85,7 +85,7 @@ class DouDianServer $param->category_leaf_id = 20267; // 商品名称 - $param->name = $goods['base']['name']; + $param->name = $goods['base']['name'] . 'pangge'; dump($param->name); // 商家推荐语 @@ -122,7 +122,18 @@ class DouDianServer // 客服号码 $param->mobile = "400123456"; $param->commit = true; #false仅保存草稿,true保存+提审 - $param->product_format_new = "{\"1687\":[{\"diy_type\":1,\"name\":\"品牌\",\"value\":682910225}],\"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}]}"; + +// $product_format_new = array( +// 697 => [ +// 'diy_type' => 1, +// 'name' => '旅行箱捆绑带', +// 'value' => 27904 +// ] +// ); +// dump(json_encode($product_format_new, JSON_UNESCAPED_UNICODE)); +// die; + $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; #品牌 # $param->presell_config_level = 2 //$param->size_info_template_id = 7119681499770667267; #尺码模板id https://op.jinritemai.com/docs/guide-docs/242/2094 @@ -205,17 +216,17 @@ class DouDianServer /** * @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) { -// dump($v); // if ($v->name == $category) { // $param->cid = $v->id; // $response = $request->execute($this->access_token); @@ -235,7 +246,10 @@ class DouDianServer $request = new \ProductGetCatePropertyV2Request(); $param = new \ProductGetCatePropertyV2Param(); $request->setParam($param); + // 箱包 -> 箱包配件 $param->category_leaf_id = 20267; + // 女装 -> 半身裙 +// $param->category_leaf_id = 20219; $response = $request->execute($this->access_token); dump($response); } @@ -264,9 +278,8 @@ class DouDianServer $param->size_info_template_id = 7119681499770667267; #尺码模板id https://op.jinritemai.com/docs/guide-docs/242/2094 $param->spec_info = '{"spec_values":[{"property_name":"颜色分类","property_id":2752,"values":[{"value_name":"白色","value_id":35497}]},{"property_name":"尺码大小","property_id":4704,"values":[{"value_name":"M","value_id":0}]}]}'; $param->spec_prices_v2 ="[{\"sell_properties\":[{\"value_name\":\"白色\",\"property_name\":\"颜色分类\"},{\"value_name\":\"M\",\"property_name\":\"尺码大小\"}],\"stock_num\":11,\"price\":1,\"code\":\"这个就是抖店后台的sku商家编码\"}]"; -// $response = $request->execute($this->access_token); - dump($param->spec_info); - dump($param->spec_prices_v2); + $response = $request->execute($this->access_token); + dump($response); } /**