Fast.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 上海牛之云网络科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace addon\servicer\shop\controller;
  13. use app\shop\controller\BaseShop;
  14. use addon\servicer\model\Fast as FastModel;
  15. /**
  16. * 关键词回复
  17. */
  18. class Fast extends BaseShop
  19. {
  20. /**
  21. * 列表
  22. */
  23. public function index()
  24. {
  25. if (request()->isAjax()) {
  26. $page = input('page', 1);
  27. $page_size = input('page_size', PAGE_LIST_ROWS);
  28. $search_text = input('search_text', '');
  29. $condition = [['site_id', '=', $this->site_id]];
  30. if (!empty($search_text)) {
  31. $condition[] = ['content', 'like', '%' . $search_text . '%'];
  32. }
  33. $fast_model = new FastModel();
  34. $res = $fast_model->getPageList($condition, $page, $page_size);
  35. return $res;
  36. } else {
  37. return $this->fetch('fast/list');
  38. }
  39. }
  40. /**
  41. * 添加
  42. */
  43. public function add()
  44. {
  45. if (request()->isAjax()) {
  46. $fast_model = new FastModel();
  47. return $fast_model->add([
  48. 'site_id' => $this->site_id,
  49. 'content' => input('content', ''),
  50. ]);
  51. }
  52. }
  53. /**
  54. * 编辑
  55. */
  56. public function edit()
  57. {
  58. $fast_model = new FastModel();
  59. if (request()->isAjax()) {
  60. return $fast_model->edit([
  61. 'content' => input('content', ''),
  62. ], [['site_id', '=', $this->site_id], ['id', '=', input('id', 0)]]);
  63. }
  64. }
  65. /**
  66. * 删除
  67. */
  68. public function delete()
  69. {
  70. if (request()->isAjax()) {
  71. $fast_model = new FastModel();
  72. return $fast_model->delete([
  73. ['site_id', '=', $this->site_id],
  74. ['id', 'in', (string)input('ids', '')]
  75. ]);
  76. }
  77. }
  78. }