Report.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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\Report as ReportService;
  15. class Report extends Auth {
  16. /**
  17. * 列表
  18. * @return string|\think\response\Json
  19. * @throws \think\db\exception\DataNotFoundException
  20. * @throws \think\db\exception\DbException
  21. * @throws \think\db\exception\ModelNotFoundException
  22. */
  23. public function index(){
  24. if(Request::isAjax()){
  25. $list = ReportService::getList(Request::param());
  26. return Response::returnArray("ok",0,$list['data'],$list['count']);
  27. }
  28. return View::fetch();
  29. }
  30. /**
  31. * 详情
  32. * @return string|\think\response\Json
  33. */
  34. public function detail(){
  35. try{
  36. if(Request::isAjax()){
  37. return Response::returnArray("操作成功");
  38. }
  39. return View::fetch("",ReportService::detail(Request::param("id",0,"intval")));
  40. }catch (\Exception $ex){
  41. }
  42. }
  43. /**
  44. * 删除
  45. * @return \think\response\Json
  46. */
  47. public function delete(){
  48. try {
  49. ReportService::delete(Request::param("id",0,"intval"));
  50. return Response::returnArray("删除成功");
  51. } catch (\Exception $ex) {
  52. return Response::returnArray($ex->getMessage(),0);
  53. }
  54. }
  55. }