|
|
@@ -60,8 +60,19 @@ class ItemController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$id = $get['id'] ?? 0;
|
|
|
$item = ItemClass::getById($id, true);
|
|
|
- $price = $item->skPrice ?? 0;
|
|
|
- $price = floatval($price);
|
|
|
+ if (empty($item)) {
|
|
|
+ util::stop('');
|
|
|
+ }
|
|
|
+ if (isset($item->discountPrice) && $item->discountPrice > 0) {
|
|
|
+ $price = $item->discountPrice;
|
|
|
+ $skMore = $item->skMore;
|
|
|
+ $skPrice = bcadd($price, $skMore, 2);
|
|
|
+ $skPrice = floatval($skPrice);
|
|
|
+ } else {
|
|
|
+ $skPrice = $item->skPrice ?? 0;
|
|
|
+ $skPrice = floatval($skPrice);
|
|
|
+ }
|
|
|
+
|
|
|
$name = $item->name ?? '';
|
|
|
|
|
|
$classId = $item->classId ?? 0;
|
|
|
@@ -69,7 +80,7 @@ class ItemController extends BaseController
|
|
|
$className = $class->name ?? '';
|
|
|
|
|
|
echo '<div style="font-size:80px;margin-top:80px;margin-left:60px;">' . $name . '</div>';
|
|
|
- echo '<div style="font-size:80px;margin-top:30px;margin-left:60px;color:red;">' . $price . '元</div>';
|
|
|
+ echo '<div style="font-size:80px;margin-top:30px;margin-left:60px;color:red;">' . $skPrice . '元</div>';
|
|
|
echo '<div style="font-size:60px;margin-top:50px;margin-left:60px;">' . $className . '</div>';
|
|
|
}
|
|
|
|