...
|
...
|
@@ -5,6 +5,8 @@ namespace app\api\controller; |
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\Area;
|
|
|
use app\common\model\Version;
|
|
|
use EasyWeChat\Factory;
|
|
|
use EasyWeChat\Foundation\Application;
|
|
|
use fast\Random;
|
|
|
use think\Config;
|
|
|
|
...
|
...
|
@@ -41,6 +43,59 @@ class Common extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* jssdk接口数据
|
|
|
* @ApiWeigh (23)
|
|
|
*
|
|
|
* @ApiTitle (jssdk接口数据)
|
|
|
* @ApiSummary (jssdk接口数据)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/common/wechat_jssdk)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="url", type="string", required=true, description="当前地址")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功',
|
|
|
"data": {
|
|
|
"jssdk": {
|
|
|
"debug": false,
|
|
|
"beta": false,
|
|
|
"jsApiList": [
|
|
|
"updateAppMessageShareData",
|
|
|
"updateTimelineShareData"
|
|
|
],
|
|
|
"appId": "wxa9281176eb57c2f1",
|
|
|
"nonceStr": "YRPUWx9AaB",
|
|
|
"timestamp": 1597023466,
|
|
|
"url": "http://tangyuanji.t.brotop.cn/",
|
|
|
"signature": "ce924ae62e9cbc7917cee79dafd9d67d31400fcf"
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function wechat_jssdk()
|
|
|
{
|
|
|
$url = $this->request->param('url','');
|
|
|
if(!$url) {
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
$options = get_addon_config('third')['wechat'];
|
|
|
$options['secret'] = $options['app_secret'];
|
|
|
$app = new Application($options);
|
|
|
// 微信jssdk
|
|
|
$jssdk = $app->js;
|
|
|
$jssdk->setUrl($url);
|
|
|
$data = json_decode($jssdk->config(config('option.apis'), $debug = false, $beta = false, $json = true),true);
|
|
|
unset($data['beta']);
|
|
|
unset($data['url']);
|
|
|
$return = [
|
|
|
'jssdk' => $data
|
|
|
];
|
|
|
$this->success('成功', $return);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 上传文件
|
|
|
* @ApiMethod (POST)
|
|
|
* @param File $file 文件流
|
...
|
...
|
|