|
@@ -8,11 +8,13 @@ class merchant_price
|
|
|
{
|
|
|
private $mPrices;
|
|
|
private $mExtraPrices;
|
|
|
+ private $mMaxInPrices;
|
|
|
|
|
|
public function __construct()
|
|
|
{
|
|
|
$this->mPrices = [];
|
|
|
$this->mExtraPrices = [];
|
|
|
+ $this->mMaxInPrices = [];
|
|
|
}
|
|
|
|
|
|
public function load($mchids)
|
|
@@ -40,6 +42,9 @@ class merchant_price
|
|
|
$card_types = $item['card_types'];
|
|
|
$price = ncPriceFormat($item['price']);
|
|
|
$extra_price = ncPriceFormat($item['extra_price']);
|
|
|
+ $max_inprice = ncPriceFormat($item['max_inprice']);
|
|
|
+
|
|
|
+ $max_inprice = $max_inprice <= 0.00001 ? $price : $max_inprice;
|
|
|
|
|
|
$spec = intval($item['spec']);
|
|
|
$quality = intval($item['quality']);
|
|
@@ -49,6 +54,7 @@ class merchant_price
|
|
|
$key = "{$mchid}-{$quality}-{$card_type}-{$spec}";
|
|
|
$this->mPrices[$key] = $price;
|
|
|
$this->mExtraPrices[$key] = $extra_price;
|
|
|
+ $this->mMaxInPrices[$key] = $max_inprice;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -57,7 +63,7 @@ class merchant_price
|
|
|
public function price($mchid,$card_type,$spec,$quality,$pcode)
|
|
|
{
|
|
|
$card_type = intval($card_type);
|
|
|
- if(in_array($card_type,[1,2,4,5,6])) //油,话费价格查找.
|
|
|
+ if (in_array($card_type, [1, 2, 4, 5, 6], true)) //油,话费价格查找.
|
|
|
{
|
|
|
$key = "{$mchid}-{$quality}-{$card_type}-{$spec}";
|
|
|
if (array_key_exists($key, $this->mPrices)) {
|
|
@@ -92,7 +98,7 @@ class merchant_price
|
|
|
public function extra_price($mchid,$card_type,$spec,$quality,$pcode)
|
|
|
{
|
|
|
$card_type = intval($card_type);
|
|
|
- if(in_array($card_type,[1,2,4,5,6])) //油,话费价格查找.
|
|
|
+ if (in_array($card_type, [1, 2, 4, 5, 6], true)) //油,话费价格查找.
|
|
|
{
|
|
|
$key = "{$mchid}-{$quality}-{$card_type}-{$spec}";
|
|
|
if (array_key_exists($key, $this->mExtraPrices)) {
|
|
@@ -105,4 +111,21 @@ class merchant_price
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function max_inprice($mchid,$card_type,$spec,$quality,$pcode)
|
|
|
+ {
|
|
|
+ $card_type = intval($card_type);
|
|
|
+ if (in_array($card_type, [1, 2, 4, 5, 6], true)) //油,话费价格查找.
|
|
|
+ {
|
|
|
+ $key = "{$mchid}-{$quality}-{$card_type}-{$spec}";
|
|
|
+ if (array_key_exists($key, $this->mMaxInPrices)) {
|
|
|
+ return $this->mMaxInPrices[$key];
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|