123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace app\api\controller;
- use think\Db;
- use think\facade\Validate;
- use think\Request;
- use OSS\OssClient;
- use OSS\Core\OssException;
- use Zxing\Qrcode\Decoder\DataBlock;
- /**
- * @title 公共类
- * @controller Publics
- */
- class Publics extends Base
- {
- /**
- * @title 上传图片
- * @desc 上传图片
- * @url /api/Publics/uploadLocality
- * @method POST
- * @tag 基础
- *
- * @param name:file type:file require:1 desc:上传
- * @return name:data@url type:string desc:图片地址
- **/
- public function uploadLocality(){
- $file = request()->file('file');
- $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/upload';
- if(!file_exists($dir)){
- //检查是否有该文件夹,如果没有就创建,并给予最高权限
- mkdir($dir, 0700,true);
- }
- $info = $file->move($dir);
- $newName = $info->getSaveName();
- $data['url'] = 'http://'.$_SERVER['SERVER_NAME']."/upload/{$newName}";
- $this->success('上传成功',$data);
- }
- /**
- * @title 获取系统配置
- * @desc 获取系统配置
- * @url /api/Publics/config_info
- * @method POST
- * @tag 基础
- *
- * @return name:agreement type:string desc:使用条款
- * @return name:privacy type:string desc:隐私协议
- * @return name:platform_agreement type:string desc:违规处罚
- * @return name:about_us type:string desc:关于我们
- * @return name:registration_agreement type:string desc:用户注册协议
- * @return name:terms_service type:string desc:联通统一认证服务条款
- * @return name:chain_on_query type:string desc:链上查询
- * @return name:examples_illustrate type:string desc:转赠说明
- * @return name:android_version type:string desc:安卓当前版本号
- * @return name:android_package type:string desc:安卓包地址
- * @return name:ios_package type:string desc:ios地址
- **/
- public function config_info(){
- $nameArray = [
- 'agreement',
- 'privacy',
- 'platform_agreement',
- 'about_us',
- 'registration_agreement',
- 'terms_service',
- 'chain_on_query',
- 'examples_illustrate',
- 'android_version',
- 'android_package',
- 'ios_package'
- ];
- $array = getConfig($nameArray);
- $this->success('成功',$array);
- }
- }
|