zory 3 veckor sedan
förälder
incheckning
a6766dc4c1
2 ändrade filer med 19 tillägg och 2 borttagningar
  1. 8 2
      app/controller/api/Home.php
  2. 11 0
      app/extra/dyLife/data/BaseData.php

+ 8 - 2
app/controller/api/Home.php

@@ -9,6 +9,7 @@ use LinFly\Annotation\Attributes\Route\Controller;
 use LinFly\Annotation\Attributes\Route\GetMapping;
 use LinFly\Annotation\Attributes\Route\Middleware;
 use support\Request;
+use support\Response;
 use Webman\RedisQueue\Redis;
 
 
@@ -22,10 +23,15 @@ class Home extends Base
     protected array $noNeedLogin = ["getHomeData"];
 
     #[GetMapping("data")]
-    public function getHomeData(Request $request)
+    public function getHomeData(Request $request): Response
     {
         try {
-            return $this->success("ok");
+            $resp = (new BaseData)->config([
+                "appid"     => sConf("wechat.appid"),
+                "secret"    => sConf("wechat.secret"),
+                "account"   => sConf("wechat.shop_id"),
+            ])->token()->getStoreCategoryTemplate(6005001);
+            return $this->success("ok",$resp);
         } catch (\Throwable $th) {
             return error($th->getMessage());
         }

+ 11 - 0
app/extra/dyLife/data/BaseData.php

@@ -35,4 +35,15 @@ class BaseData extends BasicLife
         return $this->curlGetApi("goodlife/v1/goods/category/get/",$data);
     }
 
+
+
+    /**
+     * 查下商品模板
+     */
+    public function getStoreCategoryTemplate(string $category_id,int $product_type = 1): array
+    {
+        $data = compact("category_id","product_type");
+        return $this->curlGetApi("goodlife/v1/goods/template/get/",$data);
+    }
+
 }