Suggest.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\controller\users;
  10. use app\admin\controller\Auth;
  11. use mall\response\Response;
  12. use think\facade\Request;
  13. use think\facade\View;
  14. use app\admin\service\users\Suggest as SuggestService;
  15. class Suggest extends Auth {
  16. /**
  17. * 列表
  18. * @return string|\think\response\Json
  19. */
  20. public function index(){
  21. if(Request::isAjax()){
  22. $list = SuggestService::getList(Request::param());
  23. return Response::returnArray("ok",0,$list['data'],$list['count']);
  24. }
  25. return View::fetch();
  26. }
  27. /**
  28. * 详情
  29. * @return string|\think\response\Json
  30. */
  31. public function detail(){
  32. try{
  33. if(Request::isAjax()){
  34. SuggestService::save(Request::param());
  35. return Response::returnArray("操作成功");
  36. }
  37. return View::fetch("",SuggestService::detail(Request::param("id",0,"intval")));
  38. }catch (\Exception $ex){
  39. return Response::returnArray($ex->getMessage(),0);
  40. }
  41. }
  42. /**
  43. * 删除
  44. * @return \think\response\Json
  45. */
  46. public function delete(){
  47. try {
  48. SuggestService::delete(Request::param("id",0,"intval"));
  49. return Response::returnArray("删除成功");
  50. } catch (\Exception $ex) {
  51. return Response::returnArray($ex->getMessage(),0);
  52. }
  53. }
  54. }