|
|
|
@ -51,11 +51,12 @@ class OrderData extends Card |
|
|
|
public function getOrderData($params,$option) |
|
|
|
{ |
|
|
|
//如果市场id存在
|
|
|
|
if ($params['market_id']) { |
|
|
|
$buildData = $this->buildData(); |
|
|
|
if ($params['market_id']) {//是否存在市场id
|
|
|
|
if (is_array($params['market_id'])) { |
|
|
|
$condition[] = ['in' => ['market_id' => $params['market_id']]]; |
|
|
|
$buildData = $buildData->whereIn('lanzu_order_main.market_id',$params['market_id']); |
|
|
|
} else { |
|
|
|
$condition['market_id'] = $params['market_id']; |
|
|
|
$buildData = $buildData->where('lanzu_order_main.market_id',$params['market_id']); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($params['user_type']=='lanzu_cs'||$params['user_type']=='lanzu_biz'){//社区角色
|
|
|
|
@ -63,27 +64,26 @@ class OrderData extends Card |
|
|
|
list($beginTime,$endTime) = $this->beginAndEnd($option); |
|
|
|
//>>2.构建数据模型
|
|
|
|
if ($params['user_ids']){ |
|
|
|
$condition[] = ['in'=>['lanzu_order_main.user_id'=>$params['user_ids']]]; |
|
|
|
$buildData = $buildData->whereIn('lanzu_order_main.user_id',$params['user_ids']); |
|
|
|
}else{ |
|
|
|
return 0; |
|
|
|
} |
|
|
|
$buildData = $this->buildData($condition); |
|
|
|
$buildData = $buildData |
|
|
|
->leftJoin('lanzu_user_relation_bind','lanzu_user_relation_bind.user_id','lanzu_order_main.user_id') |
|
|
|
->whereRaw('lanzu_order_main.created_at > lanzu_user_relation_bind.created_at') |
|
|
|
->groupBy('lanzu_order_main.user_id') |
|
|
|
->whereBetween('lanzu_order_main.created_at',[$beginTime,$endTime]); |
|
|
|
} |
|
|
|
}elseif ($params['user_type']=='market_service'||$params['user_type']=='lanzu_mp'){//市场服务站角色
|
|
|
|
}elseif ($params['user_type']=='market_service'||$params['user_type']=='lanzu_mp'){//市场服务站角色 及服务商
|
|
|
|
if ($params['condition']==1){//获取时间范围
|
|
|
|
list($beginTime,$endTime) = $this->beginAndEnd($option); |
|
|
|
//>>2.构建数据模型
|
|
|
|
$buildData = $this->buildData($condition); |
|
|
|
$buildData = $buildData->whereBetween('created_at',[$beginTime,$endTime]); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($params['data_type']=='count_user'){ |
|
|
|
$result = $buildData->pluck('lanzu_order_main.user_id')->toArray(); |
|
|
|
$result = $buildData->pluck('lanzu_order_main.user_id') |
|
|
|
->groupBy('lanzu_order_main.user_id') |
|
|
|
->toArray(); |
|
|
|
$result = count($result); |
|
|
|
}elseif ($params['data_type']=='number'){ |
|
|
|
$result = $buildData->count(); |
|
|
|
@ -142,12 +142,11 @@ class OrderData extends Card |
|
|
|
* @param $condition |
|
|
|
* @return mixed |
|
|
|
*/ |
|
|
|
public function buildData($condition) |
|
|
|
public function buildData() |
|
|
|
{ |
|
|
|
$build = ImsCjdcOrderMain |
|
|
|
::whereIn('state', [3, 4, 5, 10]) |
|
|
|
->where('type',1) |
|
|
|
->where($condition); |
|
|
|
->where('type',1); |
|
|
|
return $build; |
|
|
|
} |
|
|
|
|
|
|
|
|