|
|
|
@ -3,9 +3,11 @@ |
|
|
|
|
namespace app\api\service\statistics; |
|
|
|
|
|
|
|
|
|
use app\api\model\Order; |
|
|
|
|
use app\api\model\user\IdentityOrder; |
|
|
|
|
use app\common\enum\order\OrderStatus; |
|
|
|
|
use app\common\enum\order\OrderStatus as OrderStatusEnum; |
|
|
|
|
use app\common\enum\order\PayStatus as PayStatusEnum; |
|
|
|
|
use app\common\enum\user\IdentityEnum; |
|
|
|
|
use app\common\service\BaseService; |
|
|
|
|
|
|
|
|
|
class OrderData extends BaseService |
|
|
|
@ -27,15 +29,15 @@ class OrderData extends BaseService |
|
|
|
|
//下单总数 |
|
|
|
|
"orderCount" => $this->getPayOrderTotal($startDate, $endDate), |
|
|
|
|
//下单人数 |
|
|
|
|
'orderPayUser' => $this->getConsumeUsers($startDate, $endDate), |
|
|
|
|
'orderPayUser' => $this->getConsumeUsers(), |
|
|
|
|
//订单成本金额 |
|
|
|
|
'orderCostMoney' => 0, |
|
|
|
|
//预估利益 |
|
|
|
|
'orderInterest' => 0, |
|
|
|
|
//付费会员数 |
|
|
|
|
'payMemberCount' => 0, |
|
|
|
|
'payMemberCount' => $this->getPayCount(IdentityEnum::MEMBER, $startDate, $endDate), |
|
|
|
|
//付费分销商数 |
|
|
|
|
'payDealerCount' => 0 |
|
|
|
|
'payDealerCount' => $this->getPayCount(IdentityEnum::DEALER, $startDate, $endDate) |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -108,5 +110,17 @@ class OrderData extends BaseService |
|
|
|
|
->count(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 付费会员数 |
|
|
|
|
*/ |
|
|
|
|
public function getPayCount($order_type, $startDate = null, $endDate = null) : int { |
|
|
|
|
$query = new IdentityOrder(); |
|
|
|
|
if(!empty($startDate) && !empty($endDate)) { |
|
|
|
|
$query->where('create_time', '>=', strtotime($startDate)) |
|
|
|
|
->where('create_time', '<', strtotime($endDate) + 86400); |
|
|
|
|
} |
|
|
|
|
return $query->where('order_type', '=', $order_type)->count(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |