|
|
|
@ -8,6 +8,7 @@ use App\Constants\v3\OrderState; |
|
|
|
use App\Constants\v3\OrderType; |
|
|
|
use App\Constants\v3\SsdbKeys; |
|
|
|
use App\Constants\v3\Tabs; |
|
|
|
use App\Constants\v3\UserType; |
|
|
|
use App\Controller\BaseController; |
|
|
|
use App\Model\v3\FinancialRecord; |
|
|
|
use App\Model\v3\Market; |
|
|
|
@ -20,6 +21,7 @@ use App\Service\v3\Interfaces\BannerServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\CategoryServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\CouponRecServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\FinancialRecordServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\OrderOnlineServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\OrderStatisticsServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\RevenueListServiceInterface; |
|
|
|
@ -113,6 +115,12 @@ class HomeController extends BaseController |
|
|
|
*/ |
|
|
|
protected $badgeService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Inject |
|
|
|
* @var FinancialRecordServiceInterface |
|
|
|
*/ |
|
|
|
protected $financialRecordService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 小程序首页,根据market_id |
|
|
|
* 1.banner数据 |
|
|
|
@ -211,20 +219,23 @@ class HomeController extends BaseController |
|
|
|
//统计订单金额
|
|
|
|
$type = [ |
|
|
|
FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP, |
|
|
|
FinancialRecord::MONEY_TYPE_STORE_OFL_ORDER_COMP |
|
|
|
FinancialRecord::MONEY_TYPE_STORE_OFL_ORDER_COMP, |
|
|
|
FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_DIRECT_REFUND, |
|
|
|
]; |
|
|
|
$data['order_online']['total'] = 0; |
|
|
|
$data['order_offline']['total'] = 0; |
|
|
|
$revenueByOrder = $this->revenueListService->getRevenueByUser($userId,$type,$dayStartTime,$dayEndTime); |
|
|
|
foreach ($revenueByOrder as $order){ |
|
|
|
if($order['money_type'] == FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP){ |
|
|
|
//线上订单
|
|
|
|
$data['order_online']['total'] = bcadd($data['order_online']['total'],$order['money'],2); |
|
|
|
}else if($order['money_type'] == FinancialRecord::MONEY_TYPE_STORE_OFL_ORDER_COMP){ |
|
|
|
//线下订单
|
|
|
|
$data['order_offline']['total'] = bcadd($data['order_offline']['total'],$order['money'],2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$sumAmounts = $this->financialRecordService->sumAmountGroup($userId, UserType::STORE, $type, $dayStartTime, $dayEndTime); |
|
|
|
$data['order_online']['total'] = bcsub($sumAmounts[FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP],$sumAmounts[FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_DIRECT_REFUND], 2); |
|
|
|
$data['order_offline']['total'] = $sumAmounts[FinancialRecord::MONEY_TYPE_STORE_OFL_ORDER_COMP]; |
|
|
|
// $revenueByOrder = $this->revenueListService->getRevenueByUser($userId,$type,$dayStartTime,$dayEndTime);
|
|
|
|
// foreach ($revenueByOrder as $order){
|
|
|
|
// if($order['money_type'] == FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP){
|
|
|
|
// //线上订单
|
|
|
|
// $data['order_online']['total'] = bcadd($data['order_online']['total'],$order['money'],2);
|
|
|
|
// }else if($order['money_type'] == FinancialRecord::MONEY_TYPE_STORE_OFL_ORDER_COMP){
|
|
|
|
// //线下订单
|
|
|
|
// $data['order_offline']['total'] = bcadd($data['order_offline']['total'],$order['money'],2);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//统计新增用户 无法筛选时间 所以和订单分开查询
|
|
|
|
$revenueByNewUsers = $this->revenueListService->getRevenueByUser($userId,[FinancialRecord::MONEY_TYPE_STORE_PLAT_NEW_USER]); |
|
|
|
$data['new_user'] = [ |
|
|
|
|