123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/3/10
- * Time: 下午9:08
- */
- namespace fcgisrv;
- require_once(BASE_ROOT_PATH . '/helper/area_helper.php');
- require_once(BASE_CORE_PATH . '/framework/function/http.php');
- require_once(BASE_ROOT_PATH . '/mobile/index.php');
- require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
- require_once(BASE_ROOT_PATH . '/helper/sensitive_word/dfa.php');
- require_once(BASE_ROOT_PATH . '/helper/exceptionex.php');
- require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
- require_once(BASE_HELPER_PATH . '/fcgisrv/BaseServer.php');
- require_once(BASE_HELPER_PATH . '/session.php');
- use DFAFilter;
- use area_helper;
- use Log;
- use session;
- use session_helper;
- use Base;
- use UnloginException;
- use Exception;
- use mobileControl;
- use errcode;
- class MobileServer extends BaseServer
- {
- static private $stInstance = NULL;
- private $dir_name = 'callback';
- static public function instance()
- {
- if(self::$stInstance == NULL) {
- self::$stInstance = new MobileServer('mobile');
- }
- return self::$stInstance;
- }
- public function __construct($subPath)
- {
- parent::__construct($subPath);
- $exfiles = [
- 'web_wxnotify.php',
- 'wxnotify.php','pub_wxnotify.php','alipay_notify_url.php','dispatch_notify.php','kdniao_notify.php',
- 'cmbpay_notify.php','cmbpay_sign.php','wxauthor.php','api/wxLogin/index.php','api/wxLogin/callback.php',
- 'signature.php',
- 'refill_tianjt.php','refill_suhctm.php','refill_suhcpdd.php','refill_gftd.php',
- 'refill_beixt.php','refill_bxtwt.php','refill_bjb.php','refill_xyz.php',
- 'refill_zzx.php','refill_inner.php','refill_jiec.php','refill_yifa.php',
- 'bridge_shr.php','refill_weit.php','refill_afand.php','refill_afandeng.php',
- 'refill_afandnew.php','refill_lingzh.php','refill_lingzhdl.php','refill_tongy.php',
- 'refill_weiyi.php','refill_tonglu.php','refill_xc.php','refill_xunyin.php',
- 'refill_yunling.php','refill_wantong.php','refill_zhongst.php',
- 'refill_luqian.php','refill_afandfs.php','refill_yunlingfs.php',
- 'refill_tiancheng.php','refill_xunao.php','refill_weiyiman.php'
- ];
- $this->setExFiles($exfiles);
- }
- protected function is_exclude($file)
- {
- $ret = parent::is_exclude($file);
- if ($ret) {
- return true;
- } else {
- $path = BASE_ROOT_PATH . "/" . $this->mSubPath . "/callback";
- $basename = basename($file);
- $tmp = "{$path}/{$basename}";
- return file_exists($tmp);
- }
- }
- protected function preLooper()
- {
- parent::preLooper();
- DFAFilter::instance();
- area_helper::instance();
- }
- public function handle_req($file)
- {
- try
- {
- if(file_exists($file))
- {
- if($this->is_exclude($file)) {
- Log::record("Call {$file}",Log::DEBUG);
- include $file;
- }
- elseif(defined('COMPANY_NAME') && COMPANY_NAME === 'XYZ_COMPANY')
- {
- //部分控制器不需要使用session.
- $act = $_GET['act'];
- if ($act == 'refill') {
- Base::mobile_control();
- } else {
- fcgi_header("Content-Type: text/html; charset=UTF-8");
- echo "no such file.";
- }
- session::instance()->end(false);
- }
- else
- {
- if(!isset($_GET['act'])) {
- $_GET['act'] = 'index';
- }
- if(!isset($_GET['op'])) {
- $_GET['op'] = 'index';
- }
- if(!isset($_POST['act'])) {
- $_POST['act'] = 'index';
- }
- if(!isset($_POST['op'])) {
- $_POST['op'] = 'index';
- }
- //部分控制器不需要使用session.
- $act = $_GET['act'];
- if($act != 'refill') {
- session::instance()->start();
- Log::record("member_id=" . session_helper::memberid(),Log::DEBUG);
- }
- Base::mobile_control();
- session::instance()->end(true);
- }
- }
- else
- {
- Log::record("Can Not call file: {$file}",Log::DEBUG);
- fcgi_header("Content-Type: text/html; charset=UTF-8");
- echo "no such file.";
- }
- }
- catch (UnloginException $ex) {
- mobileControl::outerr(errcode::ErrUnLogin,errcode::msg(errcode::ErrUnLogin),'','android');
- }
- catch (Exception $ex) {
- mobileControl::outerr($ex->getCode(),$ex->getMessage(),'','android');
- Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}",Log::ERR);
- }
- }
- }
|