Search.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\controller\article;
  12. use app\admin\controller\AuthController;
  13. use service\JsonService as Json;
  14. use service\UploadService as Upload;
  15. use think\Request;
  16. use think\Url;
  17. use service\FormBuilder as Form;
  18. use app\admin\model\article\Search as SearchModel;
  19. /**
  20. * 搜索
  21. * Class Search
  22. * @package app\admin\controller\article
  23. */
  24. class Search extends AuthController
  25. {
  26. public function index(){
  27. $this->assign('list',SearchModel::getAll());
  28. return $this->fetch();
  29. }
  30. public function save($name=''){
  31. if(!$name) return Json::fail('请输入热词名称');
  32. if($res=SearchModel::saveSearch($name))
  33. return Json::successful('添加成功',$res);
  34. else
  35. return Json::fail(SearchModel::getErrorInfo('添加失败'));
  36. }
  37. public function del_search($id=0){
  38. if(!$id) return Json::fail('缺少参数');
  39. if(SearchModel::del($id))
  40. return Json::successful('删除成功');
  41. else
  42. return Json::fail('删除失败');
  43. }
  44. }