|
|
|
|
@ -196,7 +196,9 @@ class SupplyDemandController extends BaseController
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Parameter(name="start_date", in="query", @OA\Schema(type="string"), required=true, description="开始日期"),
|
|
|
|
|
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=true, description="结束日期"),
|
|
|
|
|
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=true, description="type类型"),
|
|
|
|
|
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
|
|
|
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
@ -266,7 +268,18 @@ class SupplyDemandController extends BaseController
|
|
|
|
|
$messageGrowthRate = $this->calculateGrowthRate($messageCount, $prevMessageCount);
|
|
|
|
|
$interactionGrowthRate = $this->calculateGrowthRate($interactionCount, $prevInteractionCount);
|
|
|
|
|
|
|
|
|
|
// 当期供需发布分页
|
|
|
|
|
$list = SupplyDemand::with(['user', 'messages' => function ($query) {
|
|
|
|
|
$query->with('user', 'toUser')->limit(2)->orderBy('created_at', 'desc');
|
|
|
|
|
}])->where(function ($query) use ($type) {
|
|
|
|
|
if ($type) {
|
|
|
|
|
$query->where('type', $type);
|
|
|
|
|
}
|
|
|
|
|
})->whereBetween('created_at', [$startDate, $endDate])
|
|
|
|
|
->paginate($all['page_size'] ?? 20);
|
|
|
|
|
|
|
|
|
|
return $this->success([
|
|
|
|
|
'list' => $list,
|
|
|
|
|
'supply_demand_count' => $supplyDemandCount,
|
|
|
|
|
'prev_supply_demand_count' => $prevSupplyDemandCount,
|
|
|
|
|
'supply_demand_growth_rate' => $supplyDemandGrowthRate,
|
|
|
|
|
|