Beispiel #1
0
 public function __construct()
 {
     $_dbConf = CApp::app()->getConf('Db');
     foreach ($_dbConf as $identify => $conf) {
         $this->_Db[$identify] = CDb::createDb($conf['host'], $conf['user'], $conf['pwd'], $conf['dbName']);
     }
 }
 public function run()
 {
     $this->ts = time();
     $this->plat = CApp::app()->tty()->getParam('plat', 1);
     $this->action = CApp::app()->tty()->getParam('action', 'exchange');
     $this->auto = CApp::app()->tty()->getParam('auto');
     $this->begin_ts = strtotime(CApp::app()->tty()->getParam('begin', date('Y-m-d H:i:s', $this->ts - $this->timeSlice)));
     $this->end_ts = strtotime(CApp::app()->tty()->getParam('end', date('Y-m-d H:i:s', $this->ts)));
     //自动补数据(补单)
     if ($this->auto) {
         $this->begin_ts = strtotime(date('Ymd', strtotime("-1 day")) . ' 00:00:00');
         $this->end_ts = strtotime(date('Ymd', strtotime("-1 day")) . ' 23:59:59');
     }
     //不能跨月   否则取当天时间
     if (date('Ym', $this->begin_ts) != date('Ym', $this->end_ts)) {
         $this->end_ts = strtotime(date('Ymd', $this->begin_ts) . ' 23:59:59');
         $this->flag = false;
     }
     /*
     if ($this->action == 'union_exchange')
     {
     	$this->op_id = CApp::app()->tty()->getParam('op_id');
     }
     */
     if (!array_key_exists($this->plat, $this->curl)) {
         die('Error plat!');
     }
     $this->handleData();
 }
Beispiel #3
0
 public function getRouter()
 {
     $sControler = $this->getParam($this->_c);
     if (strpos($sControler, '/') > 0) {
         list($controller, $action) = explode('/', $sControler);
         if (!$controller && CApp::app()->getConf('defaultController')) {
             $controller = CApp::app()->getConf('defaultController');
         }
         if (!$action && CApp::app()->getConf('defaultAction')) {
             $action = CApp::app()->getConf('defaultAction');
         }
         return array('controller' => $controller . 'Controller', 'action' => $action);
     }
     return array();
 }
Beispiel #4
0
 public function __construct()
 {
     $_dbConf = CApp::app()->getConf('Db');
     $_Dbs = array();
     if (!$_dbConf) {
         return NULL;
     }
     foreach ($_dbConf as $identify => $conf) {
         switch (!empty($conf['lib'])) {
             case 1:
                 $LibClass = 'C' . ucfirst(strtolower($conf['lib']));
                 $_Dbs[$identify] = $this->_Dbs[$identify] = $LibClass::createDb($conf);
             default:
                 $_Dbs[$identify] = $this->_Dbs[$identify] = CMysql::createDb($conf);
                 break;
         }
     }
     $this->_DbConf = array_shift($_dbConf);
     return !empty($this->_Dbs) ? $this->_Db = array_shift($_Dbs) : NULL;
 }