Просмотр исходного кода

暂存-接入淘宝联盟官方

sunxbiao месяцев назад: 8
Родитель
Сommit
136ab79f3a

+ 10 - 0
app/controller/api/thirdParty/taobao/EcoController.php

@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace app\controller\api\thirdParty\taobao;
4 4
 
5
+use app\services\ThirdParty\Taobao\PrivateUserService;
5 6
 use app\services\ThirdParty\Taobao\ProductService;
6 7
 use think\Request;
7 8
 
@@ -25,4 +26,13 @@ class EcoController
25 26
             return app('json')->fail($exception->getMessage(), null, 401);
26 27
         }
27 28
     }
29
+
30
+    public function getInvitecodeSc(Request $request)
31
+    {
32
+        /** @var PrivateUserService $privateUserService */
33
+        $privateUserService = app()->make(PrivateUserService::class);
34
+        $res = $privateUserService->getInvitecodeSc([]);
35
+        return app("json")->success($res);
36
+    }
37
+
28 38
 }

+ 11 - 0
app/services/ThirdParty/Taobao/OrderService.php

@@ -0,0 +1,11 @@
1
+<?php
2
+
3
+namespace app\services\ThirdParty\Taobao;
4
+
5
+class OrderService extends TaobaoService
6
+{
7
+    public function getTbkScOrderDetails($param)
8
+    {
9
+        new TbkOrderDetailsGetRequest();
10
+    }
11
+}

+ 21 - 0
app/services/ThirdParty/Taobao/PrivateUserService.php

@@ -0,0 +1,21 @@
1
+<?php
2
+
3
+namespace app\services\ThirdParty\Taobao;
4
+
5
+use think\exception\ValidateException;
6
+
7
+class PrivateUserService extends TaobaoService
8
+{
9
+    public function getInvitecodeSc($params)
10
+    {
11
+        $req = new \TbkScInvitecodeGetRequest();
12
+        $this->batchSetProperties($req, $params);
13
+        $req->setRelationApp('common');
14
+        $req->setCodeType(3);
15
+        $res = $this->execute($req);
16
+        if (!$res) {
17
+            throw new ValidateException('网络错误,请稍后重试');
18
+        }
19
+        return $res;
20
+    }
21
+}

+ 1 - 0
route/api.php

@@ -41,6 +41,7 @@ Route::group('api/', function () {
41 41
 
42 42
         Route::group('taobao', function () {
43 43
             Route::get('eco/searchProducts', 'EcoController/searchProducts');
44
+            Route::get('eco/getInvitecodeSc', 'EcoController/getInvitecodeSc');
44 45
         })->prefix('api.thirdParty.taobao.');
45 46
     })->prefix('api.thirdParty.');
46 47