diff --git a/app/gateway/controller/v4/Core.php b/app/gateway/controller/v4/Core.php index 8ea7e62..070fabd 100644 --- a/app/gateway/controller/v4/Core.php +++ b/app/gateway/controller/v4/Core.php @@ -151,11 +151,7 @@ class Core extends Controller $this->getMerchant(); - #验证安全进价是否匹配 - if ($this->product && $this->product != 'query' && $this->product != '' && isset($this->input['safe_price'])) { - $safe_price = $this->input['safe_price']; -// $actual_price = ; - } + } /** @@ -204,6 +200,41 @@ class Core extends Controller $this->no($signature); } + #签名结束 + + #验证安全进价是否匹配 + if ($this->product && $this->product != 'query' && $this->product != '' && isset($this->input['safe_price']) && isset($this->input['cash'])) { + $safe_price = $this->input['safe_price']; + $info = PercentService::instance()->get($this->mid, $this->product); + $percent_type = 1; + if ($info && $info['percent']) { + $percent = $info['percent']; + if (isset($info['percent_type']) && $info['percent_type']) { + $percent_type = $info['percent_type']; + } + if($this->product == 'dhcz'){ + $percent = MerchantService::instance()->getPercent($percent, $this->input['mobile'], $this->product, $this->input['cash'], $info['rule']); + }else{ + $percent = MerchantService::instance()->getPercent($percent, '', $this->product, $this->input['cash'], $info['rule']); + } + + } + + $new_cash = $this->input['cash']; + if (isset($percent) && $percent > 0) { + if ($percent_type == 2) { + $new_cash = $percent; + } else { + $new_cash = $percent*$this->input['cash']; + } + } + #对比 + if($safe_price < $new_cash){ + $this->no(-201); + } + + } + // 检测如果商户开启了特定商品指定携转检测,则进入此验证 if (isset($this->merchant['other_param']) && str_contains($this->merchant['other_param'], 'mnp_SProduct_isp')) {