Navigation.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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\platform;
  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\platform\Navigation as NavigationService;
  15. class Navigation extends Auth {
  16. /**
  17. * 列表
  18. * @return string|\think\response\Json
  19. */
  20. public function index(){
  21. if(Request::isAjax()){
  22. $list = NavigationService::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. * @throws \think\db\exception\DataNotFoundException
  31. * @throws \think\db\exception\DbException
  32. * @throws \think\db\exception\ModelNotFoundException
  33. */
  34. public function editor(){
  35. try{
  36. if(Request::isAjax()){
  37. NavigationService::save(Request::param());
  38. return Response::returnArray("操作成功!");
  39. }
  40. return View::fetch("",NavigationService::detail(Request::param("id","0","intval")));
  41. }catch (\Exception $ex){
  42. return Response::returnArray("操作失败,请重试。",0);
  43. }
  44. }
  45. /**
  46. * 删除
  47. * @return \think\response\Json
  48. */
  49. public function delete(){
  50. try{
  51. NavigationService::delete(Request::param("id","0","intval"));
  52. return Response::returnArray("删除成功");
  53. }catch (\Exception $ex){
  54. return Response::returnArray("操作失败,请稍候在试。",0);
  55. }
  56. }
  57. /**
  58. * 编辑字段
  59. * @return \think\response\Json
  60. */
  61. public function field(){
  62. try {
  63. NavigationService::setFields();
  64. return Response::returnArray("操作成功");
  65. }catch (\Exception $ex){
  66. return Response::returnArray($ex->getMessage(),0);
  67. }
  68. }
  69. }