|
@@ -10,7 +10,8 @@ require_once(BASE_HELPER_PATH . '/refill/IRefillPhone.php');
|
|
|
require_once(BASE_HELPER_PATH . '/refill/IRefillCallBack.php');
|
|
|
require_once(BASE_HELPER_PATH . '/refill/CalcMerchantPrice.php');
|
|
|
require_once(BASE_HELPER_PATH . '/refill/util.php');
|
|
|
-require_once(BASE_HELPER_RAPI_PATH . '/api.php');
|
|
|
+
|
|
|
+//require_once(BASE_HELPER_RAPI_PATH . '/api.php');
|
|
|
|
|
|
use Log;
|
|
|
use mtopcard;
|
|
@@ -83,8 +84,14 @@ class ProviderManager
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- $class = "refill\\{$name}\\{$refill_type}";
|
|
|
+ $file = BASE_HELPER_RAPI_PATH . "/{$name}/{$refill_type}.php";
|
|
|
+ if(!file_exists($file)){
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ include($file);
|
|
|
+ }
|
|
|
|
|
|
+ $class = "refill\\{$name}\\{$refill_type}";
|
|
|
if (class_exists($class, false)) {
|
|
|
$provider = new $class($cfg);
|
|
|
$provider->setOpened(false);
|
|
@@ -103,25 +110,39 @@ class ProviderManager
|
|
|
|
|
|
public function load()
|
|
|
{
|
|
|
- $this->mProviderNames = [];
|
|
|
- $this->mAllQMapPTS = [];
|
|
|
- $this->mProviders = [];
|
|
|
- $this->mSpecTypes = [];
|
|
|
+ try
|
|
|
+ {
|
|
|
+ $file = BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php';
|
|
|
+ if(!file_exists($file)){
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ include($file);
|
|
|
+ }
|
|
|
|
|
|
- global $config;
|
|
|
- $this->map_cfg($config['phone_providers'],'RefillPhone');
|
|
|
- $this->map_cfg($config['oil_providers'],'RefillOil');
|
|
|
- $this->mProviderNames = array_unique($this->mProviderNames);
|
|
|
+ $this->mProviderNames = [];
|
|
|
+ $this->mAllQMapPTS = [];
|
|
|
+ $this->mProviders = [];
|
|
|
+ $this->mSpecTypes = [];
|
|
|
|
|
|
- $channels = $this->read_channel();
|
|
|
+ global $config;
|
|
|
+ $this->map_cfg($config['phone_providers'],'RefillPhone');
|
|
|
+ $this->map_cfg($config['oil_providers'],'RefillOil');
|
|
|
+ $this->mProviderNames = array_unique($this->mProviderNames);
|
|
|
|
|
|
- foreach ($channels as $item)
|
|
|
- {
|
|
|
- $name = $item['name'];
|
|
|
- if(array_key_exists($name,$this->mProviders)) {
|
|
|
- $this->mProviders[$name]->setOpened($item['opened']);
|
|
|
+ $channels = $this->read_channel();
|
|
|
+
|
|
|
+ foreach ($channels as $item)
|
|
|
+ {
|
|
|
+ $name = $item['name'];
|
|
|
+ if(array_key_exists($name,$this->mProviders)) {
|
|
|
+ $this->mProviders[$name]->setOpened($item['opened']);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ catch (Exception $ex)
|
|
|
+ {
|
|
|
+ Log::record(__FUNCTION__ ." " . $ex->getMessage(), Log::ERR);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private function read_channel()
|
|
@@ -252,11 +273,18 @@ class ProviderManager
|
|
|
return $type_specs;
|
|
|
}
|
|
|
|
|
|
- public function getCaller($chname)
|
|
|
+ public function getCaller($name)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- $class_name = "refill\\{$chname}\\RefillCallBack";
|
|
|
+ $file = BASE_HELPER_RAPI_PATH . "/{$name}/RefillCallBack.php";
|
|
|
+ if(file_exists($file)){
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ include($file);
|
|
|
+ }
|
|
|
+
|
|
|
+ $class_name = "refill\\{$name}\\RefillCallBack";
|
|
|
if (class_exists($class_name, false)) {
|
|
|
$caller = new $class_name();
|
|
|
return $caller;
|