Example #1
0
 public function actionIndex()
 {
     $title = '';
     $reserve = '';
     try {
         $title = Setting::findOne(['code' => 'siteTitle'])->value;
         // 网站title
         $reserve = Setting::findOne(['code' => 'reserve'])->value;
         //储备金额
     } catch (ErrorException $e) {
     }
     //媒体报道
     try {
         $cat_id = Cat::find()->where(['name' => '媒体报道', 'status' => 1])->one()->id;
         if ($cat_id) {
             $media = Link::find()->where(['cat_id' => $cat_id, 'status' => 1])->asArray()->all();
         }
     } catch (ErrorException $e) {
         $media = "";
     }
     //合作伙伴
     try {
         $cat_id = Cat::find()->where(['name' => '合作伙伴', 'status' => 1])->one()->id;
         $partner = Link::find()->where(['cat_id' => $cat_id, 'status' => 1])->asArray()->all();
     } catch (ErrorException $e) {
         $partner = "";
     }
     //投资帮助
     /* try
       	{
       		$parent_id = Category::findOne(['title'=>'帮助中心','status'=>1])->id;
       		$category = Category::find()->where(['parent_id'=>$parent_id,'status'=>1])->asArray()->all();
       		$left = array();
       		foreach ($category as $K=>$V)
       		{
       			$left[] = Article::find()->where(['category_id'=>$V['id'],'status'=>1])->asArray()->all();
       		}
       	}
       	catch (ErrorException $e)
       	{
       		$left = array();
       	} */
     $hover = 'hover';
     //项目列表
     //TODO
     //		$model = Product::find()->limit(4)->orderBy('start_at DESC')->all();
     $model = Product::find()->limit(4)->orderBy('start_at DESC')->where('create_at >= 1441641600 ')->all();
     //是否签到
     $isCheckin = false;
     $checkin_total = count(SignIn::find()->where('create_at >=' . strtotime(date("Y-m-d")))->all());
     //本日签到总人数
     $yesterday_total = \frontend\actions\app\member::get_yesterday_sign_in()['data']['count'];
     //获取昨日签到情况 TODO
     $yesterday_sign_in = \frontend\actions\app\member::get_yesterday_sign_in();
     //获取今日签到情况 TODO
     $today_sign_in = \frontend\actions\app\member::get_today_sign_in();
     //昨日在投收益排名
     $command = (new \yii\db\Query())->select(['ucenter_member.real_name', 'fund_income.smoney as money'])->from('fund_income')->where("fund_income.created_at >=" . strtotime(date("Y-m-d")))->join('left join', 'ucenter_member', 'fund_income.member_id = ucenter_member.id')->limit(6)->groupBy('fund_income.member_id')->orderBy('money DESC')->createCommand();
     $rank = $command->queryAll();
     //近30天收益排名
     //TODO
     $test_time = strtotime("-1 month") > "1441641600" ? strtotime("-1 month") : '1441641600';
     $command_month = (new \yii\db\Query())->select(['ucenter_member.real_name', 'sum(fund_income.smoney) as money'])->from('fund_income')->where("fund_income.created_at >=" . $test_time)->join('left join', 'ucenter_member', 'fund_income.member_id = ucenter_member.id')->limit(6)->groupBy('fund_income.member_id')->orderBy('money DESC')->createCommand();
     $rank_month = $command_month->queryAll();
     if (!Yii::$app->user->isGuest) {
         $result = \frontend\actions\app\member::is_sign_today(yii::$app->user->id);
         if ($result['errorNum'] == 1) {
             $isCheckin = true;
         } elseif ($result['errorNum'] == 0) {
             $isCheckin = false;
         }
     }
     return $this->render('index', ['yesterday_sign_in' => $yesterday_sign_in, 'today_sign_in' => $today_sign_in, 'model' => $model, 'isCheckin' => $isCheckin, 'checkin_total' => $checkin_total, 'yesterday_total' => $yesterday_total, 'rank' => $rank, 'rank_month' => $rank_month, 'hover' => $hover, 'title' => $title, 'reserve' => $reserve, 'media' => $media, 'partner' => $partner]);
 }
