Example #1
0
 public function run($id)
 {
     $this->controller->_seoTitle = '交易详情 - ' . $this->controller->_setting['site_name'];
     $this->controller->loadModel();
     $model = new UserTrade();
     //查询条件
     $data = $model->findByAttributes(['id' => $id, 'user_id' => Yii::app()->user->id]);
     if ($data) {
         switch ($data->type) {
             case UserTrade::TYPE_RECHARGE:
                 $info_model = new UserRecharge();
                 break;
             case UserTrade::TYPE_WITHDRAW:
                 $info_model = new UserWithdraw();
                 break;
             case UserTrade::TYPE_INCOME:
                 $info_model = new UserIncome();
                 break;
             default:
                 throw new CHttpException(500, '交易数据异常');
         }
     }
     $data_info = $info_model->findByAttributes(array('trade_id' => $id));
     //加载css js
     Yii::app()->clientScript->registerScriptFile($this->controller->_static_public . "/js/jquery/jquery.js");
     Yii::app()->clientScript->registerScriptFile($this->controller->_static_public . "/js/My97DatePicker/WdatePicker.js", CClientScript::POS_END);
     $this->controller->render('trade_view', array('data' => $data, 'data_info' => $data_info));
 }