Quellcode durchsuchen

Wesmiler 校企小程序 更新 6.19

wesmiler vor 3 Jahren
Ursprung
Commit
fa83772e7a
2 geänderte Dateien mit 37 neuen und 0 gelöschten Zeilen
  1. 15 0
      app/api/controller/Setting.php
  2. 22 0
      app/api/service/Payment.php

+ 15 - 0
app/api/controller/Setting.php

@@ -12,6 +12,7 @@ declare (strict_types = 1);
 
 namespace app\api\controller;
 
+use app\api\service\Payment;
 use app\api\service\Setting as SettingService;
 
 /**
@@ -34,4 +35,18 @@ class Setting extends Controller
         $setting = $service->getPublic();
         return $this->renderSuccess(compact('setting'));
     }
+
+    /**
+     * @return \think\response\Json
+     * @throws \app\common\exception\BaseException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function pay()
+    {
+        $paySetting =  Payment::getPaySetting();
+
+        return $this->renderSuccess(compact('paySetting'));
+    }
 }

+ 22 - 0
app/api/service/Payment.php

@@ -92,4 +92,26 @@ class Payment extends BaseService
         $storeId = getStoreId();
         return WxappSettingModel::getWxappConfig($storeId);
     }
+
+    /**
+     * @return array
+     * @throws BaseException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public static function getPaySetting()
+    {
+        $setting = static::getWxConfig();
+        $setting['pay_type'] = [
+            ['name'=>'微信支付','value'=>20]
+        ];
+        unset($setting['app_id']);
+        unset($setting['app_secret']);
+        unset($setting['mchid']);
+        unset($setting['apikey']);
+        unset($setting['cert_pem']);
+        unset($setting['key_pem']);
+        return $setting;
+    }
 }