diff --git a/app/gateway/controller/v4/Handle.php b/app/gateway/controller/v4/Handle.php index 39e2d61..56c0b9d 100644 --- a/app/gateway/controller/v4/Handle.php +++ b/app/gateway/controller/v4/Handle.php @@ -3,6 +3,7 @@ namespace app\gateway\controller\v4; use app\channel\service\CardService; +use dever\Log; /** * 接口处理 @@ -17,34 +18,47 @@ class Handle extends Core # 查询接口 一般用于查询数据,同步执行 public function query(): void { - $settingStatus = sysconf('settingStatus'); - if ($settingStatus == 1) { - $this->no(-1000); + try{ + $settingStatus = sysconf('settingStatus'); + if ($settingStatus == 1) { + $this->no(-1000); + } + $this->checkOpenTime(sysconf('settingOpenTime')); + + if (isset($this->merchant['opentime']) && $this->merchant['opentime']) { + $this->checkOpenTime($this->merchant['opentime']); + } + $data = $this->channel($this->mid, $this->product, false); + $this->yes($data); + } catch (\Exception $e){ + $this->writelog($e->getMessage(), 'error'); + $this->no(-100,$e->getMessage()); } - $this->checkOpenTime(sysconf('settingOpenTime')); - - if (isset($this->merchant['opentime']) && $this->merchant['opentime']) { - $this->checkOpenTime($this->merchant['opentime']); - } - $data = $this->channel($this->mid, $this->product, false); - $this->yes($data); + } # 提交接口 一般用于提交数据,异步执行 public function submit(): void { - $settingStatus = sysconf('settingStatus'); - if ($settingStatus == 1) { - $this->no(-1000); - } - $this->checkOpenTime(sysconf('settingOpenTime')); - - if (isset($this->merchant['opentime']) && $this->merchant['opentime']) { - $this->checkOpenTime($this->merchant['opentime']); + try{ + $settingStatus = sysconf('settingStatus'); + if ($settingStatus == 1) { + $this->no(-1000); + } + $this->checkOpenTime(sysconf('settingOpenTime')); + + if (isset($this->merchant['opentime']) && $this->merchant['opentime']) { + $this->checkOpenTime($this->merchant['opentime']); + } + + $data = $this->channel($this->mid, $this->product, true); + $this->yes($data); + } catch (\Exception $e){ + + $this->writelog($e->getMessage(), 'error'); + $this->no(-100,$e->getMessage()); } - $data = $this->channel($this->mid, $this->product, true); - $this->yes($data); } # 提交接口 一般用于提交数据,异步执行 @@ -305,4 +319,14 @@ class Handle extends Core return $v; } + protected function writelog($data,$t = '') + { + if($t){ + Log::write('gateway', 'Handle_'.$t, $data); + }else{ + Log::write('gateway', 'Handle', $data); + } + + } + } \ No newline at end of file