Terms.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // |
  4. // +----------------------------------------------------------------------
  5. // |
  6. // +----------------------------------------------------------------------
  7. // |
  8. // +----------------------------------------------------------------------
  9. // |
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 友情链接管理
  13. // +----------------------------------------------------------------------
  14. namespace app\admin\controller\links;
  15. use app\admin\model\links\Terms as TermsModel;
  16. use app\common\controller\Backend;
  17. /**
  18. * 友情链接管理
  19. */
  20. class Terms extends Backend
  21. {
  22. protected function initialize()
  23. {
  24. parent::initialize();
  25. $this->modelClass = new TermsModel;
  26. }
  27. //分类管理
  28. public function index()
  29. {
  30. if ($this->request->isAjax()) {
  31. [$page, $limit, $where, $sort, $order] = $this->buildTableParames();
  32. $count = $this->modelClass
  33. ->where($where)
  34. ->where("module", "links")
  35. ->order($sort, $order)
  36. ->count();
  37. $data = $this->modelClass
  38. ->where($where)
  39. ->where("module", "links")
  40. ->order($sort, $order)
  41. ->page($page, $limit)
  42. ->select();
  43. $result = ["code" => 0, 'count' => $count, 'data' => $data];
  44. return json($result);
  45. }
  46. return $this->fetch();
  47. }
  48. }