| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- /**
- * Niushop商城系统 - 团队十年电商经验汇集巨献!
- * =========================================================
- * Copy right 2019-2029 上海牛之云网络科技有限公司, 保留所有权利。
- * ----------------------------------------------
- * 官方网址: https://www.niushop.com
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
- * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
- * =========================================================
- */
- namespace addon\servicer\shop\controller;
- use app\shop\controller\BaseShop;
- use addon\servicer\model\Fast as FastModel;
- /**
- * 关键词回复
- */
- class Fast extends BaseShop
- {
- /**
- * 列表
- */
- public function index()
- {
- if (request()->isAjax()) {
- $page = input('page', 1);
- $page_size = input('page_size', PAGE_LIST_ROWS);
- $search_text = input('search_text', '');
- $condition = [['site_id', '=', $this->site_id]];
- if (!empty($search_text)) {
- $condition[] = ['content', 'like', '%' . $search_text . '%'];
- }
- $fast_model = new FastModel();
- $res = $fast_model->getPageList($condition, $page, $page_size);
- return $res;
- } else {
- return $this->fetch('fast/list');
- }
- }
- /**
- * 添加
- */
- public function add()
- {
- if (request()->isAjax()) {
- $fast_model = new FastModel();
- return $fast_model->add([
- 'site_id' => $this->site_id,
- 'content' => input('content', ''),
- ]);
- }
- }
- /**
- * 编辑
- */
- public function edit()
- {
- $fast_model = new FastModel();
- if (request()->isAjax()) {
- return $fast_model->edit([
- 'content' => input('content', ''),
- ], [['site_id', '=', $this->site_id], ['id', '=', input('id', 0)]]);
- }
- }
- /**
- * 删除
- */
- public function delete()
- {
- if (request()->isAjax()) {
- $fast_model = new FastModel();
- return $fast_model->delete([
- ['site_id', '=', $this->site_id],
- ['id', 'in', (string)input('ids', '')]
- ]);
- }
- }
- }
|