|
@@ -73,7 +73,7 @@ class Flash extends Base
|
|
|
'product' => function ($query) use($fid) {
|
|
|
//$query->with('product')->where(['switch' => FlashProduct::SWITCH_ON]);
|
|
|
$query->alias('fp')->join('unishop_product p', 'fp.product_id = p.id')
|
|
|
- ->field('fp.id,fp.flash_id,fp.product_id,p.image,p.title,p.sales_price,p.category_id')
|
|
|
+ ->field('fp.id,fp.flash_id,fp.product_id,fp.sold,fp.number,p.image,p.title,p.sales_price,p.category_id')
|
|
|
->where([
|
|
|
'fp.switch' => FlashProduct::SWITCH_ON,
|
|
|
'p.deletetime' => NULL
|
|
@@ -90,6 +90,9 @@ class Flash extends Base
|
|
|
$flash = $flash->toArray();
|
|
|
foreach ($flash['product'] as &$product) {
|
|
|
$product['image'] = Config::getImagesFullUrl($product['image']);
|
|
|
+
|
|
|
+ $product['sold'] = $product['sold'] > $product['number'] ? $product['number'] : $product['sold'];
|
|
|
+ $product['bili'] = bcdiv($product['sold'],$product['number'],1).'%';
|
|
|
}
|
|
|
|
|
|
// 寻找下一场的倒计时
|