Example #2
0
// footer数据表
try {
    $tel1 = Setting::findOne(['code' => 'phone'])->value;
    $tel2 = Setting::findOne(['code' => 'tell'])->value;
    $email = Setting::findOne(['code' => 'email'])->value;
    $work = Setting::findOne(['code' => 'work'])->value;
} catch (ErrorException $e) {
    $tel1 = "";
    $tel2 = "";
    $email = "";
    $work = "";
}
//关键词
$keywords = '';
try {
    $keywords = Setting::findOne(['code' => 'siteKeyword'])->value;
} catch (ErrorException $e) {
}
?>
    <?php 
$this->beginPage();
?>
    <!DOCTYPE html>
    <html lang="<?php 
echo Yii::$app->language;
?>
">
    <head>

        <meta charset="<?php 
echo Yii::$app->charset;
Example #3
0
 public function actionSetting()
 {
     if (\yii::$app->user->isGuest) {
         $this->redirect(['site/login']);
     }
     $uid = yii::$app->user->id;
     $is_Authentic = member::isAuthentic($uid);
     $model = UcenterMember::find()->where("id=" . $uid)->one();
     if (isset($_POST['prepassword']) && isset($_POST['newpassword']) && isset($_POST['repeatpassword'])) {
         $_model = UcenterMember::findIdentity($uid);
         if (!yii::$app->security->validatePassword($_POST['prepassword'], $_model->password_hash)) {
             echo '原始密码错误';
             exit;
         } elseif ($_POST['newpassword'] == $_POST['repeatpassword']) {
             $_model->password_hash = Yii::$app->security->generatePasswordHash($_POST['newpassword']);
             $app_pwd = md5(sha1($_POST['newpassword']) . time());
             $_model->app_pwd = $app_pwd;
             $_model->save(false);
             echo '密码修改成功';
             exit;
         } else {
             echo '两次密码不一致';
             exit;
         }
     }
     if (isset($_POST['realname']) && isset($_POST['idcard'])) {
         $realname = $_POST['realname'];
         $idcard = $_POST['idcard'];
         try {
             $idcard_result = Port::baiduIdentity($idcard);
             if (!$idcard) {
                 echo '身份认号不匹配,请核对后重新输入';
                 exit;
             }
         } catch (ErrorException $e) {
             echo '认证失败';
             exit;
         }
         try {
             $result = member::authentication($uid, $realname, $idcard);
             if ($result) {
                 echo '身份认证成功';
                 exit;
             }
         } catch (ErrorException $e) {
             echo $e->getMessage();
             exit;
         }
     }
     if (isset($_POST['UcenterMember']['person_face'])) {
         $model->person_face = UploadedFile::getInstance($model, 'person_face');
         if ($model->person_face) {
             if ($model->validate()) {
                 $old_face = UcenterMember::findOne(['id' => $uid])->person_face;
                 //旧头像
                 $init_face = Setting::findOne(['code' => 'img'])->value;
                 //初始头像
                 $Name = mt_rand(1100, 9900) . time() . '.' . $model->person_face->extension;
                 $model->person_face->saveAs('upload/' . $Name);
                 //保存头像名到数据表
                 $model->person_face = $Name;
                 if ($model->update()) {
                     //若不是初始头像,删除旧头像。
                     if ($old_face != $init_face) {
                         @unlink('../web/upload/' . $old_face);
                     }
                     header("Content-type: text/html; charset=utf-8");
                     echo '<script>alert("头像修改完成~");</script>';
                 }
             }
         }
     }
     $infos_rar = $this->Ucenter();
     //用户数据包
     return $this->render('setting', compact("infos_rar", "model", "model_password", "is_Authentic"));
 }