Sale.php 2.2 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\statistics;
  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\statistics\Sale as SaleService;
  15. class Sale extends Auth {
  16. /**
  17. * 销售统计
  18. * @return string
  19. */
  20. public function index(){
  21. return View::fetch("",SaleService::getSalesRanking());
  22. }
  23. /**
  24. * 购买排行
  25. * @return string|\think\response\Json
  26. */
  27. public function ranking(){
  28. try{
  29. if(Request::isAjax()){
  30. $list = SaleService::getRankingData(Request::param());
  31. return Response::returnArray("ok",0,$list["data"],$list["count"]);
  32. }
  33. return View::fetch();
  34. }catch (\Exception $ex){
  35. return Response::returnArray($ex->getMessage(),0);
  36. }
  37. }
  38. /**
  39. * 销售明细
  40. * @return string|\think\response\Json
  41. */
  42. public function sale_list(){
  43. try{
  44. if(Request::isAjax()){
  45. $list = SaleService::getSaleList(Request::param());
  46. return Response::returnArray("ok",0,$list["data"],$list["count"]);
  47. }
  48. return View::fetch();
  49. }catch (\Exception $ex){
  50. return Response::returnArray($ex->getMessage(),0);
  51. }
  52. }
  53. /**
  54. * 商品排行
  55. * @return string|\think\response\Json
  56. */
  57. public function sale_order(){
  58. try{
  59. if(Request::isAjax()){
  60. $list = SaleService::getSaleOrder(Request::param());
  61. return Response::returnArray("ok",0,$list["data"],$list["count"]);
  62. }
  63. return View::fetch();
  64. }catch (\Exception $ex){
  65. return Response::returnArray($ex->getMessage(),0);
  66. }
  67. }
  68. }