Navigation.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 Navigation extends BaseModel {
  16. public $page_info;
  17. /**
  18. * 获取导航列表
  19. * @access public
  20. * @author csdeshang
  21. * @param array $condition 条件
  22. * @param int $pagesize 分页
  23. * @param string $order 排序
  24. * @return array
  25. */
  26. public function getNavigationList($condition, $pagesize = '', $order = 'nav_sort desc') {
  27. if ($pagesize) {
  28. $nav_list = Db::name('navigation')->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
  29. $this->page_info = $nav_list;
  30. return $nav_list->items();
  31. } else {
  32. return Db::name('navigation')->where($condition)->order('nav_sort')->select()->toArray();
  33. }
  34. }
  35. /**
  36. * 新增导航
  37. * @access public
  38. * @author csdeshang
  39. * @param type $data 参数内容
  40. * @return bool
  41. */
  42. public function addNavigation($data) {
  43. $add_navigation = Db::name('navigation')->insert($data);
  44. return $add_navigation;
  45. }
  46. /**
  47. * 编辑导航
  48. * @access public
  49. * @author csdeshang
  50. * @param type $data 数据
  51. * @param type $condition 条件
  52. * @return bool
  53. */
  54. public function eidtNavigation($data, $condition) {
  55. return Db::name('navigation')->where($condition)->update($data);
  56. }
  57. /**
  58. * 获取单个导航
  59. * @access public
  60. * @author csdeshang
  61. * @param type $condition 条件
  62. * @return array
  63. */
  64. public function getOneNavigation($condition) {
  65. return Db::name('navigation')->where($condition)->find();
  66. }
  67. /**
  68. * 删除导航
  69. * @access public
  70. * @author csdeshang
  71. * @param type $condition 条件
  72. * @return bool
  73. */
  74. public function delNavigation($condition) {
  75. return Db::name('navigation')->where($condition)->delete();
  76. }
  77. }