### Initialize Vipshop SDK Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initialize the Vipshop SDK client. Note that the official SDK has a different usage pattern compared to other platforms. This example demonstrates PID generation. ```php pidNameList = $pidNameList2; $pidGenRequest1->requestId = "requestId"; dd($service->genPidWithOauth($pidGenRequest1)); ``` -------------------------------- ### Initialize Pinduoduo SDK Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initialize the Pinduoduo SDK client and create a request to get product details. The `goodsIdList` parameter, containing a list of goods IDs, is necessary. ```php setGoodsIdList("[$itemid]"); return $pdd->execute($req); ``` -------------------------------- ### Install EasyTBK and Publish Configuration Source: https://context7.com/flutterbest/easytbk/llms.txt Install the EasyTBK package via Composer and publish its configuration file to your Laravel project. ```bash composer require niugengyun/easytbk php artisan vendor:publish --provider "NiuGengYun\EasyTBK\ServiceProvider" ``` -------------------------------- ### Install EasyTBK Package Source: https://github.com/flutterbest/easytbk/blob/master/README.md Install the EasyTBK package using Composer. This package is designed for Laravel applications. ```bash composer require niugengyun/easytbk ``` -------------------------------- ### Taobao Item Search Request Example Source: https://context7.com/flutterbest/easytbk/llms.txt Demonstrates how to use the EasyTBK factory to instantiate and execute a Taobao item search request. Ensure the correct platform is specified (e.g., 2 for mobile). ```php setQ('手机壳'); $req->setPageNo(1); $req->setPageSize(40); $req->setPlatform(2); // 2: 无线端 $result = $client->execute($req); ``` -------------------------------- ### Factory::taobao() - Taobao Alliance Client Source: https://context7.com/flutterbest/easytbk/llms.txt This section details how to obtain and use the Taobao Alliance client instance provided by EasyTBK. It covers obtaining the client, executing various Taobao API requests such as getting item information, performing material searches, generating promotion links, and querying orders. ```APIDOC ## Factory::taobao() ### Description Obtain the Taobao `Application` instance. This client automatically reads `app_key` and `app_secret` from the Laravel configuration file (`config/easytbk.php`). The gateway URL is `https://gw.api.taobao.com/router/rest`, and the signature method is MD5. ### Method `Factory::taobao()` ### Usage ```php use NiuGengYun\EasyTBK\Factory; use NiuGengYun\EasyTBK\TaoBao\request\TbkItemInfoGetRequest; use NiuGengYun\EasyTBK\TaoBao\request\TbkDgMaterialOptionalRequest; use NiuGengYun\EasyTBK\TaoBao\request\TbkPrivilegeGetRequest; use NiuGengYun\EasyTBK\TaoBao\request\TbkOrderGetRequest; // Get the Taobao client instance (reads credentials from config/easytbk.php) $client = Factory::taobao(); // ① Get item information by item ID (taobao.tbk.item.info.get) $req = new TbkItemInfoGetRequest(); $req->setNumIids('123456789,987654321'); // Comma-separated, max 40 items $req->setPlatform('2'); // 1: PC, 2: Wireless $result = $client->execute($req); // Example Response: stdClass { tbk_item_info_get_response: { result: { ... } } } var_dump($result); // ② Material Search (taobao.tbk.dg.material.optional) - Requires promotion space ID $req2 = new TbkDgMaterialOptionalRequest(); $req2->setAdzoneId('mm_12345_6789_0001'); // Required: mm_xxx_xxx_xxx third segment $req2->setQ('dress'); $req2->setPageNo(1); $req2->setPageSize(20); $req2->setHasCoupon('true'); // Only return items with coupons $req2->setIsTmall('true'); // Only Tmall items $req2->setStartTkRate(100); // Minimum commission rate, 100 = 1% $result2 = $client->execute($req2); // ③ Get High Commission Promotion Link (taobao.tbk.privilege.get) $req3 = new TbkPrivilegeGetRequest(); $req3->setItemId('123456789'); $req3->setAdzoneId('mm_12345_6789_0001'); $result3 = $client->execute($req3); // ④ Taobao Customer Order Query (taobao.tbk.order.get) $req4 = new TbkOrderGetRequest(); $req4->setStartTime('2024-01-01 00:00:00'); $req4->setEndTime('2024-01-01 23:59:59'); $req4->setPageNo(1); $req4->setPageSize(50); $result4 = $client->execute($req4); ``` ``` -------------------------------- ### Vipshop SDK Initialization and Usage Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initializes the Vipshop SDK client and demonstrates how to generate a PID with OAuth using PidGenRequest and UnionPidServiceClient. ```APIDOC ## Vipshop SDK Initialization ### Description Initializes the Vipshop SDK client and demonstrates how to generate a PID with OAuth using PidGenRequest and UnionPidServiceClient. Note that the Vipshop SDK usage differs slightly from other platforms. ### Method ```php use NiuGengYun\EasyTBK\Factory; use NiuGengYun\EasyTBK\Vip\Request\PidGenRequest; use NiuGengYun\EasyTBK\Vip\Request\UnionPidServiceClient; $service= UnionPidServiceClient::getService(); Factory::vip(); $pidGenRequest1 = new PidGenRequest(); $pidNameList2 = array(); $pidNameList2[0] = "value"; $pidGenRequest1->pidNameList = $pidNameList2; $pidGenRequest1->requestId = "requestId"; dd($service->genPidWithOauth($pidGenRequest1)); ``` ``` -------------------------------- ### Suning SDK Initialization and Usage Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initializes the Suning SDK client and demonstrates how to execute a CouponproductQueryRequest to query coupon products with pagination and position ID. ```APIDOC ## Suning SDK Initialization ### Description Initializes the Suning SDK client and demonstrates how to execute a CouponproductQueryRequest to query coupon products with pagination and position ID. ### Method ```php use NiuGengYun\EasyTBK\Factory; use NiuGengYun\EasyTBK\suning\Request\netalliance\CouponproductQueryRequest; $c = Factory::suning(); $req = new CouponproductQueryRequest(); $req->setPageNo("1"); $req->setPageSize("10"); $req->setPositionId("12"); $resp = $c->execute($req); dd($resp); ``` ``` -------------------------------- ### JD SDK Initialization and Usage Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initializes the JD SDK client and demonstrates how to execute a JdUnionGoodsPromotiongoodsinfoQueryRequest to query product information using SKU IDs. ```APIDOC ## JD SDK Initialization ### Description Initializes the JD SDK client and demonstrates how to execute a JdUnionGoodsPromotiongoodsinfoQueryRequest to query product information using SKU IDs. ### Method ```php use NiuGengYun\EasyTBK\Factory; use NiuGengYun\EasyTBK\jingdong\request\JdUnionGoodsPromotiongoodsinfoQueryRequest; $jd = Factory::jingdong(); $req = new JdUnionGoodsPromotiongoodsinfoQueryRequest(); $req->setSkuIds("$itemid"); return $jd->execute($req); ``` ``` -------------------------------- ### Publish Configuration and Run Migrations Source: https://github.com/flutterbest/easytbk/blob/master/README.md Publish the EasyTBK configuration file and run any necessary migrations. Remember to modify the config/easytbk.php file after publishing. ```bash php artisan vendor:publish --provider "NiuGengYun\EasyTBK\ServiceProvider" ``` -------------------------------- ### Initialize Suning Alliance SDK Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initialize the Suning Alliance SDK client and create a request for coupon product queries. Pagination parameters like `pageNo` and `pageSize`, along with `positionId`, are required. ```php setPageNo("1"); $req->setPageSize("10"); $req->setPositionId("12"); $resp = $c->execute($req); dd($resp); ``` -------------------------------- ### Initialize JD SDK Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initialize the JD SDK client and create a request to query product information using SKU IDs. The `skuIds` parameter is required for this query. ```php setSkuIds("$itemid"); return $jd->execute($req); ``` -------------------------------- ### Taobao SDK Initialization and Usage Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initializes the Taobao SDK client and demonstrates how to execute a TbkItemInfoGetRequest to retrieve item information. ```APIDOC ## Taobao SDK Initialization ### Description Initializes the Taobao SDK client and demonstrates how to execute a TbkItemInfoGetRequest to retrieve item information. ### Method ```php use NiuGengYun\EasyTBK\Factory; use NiuGengYun\EasyTBK\taobao\request\TbkItemInfoGetRequest; $client = Factory::taobao (); $req = new TbkItemInfoGetRequest(); $req->setNumIids ($numIids); return $client->execute ($req); ``` ``` -------------------------------- ### Initialize Taobao SDK Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initialize the Taobao SDK client and create a request for item information. Ensure you have the necessary `numIids` to fetch item details. ```php setNumIids ($numIids); return $client->execute ($req); ``` -------------------------------- ### Pinduoduo SDK Initialization and Usage Source: https://github.com/flutterbest/easytbk/blob/master/README.md Initializes the Pinduoduo SDK client and demonstrates how to execute a DdkGoodsDetailRequest to retrieve goods details using a list of goods IDs. ```APIDOC ## Pinduoduo SDK Initialization ### Description Initializes the Pinduoduo SDK client and demonstrates how to execute a DdkGoodsDetailRequest to retrieve goods details using a list of goods IDs. ### Method ```php use NiuGengYun\EasyTBK\Factory; use NiuGengYun\EasyTBK\pinduoduo\request\DdkGoodsDetailRequest; $pdd = Factory::pinduoduo(); $req = new DdkGoodsDetailRequest(); $req->setGoodsIdList("[$itemid]"); return $pdd->execute($req); ``` ``` -------------------------------- ### Configure E-commerce Platform API Keys Source: https://context7.com/flutterbest/easytbk/llms.txt Edit the published `config/easytbk.php` file to include your API keys and secrets for each supported e-commerce platform. ```php return [ 'taobao' => [ 'app_key' => env('TAOBAO_APP_KEY', ''), 'app_secret' => env('TAOBAO_APP_SECRET', ''), 'format' => 'json', // json 或 xml ], 'jingdong' => [ 'app_key' => env('JD_APP_KEY', ''), 'app_secret' => env('JD_APP_SECRET', ''), 'format' => 'json', ], 'pinduoduo' => [ 'client_id' => env('PDD_CLIENT_ID', ''), 'client_secret' => env('PDD_CLIENT_SECRET', ''), 'format' => 'JSON', ], 'vip' => [ 'app_key' => env('VIP_APP_KEY', ''), 'app_secret' => env('VIP_APP_SECRET', ''), 'access_token' => env('VIP_ACCESS_TOKEN', ''), ], 'suning' => [ 'app_key' => env('SUNING_APP_KEY', ''), 'app_secret' => env('SUNING_APP_SECRET', ''), 'format' => 'json', ], ]; ``` -------------------------------- ### Interact with Taobao Affiliate API Source: https://context7.com/flutterbest/easytbk/llms.txt Use the `Factory::taobao()` client to interact with the Taobao affiliate API. Ensure your API keys are configured in `config/easytbk.php`. ```php setNumIids('123456789,987654321'); // 逗号分隔,最多40个 $req->setPlatform('2'); // 1: PC, 2: 无线 $result = $client->execute($req); // 返回示例:stdClass { tbk_item_info_get_response: { result: { ... } } } var_dump($result); // ② 物料搜索(taobao.tbk.dg.material.optional)- 需要推广位ID $req2 = new TbkDgMaterialOptionalRequest(); $req2->setAdzoneId('mm_12345_6789_0001'); // 必填:mm_xxx_xxx_xxx 第三位 $req2->setQ('连衣裙'); $req2->setPageNo(1); $req2->setPageSize(20); $req2->setHasCoupon('true'); // 仅返回有优惠券商品 $req2->setIsTmall('true'); // 仅天猫商品 $req2->setStartTkRate(100); // 佣金比率下限,100 = 1% $result2 = $client->execute($req2); // ③ 获取高佣推广链接(taobao.tbk.privilege.get) $req3 = new TbkPrivilegeGetRequest(); $req3->setItemId('123456789'); $req3->setAdzoneId('mm_12345_6789_0001'); $result3 = $client->execute($req3); // ④ 淘宝客订单查询(taobao.tbk.order.get) $req4 = new TbkOrderGetRequest(); $req4->setStartTime('2024-01-01 00:00:00'); $req4->setEndTime('2024-01-01 23:59:59'); $req4->setPageNo(1); $req4->setPageSize(50); $result4 = $client->execute($req4); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.