正在显示
3 个修改的文件
包含
60 行增加
和
0 行删除
@@ -5,6 +5,8 @@ namespace app\api\controller; | @@ -5,6 +5,8 @@ namespace app\api\controller; | ||
5 | use app\common\controller\Api; | 5 | use app\common\controller\Api; |
6 | use app\common\model\Area; | 6 | use app\common\model\Area; |
7 | use app\common\model\Version; | 7 | use app\common\model\Version; |
8 | +use EasyWeChat\Factory; | ||
9 | +use EasyWeChat\Foundation\Application; | ||
8 | use fast\Random; | 10 | use fast\Random; |
9 | use think\Config; | 11 | use think\Config; |
10 | 12 | ||
@@ -41,6 +43,59 @@ class Common extends Api | @@ -41,6 +43,59 @@ class Common extends Api | ||
41 | } | 43 | } |
42 | 44 | ||
43 | /** | 45 | /** |
46 | + * jssdk接口数据 | ||
47 | + * @ApiWeigh (23) | ||
48 | + * | ||
49 | + * @ApiTitle (jssdk接口数据) | ||
50 | + * @ApiSummary (jssdk接口数据) | ||
51 | + * @ApiMethod (POST) | ||
52 | + * @ApiRoute (/api/common/wechat_jssdk) | ||
53 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
54 | + * @ApiParams (name="url", type="string", required=true, description="当前地址") | ||
55 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
56 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
57 | + * @ApiReturn ({ | ||
58 | + 'code':'1', | ||
59 | + 'msg':'返回成功', | ||
60 | + "data": { | ||
61 | + "jssdk": { | ||
62 | + "debug": false, | ||
63 | + "beta": false, | ||
64 | + "jsApiList": [ | ||
65 | + "updateAppMessageShareData", | ||
66 | + "updateTimelineShareData" | ||
67 | + ], | ||
68 | + "appId": "wxa9281176eb57c2f1", | ||
69 | + "nonceStr": "YRPUWx9AaB", | ||
70 | + "timestamp": 1597023466, | ||
71 | + "url": "http://tangyuanji.t.brotop.cn/", | ||
72 | + "signature": "ce924ae62e9cbc7917cee79dafd9d67d31400fcf" | ||
73 | + } | ||
74 | + } | ||
75 | + }) | ||
76 | + */ | ||
77 | + public function wechat_jssdk() | ||
78 | + { | ||
79 | + $url = $this->request->param('url',''); | ||
80 | + if(!$url) { | ||
81 | + $this->error('参数错误'); | ||
82 | + } | ||
83 | + $options = get_addon_config('third')['wechat']; | ||
84 | + $options['secret'] = $options['app_secret']; | ||
85 | + $app = new Application($options); | ||
86 | + // 微信jssdk | ||
87 | + $jssdk = $app->js; | ||
88 | + $jssdk->setUrl($url); | ||
89 | + $data = json_decode($jssdk->config(config('option.apis'), $debug = false, $beta = false, $json = true),true); | ||
90 | + unset($data['beta']); | ||
91 | + unset($data['url']); | ||
92 | + $return = [ | ||
93 | + 'jssdk' => $data | ||
94 | + ]; | ||
95 | + $this->success('成功', $return); | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
44 | * 上传文件 | 99 | * 上传文件 |
45 | * @ApiMethod (POST) | 100 | * @ApiMethod (POST) |
46 | * @param File $file 文件流 | 101 | * @param File $file 文件流 |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论