diff --git a/CHANGELOG.md b/CHANGELOG.md index d9df294d714bf5ca4c2b022493cbe690f5f763fc..8b4050f4ffe571463c705c2d694b6d709f8338b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v6.0.124 / 2020-11-19 +- 小范围测试淘宝官方SDK + ## v6.0.123 / 2020-11-19 - 测试淘宝官方SDK diff --git a/src/common.php b/src/common.php index e28cdc8ef19e23b128bd182b83684cdf818dbd6a..f9758f5148cf38717599cc1dbd2b9dd8f6066f6a 100644 --- a/src/common.php +++ b/src/common.php @@ -25,7 +25,7 @@ use DtApp\ThinkLibrary\service\SystemService; /** * 定义当前版本 */ -const VERSION = '6.0.123'; +const VERSION = '6.0.124'; if (!function_exists('get_ip_info')) { /** diff --git a/src/service/taobao/TaoBaoService.php b/src/service/taobao/TaoBaoService.php index 1577eaf2a988127b71687225fa1e3314656674d6..5eb099e0d2807668896d73dad561e08b0a6e503a 100644 --- a/src/service/taobao/TaoBaoService.php +++ b/src/service/taobao/TaoBaoService.php @@ -2,8 +2,12 @@ namespace DtApp\ThinkLibrary\service\taobao; +require_once __DIR__ . '/bin/TopSdk.php'; + use DtApp\ThinkLibrary\Service; use TbkScInvitecodeGetRequest; +use TbkScPublisherInfoGetRequest; +use TbkScPublisherInfoSaveRequest; use TopClient; /** @@ -64,7 +68,90 @@ class TaoBaoService extends Service return $this; } - public function scInvitecodeGet($sessionKey): self + /** + * ( 淘宝客-公用-私域用户备案 ) + * 通过入参渠道管理或会员运营管理的邀请码,生成渠道id或会员运营id,完成渠道或会员的备案。 + * https://open.taobao.com/api.htm?docId=37988&docType=2&scopeId=14474 + * @param $sessionKey + * @return $this + */ + public function tbkScPublisherInfoSave($sessionKey): self + { + $c = new TopClient(); + $c->appkey = $this->app_key; + $c->secretKey = $this->app_secret; + $req = new TbkScPublisherInfoSaveRequest(); + if (isset($this->param['relation_from'])) { + $req->setRelationFrom($this->param['relation_from']); + } + if (isset($this->param['offline_scene'])) { + $req->setOfflineScene($this->param['offline_scene']); + } + if (isset($this->param['online_scene'])) { + $req->setOnlineScene($this->param['online_scene']); + } + if (isset($this->param['inviter_code'])) { + $req->setInviterCode($this->param['inviter_code']); + } + if (isset($this->param['info_type'])) { + $req->setInfoType($this->param['info_type']); + } + if (isset($this->param['note'])) { + $req->setNote($this->param['note']); + } + if (isset($this->param['register_info'])) { + $req->setRegisterInfo($this->param['register_info']); + } + $this->output = $c->execute($req, $sessionKey); + return $this; + } + + /** + * ( 淘宝客-公用-私域用户备案信息查询 ) + * 查询已生成的渠道id或会员运营id的相关信息。 + * https://open.taobao.com/api.htm?docId=37989&docType=2&scopeId=14474 + * @param $sessionKey + * @return $this + */ + public function tbkScPublisherInfoGet($sessionKey): self + { + $c = new TopClient(); + $c->appkey = $this->app_key; + $c->secretKey = $this->app_secret; + $req = new TbkScPublisherInfoGetRequest(); + if (isset($this->param['info_type'])) { + $req->setInfoType($this->param['info_type']); + } + if (isset($this->param['relation_id'])) { + $req->setRelationId($this->param['relation_id']); + } + if (isset($this->param['page_no'])) { + $req->setPageNo($this->param['page_no']); + } + if (isset($this->param['page_size'])) { + $req->setPageSize($this->param['page_size']); + } + if (isset($this->param['relation_app'])) { + $req->setRelationApp($this->param['relation_app']); + } + if (isset($this->param['special_id'])) { + $req->setSpecialId($this->param['special_id']); + } + if (isset($this->param['external_id'])) { + $req->setExternalId($this->param['external_id']); + } + $this->output = $c->execute($req, $sessionKey); + return $this; + } + + /** + * ( 淘宝客-公用-私域用户邀请码生成 ) + * 私域用户管理(即渠道管理或会员运营管理)功能中,通过此API可生成淘宝客自身的邀请码。 + * https://open.taobao.com/api.htm?docId=38046&docType=2&scopeId=14474 + * @param $sessionKey + * @return $this + */ + public function tbkScInvitecodeGet($sessionKey): self { $c = new TopClient(); $c->appkey = $this->app_key; @@ -79,7 +166,7 @@ class TaoBaoService extends Service if (isset($this->param['code_type'])) { $req->setCodeType($this->param['code_type']); } - $resp = $c->execute($req, $sessionKey); + $this->output = $c->execute($req, $sessionKey); return $this; }