1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace refill;
- class mavg_price
- {
- private $mMchidPrices;
- public function __construct()
- {
- $this->mMchidPrices = [];
- }
- public function setPrice($mchid,$quality,$card_type,$spec,$avg_price)
- {
- $key = "{$mchid}-{$quality}-{$card_type}-{$spec}";
- if(array_key_exists($key,$this->mMchidPrices)) {
- return $this->mMchidPrices[$key];
- } else {
- $this->mMchidPrices[$key] = $avg_price;
- }
- }
- public function getPrice($mchid,$quality,$card_type,$spec)
- {
- $key = "{$mchid}-{$quality}-{$card_type}-{$spec}";
- if(array_key_exists($key,$this->mMchidPrices)) {
- return $this->mMchidPrices[$key];
- } else {
- return false;
- }
- }
- }
|