12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace App\Http\Controllers\Channel\Trade;
- use App\Http\Controllers\Channel\BaseController;
- use App\Http\Controllers\Channel\Trade\Transformers\OrdersRechargeTransformer;
- use App\Http\Controllers\Channel\Trade\Transformers\OrderStatTransformer;
- use App\Http\Controllers\Channel\Trade\Transformers\OrderTransformer;
- use App\Modules\SendOrder\Services\SendOrderForceDayStatService;
- use App\Modules\SendOrder\Services\SendOrderService;
- use App\Modules\SendOrder\Services\SendOrderStatService;
- use App\Modules\Trade\Services\OrderStatService;
- use App\Modules\Channel\Services\ChannelService;
- use Illuminate\Http\Request;
- class OrderStatController extends BaseController
- {
-
-
- function getChannelTotalStat(Request $request)
- {
- $channel_user_id = $this->getChannelUserId();
- if(!$channel_user_id) return response()->error('PARAM_ERROR');
- $distribution_channel_ids = ChannelService::getUserChannelIds($channel_user_id);
- $stats = OrderStatService::getChannelTotalStat($distribution_channel_ids);
- $stats->cost_sum = SendOrderService::getCostStats($distribution_channel_ids);
- return response()->item(new OrderStatTransformer(), $stats);
- }
- public function getSendOrdersRechargeStats(Request $request) {
- $channel_user_id = $this->getChannelUserId();
- if(!$channel_user_id) return response()->error('PARAM_ERROR');
- $distribution_channel_ids = ChannelService::getUserChannelIdsV2($channel_user_id);
- $stats = SendOrderStatService::getSendOrdersRechargeDetail($distribution_channel_ids);
- return response()->pagination(new OrdersRechargeTransformer(),$stats);
- }
- public function exportSendOrdersRechargeStats(){
- $channel_user_id = $this->getChannelUserId();
- if(!$channel_user_id) return response()->error('PARAM_ERROR');
- $distribution_channel_ids = ChannelService::getUserChannelIdsV2($channel_user_id);
- $stats = SendOrderStatService::exportSendOrdersRechargeDetail($distribution_channel_ids);
- saveExcelData($stats['header'],$stats['data'],'');
- }
- }
|