Автор: :dayunlong (gengjun@qiyi.com)
Наследование: extends CComponent
Пример #1
0
 /**
  * 加载对应模块里controller方法
  * @param unknown $params
  * @date: 2015-3-18 下午2:58:32
  * @author: dayunlong<*****@*****.**>
  */
 public function dispatchModule()
 {
     $apikey = Yii::app()->request->getParam('apikey');
     if (empty($apikey)) {
         //跳转到应该去的地方
         //$this->redirect(APP_HOST."/site/nopri");//没有权限
         $_module = '/plat/user/index';
         $this->redirect($_module);
     } else {
         $_module = ApiComponent::getApiModule($apikey);
         if (is_numeric($_module)) {
             echo $_module;
             exit;
         } else {
             Yii::app()->runController($_module);
         }
     }
 }
Пример #2
0
 /**
  * test convertBoolean() method
  *
  * @test
  */
 public function convertBoolean()
 {
     $this->assertSame(true, ApiComponent::convertBoolean('yes'));
     $this->assertSame(false, ApiComponent::convertBoolean('no'));
     $this->AssertSame([true, true, true, true, true, false, false, false, false, false], ApiComponent::convertBoolean([true, 'yes', 'true', '1', 1, false, 'false', 'no', '0', 0]));
 }