Ejemplo n.º 1
0
 public function actionNewsign()
 {
     $yesterday_sign_in = member::get_yesterday_sign_in();
     $today_sign_in = member::get_today_sign_in();
     $result = member::is_sign_today(yii::$app->user->id);
     if ($result['errorNum'] == 1) {
         $isCheckin = true;
     } elseif ($result['errorNum'] == 0) {
         $isCheckin = false;
     }
     return $this->view('newsign', compact('yesterday_sign_in', 'today_sign_in', 'isCheckin'));
 }
Ejemplo n.º 2
0
 /**
  * 用户是否签到
  * @return array|string
  */
 public function actionIssigntoday()
 {
     $result = App::AppGet();
     try {
         if ($result['errorNum']) {
             $result = array('errorNum' => $result['errorNum'], 'errorMsg' => $result['errorMsg'], 'data' => null);
         } else {
             $data = $result['data'];
             if (array_key_exists('uid', $data)) {
                 $uid = $data['uid'];
                 $result = member::is_sign_today($uid);
             } else {
                 $result = array('errorNum' => '1', 'errorMsg' => '参数错误', 'data' => null);
             }
         }
     } catch (ErrorException $e) {
         Yii::error("用户是否签到---异常 方法:actionIssigntoday 参数:" . json_encode($result['data']), "app");
         Yii::trace($e->getMessage(), "app");
         $result = array('errorNum' => '7', 'errorMsg' => '服务器异常,请联系管理员', 'data' => null);
     }
     $result = App::AppReturn($result);
     return $result;
 }
Ejemplo n.º 3
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]);
 }