Publics.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\api\controller;
  3. use think\Db;
  4. use think\facade\Validate;
  5. use think\Request;
  6. use OSS\OssClient;
  7. use OSS\Core\OssException;
  8. use Zxing\Qrcode\Decoder\DataBlock;
  9. /**
  10. * @title 公共类
  11. * @controller Publics
  12. */
  13. class Publics extends Base
  14. {
  15. /**
  16. * @title 上传图片
  17. * @desc 上传图片
  18. * @url /api/Publics/uploadLocality
  19. * @method POST
  20. * @tag 基础
  21. *
  22. * @param name:file type:file require:1 desc:上传
  23. * @return name:data@url type:string desc:图片地址
  24. **/
  25. public function uploadLocality(){
  26. $file = request()->file('file');
  27. $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/upload';
  28. if(!file_exists($dir)){
  29. //检查是否有该文件夹,如果没有就创建,并给予最高权限
  30. mkdir($dir, 0700,true);
  31. }
  32. $info = $file->move($dir);
  33. $newName = $info->getSaveName();
  34. $data['url'] = 'http://'.$_SERVER['SERVER_NAME']."/upload/{$newName}";
  35. $this->success('上传成功',$data);
  36. }
  37. /**
  38. * @title 获取系统配置
  39. * @desc 获取系统配置
  40. * @url /api/Publics/config_info
  41. * @method POST
  42. * @tag 基础
  43. *
  44. * @return name:agreement type:string desc:使用条款
  45. * @return name:privacy type:string desc:隐私协议
  46. * @return name:platform_agreement type:string desc:违规处罚
  47. * @return name:about_us type:string desc:关于我们
  48. * @return name:registration_agreement type:string desc:用户注册协议
  49. * @return name:terms_service type:string desc:联通统一认证服务条款
  50. * @return name:chain_on_query type:string desc:链上查询
  51. * @return name:examples_illustrate type:string desc:转赠说明
  52. * @return name:android_version type:string desc:安卓当前版本号
  53. * @return name:android_package type:string desc:安卓包地址
  54. * @return name:ios_package type:string desc:ios地址
  55. **/
  56. public function config_info(){
  57. $nameArray = [
  58. 'agreement',
  59. 'privacy',
  60. 'platform_agreement',
  61. 'about_us',
  62. 'registration_agreement',
  63. 'terms_service',
  64. 'chain_on_query',
  65. 'examples_illustrate',
  66. 'android_version',
  67. 'android_package',
  68. 'ios_package'
  69. ];
  70. $array = getConfig($nameArray);
  71. $this->success('成功',$array);
  72. }
  73. }