12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Description: 应用配置
  4. // +----------------------------------------------------------------------
  5. // | Author: Michael_xu | gengxiaoxu@5kcrm.com
  6. // +----------------------------------------------------------------------
  7. namespace app\admin\model;
  8. use app\admin\model\Common;
  9. use think\Db;
  10. class Config extends Common
  11. {
  12. /**
  13. * 为了数据库的整洁,同时又不影响Model和Controller的名称
  14. * 我们约定每个模块的数据表都加上相同的前缀,比如CRM模块用crm作为数据表前缀
  15. */
  16. protected $name = 'admin_config';
  17. /**
  18. * [getDataList 获取列表]
  19. * @return [array]
  20. */
  21. public function getDataList()
  22. {
  23. $list = Db::name('AdminConfig')->order('type asc')->select();
  24. return $list;
  25. }
  26. /**
  27. * 编辑
  28. * @author Michael_xu
  29. * @return
  30. */
  31. public function updateDataById($param, $id)
  32. {
  33. $data = [];
  34. $data['status'] = $param['status'] ? : '0';
  35. if ($this->where(['id' => $id])->update($data)) {
  36. return true;
  37. }
  38. $this->error = '操作失败';
  39. return false;
  40. }
  41. }