VApiServer.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace fcgisrv;
  3. require_once(BASE_ROOT_PATH . '/helper/area_helper.php');
  4. require_once(BASE_CORE_PATH . '/framework/function/http.php');
  5. require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
  6. require_once(BASE_ROOT_PATH . '/helper/sensitive_word/dfa.php');
  7. require_once(BASE_ROOT_PATH . '/helper/exceptionex.php');
  8. require_once(BASE_HELPER_PATH . '/fcgisrv/BaseServer.php');
  9. require_once(BASE_HELPER_PATH . '/refill/util.php');
  10. use Log;
  11. use Base;
  12. use UnSignException;
  13. use Exception;
  14. use merchantControl;
  15. use errcode;
  16. class VApiServer extends BaseServer
  17. {
  18. public function __construct($subPath)
  19. {
  20. parent::__construct($subPath);
  21. $exfiles = [
  22. ];
  23. $this->setExFiles($exfiles);
  24. }
  25. static private $stInstance = NULL;
  26. static public function instance()
  27. {
  28. if(self::$stInstance == NULL) {
  29. self::$stInstance = new VApiServer('vapi');
  30. }
  31. return self::$stInstance;
  32. }
  33. function handle_req($file)
  34. {
  35. try
  36. {
  37. Log::record("file is {$file}",Log::DEBUG);
  38. fcgi_header("Content-Type: text/html; charset=UTF-8");
  39. if(file_exists($file))
  40. {
  41. if($this->is_exclude($file)) {
  42. Log::record("Call {$file}",Log::DEBUG);
  43. include $file;
  44. } else {
  45. Base::mobile_control();
  46. }
  47. }
  48. else
  49. {
  50. echo "no such file.";
  51. }
  52. }
  53. catch (UnSignException $ex) {
  54. merchantControl::outerr(errcode::ErrUnLogin,errcode::msg(errcode::ErrUnLogin));
  55. }
  56. catch (Exception $ex) {
  57. merchantControl::outerr($ex->getCode(),$ex->getMessage());
  58. Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}",Log::ERR);
  59. }
  60. }
  61. }