...
|
...
|
@@ -5,6 +5,7 @@ namespace app\api\controller; |
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\Area;
|
|
|
use app\common\model\Version;
|
|
|
use EasyWeChat\Foundation\Application;
|
|
|
use Qiniu\Auth;
|
|
|
use think\Config;
|
|
|
use think\Hook;
|
...
|
...
|
@@ -178,4 +179,33 @@ class Common extends Api |
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (获取微信SDK配置)
|
|
|
* @ApiSummary (获取微信SDK配置)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/Common/getJsSdkConfig)
|
|
|
* @ApiParams (name="url", type="string", required=true, description="当前页面url")
|
|
|
* @ApiParams (name="api", type="string", required=true, description="要应用的API名称逗号分割")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturnParams (name="url", type="string", required=true, sample="跳转地址")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功',
|
|
|
})
|
|
|
*/
|
|
|
public function getJsSdkConfig()
|
|
|
{
|
|
|
$api = input('api');
|
|
|
$url = input('url');
|
|
|
$config = config('wechat');
|
|
|
// dump($config);
|
|
|
$APIs = explode(',', $api);
|
|
|
$Wechat = new Application($config);
|
|
|
$Wechat->js->setUrl($url);
|
|
|
$return['config'] = $Wechat->js->config($APIs, $debug = false, $beta = false, $json = false);
|
|
|
$this->success('', $return);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|