心理咨询网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ConfigModel.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * @copyright (C)2016-2099 Hnaoyun Inc.
  4. * @author XingMeng
  5. * @email hnxsh@foxmail.com
  6. * @date 2018年01月03日
  7. * 应用配置模型类
  8. */
  9. namespace app\admin\model\system;
  10. use core\basic\Model;
  11. class ConfigModel extends Model
  12. {
  13. // 获取应用配置列表
  14. public function getList()
  15. {
  16. return parent::table('ay_config')->order('sorting,id')->column('name,value,type,description', 'name');
  17. }
  18. // 检查应用配置
  19. public function checkConfig($where)
  20. {
  21. return parent::table('ay_config')->field('id')
  22. ->where($where)
  23. ->find();
  24. }
  25. // 添加应用配置字段
  26. public function addConfig(array $data)
  27. {
  28. return parent::table('ay_config')->insert($data);
  29. }
  30. // 修改应用配置值
  31. public function modValue($name, $value)
  32. {
  33. return parent::table('ay_config')->where("name='$name'")->update("value='$value'");
  34. }
  35. // 获取区域及主题
  36. public function getAreaTheme()
  37. {
  38. $field = array(
  39. 'a.*',
  40. 'b.theme'
  41. );
  42. $join = array(
  43. 'ay_site b',
  44. 'a.acode=b.acode',
  45. 'LEFT'
  46. );
  47. return parent::table('ay_area a')->field($field)
  48. ->join($join)
  49. ->order('is_default DESC')
  50. ->select(1);
  51. }
  52. // 获取配置参数
  53. public function getConfig()
  54. {
  55. return parent::table('ay_config')->column('value', 'name');
  56. }
  57. }