Order.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\api\controller;
  13. use app\api\model\Order as OrderModel;
  14. use app\api\model\Setting as SettingModel;
  15. use app\api\model\Express as ExpressModel;
  16. use app\api\model\Receipt as ReceiptModel;
  17. use app\api\model\shop\Shops;
  18. use app\common\enum\order\DeliveryType;
  19. use app\common\enum\order\PayType as OrderPayTypeEnum;
  20. use app\common\enum\order\DeliveryStatus as DeliveryStatusEnum;
  21. use app\common\exception\BaseException;
  22. use app\api\service\order\Order as OrderService;
  23. use app\api\model\OrderGoods;
  24. use app\common\library\helper;
  25. use app\common\model\card\UserRiceDeliveryExpress as UserRiceDeliveryExpressModel;
  26. use app\common\model\card\UserRiceDelivery as UserRiceDeliveryModel;
  27. use app\api\service\User as UserService;
  28. use app\common\model\RefundCompensate;
  29. use app\common\model\OrderTj;
  30. use app\common\model\SmsRemind;
  31. use app\common\model\PushLog;
  32. use app\store\model\ChannelSaleVolumeTj;
  33. use app\store\model\user\CommerCountTj;
  34. use think\cache\driver\Redis;
  35. use app\common\model\member\MemberTj;
  36. use think\facade\Db;
  37. /**
  38. * 我的订单控制器
  39. * Class Order
  40. * @package app\api\controller
  41. */
  42. class Order extends Controller
  43. {
  44. public function tj(){
  45. $now = time();
  46. //推荐官销售数据统计
  47. $commerTj = new CommerCountTj();
  48. $commerTj->day($now);
  49. $commerTj->week($now);
  50. $commerTj->month($now);
  51. echo 'success commer'.PHP_EOL;
  52. //全渠道销售业绩构成
  53. $csvTj = new ChannelSaleVolumeTj();
  54. $csvTj->day($now);
  55. $csvTj->week($now);
  56. $csvTj->month($now);
  57. echo 'success order'.PHP_EOL;
  58. $otj = new OrderTj;
  59. $day = $otj->day(1);
  60. $month = $otj->month();
  61. $week = $otj->week();
  62. echo 'success order <br/>';
  63. $otjmember = new MemberTj;
  64. $otjmember->day(1);
  65. $otjmember->month();
  66. $otjmember->week();
  67. echo 'success member';
  68. }
  69. //给订单打新老用户tag
  70. public function ordertag(){
  71. $sql = 'select order_id,user_id from yoshop_order where pay_status=20 and tag=-1 limit 100';
  72. $result = Db::query($sql);
  73. foreach($result as $row){
  74. $user_id = $row['user_id'];
  75. $small = "select min(order_id) as min_order_id from yoshop_order where pay_status=20 and user_id=".$user_id;
  76. $s = Db::query($small);
  77. if($s[0]['min_order_id']==$row['order_id']){
  78. OrderModel::where('order_id',$row['order_id'])->update(['tag'=>1]);
  79. }else{
  80. OrderModel::where('order_id',$row['order_id'])->update(['tag'=>0]);
  81. }
  82. }
  83. echo 'success order tag';
  84. }
  85. public function smsremind(){
  86. $sms = SmsRemind::where('id','>',0)->find();
  87. if($sms->hours){
  88. $hours = $sms->hours;
  89. $hours_arr = explode(",",$hours);
  90. $now_hour = Date("H",time());
  91. if(in_array($now_hour,$hours_arr)){
  92. $filter['pay_status'] =20;
  93. $filter['delivery_status'] = 10;//未发货
  94. $filter['order_status'] = 10;//进行中
  95. $filter['delivery_type'] = 10;// 快递配送单
  96. $c = OrderModel::where($filter)->count();
  97. if($c>0){
  98. $mobiles = $sms->mobiles;
  99. $key = "sms remind".Date("YmdH",time());
  100. $rds = new Redis(config('cache.stores.redis'));
  101. $value = $rds->get($key);
  102. if($value){
  103. echo 'sms have send';
  104. }else{
  105. $rds->set($key,1,3600);
  106. $content = '您有'.$c.'个订单待发货,请及时处理!['.substr(Date("Y-m-d",time()),2)." ".$now_hour.":00".']';
  107. // var_dump($content);
  108. PushLog::addSmsMon($content,$mobiles,1);
  109. echo 'remind order success'.$content.',mobile:'.$sms->mobiles;
  110. }
  111. }else{
  112. echo 'no order remind';
  113. }
  114. }else{
  115. echo 'no the time now ';
  116. }
  117. }
  118. //每小时给订单打个新老用户的标签
  119. $this->ordertag();
  120. }
  121. /**
  122. * 获取当前用户待处理的订单数量
  123. * @return array|\think\response\Json
  124. * @throws BaseException
  125. */
  126. public function todoCounts()
  127. {
  128. $model = new OrderModel;
  129. $counts = $model->getTodoCounts();
  130. return $this->renderSuccess(compact('counts'));
  131. }
  132. /**
  133. * 订单商品详情
  134. * @param int $orderGoodsId 订单商品ID
  135. * @return \app\common\model\OrderGoods|null
  136. * @throws BaseException
  137. */
  138. public function refundGoods(int $order_goods_id)
  139. {
  140. $goods = OrderGoods::detail($order_goods_id);
  141. unset($goods['content']);
  142. return $this->renderSuccess(compact('goods'));
  143. }
  144. /**
  145. * 我的订单列表
  146. * @param string $dataType 订单类型 (all全部 payment待付款 received待发货 deliver待收货 completed已完成 comment待评价)
  147. * @return array|\think\response\Json
  148. * @throws BaseException
  149. * @throws \think\db\exception\DbException
  150. */
  151. public function list(string $dataType)
  152. {
  153. $isExchange = boolval($this->request->param('isExchange',0));
  154. $model = new OrderModel;
  155. $list = $model->getList($dataType,$isExchange);
  156. $orderService = new OrderService;
  157. //获取多个物流的最新信息
  158. $orderService->setUserOrder($list);
  159. return $this->renderSuccess(compact('list'));
  160. }
  161. /**
  162. * 订单详情信息
  163. * @param int $orderId 订单ID
  164. * @return array|\think\response\Json
  165. * @throws BaseException
  166. * @throws \think\db\exception\DataNotFoundException
  167. * @throws \think\db\exception\DbException
  168. * @throws \think\db\exception\ModelNotFoundException
  169. */
  170. public function detail(int $orderId)
  171. {
  172. // 订单详情
  173. $model = OrderModel::getUserOrderDetail($orderId);
  174. $ExpressModel = new ExpressModel;
  175. $express = [];
  176. $i = 0;
  177. if($model['delivery_status']==DeliveryStatusEnum::DELIVERED){//订单状态没有更改为已发货就不显示物流信息
  178. foreach ($model['goods'] as &$good){
  179. $refundCompensate = RefundCompensate::where('order_goods_id',$good['order_goods_id'])->where("finance_refund",10)->where("status",20)->find();
  180. if($refundCompensate){
  181. $good['compensate'] = ['refund_money'=>$refundCompensate->refund_money];
  182. }else{
  183. $good['compensate'] =null;
  184. }
  185. if($good['is_split_package']){
  186. foreach ($good['package'] as $pack){
  187. $express[$i] = $ExpressModel->deliverylist($pack['express_no'], $pack['delivery_time'], 2);
  188. $express[$i]['express_no'] = $pack['express_no'];
  189. $i++;
  190. }
  191. }else{
  192. if($good['express_no']){
  193. $express[$i] = $ExpressModel->deliverylist($good['express_no'], $good['delivery_time'], 2);
  194. $express[$i]['express_no'] = $good['express_no'];
  195. $i++;
  196. }
  197. }
  198. }
  199. }
  200. $model['express_list'] = $express;
  201. $express_no_list = array_values(array_filter(array_unique(helper::getArrayColumn($express, 'express_no'))));
  202. $model['express_no'] = implode(',',$express_no_list);
  203. OrderModel::restructureGoods($model);
  204. $model['has_receipt'] = ReceiptModel::ifApplyReceipt($orderId);
  205. $model['hx_qrcode_url'] = url('/api/order/getHxQrcode',['hxCode'=>$model['hx_code']], true, true)->build();
  206. if($model['delivery_type']==DeliveryType::SHOPS_DELIVERY){
  207. $model['shops'] = Shops::find($model['shop_id']);
  208. }
  209. return $this->renderSuccess([
  210. 'order' => $model, // 订单详情
  211. 'setting' => [
  212. // 积分名称
  213. 'points_name' => SettingModel::getPointsName(),
  214. ],
  215. ]);
  216. }
  217. /**
  218. * 检查订单核销状态
  219. */
  220. public function checkHxStatus(int $orderId)
  221. {
  222. // 订单详情
  223. $model = OrderModel::getDetail($orderId);
  224. if (empty($model)) {
  225. return $this->renderError("订单不存在");
  226. }
  227. $hx_status = $model['hx_status'];
  228. return $this->renderSuccess(compact('hx_status'));
  229. }
  230. /**
  231. * 核销码二维码地址
  232. */
  233. public function getHxQrcode(string $hxCode) {
  234. return OrderService::getHxQrcode($hxCode);
  235. }
  236. /**
  237. * 自制异业福利券核销码二维码地址
  238. */
  239. public function getHxWelQrcode($id) {
  240. return OrderService::getHxQrcode($id);
  241. }
  242. /**
  243. * 查看物流列表
  244. * @param int $orderId 订单ID
  245. * @return array|\think\response\Json
  246. * @throws BaseException
  247. * @throws \think\db\exception\DataNotFoundException
  248. * @throws \think\db\exception\DbException
  249. * @throws \think\db\exception\ModelNotFoundException
  250. */
  251. public function expressList(int $orderId)
  252. {
  253. // 订单信息
  254. $order = OrderModel::getDetail($orderId, ['goods' => ['image', 'package'], 'address']);
  255. if (!$order || $order['delivery_status']!=DeliveryStatusEnum::DELIVERED) {
  256. return $this->renderError('没有物流信息');
  257. }
  258. $orderService = new OrderService;
  259. //获取多个物流的最新信息
  260. $res = $orderService->getExpressList($order);
  261. return $this->renderSuccess($res);
  262. }
  263. /**
  264. * 查看物流详情
  265. * @param $orderId
  266. * @param $expressNo
  267. * @return array
  268. * @throws BaseException
  269. * @throws \think\db\exception\DataNotFoundException
  270. * @throws \think\db\exception\DbException
  271. * @throws \think\db\exception\ModelNotFoundException
  272. * @author: zjwhust
  273. * @Time: 2021/10/9 9:13
  274. */
  275. public function express($orderId, $expressNo)
  276. {
  277. // 订单信息
  278. $order = OrderModel::getDetail(intval($orderId), ['goods' => ['image', 'package'], 'address']);
  279. if (!$order || $order['delivery_status']!=DeliveryStatusEnum::DELIVERED) {
  280. return $this->renderError('没有物流信息');
  281. }
  282. $orderService = new OrderService;
  283. //获取多个物流的最新信息
  284. $res = $orderService->getExpressDetail($order, $expressNo);
  285. return $this->renderSuccess($res);
  286. }
  287. //获取物流的最新信息
  288. public function rcexpress($express_no){
  289. $orderService = new OrderService;
  290. $express = UserRiceDeliveryExpressModel::field('express_no,express_id,express_company,user_rice_delivery_id,delivery_time')->where("express_no",$express_no)->find();
  291. if(empty($express)){
  292. return $this->renderError("物流单号找不到");
  293. }
  294. $delivery_time = $express['delivery_time']??'';
  295. $delivery = UserRiceDeliveryModel::where('id',$express->user_rice_delivery_id)->find();
  296. $data = $orderService->getExpressInfo($express_no,$delivery_time);
  297. return $this->renderSuccess(['data'=>$data,'express'=>$express,'delivery'=>$delivery]);
  298. }
  299. /**
  300. * 取消订单
  301. * @param int $orderId
  302. * @return array|\think\response\Json
  303. * @throws BaseException
  304. */
  305. public function cancel(int $orderId)
  306. {
  307. $model = OrderModel::getDetail($orderId);
  308. if ($model->cancel()) {
  309. return $this->renderSuccess('订单取消成功');
  310. }
  311. return $this->renderError($model->getError() ?: '订单取消失败');
  312. }
  313. /**
  314. * 删除订单
  315. * @param int $orderId
  316. * @return array|\think\response\Json
  317. * @throws BaseException
  318. */
  319. public function delete(int $orderId)
  320. {
  321. $model = OrderModel::getDetail($orderId);
  322. if ($model->clear()) {
  323. return $this->renderSuccess('订单删除成功');
  324. }
  325. return $this->renderError($model->getError() ?: '订单删除失败');
  326. }
  327. /**
  328. * 确认收货
  329. * @param int $orderId
  330. * @return array|\think\response\Json
  331. * @throws BaseException
  332. */
  333. public function receipt(int $orderId)
  334. {
  335. $model = OrderModel::getDetail($orderId);
  336. if ($model->receipt()) {
  337. // //分佣结算逻辑
  338. // $cm = new GiveOutCommission();
  339. // $flag = $cm->confirmGoodsCommission($orderId);
  340. // if ($flag == false){
  341. // log_record('订单分佣结算失败:'.$orderId);
  342. // }
  343. // //order_goods的财务结算状态变更
  344. // OrderGoods::where('order_id',$orderId)->update(['finance_clearing_status'=>OrderGoods::FINANCE_CLEARING_WAIT]);
  345. return $this->renderSuccess('确认收货成功');
  346. }
  347. return $this->renderError($model->getError());
  348. }
  349. /**
  350. * 立即支付
  351. * @param int $orderId 订单ID
  352. * @param int $payType 支付方式
  353. * @return array|\think\response\Json
  354. * @throws BaseException
  355. * @throws \think\db\exception\DataNotFoundException
  356. * @throws \think\db\exception\DbException
  357. * @throws \think\db\exception\ModelNotFoundException
  358. */
  359. public function pay(int $orderId, int $payType = OrderPayTypeEnum::WECHAT)
  360. {
  361. // 获取订单详情
  362. $model = OrderModel::getUserOrderDetail($orderId);
  363. // 订单支付事件
  364. if (!$model->onPay($payType)) {
  365. return $this->renderError($model->getError() ?: '订单支付失败');
  366. }
  367. // 构建微信支付请求
  368. $payment = $model->onOrderPayment($model, $payType);
  369. // 支付状态提醒
  370. return $this->renderSuccess([
  371. 'order_id' => $model['order_id'], // 订单id
  372. 'pay_type' => $payType, // 支付方式
  373. 'payment' => $payment // 微信支付参数
  374. ]);
  375. }
  376. //统计rf
  377. public function rf(){
  378. $r1f1 = "select user_id,count(order_id) as c from yoshop_order
  379. where pay_status=20
  380. and pay_time>unix_timestamp(now())-7*86400
  381. GROUP BY user_id HAVING count(order_id)=1";
  382. $r1f2 = "select user_id,count(order_id) as c from yoshop_order
  383. where pay_status=20
  384. and pay_time>unix_timestamp(now())-7*86400
  385. GROUP BY user_id HAVING count(order_id)>=2 and count(order_id)<5";
  386. $r1f3 = "select user_id,count(order_id) as c from yoshop_order
  387. where pay_status=20
  388. and pay_time>unix_timestamp(now())-7*86400
  389. GROUP BY user_id HAVING count(order_id)>=5";
  390. $r2f1 = "select user_id,count(order_id) as c from yoshop_order
  391. where pay_status=20
  392. and pay_time<unix_timestamp(now())-7*86400
  393. and pay_time>unix_timestamp(now())-60*86400
  394. GROUP BY user_id HAVING count(order_id)=1";
  395. $r2f2 = "select user_id,count(order_id) as c from yoshop_order
  396. where pay_status=20
  397. and pay_time<unix_timestamp(now())-7*86400
  398. and pay_time>unix_timestamp(now())-60*86400
  399. GROUP BY user_id HAVING count(order_id)>=2 and count(order_id)<5";
  400. $r2f3 = "select user_id,count(order_id) as c from yoshop_order
  401. where pay_status=20
  402. and pay_time<unix_timestamp(now())-7*86400
  403. and pay_time>unix_timestamp(now())-60*86400
  404. GROUP BY user_id HAVING count(order_id)>=5";
  405. $r3f1 = "select user_id,count(order_id) as c from yoshop_order
  406. where pay_status=20
  407. and pay_time<unix_timestamp(now())-60*86400
  408. GROUP BY user_id HAVING count(order_id)=1";
  409. $r3f2 = "select user_id,count(order_id) as c from yoshop_order
  410. where pay_status=20
  411. and pay_time<unix_timestamp(now())-60*86400
  412. GROUP BY user_id HAVING count(order_id)>=2 and count(order_id)<5";
  413. $r3f3 = "select user_id,count(order_id) as c from yoshop_order
  414. where pay_status=20
  415. and pay_time<unix_timestamp(now())-60*86400
  416. GROUP BY user_id HAVING count(order_id)>=5";
  417. $result11 = Db::query($r1f1);
  418. $result12 = Db::query($r1f2);
  419. $result13 = Db::query($r1f3);
  420. $result21 = Db::query($r2f1);
  421. $result22 = Db::query($r2f2);
  422. $result23 = Db::query($r2f3);
  423. $result31 = Db::query($r3f1);
  424. $result32 = Db::query($r3f2);
  425. $result33 = Db::query($r3f3);
  426. // var_dump(count($result11));
  427. // var_dump(count($result12));
  428. // var_dump(count($result13));
  429. $r11 = count($result11);
  430. $r12 = count($result12);
  431. $r13 = count($result13);
  432. $r21 = count($result21);
  433. $r22 = count($result22);
  434. $r23 = count($result23);
  435. // var_dump(count($result21));
  436. // var_dump(count($result22));
  437. // var_dump(count($result23));
  438. // var_dump(count($result31));
  439. // var_dump(count($result32));
  440. // var_dump(count($result33));
  441. $r31 = count($result31);
  442. $r32 = count($result32);
  443. $r33 = count($result33);
  444. $data[] = ['r11'=>$r11,"r12"=>$r12,"r13"=>$r13,'r1'=>$r11+$r12+$r13];
  445. $data[] = ['r21'=>$r21,"r22"=>$r22,"r23"=>$r23,'r2'=>$r21+$r22+$r23];
  446. $data[] = ['r31'=>$r31,"r32"=>$r32,"r33"=>$r33,'r3'=>$r31+$r32+$r33];
  447. return $this->renderSuccess(compact('data'));
  448. }
  449. //统计rm
  450. public function rm(){
  451. $r1f1 = "select user_id,sum(pay_price+rice_card_money) from yoshop_order
  452. where pay_status=20
  453. and pay_time>unix_timestamp(now())-7*86400
  454. GROUP BY user_id HAVING sum(pay_price+rice_card_money)<200";
  455. $r1f2 = "select user_id,count(order_id) as c from yoshop_order
  456. where pay_status=20
  457. and pay_time>unix_timestamp(now())-7*86400
  458. GROUP BY user_id HAVING sum(pay_price+rice_card_money)>=200 and sum(pay_price+rice_card_money)<1000";
  459. $r1f3 = "select user_id,count(order_id) as c from yoshop_order
  460. where pay_status=20
  461. and pay_time>unix_timestamp(now())-7*86400
  462. GROUP BY user_id HAVING sum(pay_price+rice_card_money)>=1000";
  463. $r2f1 = "select user_id,sum(pay_price+rice_card_money) from yoshop_order
  464. where pay_status=20
  465. and pay_time>unix_timestamp(now())-60*86400
  466. and pay_time<unix_timestamp(now())-7*86400
  467. GROUP BY user_id HAVING sum(pay_price+rice_card_money)<200";
  468. $r2f2 ="select user_id,sum(pay_price+rice_card_money) from yoshop_order
  469. where pay_status=20
  470. and pay_time>unix_timestamp(now())-60*86400
  471. and pay_time<unix_timestamp(now())-7*86400
  472. GROUP BY user_id HAVING sum(pay_price+rice_card_money)>=200 and sum(pay_price+rice_card_money)<1000";
  473. $r2f3 = "select user_id,sum(pay_price+rice_card_money) from yoshop_order
  474. where pay_status=20
  475. and pay_time>unix_timestamp(now())-60*86400
  476. and pay_time<unix_timestamp(now())-7*86400
  477. GROUP BY user_id HAVING sum(pay_price+rice_card_money)>=1000";
  478. $r3f1 = "select user_id,sum(pay_price+rice_card_money) from yoshop_order
  479. where pay_status=20
  480. and pay_time<unix_timestamp(now())-60*86400
  481. GROUP BY user_id HAVING sum(pay_price+rice_card_money)<200";
  482. $r3f2 ="select user_id,sum(pay_price+rice_card_money) from yoshop_order
  483. where pay_status=20
  484. and pay_time<unix_timestamp(now())-60*86400
  485. GROUP BY user_id HAVING sum(pay_price+rice_card_money)>=200 and sum(pay_price+rice_card_money)<1000";
  486. $r3f3 = "select user_id,sum(pay_price+rice_card_money) from yoshop_order
  487. where pay_status=20
  488. and pay_time<unix_timestamp(now())-60*86400
  489. GROUP BY user_id HAVING sum(pay_price+rice_card_money)>=1000";
  490. $result11 = Db::query($r1f1);
  491. $result12 = Db::query($r1f2);
  492. $result13 = Db::query($r1f3);
  493. $result21 = Db::query($r2f1);
  494. $result22 = Db::query($r2f2);
  495. $result23 = Db::query($r2f3);
  496. $result31 = Db::query($r3f1);
  497. $result32 = Db::query($r3f2);
  498. $result33 = Db::query($r3f3);
  499. // var_dump(count($result11));
  500. // var_dump(count($result12));
  501. // var_dump(count($result13));
  502. $r11 = count($result11);
  503. $r12 = count($result12);
  504. $r13 = count($result13);
  505. $r21 = count($result21);
  506. $r22 = count($result22);
  507. $r23 = count($result23);
  508. // var_dump(count($result21));
  509. // var_dump(count($result22));
  510. // var_dump(count($result23));
  511. // var_dump(count($result31));
  512. // var_dump(count($result32));
  513. // var_dump(count($result33));
  514. $r31 = count($result31);
  515. $r32 = count($result32);
  516. $r33 = count($result33);
  517. $data[] = ['r11'=>$r11,"r12"=>$r12,"r13"=>$r13,'r1'=>$r11+$r12+$r13];
  518. $data[] = ['r21'=>$r21,"r22"=>$r22,"r23"=>$r23,'r2'=>$r21+$r22+$r23];
  519. $data[] = ['r31'=>$r31,"r32"=>$r32,"r33"=>$r33,'r3'=>$r31+$r32+$r33];
  520. return $this->renderSuccess(compact('data'));
  521. }
  522. }