算力套餐列表优化
This commit is contained in:
@@ -20,14 +20,14 @@ class TokensController extends BaseController
|
||||
];
|
||||
$query = TokensPackage::where($where);
|
||||
$total = $query->count();
|
||||
$list = $query->where($where)->page($page, $limit)->order('id desc')->select();
|
||||
$list = $query->where($where)->page($page, $limit)->order('sort ASC,id desc')->select();
|
||||
foreach ($list as &$item) {
|
||||
$item['description'] = json_decode($item['description'], true);
|
||||
$item['discount'] = round(((($item['originalPrice'] - $item['price']) / $item['originalPrice']) * 100),2);
|
||||
$price = round($item['price'] / 100,2);
|
||||
$item['price'] = number_format($price, 2);
|
||||
$item['unitPrice'] = round($price / $item['tokens'],6);
|
||||
$item['originalPrice'] = number_format($item['originalPrice'] / 100, 2);
|
||||
$item['price'] = round( $item['price'], 2);
|
||||
$item['unitPrice'] = round( $item['price'] / $item['tokens'],6);
|
||||
$item['originalPrice'] = round($item['originalPrice'] / 100, 2);
|
||||
$item['tokens'] = number_format($item['tokens']);
|
||||
}
|
||||
unset($item);
|
||||
return ResponseHelper::success(['list' => $list, 'total' => $total]);
|
||||
|
||||
Reference in New Issue
Block a user