فهرست منبع

师傅端-产品分类

whitefang 1 سال پیش
والد
کامیت
a95b7ebaa8

+ 10 - 0
app/common/service/wechat/WeChatMnpService.php

@@ -97,5 +97,15 @@ class WeChatMnpService
         ]);
     }
 
+    public function getUnlimitedQRCode($scene,$page,$env_version='release',$check_path=true)
+    {
+        return $this->app->getClient()->postJson('wxa/getwxacodeunlimit', [
+            'scene' => $scene,
+            'page'=>$page,
+            'env_version'=>$env_version,//trial小程序版本
+            'check_path'=>$check_path
+        ]);
+    }
+
 
 }

+ 10 - 2
app/workerapi/controller/GoodsCategoryController.php

@@ -2,6 +2,7 @@
 namespace app\workerapi\controller;
 
 use app\workerapi\lists\GoodsCategoryLists;
+use app\workerapi\logic\GoodsCategoryLogic;
 
 /**
  * 用户控制器
@@ -10,10 +11,17 @@ use app\workerapi\lists\GoodsCategoryLists;
  */
 class GoodsCategoryController extends BaseApiController
 {
-    public array $notNeedLogin = ['lists'];
-
     public function lists()
     {
         return $this->dataLists(new GoodsCategoryLists());
     }
+
+    public function getQrCode()
+    {
+        $result = GoodsCategoryLogic::getQRCode();
+        if (false === $result) {
+            return $this->fail(GoodsCategoryLogic::getError());
+        }
+        return $this->success('生成二维码', [], 1, 1);
+    }
 }

+ 29 - 0
app/workerapi/logic/GoodsCategoryLogic.php

@@ -0,0 +1,29 @@
+<?php
+namespace app\workerapi\logic;
+
+use app\common\logic\BaseLogic;
+use app\common\service\wechat\WeChatMnpService;
+
+/**
+ * 服务商品逻辑处理
+ * Class GoodsCategoryLogic
+ * @package app\workerapi\logic
+ */
+class GoodsCategoryLogic extends BaseLogic
+{
+    /**
+     * @return \EasyWeChat\Kernel\HttpClient\Response|false|\Symfony\Contracts\HttpClient\ResponseInterface
+     */
+    public static function getQRCode()
+    {
+        try {
+            $response = (new WeChatMnpService())->getUnlimitedQRCode('type=2&id=19','/pages/good/good','trial',false);
+            return $response;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+
+    }
+
+}