Skip to content

Commit 39b91de

Browse files
author
xxx
committed
fixed: 成交量排名统计api的Bug
1 parent 9584517 commit 39b91de

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/Http/Controllers/Backend/Api/V2/StatsController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,12 @@ public function transactionTop(Request $request)
129129
$tableOrders = TableConstant::TABLE_ORDERS;
130130
$tableOrderGoods = TableConstant::TABLE_ORDER_GOODS;
131131

132+
$queryParams = [];
133+
132134
$goodsTypeSql = '';
133135
if ($goodsType) {
134-
$goodsTypeSql = ' and ' . $tableOrderGoods . ".goods_type='{$goodsType}' ";
136+
$goodsTypeSql = ' and ' . $tableOrderGoods . '.goods_type=? ';
137+
$queryParams[] = $goodsType;
135138
}
136139

137140
$countSql = <<<SQL
@@ -161,8 +164,8 @@ public function transactionTop(Request $request)
161164
limit {$offset},{$size};
162165
SQL;
163166

164-
$count = DB::selectOne($countSql);
165-
$result = DB::select($sql);
167+
$count = DB::selectOne($countSql, $queryParams);
168+
$result = DB::select($sql, $queryParams);
166169

167170
return $this->successData([
168171
'data' => $result,

0 commit comments

Comments
 (0)