|
@@ -50,6 +50,7 @@ class CalcPrice implements ICalc
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private function order_num()
|
|
|
{
|
|
|
if($this->mUserId <= 0) return 0;
|
|
@@ -81,6 +82,15 @@ class CalcPrice implements ICalc
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private function first_order($goods_id)
|
|
|
+ {
|
|
|
+ if($this->mOrderCount == 0) return false;
|
|
|
+
|
|
|
+ $share_policy = $this->share_policy($goods_id);
|
|
|
+
|
|
|
+ return empty($share_policy) ? false : $share_policy[0];
|
|
|
+ }
|
|
|
+
|
|
|
public function left_invitees()
|
|
|
{
|
|
|
if($this->mUserId <= 0 || $this->mMemberInfo == null) {
|
|
@@ -221,14 +231,6 @@ class CalcPrice implements ICalc
|
|
|
|
|
|
public function inviter_tips($goods_id)
|
|
|
{
|
|
|
-// $now = time();
|
|
|
-// $nine = strtotime(date('Y-m-d',$now)) + 9*3600;
|
|
|
-// $twenty_first = strtotime(date('Y-m-d',$now)) + 21*3600;
|
|
|
-//
|
|
|
-// if($now < $nine || $now > $twenty_first) {
|
|
|
-// return '试营业时间为9:00--21:00,其它时间会慢';
|
|
|
-// }
|
|
|
-
|
|
|
if($this->mCalcType == self::CalcTypeNormal || $this->mCalcType == self::CalcTypeInvitees)
|
|
|
{
|
|
|
$left_invitees = $this->left_invitees();
|
|
@@ -247,7 +249,7 @@ class CalcPrice implements ICalc
|
|
|
|
|
|
if(empty($next)) {
|
|
|
$discount = $cur['discount'];
|
|
|
- $tip = "您已领补贴{$discount}元";
|
|
|
+ $tip = "您已省{$discount}元,已经最优惠~";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -255,16 +257,23 @@ class CalcPrice implements ICalc
|
|
|
$discount = $next['discount'];
|
|
|
|
|
|
if(empty($cur)) {
|
|
|
- $tip = "成功分享{$count}人,可领补贴{$discount}元";
|
|
|
+ $tip = "邀请{$count}人注册,可省{$discount}元";
|
|
|
}
|
|
|
else {
|
|
|
- $tip = "已领补贴{$cur['discount']}元,再分享{$count}人,可领补贴{$discount}元";
|
|
|
+ $discount = $discount - $cur['discount'];
|
|
|
+ $tip = "已省{$cur['discount']}元,再邀请{$count}人注册,还能省{$discount}元";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return $tip;
|
|
|
- } else {
|
|
|
- return "";
|
|
|
+ return [$tip,true];
|
|
|
+ }
|
|
|
+ elseif($this->mCalcType == self::CalcTypeFirstOrder) {
|
|
|
+ $share_policy = $this->first_order($goods_id);
|
|
|
+ $tip = "已领新人优惠券,现在充值可省{$share_policy['discount']}元";
|
|
|
+ return [$tip,false];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return ['',true];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -283,10 +292,15 @@ class CalcPrice implements ICalc
|
|
|
$price = $this->mUserCards->calc_price($goods_id, $goods_price);
|
|
|
return ['price_des' => '会员价', 'accu_price' => round($price,2)];
|
|
|
}
|
|
|
+ elseif(!empty($policy = $this->first_order($goods_id))) {
|
|
|
+ $this->mCalcType = self::CalcTypeFirstOrder;
|
|
|
+ $price = $policy['price'];
|
|
|
+ return ['price_des' => '优惠价', 'accu_price' => round($price,2)];
|
|
|
+ }
|
|
|
elseif(!empty($policy = $this->select_invitees($goods_id))) {
|
|
|
$this->mCalcType = self::CalcTypeInvitees;
|
|
|
$price = $policy['price'];
|
|
|
- return ['price_des' => '补贴价', 'accu_price' => round($price,2)];
|
|
|
+ return ['price_des' => '优惠价', 'accu_price' => round($price,2)];
|
|
|
}
|
|
|
else {
|
|
|
$this->mCalcType = self::CalcTypeNormal;
|
|
@@ -323,6 +337,11 @@ class CalcPrice implements ICalc
|
|
|
$goods_price = $this->goods_spec_amount($goods_id,$goods_price);
|
|
|
return $this->mUserCards->calc_amount($goods_id, $goods_price * $num);
|
|
|
}
|
|
|
+ elseif(!empty($policy = $this->first_order($goods_id))) {
|
|
|
+ $this->mCalcType = self::CalcTypeFirstOrder;
|
|
|
+ $price = $policy['price'];
|
|
|
+ return round($price * $num,2);
|
|
|
+ }
|
|
|
elseif(!empty($policy = $this->select_invitees($goods_id))) {
|
|
|
$this->mCalcType = self::CalcTypeInvitees;
|
|
|
$price = $policy['price'];
|