EditablePageModel.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class EditablePageModel extends BaseModel {
  16. public $page_info;
  17. /**
  18. * 新增可编辑页面模块
  19. * @author csdeshang
  20. * @param array $data 参数内容
  21. * @return bool 布尔类型的返回结果
  22. */
  23. public function addEditablePageModel($data) {
  24. return Db::name('editable_page_model')->insertGetId($data);
  25. }
  26. /**
  27. * 删除一个可编辑页面模块
  28. * @author csdeshang
  29. * @param array $editable_page_model_id 可编辑页面模块id
  30. * @return bool 布尔类型的返回结果
  31. */
  32. public function delEditablePageModel($editable_page_model_id) {
  33. return Db::name('editable_page_model')->where('editable_page_model_id', $editable_page_model_id)->delete();
  34. }
  35. /**
  36. * 获取可编辑页面模块列表
  37. * @author csdeshang
  38. * @param array $condition 查询条件
  39. * @param obj $pagesize 分页页数
  40. * @param str $orderby 排序
  41. * @return array 二维数组
  42. */
  43. public function getEditablePageModelList($condition = array(), $pagesize = '', $orderby = 'editable_page_model_id desc') {
  44. if ($pagesize) {
  45. $result = Db::name('editable_page_model')->where($condition)->order($orderby)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  46. $this->page_info = $result;
  47. return $result->items();
  48. } else {
  49. return Db::name('editable_page_model')->where($condition)->order($orderby)->select()->toArray();
  50. }
  51. }
  52. public function getOneEditablePageModel($condition = array()) {
  53. return Db::name('editable_page_model')->where($condition)->find();
  54. }
  55. /**
  56. * 更新可编辑页面模块记录
  57. * @author csdeshang
  58. * @param array $data 更新内容
  59. * @return bool
  60. */
  61. public function editEditablePageModel($condition, $data) {
  62. return Db::name('editable_page_model')->where($condition)->update($data);
  63. }
  64. }
  65. ?>