Fix image upload structure for Miravia API compliance
🔧 Bug Fixes: - Fixed product image structure to match Miravia API requirements - Updated MiraviaProduct.php getData() method to wrap images in {"Image": [...]} format - Updated MiraviaCombination.php getData() method to wrap SKU images properly - Resolved error "[4224] The Main image of the product is required" 📋 Changes: - Modified getData() methods to transform flat image arrays to nested structure - Product images: images[] → Images: {"Image": [...]} - SKU images: images[] → Images: {"Image": [...]} - Maintains backward compatibility for empty image arrays 🎯 Impact: - Product uploads will now pass Miravia's image validation - Both product-level and SKU-level images properly formatted - Complies with official Miravia API documentation structure 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
/**
|
||||
* 获取卖家地址信息
|
||||
* Created by Sweeper PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/18 16:46
|
||||
* @Package \Sweeper\PlatformMiddleware\Services\Aliexpress\Address
|
||||
*/
|
||||
class Address extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取卖家地址
|
||||
* 目录:API文档/AE-物流/获取卖家地址
|
||||
* api: https://developers.aliexpress.com/doc.htm?docId=30133&docType=2
|
||||
* api: https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193531.0.0.13b33b53KFl1Q9#/api?cid=20892&path=aliexpress.logistics.redefining.getlogisticsselleraddresses&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/18 16:46
|
||||
* @param $accountInfo
|
||||
* @return false
|
||||
*/
|
||||
public function getAddressInfo($accountInfo): bool
|
||||
{
|
||||
return static::executeRequest($accountInfo, 'aliexpress.logistics.redefining.getlogisticsselleraddresses', [], 'seller_address_query', [], 'POST', function($client, $request) use ($accountInfo) {
|
||||
$request->addApiParam('seller_address_query', 'sender,pickup,refund');
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
class Attributes extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取用户运费模板列表信息
|
||||
* 目录:API文档/AE-商品/AE-运费/用户运费模板列表信息
|
||||
* api: https://developers.aliexpress.com/doc.htm?docId=30126&docType=2
|
||||
* api: https://open.aliexpress.com/doc/api.htm#/api?cid=20900&path=aliexpress.freight.redefining.listfreighttemplate&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/18 17:42
|
||||
* @param $accountInfo
|
||||
* @return false
|
||||
*/
|
||||
public function getAttributesList($accountInfo): ?bool
|
||||
{
|
||||
return static::executeRequest($accountInfo, 'aliexpress.freight.redefining.listfreighttemplate');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopClient;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopRequest;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\UrlConstants;
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
class Category extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 类目预测,可以筛选卖家已经通过准入申请的类目
|
||||
* api: https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.postproduct.redefining.categoryforecast&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 14:41
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function categoryForecast(array $accountInfo, array $params = [])
|
||||
{
|
||||
$c = new IopClient(UrlConstants::API_GATEWAY_URL, $accountInfo['app_key'], $accountInfo['secret_key']);
|
||||
$request = new IopRequest('aliexpress.category.tree.list', 'GET');
|
||||
if (!empty($params['channel_seller_id'])) {
|
||||
$request->addApiParam('channel_seller_id', $params['channel_seller_id']);
|
||||
}
|
||||
if (!empty($params['only_with_permission'])) {
|
||||
$request->addApiParam('only_with_permission', $params['only_with_permission']);
|
||||
}
|
||||
if (!empty($params['channel'])) {
|
||||
$request->addApiParam('channel', $params['channel']);
|
||||
}
|
||||
if (!empty($params['category_id']) || $params['category_id'] === 0) {
|
||||
$request->addApiParam('category_id', $params['category_id']);
|
||||
}
|
||||
$rs = $c->execute($request, $accountInfo['access_token']);
|
||||
|
||||
return $rs->cainiao_global_handover_content_query_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据发布类目id、父属性路径(可选)获取子属性信息,只返回有权限品牌
|
||||
* api: https://open.aliexpress.com/doc/api.htm#/api?cid=20897&path=aliexpress.category.redefining.getchildattributesresultbypostcateidandpath&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 14:42
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return false|mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function getAttributesList(array $accountInfo, array $params = [])
|
||||
{
|
||||
$c = new IopClient(UrlConstants::API_GATEWAY_URL, $accountInfo['app_key'], $accountInfo['secret_key']);
|
||||
$request = new IopRequest('aliexpress.category.redefining.getchildattributesresultbypostcateidandpath', 'POST');
|
||||
if (!empty($params['channel_seller_id'])) {
|
||||
$request->addApiParam('channel_seller_id', $params['channel_seller_id']);
|
||||
}
|
||||
if (!empty($params['channel'])) {
|
||||
$request->addApiParam('channel', $params['channel']);
|
||||
}
|
||||
if (!empty($params['locale'])) {
|
||||
$request->addApiParam('locale', $params['locale']);
|
||||
}
|
||||
if (!empty($params['param1'])) {
|
||||
$request->addApiParam('param1', $params['param1']);
|
||||
}
|
||||
if (!empty($params['param2'])) {
|
||||
$request->addApiParam('param2', $params['param2']);
|
||||
}
|
||||
|
||||
$rs = $c->execute($request, $accountInfo['access_token']);
|
||||
|
||||
return $rs->cainiao_global_handover_content_query_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Sweeper
|
||||
* Time: 2022/12/29 15:06
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopClient;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopRequest;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\UrlConstants;
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
class Decrypt extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 买家订单物流详情解密
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 14:46
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.6dc86f3dwkNxPS#/api?cid=20905&path=aliexpress.trade.seller.order.decrypt&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param $orderId
|
||||
* @param $oaid
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function decrypt(array $accountInfo, $orderId, $oaid)
|
||||
{
|
||||
$client = new IopClient(UrlConstants::API_GATEWAY_URL, $accountInfo['app_key'], $accountInfo['secret_key']);
|
||||
$request = new IopRequest('aliexpress.trade.seller.order.decrypt');
|
||||
$request->addApiParam('orderId', $orderId);
|
||||
$request->addApiParam('oaid', $oaid);
|
||||
$response = $client->execute($request, $accountInfo['access_token']);
|
||||
|
||||
return $response->aliexpress_trade_seller_order_decrypt_response ?? $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Sweeper
|
||||
* Time: 2022/12/27 9:46
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopClient;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopRequest;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\UrlConstants;
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
/**
|
||||
* AE-评价
|
||||
* Created by Sweeper PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 14:49
|
||||
* @Package \Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi\Evaluation
|
||||
*/
|
||||
class Evaluation extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询待卖家评价的订单信息
|
||||
* User: Sweeper
|
||||
* Time: 2022/12/27 14:24
|
||||
* @doc https://developers.aliexpress.com/doc.htm?docId=30247&docType=2
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20896&path=aliexpress.appraise.redefining.querysellerevaluationorderlist&methodType=GET/POST
|
||||
* @param array $accountInfo 用户信息
|
||||
* @param array $params 参数数组
|
||||
* @return mixed
|
||||
*/
|
||||
public function querySellerEvaluationOrderList(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.appraise.redefining.querysellerevaluationorderlist', $params, 'query_d_t_o');
|
||||
|
||||
return $response->aliexpress_appraise_redefining_querysellerevaluationorderlist_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 卖家对未评价的订单进行评价
|
||||
* User: Sweeper
|
||||
* Time: 2022/12/27 14:24
|
||||
* @doc https://developers.aliexpress.com/doc.htm?docId=30250&docType=2
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20896&path=aliexpress.appraise.redefining.savesellerfeedback&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function saveSellerFeedback(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.appraise.redefining.savesellerfeedback', $params, 'param1');
|
||||
|
||||
return $response->aliexpress_appraise_redefining_savesellerfeedback_response ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单已生效的评价信息
|
||||
* @doc https://developers.aliexpress.com/doc.htm?docId=35927&docType=2
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20896&path=aliexpress.evaluation.listorderevaluation.get&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @author linzj
|
||||
* @date 2023-01-12 14:10
|
||||
*/
|
||||
public function getListOrderEvaluation(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.evaluation.listorderevaluation.get', $params, 'trade_evaluation_request');
|
||||
|
||||
return $response->aliexpress_evaluation_listorderevaluation_get_response->target_list ?? $response->target_list ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复评价
|
||||
* @doc https://developers.aliexpress.com/doc.htm?docId=35905&docType=2
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20896&path=aliexpress.evaluation.evaluation.reply&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @author linzj
|
||||
* @date 2023-01-12 14:27
|
||||
*/
|
||||
public function replyEvaluation(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.evaluation.evaluation.reply', [], '', [], 'POST', function($client, $request) use ($params, $accountInfo) {
|
||||
$request->addApiParam('child_order_id', $params['child_order_id']);
|
||||
$request->addApiParam('parent_order_id', $params['parent_order_id']);
|
||||
$request->addApiParam('text', $params['text']);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $response->aliexpress_evaluation_evaluation_reply_response->target ?? $response->target ?? $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 15:52
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\HelperPhp\Traits\RedisCache;
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
/**
|
||||
* OpenAPI 统一跨境商家工作台-商家相关接口
|
||||
* Created by Sweeper PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 14:56
|
||||
* @Package \Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi\GlobalSeller
|
||||
*/
|
||||
class GlobalSeller extends Base
|
||||
{
|
||||
|
||||
use RedisCache;
|
||||
|
||||
/** @var string 全托管店铺类型 */
|
||||
public const BUSINESS_TYPE_TRUSTEESHIP = 'ONE_STOP_SERVICE';
|
||||
|
||||
/** @var string 半托管店铺类型 */
|
||||
public const BUSINESS_TYPE_POP_CHOICE = 'POP_CHOICE';
|
||||
|
||||
/**
|
||||
* 获取商家账号列表
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 17:16
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21387&path=global.seller.relation.query&methodType=GET
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @response
|
||||
* //{
|
||||
* // "seller_relation_list": {// 渠道账号列表
|
||||
* // "seller_relation": [
|
||||
* // {
|
||||
* // "channel_currency": "USD", // 渠道商品币种
|
||||
* // "channel_shop_name": "DKSHETOY Official Store", // 渠道店铺名称
|
||||
* // "business_type": "POP_CHOICE", // 业务类型: ONE_STOP_SERVICE : 全托管店铺; POP_CHOICE:POP与半托管店铺
|
||||
* // "channel_seller_id": 223525827, // 渠道sellerId
|
||||
* // "channel": "AE_GLOBAL", // 渠道标识
|
||||
* // "seller_id": 223525827, // 全球sellerId
|
||||
* // },
|
||||
* // ]
|
||||
* // },
|
||||
* // "global_currency": "USD", // 全球商品币种
|
||||
* // "success": true,// 成功失败
|
||||
* // "request_id": "2102e2b216953763075105129"
|
||||
* //}
|
||||
*/
|
||||
public function relationQuery(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'global.seller.relation.query', $params, 'param', [], 'GET');
|
||||
|
||||
return $response->global_seller_relation_query_response->seller_relation_list ?? $response->seller_relation_list ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过缓存获取 - 商家账号列表
|
||||
* User: Sweeper
|
||||
* Time: 2023/7/19 9:52
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @param bool $refresh
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getSellerRelationListByCache(array $accountInfo, array $params = [], $refresh = false)
|
||||
{
|
||||
$unique = md5(json_encode($accountInfo));
|
||||
$cacheKey = "middleware_cache:aliexpress:seller_relation_list:{$unique}";
|
||||
|
||||
[$cacheData, $errors] = $this->getCacheData($cacheKey, function($accountInfo, $params) {
|
||||
$result = $this->relationQuery($accountInfo, $params);
|
||||
$sellerRelationList = json_decode(json_encode($result), true);
|
||||
$errorResponse = $sellerRelationList['error_response'] ?? [];
|
||||
if ($errorResponse && isset($errorResponse['msg'])) {
|
||||
throw new \LogicException($errorResponse['msg']);
|
||||
}
|
||||
|
||||
return $sellerRelationList['seller_relation_list']['seller_relation'] ?? $sellerRelationList['seller_relation'] ?? [];
|
||||
}, 86400, $refresh, $accountInfo, $params);
|
||||
|
||||
return $cacheData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全球卖家信息
|
||||
* User: Sweeper
|
||||
* Time: 2023/7/7 16:45
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @param string $key 要获取的 key
|
||||
* @param string $channel 指定渠道名称
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getGlobalSellerInfo(array $accountInfo, array $params = [], string $key = '', string $channel = 'ARISE_ES')
|
||||
{
|
||||
$sellerRelationList = $this->getSellerRelationListByCache($accountInfo, $params);
|
||||
$globalSellerInfo = current($sellerRelationList);
|
||||
foreach ($sellerRelationList as $sellerRelation) {
|
||||
// 跳过全托管店铺渠道
|
||||
if (!empty($sellerRelation['business_type']) && $sellerRelation['business_type'] === static::BUSINESS_TYPE_TRUSTEESHIP) {
|
||||
continue;
|
||||
}
|
||||
// 指定要使用的渠道
|
||||
if (!empty($channel)) {
|
||||
if ($sellerRelation['channel'] === $channel) {
|
||||
$globalSellerInfo = $sellerRelation;
|
||||
break;
|
||||
}
|
||||
continue;// 没匹配中继续下一轮匹配
|
||||
}
|
||||
$globalSellerInfo = $sellerRelation;
|
||||
break;
|
||||
}
|
||||
|
||||
return $key ? ($globalSellerInfo[$key] ?? $globalSellerInfo) : $globalSellerInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全球卖家信息
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/20 17:14
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @param string $businessType
|
||||
* @param string $channel
|
||||
* @param array $where
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGlobalSellerInfoByWhere(array $accountInfo, array $params = [], string $businessType = self::BUSINESS_TYPE_TRUSTEESHIP, string $channel = 'AE_GLOBAL', array $where = [])
|
||||
{
|
||||
$sellerRelationList = $this->getSellerRelationListByCache($accountInfo, $params);
|
||||
$globalSellerInfo = count($sellerRelationList) === 1 ? current($sellerRelationList) : [];
|
||||
foreach ($sellerRelationList as $sellerRelation) {
|
||||
// {
|
||||
// "channel_currency": "USD", // 渠道商品币种
|
||||
// "channel_shop_name": "DKSHETOY Official Store", // 渠道店铺名称
|
||||
// "business_type": "POP_CHOICE", // 业务类型: ONE_STOP_SERVICE : 全托管店铺; POP_CHOICE:POP与半托管店铺
|
||||
// "channel_seller_id": 223525827, // 渠道sellerId
|
||||
// "channel": "AE_GLOBAL", // 渠道标识
|
||||
// "seller_id": 223525827, // 全球sellerId
|
||||
// },
|
||||
// 指定要使用的业务类型: ONE_STOP_SERVICE : 全托管店铺; POP_CHOICE:POP与半托管店铺
|
||||
if (!empty($businessType) && (empty($sellerRelation['business_type']) || $sellerRelation['business_type'] !== $businessType)) {
|
||||
continue;// 没匹配中继续下一轮匹配
|
||||
}
|
||||
// 指定要使用的渠道标识
|
||||
if (!empty($channel) && (empty($sellerRelation['channel']) || $sellerRelation['channel'] !== $channel)) {
|
||||
continue;// 没匹配中继续下一轮匹配
|
||||
}
|
||||
foreach ($where as $key => $val) {
|
||||
if (!isset($sellerRelation[$key]) || $sellerRelation[$key] !== $val) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
$globalSellerInfo = $sellerRelation;
|
||||
}
|
||||
|
||||
return $globalSellerInfo ?: $sellerRelationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商家半托管基本信息查询
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/26 10:09
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21439&path=aliexpress.pop.choice.info.query&methodType=GET
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChoiceInfo(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.pop.choice.info.query', $params, 'param', [], 'GET');
|
||||
|
||||
return $response->aliexpress_pop_choice_info_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Sweeper
|
||||
* Time: 2022/12/27 9:46
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopClient;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopRequest;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\UrlConstants;
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
/**
|
||||
* OpenAPI 物流相关接口
|
||||
* Created by Sweeper PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 15:15
|
||||
* @Package \Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi\Logistics
|
||||
*/
|
||||
class Logistics extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 创建子交易单线上物流订单
|
||||
* User: Sweeper
|
||||
* Time: 2023/1/11 10:02
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20892&path=aliexpress.logistics.order.createorder&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function createOrder(array $accountInfo, array $params = [])
|
||||
{
|
||||
static::verifyParams(['trade_order_from', 'trade_order_id', 'declare_product_d_t_os', 'warehouse_carrier_service', 'address_d_t_os'], $params);
|
||||
$client = new IopClient(UrlConstants::API_GATEWAY_URL, $accountInfo['app_key'], $accountInfo['secret_key']);
|
||||
$request = new IopRequest('aliexpress.logistics.order.createorder');
|
||||
// 必填参数
|
||||
$request->addApiParam('trade_order_from', $params['trade_order_from']);
|
||||
$request->addApiParam('trade_order_id', $params['trade_order_id']);
|
||||
$request->addApiParam('declare_product_d_t_os', $params['declare_product_d_t_os']);
|
||||
$request->addApiParam('warehouse_carrier_service', $params['warehouse_carrier_service']);
|
||||
$request->addApiParam('address_d_t_os', $params['address_d_t_os']);
|
||||
// 条件非必填
|
||||
isset($params['domestic_logistics_company']) && $request->addApiParam('domestic_logistics_company', $params['domestic_logistics_company']);
|
||||
isset($params['domestic_logistics_company_id']) && $request->addApiParam('domestic_logistics_company_id', $params['domestic_logistics_company_id']);
|
||||
isset($params['domestic_tracking_no']) && $request->addApiParam('domestic_tracking_no', $params['domestic_tracking_no']);
|
||||
// 非必填参数
|
||||
isset($params['is_agree_upgrade_reverse_parcel_insure']) && $request->addApiParam('is_agree_upgrade_reverse_parcel_insure', $params['is_agree_upgrade_reverse_parcel_insure']);
|
||||
isset($params['oaid']) && $request->addApiParam('oaid', $params['oaid']);
|
||||
isset($params['pickup_type']) && $request->addApiParam('pickup_type', $params['pickup_type']);
|
||||
isset($params['package_num']) && $request->addApiParam('package_num', $params['package_num']);
|
||||
isset($params['undeliverable_decision']) && $request->addApiParam('undeliverable_decision', $params['undeliverable_decision']);
|
||||
isset($params['invoice_number']) && $request->addApiParam('invoice_number', $params['invoice_number']);
|
||||
isset($params['top_user_key']) && $request->addApiParam('top_user_key', $params['top_user_key']);
|
||||
isset($params['insurance_coverage']) && $request->addApiParam('insurance_coverage', $params['insurance_coverage']);
|
||||
|
||||
$response = $client->execute($request, $accountInfo['access_token']);
|
||||
|
||||
return $response->aliexpress_logistics_order_createorder_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物流订单信息(推荐)
|
||||
* 目录:API文档/AE物流/查询物流订单信息(推荐)
|
||||
* api: https://open.aliexpress.com/doc/api.htm#/api?cid=20892&path=aliexpress.logistics.querylogisticsorderdetail&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 16:01
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function getLogisticsOrderDetail(array $accountInfo, array $params = [])
|
||||
{
|
||||
// 参数验证和组装 交易订单号
|
||||
if (empty($params['trade_order_id'])) {
|
||||
throw new \InvalidArgumentException('参数trade_order_id必填且不能为空');
|
||||
}
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.logistics.querylogisticsorderdetail', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
$request->addApiParam('trade_order_id', $params['trade_order_id']);
|
||||
if (!empty($params['current_page'])) {
|
||||
$request->addApiParam('current_page', $params['current_page']);
|
||||
} //当前页
|
||||
if (!empty($params['domestic_logistics_num'])) {
|
||||
$request->addApiParam('domestic_logistics_num', $params['domestic_logistics_num']);
|
||||
} //国内运单号
|
||||
if (!empty($params['gmt_create_end_str'])) {
|
||||
$request->addApiParam('gmt_create_end_str', $params['gmt_create_end_str']);
|
||||
} //起始创建时间
|
||||
if (!empty($params['gmt_create_start_str'])) {
|
||||
$request->addApiParam('gmt_create_start_str', $params['gmt_create_start_str']);
|
||||
} //截止创建时间
|
||||
if (!empty($params['international_logistics_num'])) {
|
||||
$request->addApiParam('international_logistics_num', $params['international_logistics_num']);
|
||||
} //国际运单号
|
||||
if (!empty($params['logistics_status'])) {
|
||||
$request->addApiParam('logistics_status', $params['logistics_status']);
|
||||
} //订单状态
|
||||
if (!empty($params['page_size'])) {
|
||||
$request->addApiParam('page_size', $params['page_size']);
|
||||
} //页面大小
|
||||
if (!empty($params['warehouse_carrier_service'])) {
|
||||
$request->addApiParam('warehouse_carrier_service', $params['warehouse_carrier_service']);
|
||||
} //物流服务编码
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->aliexpress_logistics_querylogisticsorderdetail_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仓发物流订单信息
|
||||
* 目录:API文档/AE物流/查询仓发物流订单信息
|
||||
* api: https://open.aliexpress.com/doc/api.htm#/api?cid=20892&path=aliexpress.logistics.warehouse.querydetail&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return false || object
|
||||
*/
|
||||
public function getLogisticsWarehouseQueryDetail(array $accountInfo, array $params = [])
|
||||
{
|
||||
// 参数验证和组装 交易订单号
|
||||
if (empty($params['trade_order_id'])) {
|
||||
throw new \InvalidArgumentException('参数trade_order_id必填且不能为空');
|
||||
}
|
||||
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.logistics.warehouse.querydetail', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
$request->addApiParam('trade_order_id', $params['trade_order_id']);
|
||||
if (!empty($params['consign_type'])) {
|
||||
$request->addApiParam('consign_type', $params['consign_type']);
|
||||
} //仓发订单类型 DOMESTIC 优选仓
|
||||
if (!empty($params['current_page'])) {
|
||||
$request->addApiParam('current_page', $params['current_page']);
|
||||
} //当前页
|
||||
if (!empty($params['domestic_logistics_num'])) {
|
||||
$request->addApiParam('domestic_logistics_num', $params['domestic_logistics_num']);
|
||||
} //国内运单号
|
||||
if (!empty($params['gmt_create_end_str'])) {
|
||||
$request->addApiParam('gmt_create_end_str', $params['gmt_create_end_str']);
|
||||
} //起始创建时间
|
||||
if (!empty($params['gmt_create_start_str'])) {
|
||||
$request->addApiParam('gmt_create_start_str', $params['gmt_create_start_str']);
|
||||
} //截止创建时间
|
||||
if (!empty($params['international_logistics_num'])) {
|
||||
$request->addApiParam('international_logistics_num', $params['international_logistics_num']);
|
||||
} //国际运单号
|
||||
if (!empty($params['logistics_status'])) {
|
||||
$request->addApiParam('logistics_status', $params['logistics_status']);
|
||||
} //订单状态
|
||||
if (!empty($params['page_size'])) {
|
||||
$request->addApiParam('page_size', $params['page_size']);
|
||||
} //页面大小
|
||||
if (!empty($params['warehouse_carrier_service'])) {
|
||||
$request->addApiParam('warehouse_carrier_service', $params['warehouse_carrier_service']);
|
||||
} //物流服务编码
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->aliexpress_logistics_warehouse_querydetail_response->return_result ?? $rs->return_result ?? $rs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 15:52
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
/**
|
||||
* OpenAPI AE-商家相关接口
|
||||
* Created by Sweeper PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 15:20
|
||||
* @Package \Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi\Merchant
|
||||
*/
|
||||
class Merchant extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 商家地址列表查询
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 17:16
|
||||
* channel_seller_id Number 请输入全托管店铺的id。 渠道seller id (可以在这个API中查询:global.seller.relation.query), 请使用 business_type = ONE_STOP_SERVICE 的全托管店铺 channel_seller_id
|
||||
* address_types String[] 地址类型:SALESRETURN(退货地址),WAREHOUSE(发货地址)
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20895&path=aliexpress.merchant.Address.list&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function merchantAddressList(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.merchant.Address.list', $params, 'param', ['channel_seller_id', 'address_types']);
|
||||
|
||||
return $response->aliexpress_merchant_Address_list_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询卖家资料,如刊登数量
|
||||
* api: https://open.aliexpress.com/doc/api.htm#/api?cid=20895&path=aliexpress.merchant.profile.get&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 16:27
|
||||
* @param array $accountInfo
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMerchantProfile(array $accountInfo)
|
||||
{
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.merchant.profile.get');
|
||||
|
||||
return $rs->aliexpress_merchant_profile_get_response->profile ?? $rs->profile ?? $rs;
|
||||
}
|
||||
|
||||
}
|
||||
126
connector-miravia/classes/Services/Aliexpress/OpenApi/Order.php
Normal file
126
connector-miravia/classes/Services/Aliexpress/OpenApi/Order.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Sweeper
|
||||
* Time: 2022/12/27 9:46
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopClient;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\IopRequest;
|
||||
use Sweeper\PlatformMiddleware\Sdk\AeSdk\UrlConstants;
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
use function GuzzleHttp\json_encode;
|
||||
|
||||
/**
|
||||
* OpenAPI 订单相关接口
|
||||
* Created by Sweeper PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 15:21
|
||||
* @Package \Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi\Order
|
||||
*/
|
||||
class Order extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 订单收货信息查询
|
||||
* User: Sweeper
|
||||
* Time: 2023/1/11 10:06
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.6dc86f3dAv7fsz#/api?cid=20905&path=aliexpress.trade.redefining.findorderreceiptinfo&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function findOrderReceiptInfo(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.trade.redefining.findorderreceiptinfo', $params, 'param1');
|
||||
|
||||
return $response->aliexpress_trade_redefining_findorderreceiptinfo_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单列表
|
||||
* User: Sweeper
|
||||
* Time: 2023/2/24 10:19
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.6dc86f3dAv7fsz#/api?cid=20905&path=aliexpress.trade.seller.orderlist.get&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOrderList(array $accountInfo, array $params = [])
|
||||
{
|
||||
static::verifyParams(['current_page', 'page_size'], $params);
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.trade.seller.orderlist.get', $params, 'param_aeop_order_query');
|
||||
|
||||
return $response->aliexpress_trade_seller_orderlist_get_response ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表简化查询
|
||||
* User: Sweeper
|
||||
* Time: 2023/2/24 10:22
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.6dc86f3dAv7fsz#/api?cid=20905&path=aliexpress.trade.redefining.findorderlistsimplequery&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function findOrderListSimpleQuery(array $accountInfo, array $params = [])
|
||||
{
|
||||
static::verifyParams(['page', 'page_size'], $params);
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.trade.redefining.findorderlistsimplequery', $params, 'param1');
|
||||
|
||||
return $response->aliexpress_trade_redefining_findorderlistsimplequery_response ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新版交易订单详情查询
|
||||
* User: Sweeper
|
||||
* Time: 2023/1/11 10:09
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.6dc86f3dAv7fsz#/api?cid=20905&path=aliexpress.trade.new.redefining.findorderbyid&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function findOrderById(array $accountInfo, array $params = [])
|
||||
{
|
||||
static::verifyParams(['order_id'], $params);
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.trade.new.redefining.findorderbyid', $params, 'param1');
|
||||
|
||||
return $response->aliexpress_trade_new_redefining_findorderbyid_response ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 卖家同意取消订单
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/20 11:09
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20905&path=aliexpress.trade.seller.order.acceptcancel&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params [buyer_login_id: String, order_id: Number]
|
||||
* @return mixed
|
||||
*/
|
||||
public function acceptCancelOrder(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.trade.seller.order.acceptcancel', $params, 'param_order_cancel_request');
|
||||
|
||||
return $response->aliexpress_trade_seller_order_acceptcancel_response ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 卖家拒绝取消订单
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/20 11:10
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=20905&path=aliexpress.trade.seller.order.refusecancel&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params ['buyer_login_id','memo','order_id']
|
||||
* @return mixed
|
||||
*/
|
||||
public function refuseCancelOrder(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.trade.seller.order.refusecancel', $params, 'param_order_cancel_request', ['buyer_login_id', 'memo', 'order_id']);
|
||||
|
||||
return $response->aliexpress_trade_seller_order_refusecancel_response ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/26 9:51
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
class Product extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 商品查询新接口
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 17:07
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.offer.product.query&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductDetail(array $accountInfo, array $params)
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.offer.product.query', $params, 'product_id', ['product_id'], 'POST', function($client, $request) use ($accountInfo, $params) {
|
||||
$request->addApiParam('product_id', $params['product_id']);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $response->aliexpress_offer_product_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询半托管已加入/待加入/待预存商品列表
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/26 10:10
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21439&path=aliexpress.pop.choice.products.list&methodType=GET
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPopChoiceProductList(array $accountInfo, array $params)
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.pop.choice.products.list', $params, 'param', [], 'GET');
|
||||
|
||||
return $response->aliexpress_pop_choice_products_list_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半托管商品详情查询
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/26 10:10
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21439&path=aliexpress.pop.choice.product.query&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPopChoiceProductDetail(array $accountInfo, array $params)
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.pop.choice.product.query', $params, 'product_id', ['product_id'], 'POST', function($client, $request) use ($accountInfo, $params) {
|
||||
$request->addApiParam('product_id', $params['product_id']);
|
||||
$request->addApiParam('language', 'zh_CN');
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $response->aliexpress_pop_choice_product_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* AE-全托管-商品列表查询
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/26 10:10
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21403&path=aliexpress.choice.products.list&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChoiceProductList(array $accountInfo, array $params)
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.choice.products.list', $params, 'param', ['channel_seller_id', 'channel', 'search_condition_do'], 'POST',
|
||||
function($client, $request) use ($accountInfo, $params) {
|
||||
$request->addApiParam('channel_seller_id', $params['channel_seller_id']);
|
||||
$request->addApiParam('channel', $params['channel']);
|
||||
$request->addApiParam('page_size', $params['page_size'] ?? 20);
|
||||
$request->addApiParam('current_page', $params['current_page'] ?? 1);
|
||||
$request->addApiParam('search_condition_do', json_encode($params['search_condition_do']));
|
||||
$request->addApiParam('version', $params['version'] ?? 1);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $response->aliexpress_choice_products_list_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* AE-全托管-全托管店铺-查询单个商品详情
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/26 10:10
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21403&path=aliexpress.choice.product.query&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChoiceProductDetail(array $accountInfo, array $params)
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.choice.product.query', $params, 'param', ['channel_seller_id', 'channel', 'product_id'], 'POST',
|
||||
function($client, $request) use ($accountInfo, $params) {
|
||||
$request->addApiParam('product_id', $params['product_id']);
|
||||
$request->addApiParam('channel_seller_id', $params['channel_seller_id']);
|
||||
$request->addApiParam('channel', $params['channel']);
|
||||
$request->addApiParam('version', $params['version'] ?? 1);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $response->aliexpress_choice_product_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* AE-全托管-按照商家查询仓库编码
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/26 10:30
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChoiceProductWarehouseList(array $accountInfo, array $params)
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.choice.product.warehouse.list', $params, 'param', ['channel_seller_id', 'channel'], 'POST',
|
||||
function($client, $request) use ($accountInfo, $params) {
|
||||
$request->addApiParam('product_id', $params['product_id']);
|
||||
$request->addApiParam('channel_seller_id', $params['channel_seller_id']);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $response->aliexpress_choice_product_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品删除接口
|
||||
* api: https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.offer.product.delete&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 17:03
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function deleteProduct(array $accountInfo, array $params)
|
||||
{
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.offer.product.delete', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
if (!empty($params['product_id'])) {
|
||||
$request->addApiParam('product_id', $params['product_id']);
|
||||
}
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->aliexpress_offer_product_delete_response->product_id ?? $rs->product_id ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表查询接口
|
||||
* api: https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.postproduct.redefining.findproductinfolistquery&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 17:05
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductsList(array $accountInfo, array $params)
|
||||
{
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.postproduct.redefining.findproductinfolistquery', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
$request->addApiParam('aeop_a_e_product_list_query', $params['aeop_a_e_product_list_query']);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->aliexpress_postproduct_redefining_findproductinfolistquery_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询待优化商品列表
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 17:08
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.product.diagnosis.pageQueryProblem&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductProblemList(array $accountInfo, array $params)
|
||||
{
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.product.diagnosis.pageQueryProblem', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
isset($params['operate_status']) && $request->addApiParam('operate_status', $params['operate_status']);
|
||||
isset($params['problem_type_list']) && $request->addApiParam('problem_type_list', $params['problem_type_list']);
|
||||
isset($params['page_size']) && $request->addApiParam('page_size', $params['page_size']);
|
||||
isset($params['current_page']) && $request->addApiParam('current_page', $params['current_page']);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->aliexpress_product_diagnosis_pageQueryProblem_response ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商家下待优化的商品问题类型列表
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 17:12
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.product.diagnosis.queryProblem&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductProblemTypeList(array $accountInfo, array $params)
|
||||
{
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.product.diagnosis.queryProblem', [], '');
|
||||
|
||||
return $rs->aliexpress_product_diagnosis_queryProblem_response->product_problem_type_list ?? $rs->product_problem_type_list ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品新的编辑接口
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 17:14
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.offer.product.edit&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function editProductNew(array $accountInfo, array $params)
|
||||
{
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.offer.product.edit', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
$request->addApiParam('aeop_a_e_product', $params['aeop_a_e_product']);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->aliexpress_offer_product_edit_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品发布新接口
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 17:15
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20904&path=aliexpress.offer.product.post&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function uploadListing(array $accountInfo, array $params)
|
||||
{
|
||||
$rs = static::executeRequest($accountInfo, 'aliexpress.offer.product.post', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
$request->addApiParam('aeop_a_e_product', $params['aeop_a_e_product']);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->aliexpress_offer_product_edit_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
## API 文档
|
||||
https://console-docs.apipost.cn/preview/a8b356c4e7ad1bd6/8b42e455151dbc70 pwd:444421
|
||||
244
connector-miravia/classes/Services/Aliexpress/OpenApi/Ship.php
Normal file
244
connector-miravia/classes/Services/Aliexpress/OpenApi/Ship.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
class Ship extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 组包提交
|
||||
* 目录:API文档/菜鸟国际出口/提供给ISV通过该接口提交发布交接单
|
||||
* api:https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=21215&path=cainiao.global.handover.commit&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 16:22
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function commitBigBag(array $accountInfo, array $params = [])
|
||||
{
|
||||
if (empty($params['pickup_info'])) {
|
||||
throw new \InvalidArgumentException('参数pickup_info必填且不能为空');
|
||||
}
|
||||
if (empty($params['user_info'])) {
|
||||
throw new \InvalidArgumentException('参数user_info必填且不能为空');
|
||||
}
|
||||
if (empty($params['client'])) {
|
||||
throw new \InvalidArgumentException('参数client必填且不能为空');
|
||||
}
|
||||
$rs = static::executeRequest($accountInfo, 'cainiao.global.handover.commit', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
if (!empty($params['seller_parcel_order_list'])) {
|
||||
if (is_array($params['seller_parcel_order_list']) || is_object($params['seller_parcel_order_list'])) {
|
||||
$request->addApiParam('seller_parcel_order_list', json_encode($params['seller_parcel_order_list']));
|
||||
} else {
|
||||
$request->addApiParam('seller_parcel_order_list', $params['seller_parcel_order_list']);
|
||||
}
|
||||
}
|
||||
if (is_array($params['pickup_info']) || is_object($params['pickup_info'])) {
|
||||
$request->addApiParam('pickup_info', json_encode($params['pickup_info']));
|
||||
} else {
|
||||
$request->addApiParam('pickup_info', $params['pickup_info']);
|
||||
}
|
||||
if (!empty($params['order_code_list'])) {
|
||||
if (is_array($params['order_code_list']) || is_object($params['order_code_list'])) {
|
||||
$request->addApiParam('order_code_list', json_encode($params['order_code_list']));
|
||||
} else {
|
||||
$request->addApiParam('order_code_list', $params['order_code_list']);
|
||||
}
|
||||
}
|
||||
if (!empty($params['weight'])) {
|
||||
$request->addApiParam('weight', $params['weight']);
|
||||
}
|
||||
if (!empty($params['handover_order_id'])) {
|
||||
$request->addApiParam('handover_order_id', $params['handover_order_id']);
|
||||
}
|
||||
if (!empty($params['remark'])) {
|
||||
$request->addApiParam('remark', $params['remark']);
|
||||
}
|
||||
if (!empty($params['return_info'])) {
|
||||
if (is_array($params['return_info']) || is_object($params['return_info'])) {
|
||||
$request->addApiParam('return_info', json_encode($params['return_info']));
|
||||
} else {
|
||||
$request->addApiParam('return_info', $params['return_info']);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($params['user_info']) || is_object($params['user_info'])) {
|
||||
$request->addApiParam('user_info', json_encode($params['user_info']));
|
||||
} else {
|
||||
$request->addApiParam('user_info', $params['user_info']);
|
||||
}
|
||||
if (!empty($params['weight_unit'])) {
|
||||
$request->addApiParam('weight_unit', $params['weight_unit']);
|
||||
}
|
||||
|
||||
if (!empty($params['skip_invalid_parcel'])) {
|
||||
$request->addApiParam('skip_invalid_parcel', $params['skip_invalid_parcel']);
|
||||
} else {
|
||||
$request->addApiParam('skip_invalid_parcel', 'true');
|
||||
}
|
||||
|
||||
if (!empty($params['type'])) {
|
||||
$request->addApiParam('type', $params['type']);
|
||||
}
|
||||
|
||||
$request->addApiParam('client', $params['client']);
|
||||
if (!empty($params['locale'])) {
|
||||
$request->addApiParam('locale', $params['locale']);
|
||||
}
|
||||
if (!empty($params['features'])) {
|
||||
if (is_array($params['features']) || is_object($params['features'])) {
|
||||
$request->addApiParam('features', json_encode($params['features']));
|
||||
} else {
|
||||
$request->addApiParam('features', $params['features']);
|
||||
}
|
||||
}
|
||||
if (!empty($params['appointment_type'])) {
|
||||
$request->addApiParam('appointment_type', $params['appointment_type']);
|
||||
}
|
||||
if (!empty($params['domestic_tracking_no'])) {
|
||||
$request->addApiParam('domestic_tracking_no', $params['domestic_tracking_no']);
|
||||
}
|
||||
if (!empty($params['domestic_logistics_company_id'])) {
|
||||
$request->addApiParam('domestic_logistics_company_id', $params['domestic_logistics_company_id']);
|
||||
}
|
||||
if (!empty($params['domestic_logistics_company'])) {
|
||||
$request->addApiParam('domestic_logistics_company', $params['domestic_logistics_company']);
|
||||
}
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->cainiao_global_handover_commit_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批次追加大包
|
||||
* 目录:API文档/菜鸟国际出口/批次追加大包
|
||||
* api:https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=21215&path=cainiao.global.handover.content.subbag.add&methodType=POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 16:19
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function addSubBag(array $accountInfo, array $params = [])
|
||||
{
|
||||
// 参数验证和组装
|
||||
if (empty($params['user_info'])) {
|
||||
throw new \InvalidArgumentException('参数user_info必填且不能为空');
|
||||
}
|
||||
if (empty($params['add_subbag_quantity'])) {
|
||||
throw new \InvalidArgumentException('参数order_code必填且不能为空');
|
||||
}
|
||||
if (empty($params['order_code'])) {
|
||||
throw new \InvalidArgumentException('参数order_code必填且不能为空');
|
||||
}
|
||||
$rs = static::executeRequest($accountInfo, 'cainiao.global.handover.content.subbag.add', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
if (is_array($params['user_info']) || is_object($params['user_info'])) {
|
||||
$request->addApiParam('user_info', json_encode($params['user_info']));
|
||||
} else {
|
||||
$request->addApiParam('user_info', $params['user_info']);
|
||||
}
|
||||
$request->addApiParam('order_code', $params['order_code']);
|
||||
$request->addApiParam('add_subbag_quantity', $params['add_subbag_quantity']);
|
||||
if (empty($params['locale'])) {
|
||||
$request->addApiParam('locale', 'zh_CN');
|
||||
} else {
|
||||
$request->addApiParam('locale', $params['locale']);
|
||||
}
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->cainiao_global_handover_content_subbag_add_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取大包面单
|
||||
* 目录:API文档/菜鸟国际出口/返回指定大包面单的PDF文件数据
|
||||
* api:https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=21215&path=cainiao.global.handover.pdf.get&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 16:14
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBigBagPdf(array $accountInfo, array $params = [])
|
||||
{
|
||||
// 参数验证和组装
|
||||
if (empty($params['user_info'])) {
|
||||
throw new \InvalidArgumentException('参数user_info必填且不能为空');
|
||||
}
|
||||
if (empty($params['client'])) {
|
||||
throw new \InvalidArgumentException('参数client必填且不能为空');
|
||||
}
|
||||
if (empty($params['handover_content_id'])) {
|
||||
throw new \InvalidArgumentException('参数handover_content_id必填且不能为空');
|
||||
}
|
||||
$rs = static::executeRequest($accountInfo, 'cainiao.global.handover.pdf.get', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
if (is_array($params['user_info']) || is_object($params['user_info'])) {
|
||||
$request->addApiParam('user_info', json_encode($params['user_info']));
|
||||
} else {
|
||||
$request->addApiParam('user_info', $params['user_info']);
|
||||
}
|
||||
$request->addApiParam('client', $params['client']);
|
||||
if (!empty($params['locale'])) {
|
||||
$request->addApiParam('locale', $params['locale']);
|
||||
}
|
||||
|
||||
$request->addApiParam('handover_content_id', $params['handover_content_id']);
|
||||
if (!empty($params['type'])) {
|
||||
$request->addApiParam('type', $params['type']);
|
||||
}
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->cainiao_global_handover_pdf_get_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询大包详情
|
||||
* 目录:API文档/菜鸟国际出口/查询大包详情
|
||||
* api: https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=21215&path=cainiao.global.handover.pdf.get&methodType=GET/POST
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 16:12
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBigBagInfo(array $accountInfo, array $params = [])
|
||||
{
|
||||
if (empty($params['client'])) {
|
||||
throw new \InvalidArgumentException('参数client必填且不能为空');
|
||||
}
|
||||
$rs = static::executeRequest($accountInfo, 'cainiao.global.handover.content.query', [], '', [], 'POST', function($client, $request, $accountInfo) use ($params) {
|
||||
// 参数验证和组装
|
||||
if (!empty($params['user_info'])) {
|
||||
if (is_array($params['user_info']) || is_object($params['user_info'])) {
|
||||
$request->addApiParam('user_info', json_encode($params['user_info']));
|
||||
} else {
|
||||
$request->addApiParam('user_info', $params['user_info']);
|
||||
}
|
||||
}
|
||||
if (!empty($params['order_code'])) {
|
||||
$request->addApiParam('order_code', $params['order_code']);
|
||||
}
|
||||
if (!empty($params['tracking_number'])) {
|
||||
$request->addApiParam('tracking_number', $params['tracking_number']);
|
||||
}
|
||||
$request->addApiParam('client', $params['client']);
|
||||
if (!empty($params['locale'])) {
|
||||
$request->addApiParam('locale', $params['locale']);
|
||||
}
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $rs->cainiao_global_handover_content_query_response->result ?? $rs->result ?? $rs;
|
||||
}
|
||||
|
||||
}
|
||||
250
connector-miravia/classes/Services/Aliexpress/OpenApi/Supply.php
Normal file
250
connector-miravia/classes/Services/Aliexpress/OpenApi/Supply.php
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 15:52
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
/**
|
||||
* OpenAPI AE-供应链相关接口
|
||||
* Created by Sweeper PhpStorm.
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 15:22
|
||||
* @Package \Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi\Supply
|
||||
*/
|
||||
class Supply extends Base
|
||||
{
|
||||
|
||||
/** 行业账套编码[业务租户Id,全托管场景请填写5110000] AER 221000,AEG 288000 aechoice 5110000 */
|
||||
|
||||
/** @var int 行业账套编码[业务租户Id] AER */
|
||||
public const BIZ_TYPE_AER = 221000;
|
||||
|
||||
/** @var int 行业账套编码[业务租户Id] AEG */
|
||||
public const BIZ_TYPE_AEG = 288000;
|
||||
|
||||
/** @var int 行业账套编码[业务租户Id] aechoice */
|
||||
public const BIZ_TYPE_AE_CHOICE = 5110000;
|
||||
|
||||
/** 单据类型 10:普通仓发 50:JIT */
|
||||
|
||||
/** @var int 订单类型 - 普通仓发 */
|
||||
public const ORDER_TYPE_NORMAL = 10;
|
||||
|
||||
/** @var int 订单类型 - JIT */
|
||||
public const ORDER_TYPE_JIT = 50;
|
||||
|
||||
/** 单据状态 10:待确认 15:已确认 17:待发货 20:待收货 21:已到仓 30:部分收货 40:收货完成 -99:已取消,不传则返回所有状态的采购单 */
|
||||
|
||||
/** biz_type Number 是 业务租户Id,全托管场景请填写5110000 */
|
||||
|
||||
/** channel_user_id Number 是 渠道seller id (可以在这个API中查询:global.seller.relation.query), 请使用 business_type = ONE_STOP_SERVICE 的全托管店铺 channel_seller_id */
|
||||
|
||||
/**
|
||||
* 采购单分页查询
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 15:52
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.pageQuery&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function pageQuery(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.pageQuery', $params, 'param0', ['order_type', 'biz_type', 'channel_user_id']);
|
||||
|
||||
return $response->aliexpress_ascp_po_pageQuery_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购单确认
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 16:17
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.confirmPurchaseOrder&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function confirmPurchaseOrder(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.confirmPurchaseOrder', $params, 'param0', ['purchase_order_no', 'biz_type', 'all_quantity_confirm', 'channel_user_id']);
|
||||
|
||||
return $response->aliexpress_ascp_po_confirmPurchaseOrder_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建揽收单
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 16:50
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.createPickupOrder&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function createPickupOrder(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.createPickupOrder', $params, 'param0', [
|
||||
'order_type',
|
||||
'estimated_pickup_date',
|
||||
'biz_type',
|
||||
'estimated_weight',
|
||||
'estimated_box_number',
|
||||
'contact_info_dto',
|
||||
'estimated_volume',
|
||||
'order_no_list',
|
||||
'channel_user_id',
|
||||
]);
|
||||
|
||||
return $response->aliexpress_ascp_po_createPickupOrder_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询揽收单
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 16:54
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.queryPickupOrder&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function queryPickupOrder(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.queryPickupOrder', $params, 'param0', ['pickup_order_number', 'biz_type', 'channel_user_id']);
|
||||
|
||||
return $response->aliexpress_ascp_po_queryPickupOrder_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印箱唛
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 16:58
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.query.createShippingMarkPdf&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function createShippingMarkPdf(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.query.createShippingMarkPdf', $params, 'param0', ['biz_type', 'channel_user_id', 'purchase_order_no']);
|
||||
|
||||
return $response->aliexpress_ascp_po_query_createShippingMarkPdf_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印货品标签
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 16:59
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.createScItemBarcodePdf&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function createScItemBarcodePdf(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.createScItemBarcodePdf', $params, 'param0', ['purchase_order_no', 'biz_type', 'channel_user_id']);
|
||||
|
||||
return $response->aliexpress_ascp_po_createScItemBarcodePdf_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印揽收面单
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 17:01
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.createPickupShippingMarkPdf&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function createPickupShippingMarkPdf(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.createPickupShippingMarkPdf', $params, 'param0', ['pickup_order_number', 'biz_type', 'channel_user_id']);
|
||||
|
||||
return $response->aliexpress_ascp_po_createScItemBarcodePdf_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* AliExpress采购单明细查询API
|
||||
* User: Sweeper
|
||||
* Time: 2023/4/4 17:18
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.item.query&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function purchaseOrderDetail(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.item.query', $params, 'purchase_order_item_query', ['biz_type', 'purchase_order_no']);
|
||||
|
||||
return $response->aliexpress_ascp_po_item_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* AliExpress采购单查询API
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/21 14:24
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.query&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function purchaseOrderQuery(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.query', $params, 'purchase_order_query', ['biz_type', 'purchase_order_no']);
|
||||
|
||||
return $response->aliexpress_ascp_po_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购单货品详情
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/20 16:58
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.item.detail&methodType=GET
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function purchaseOrderItemDetail(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.item.detail', $params, 'param0', ['sc_item_id', 'channel', 'channel_seller_id'], 'GET');
|
||||
|
||||
return $response->aliexpress_ascp_item_detail_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* AliExpress货品查询API
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/21 13:49
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.item.query&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function purchaseOrderItemQuery(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.item.query', $params, 'sc_item_query', ['biz_type']);
|
||||
|
||||
return $response->aliexpress_ascp_item_query_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消揽收单
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2023/9/21 13:49
|
||||
* @doc https://open.aliexpress.com/doc/api.htm#/api?cid=21022&path=aliexpress.ascp.po.cancelPickupOrder&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function purchaseCancelPickOrder(array $accountInfo, array $params = [])
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.ascp.po.cancelPickupOrder', $params, 'param0', ['pickup_order_number','biz_type','channel_user_id','cancel_reason']);
|
||||
|
||||
return $response->aliexpress_ascp_po_cancelPickupOrder_response->result ?? $response->result ?? $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: czq
|
||||
* Time: 2023/1/17 15:06
|
||||
*/
|
||||
|
||||
namespace Sweeper\PlatformMiddleware\Services\Aliexpress\OpenApi;
|
||||
|
||||
use Sweeper\PlatformMiddleware\Services\Aliexpress\Base;
|
||||
|
||||
class Trade extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 延长买家收货时间
|
||||
* Author: Sweeper <wili.lixiang@gmail.com>
|
||||
* DateTime: 2024/3/19 16:55
|
||||
* @doc https://open.aliexpress.com/doc/api.htm?spm=a2o9m.11193487.0.0.35096f3dtoF70t#/api?cid=20905&path=aliexpress.trade.redefining.extendsbuyeracceptgoodstime&methodType=GET/POST
|
||||
* @param array $accountInfo
|
||||
* @param $orderId
|
||||
* @param $day
|
||||
* @return mixed
|
||||
*/
|
||||
public function extendsBuyerAcceptGoodsTime(array $accountInfo, $orderId, $day)
|
||||
{
|
||||
$response = static::executeRequest($accountInfo, 'aliexpress.trade.redefining.extendsbuyeracceptgoodstime', [], '', [], 'POST', function($client, $request, $accountInfo) use ($orderId, $day) {
|
||||
$request->addApiParam('param0', $orderId);
|
||||
$request->addApiParam('param1', $day);
|
||||
|
||||
return $client->execute($request, $accountInfo['access_token']);
|
||||
});
|
||||
|
||||
return $response->aliexpress_trade_redefining_extendsbuyeracceptgoodstime_response ?? $response;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user