|
@@ -86,17 +86,20 @@ class Price
|
|
|
public function getDiscount($price, $vip, $agent)
|
|
|
{
|
|
|
$result = array();
|
|
|
- # 获取会员价
|
|
|
- if ($vip && isset($vip[Place::$user['vip_id']])) {
|
|
|
- $price = $vip[Place::$user['vip_id']][1];
|
|
|
- }
|
|
|
- # 获取代理价
|
|
|
- if ($agent && isset($agent[Place::$user['agent_id']])) {
|
|
|
- $agent_price = $agent[Place::$user['agent_id']][1];
|
|
|
- if ($agent_price < $price) {
|
|
|
- $price = $agent_price;
|
|
|
+ if (Place::$uid) {
|
|
|
+ # 获取会员价
|
|
|
+ if ($vip && isset($vip[Place::$user['vip_id']])) {
|
|
|
+ $price = $vip[Place::$user['vip_id']][1];
|
|
|
+ }
|
|
|
+ # 获取代理价
|
|
|
+ if ($agent && isset($agent[Place::$user['agent_id']])) {
|
|
|
+ $agent_price = $agent[Place::$user['agent_id']][1];
|
|
|
+ if ($agent_price < $price) {
|
|
|
+ $price = $agent_price;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
# 获取折扣+代金券的价格,暂时没有
|
|
|
return $price;
|
|
|
}
|
|
@@ -118,7 +121,7 @@ class Price
|
|
|
public function getValue($value, $price, $type)
|
|
|
{
|
|
|
if ($type == 3) {
|
|
|
- return number_format($price * ($value/100), 2);
|
|
|
+ return $value ? number_format($price * ($value/100), 2) : 0.00;
|
|
|
} elseif ($value || $value === '0') {
|
|
|
return number_format($value, 2);
|
|
|
}
|