LZRAccServer.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace fcgisrv;
  3. require_once(BASE_HELPER_PATH . '/fcgisrv/BaseServer.php');
  4. require_once(BASE_HELPER_PATH . '/refill/util.php');
  5. require_once(BASE_ROOT_PATH . '/helper/area_helper.php');
  6. require_once(BASE_CORE_PATH . '/framework/function/http.php');
  7. require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
  8. require_once(BASE_ROOT_PATH . '/helper/sensitive_word/dfa.php');
  9. require_once(BASE_ROOT_PATH . '/helper/exceptionex.php');
  10. require_once(BASE_PATH . '/control/merchant.php');
  11. require_once(BASE_PATH . '/control/lzbase.php');
  12. use Log;
  13. use Base;
  14. use Exception;
  15. use LzException;
  16. class LZRAccServer extends BaseServer
  17. {
  18. public function __construct($subPath)
  19. {
  20. parent::__construct($subPath);
  21. $exfiles = [
  22. 'callback/lingzh/baizeyd.php','callback/lingzh/aming.php' ,'callback/lingzh/binghc.php',
  23. 'callback/lingzh/ruishun.php','callback/lingzh/wuchen.php' ,'callback/lingzh/yibao.php',
  24. 'callback/lingzh/amingyd.php','callback/lingzh/chuka.php' ,'callback/lingzh/amingjd.php',
  25. 'callback/lingzh/legou.php' ,'callback/lingzh/feiniao.php','callback/lingzh/fensheng.php',
  26. 'callback/lingzh/riying.php' ,'callback/lingzh/wailing.php','callback/lingzh/weishengy.php',
  27. 'callback/lingzh/shengying.php','callback/lingzh/amingjdman.php','callback/lingzh/weishengywt.php',
  28. 'callback/lingzh/weishengyjd.php'
  29. ];
  30. $this->setExFiles($exfiles);
  31. }
  32. protected function is_exclude($file)
  33. {
  34. $ret = parent::is_exclude($file);
  35. if ($ret) {
  36. return true;
  37. } else {
  38. $path = BASE_ROOT_PATH . "/" . $this->mSubPath . "/callback/lingzh";
  39. $basename = basename($file);
  40. $tmp = "{$path}/{$basename}";
  41. return file_exists($tmp);
  42. }
  43. }
  44. static private $stInstance = NULL;
  45. static public function instance()
  46. {
  47. if(self::$stInstance == NULL) {
  48. self::$stInstance = new LZRAccServer('racc');
  49. }
  50. return self::$stInstance;
  51. }
  52. function handle_req($file)
  53. {
  54. try
  55. {
  56. Log::record("file is {$file}",Log::DEBUG);
  57. if(file_exists($file))
  58. {
  59. if($this->is_exclude($file)) {
  60. Log::record("Call {$file}",Log::DEBUG);
  61. include $file;
  62. } else {
  63. Base::mobile_control();
  64. }
  65. }
  66. else
  67. {
  68. fcgi_header("Content-Type: text/html; charset=UTF-8");
  69. echo "no such file.";
  70. }
  71. }
  72. catch (LzException $ex) {
  73. echo ($ex->getMessage());
  74. }
  75. catch (Exception $ex) {
  76. $msg = "{$ex->getCode()}|{$ex->getMessage()}|";
  77. echo $msg;
  78. Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}",Log::ERR);
  79. }
  80. }
  81. }