Deliver.php 1.9 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\products;
  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\products\Deliver as DeliverService;
  15. class Deliver 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 = DeliverService::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 editor(){
  35. try{
  36. if(Request::isAjax()){
  37. DeliverService::save(Request::param());
  38. return Response::returnArray("操作成功!");
  39. }
  40. return View::fetch("",DeliverService::detail(Request::param("id",0,"intval")));
  41. }catch (\Exception $ex){
  42. return Response::returnArray($ex->getMessage(),0);
  43. }
  44. }
  45. /**
  46. * 删除
  47. * @return \think\response\Json
  48. */
  49. public function delete(){
  50. try{
  51. DeliverService::delete(Request::get("id",0,"intval"));
  52. return Response::returnArray("删除成功");
  53. }catch (\Exception $ex){
  54. return Response::returnArray($ex->getMessage(),0);
  55. }
  56. }
  57. }