Charts.Class.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. namespace JinDouYun\Controller\Charts;
  3. use App\Tools\ErrorCode;
  4. use JinDouYun\Controller\BaseController;
  5. use JinDouYun\Model\Charts\MCharts;
  6. /**
  7. * @copyright Copyright (c) https://www.qianniaovip.com All rights reserved
  8. * Description: 报表
  9. * Class Charts
  10. * @package JinDouYun\Controller\Charts
  11. */
  12. class Charts extends BaseController
  13. {
  14. private $objMCharts;
  15. public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false, $checkShopToken = true, $checkSupplierToken = true)
  16. {
  17. parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode, $checkShopToken, $checkSupplierToken);
  18. $this->objMCharts = new MCharts($this->onlineUserId,$this->onlineEnterpriseId);
  19. }
  20. /**
  21. * Doc: (des="商品销售报表")
  22. * User: XMing
  23. * Date: 2021/3/29
  24. * Time: 10:49 上午
  25. * @throws \Exception
  26. */
  27. public function goods()
  28. {
  29. $params = $this->request->getRawJson();
  30. if (empty($params)){
  31. parent::sendOutput("参数为空",ErrorCode::$paramError);
  32. }
  33. $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
  34. $params['limit'] = $pageParams['limit'];
  35. $params['offset'] = $pageParams['offset'];
  36. $result = $this->objMCharts->goods($params);
  37. if(!$result->isSuccess()){
  38. parent::sendOutput($result->getData(), $result->getErrorCode());
  39. }
  40. $returnData = $result->getData();
  41. $pageData = [
  42. 'pageIndex' => $params['page'],
  43. 'pageSize' => $params['pageSize'],
  44. 'pageTotal' => $returnData['total'],
  45. ];
  46. parent::sendOutput($returnData['data'], 0, $pageData);
  47. }
  48. /**
  49. * Doc: (des="客户商品报表")
  50. * User: XMing
  51. * Date: 2021/3/29
  52. * Time: 2:22 下午
  53. * @throws \Exception
  54. */
  55. public function customerGoods()
  56. {
  57. $params = $this->request->getRawJson();
  58. if (empty($params)){
  59. parent::sendOutput("参数为空",ErrorCode::$paramError);
  60. }
  61. $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
  62. $params['limit'] = $pageParams['limit'];
  63. $params['offset'] = $pageParams['offset'];
  64. $result = $this->objMCharts->customerGoods($params);
  65. if(!$result->isSuccess()){
  66. parent::sendOutput($result->getData(), $result->getErrorCode());
  67. }
  68. $returnData = $result->getData();
  69. $pageData = [
  70. 'pageIndex' => $params['page'],
  71. 'pageSize' => $params['pageSize'],
  72. 'pageTotal' => $returnData['total'],
  73. ];
  74. parent::sendOutput($returnData['data'], 0, $pageData);
  75. }
  76. /**
  77. * Doc: (des="订单数据表表")
  78. * User: XMing
  79. * Date: 2021/3/29
  80. * Time: 3:11 下午
  81. */
  82. public function order()
  83. {
  84. $params = $this->request->getRawJson();
  85. if (empty($params)){
  86. parent::sendOutput("参数为空",ErrorCode::$paramError);
  87. }
  88. $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
  89. $params['limit'] = $pageParams['limit'];
  90. $params['offset'] = $pageParams['offset'];
  91. $result = $this->objMCharts->order($params);
  92. if(!$result->isSuccess()){
  93. parent::sendOutput($result->getData(), $result->getErrorCode());
  94. }
  95. $returnData = $result->getData();
  96. $pageData = [
  97. 'pageIndex' => $params['page'],
  98. 'pageSize' => $params['pageSize'],
  99. 'pageTotal' => $returnData['total'],
  100. ];
  101. parent::sendOutput($returnData['data'], 0, $pageData);
  102. }
  103. /**
  104. * Doc: (des="客户订单报表")
  105. * User: XMing
  106. * Date: 2021/3/29
  107. * Time: 4:01 下午
  108. * @throws \Exception
  109. */
  110. public function customerOrder()
  111. {
  112. $params = $this->request->getRawJson();
  113. if (empty($params)){
  114. parent::sendOutput("参数为空",ErrorCode::$paramError);
  115. }
  116. $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
  117. $params['limit'] = $pageParams['limit'];
  118. $params['offset'] = $pageParams['offset'];
  119. $result = $this->objMCharts->customerOrder($params);
  120. if(!$result->isSuccess()){
  121. parent::sendOutput($result->getData(), $result->getErrorCode());
  122. }
  123. $returnData = $result->getData();
  124. $pageData = [
  125. 'pageIndex' => $params['page'],
  126. 'pageSize' => $params['pageSize'],
  127. 'pageTotal' => $returnData['total'],
  128. ];
  129. parent::sendOutput($returnData['data'], 0, $pageData);
  130. }
  131. /**
  132. * Doc: (des="业务员订单报表")
  133. * User: XMing
  134. * Date: 2021/3/29
  135. * Time: 4:01 下午
  136. * @throws \Exception
  137. */
  138. public function salesManOrder()
  139. {
  140. $params = $this->request->getRawJson();
  141. if (empty($params)){
  142. parent::sendOutput("参数为空",ErrorCode::$paramError);
  143. }
  144. $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
  145. $params['limit'] = $pageParams['limit'];
  146. $params['offset'] = $pageParams['offset'];
  147. $result = $this->objMCharts->salesManOrder($params);
  148. if(!$result->isSuccess()){
  149. parent::sendOutput($result->getData(), $result->getErrorCode());
  150. }
  151. $returnData = $result->getData();
  152. $pageData = [
  153. 'pageIndex' => $params['page'],
  154. 'pageSize' => $params['pageSize'],
  155. 'pageTotal' => $returnData['total'],
  156. ];
  157. parent::sendOutput($returnData['data'], 0, $pageData);
  158. }
  159. /**
  160. * Doc: (des="地区订单报表")
  161. * User: XMing
  162. * Date: 2021/3/30
  163. * Time: 10:08 上午
  164. * @throws \Exception
  165. */
  166. public function areaOrder()
  167. {
  168. $params = $this->request->getRawJson();
  169. if (empty($params)){
  170. parent::sendOutput("参数为空",ErrorCode::$paramError);
  171. }
  172. $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
  173. $params['limit'] = $pageParams['limit'];
  174. $params['offset'] = $pageParams['offset'];
  175. $result = $this->objMCharts->areaOrder($params);
  176. if(!$result->isSuccess()){
  177. parent::sendOutput($result->getData(), $result->getErrorCode());
  178. }
  179. $returnData = $result->getData();
  180. $pageData = [
  181. 'pageIndex' => $params['page'],
  182. 'pageSize' => $params['pageSize'],
  183. 'pageTotal' => $returnData['total'],
  184. ];
  185. parent::sendOutput($returnData['data'], 0, $pageData);
  186. }
  187. }