Config.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class Config extends Model
  5. {
  6. // 表名,不含前缀
  7. protected $name = 'config';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = false;
  10. // 定义时间戳字段名
  11. protected $createTime = false;
  12. protected $updateTime = false;
  13. // 追加属性
  14. protected $append = [
  15. ];
  16. /**
  17. * 读取配置类型
  18. * @return array
  19. */
  20. public static function getTypeList()
  21. {
  22. $typeList = [
  23. 'string' => __('String'),
  24. 'text' => __('Text'),
  25. 'number' => __('Number'),
  26. 'datetime' => __('Datetime'),
  27. 'select' => __('Select'),
  28. 'selects' => __('Selects'),
  29. 'image' => __('Image'),
  30. 'images' => __('Images'),
  31. 'file' => __('File'),
  32. 'files' => __('Files'),
  33. 'checkbox' => __('Checkbox'),
  34. 'radio' => __('Radio'),
  35. 'array' => __('Array'),
  36. ];
  37. return $typeList;
  38. }
  39. /**
  40. * 读取分类分组列表
  41. * @return array
  42. */
  43. public static function getGroupList()
  44. {
  45. $groupList = config('site.configgroup');
  46. return $groupList;
  47. }
  48. /**
  49. * 本地上传配置信息
  50. * @return array
  51. */
  52. public static function upload()
  53. {
  54. $uploadcfg = config('upload');
  55. $upload = [
  56. 'cdnurl' => $uploadcfg['cdnurl'],
  57. 'uploadurl' => $uploadcfg['uploadurl'],
  58. 'bucket' => 'local',
  59. 'maxsize' => $uploadcfg['maxsize'],
  60. 'mimetype' => $uploadcfg['mimetype'],
  61. 'multipart' => [],
  62. 'multiple' => $uploadcfg['multiple'],
  63. ];
  64. return $upload;
  65. }
  66. }