Example #1
0
 protected function findModel($id)
 {
     if (($model = Post::findOne($id)) !== null) {
         /** @var Post $model */
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #2
0
 public function actionInformation()
 {
     if (($moneyModel = Invest::findByLately(Invest::TYPE_MONEY)) !== null) {
         $inverstOfMoney = Utils::timeCut($moneyModel->buy_time_start, time());
     } else {
         $inverstOfMoney = '未发布';
     }
     if (($emoneyModel = Invest::findByLately(Invest::TYPE_EXPERIENCE_MONEY)) !== null) {
         $inverstOfeMoney = Utils::timeCut($emoneyModel->buy_time_start, time());
     } else {
         $inverstOfeMoney = '未发布';
     }
     try {
         $jiuxinInfo = JiuxinApi::jiuxinGet();
         $row = wanhunet::app()->member->getOtherInfo(MemberOther::TABLE_JIUXIN)->row;
         $jiuxinInfo['j_user_name'] = current(explode('=|=', $row));
     } catch (\Exception $e) {
         $jiuxinInfo = [];
         //
         //            if ($e->getCode() == ErrorCode::Jiuxin_auth) {
         //                $jiuxinInfo = [];
         //            } else {
         //            }
     }
     return $this->view('information', ['inverstOfMoney' => $inverstOfMoney, 'inverstOfeMoney' => $inverstOfeMoney, 'jiuxinInfo' => $jiuxinInfo, 'actives' => Post::find()->where(['status' => Post::STATUS_ACTIVE])->orderBy('id desc')->all()]);
 }