shish 12 часов назад
Родитель
Сommit
de933b2af3
1 измененных файлов с 33 добавлено и 0 удалено
  1. 33 0
      app-ghs/controllers/CustomController.php

+ 33 - 0
app-ghs/controllers/CustomController.php

@@ -7,9 +7,11 @@ use biz\ghs\classes\GhsClass;
 use biz\shop\classes\ShopAdminClass;
 use biz\sj\classes\SjClass;
 use biz\wx\classes\WxMessageClass;
+use biz\wx\classes\WxOpenClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\custom\services\CustomService;
 use bizGhs\custom\services\GhsRechargeSettleService;
+use common\components\miniUtil;
 use common\components\noticeUtil;
 use common\components\qrCodeUtil;
 use bizGhs\order\classes\OrderClass;
@@ -117,6 +119,37 @@ class CustomController extends BaseController
         util::success(['imgUrl' => $imageUrl]);
     }
 
+    /**
+     * 获取收款小程序码(区别于 actionGetGatheringCode 的普通二维码,扫码直接进小程序,不用先跳浏览器)ssh 冲销单功能
+     * 用途:affirmForward.vue 提交冲销单成功后的退款凭证海报(forwardResult.vue),识别后直接打开 hdApp 小程序的
+     * admin/ghs/pay 页面查看余额明细;与 actionGetGatheringCode 生成的参数含义完全一致(id=ghsId, salt=custom.salt),
+     * 只是二维码载体从"H5链接二维码"换成了"小程序码",hdApp 端 admin/ghs/pay.vue 已同步支持从 scene 里解析这两个参数。
+     */
+    public function actionGetGatheringMiniCode()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $custom = CustomClass::getById($id, true);
+        if (empty($custom)) {
+            util::fail('没有找到客户');
+        }
+        if ($custom->ownMainId != $this->mainId) {
+            util::fail('不是你的客户哈');
+        }
+        $ghsId = $custom->ghsId ?? 0;
+        $salt = $custom->salt ?? '';
+
+        $merchant = WxOpenClass::getWxInfo();
+        $page = 'admin/ghs/pay';
+        $ptStyle = dict::getDict('ptStyle', 'hd');
+        //小程序码scene不能超过32个字符,与H5链接的query参数含义保持一致:id=ghsId, salt=custom.salt
+        $scene = "id={$ghsId}&salt={$salt}";
+        $envVersion = miniUtil::normalizeMiniEnvVersion($get['env_version'] ?? 'release');
+        $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle, $envVersion);
+        $imageUrl = imgUtil::groupImg($imgUrl);
+        util::success(['imgUrl' => $imageUrl]);
+    }
+
     //供货商给客户充值和结账 ssh 20240309
     public function actionRecharge()
     {