示例#1
0
 public function actionIndex()
 {
     $uid = Yii::$app->user->id;
     Utils::ensureOpenId();
     $openId = Yii::$app->request->get('open_id');
     if (($usermodel = UcenterMember::findOne(['openid' => $openId])) !== null) {
         Yii::$app->user->login($usermodel);
     } elseif (empty(Yii::$app->user->id)) {
         return $this->redirect(['site/signin']);
     }
     $isAuthentic = member::isAuthentic(yii::$app->user->id);
     if ($isAuthentic['errorNum'] != 0) {
         header("Content-type: text/html; charset=utf-8");
         echo "<script>alert('您还没有实名制认证')</script>";
         echo "<script>window.location.href='" . \yii\helpers\Url::to(['site/step2']) . "'</script>";
         exit;
     }
     //判断用户是否绑定银行卡
     $is_bind = sinapay::isBinding($uid);
     $model = UcenterMember::find()->where(['id' => $uid])->one();
     if ($is_bind['errorNum'] != 0) {
         header("Content-type: text/html; charset=utf-8");
         echo "<script>alert('您还没有绑定银行卡');</script>";
         echo "<script>location.href='" . \yii\helpers\Url::to(['site/bindcard']) . "'</script>";
         exit;
     }
     //全部记录
     $logs = AloneMethod::total_log($uid, 1, 15);
     $logs_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid])->andWhere(['>', 'status', '0'])->andWhere(['<>', 'step', '0.00'])->asArray()->all();
     $logs_pages = ceil(count($logs_pages) / 15);
     //$logs = Log::find()->select(['step','create_at','status'])->where(['member_id'=>$uid])->andWhere(['in','status',[1,2,3,4]])->orderBy('id desc')->asArray()->all();
     //充值
     $recharge = AloneMethod::recharge_log($uid, 1, 15);
     $recharge_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_RECHAR_SUC])->asArray()->all();
     $recharge_pages = ceil(count($recharge_pages) / 15);
     //投资
     $invest = AloneMethod::invest_log($uid, 1, 15);
     $invest_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_INVEST_SUC])->asArray()->all();
     $invest_pages = ceil(count($invest_pages) / 15);
     //赎回
     $ransom = AloneMethod::redeem_log($uid, 1, 15);
     $ransom_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_REDEM_SUC])->asArray()->all();
     $ransom_pages = ceil(count($recharge_pages) / 15);
     //提现
     $withdraw = AloneMethod::withdrawals_log($uid, 1, 15);
     $withdraw_pages = Log::find()->select(['step', 'remark', 'status', 'create_at'])->where(['member_id' => $uid, 'status' => Log::STATUS_WITHDRAW_SUC])->asArray()->all();
     $withdraw_pages = ceil(count($recharge_pages) / 15);
     return $this->view('index', compact('invest', 'recharge', 'withdraw', 'ransom', 'logs', 'logs_pages', 'recharge_pages', 'invest_pages', 'ransom_pages', 'withdraw_pages'));
 }
示例#2
0
 public function actionLogout()
 {
     Utils::ensureOpenId();
     $request = Yii::$app->request;
     if ($request->isPost) {
         if (($model = UcenterMember::findOne(['openid' => $request->post('open_id')])) !== null) {
             /** @var MemberOther $model */
             $model->openid = '';
             $model->save();
         }
         Yii::$app->user->logout();
         return $this->goBack(['info' => "解绑成功"], Url::to(['site/signin']));
     }
     return $this->view('logout');
 }
示例#3
0
 public function actionGindex()
 {
     Utils::ensureOpenId();
     $openId = Yii::$app->request->get('open_id');
     if (($usermodel = UcenterMember::findOne(['openid' => $openId])) !== null) {
         Yii::$app->user->login($usermodel);
     } elseif (empty(Yii::$app->user->id)) {
         return $this->redirect(['site/signin']);
     }
     $uid = yii::$app->user->id;
     $gold = Gold::find()->select('uid,sum(money) as smoney')->where(['uid' => $uid])->asArray()->one();
     $allgold = Gold::find()->select('uid,rid,sum(money) as smoney')->where(['uid' => $uid])->asArray()->groupBy('rid')->all();
     $invitation_code = UcenterMember::findIdentity($uid)->invitation_code;
     $goldincome = Income::find()->select('member_id,sum(goldincome) as sincome')->where(['member_id' => $uid])->asArray()->one();
     $jssdk = new Jssdk('wx32814d588c44c17c', '23b0f218574551f18db1dc991dbee87f');
     $signpack = $jssdk->getSignPackage();
     return $this->view('gindex', compact('gold', 'allgold', 'goldincome', 'invitation_code', 'signpack'));
 }
示例#4
0
 public function actionDorepass()
 {
     $uid = Yii::$app->user->id;
     if ($_POST) {
         $member = member::changePassword($uid, $_POST['oldpass'], $_POST['password'], $_POST['repassword']);
         if ($member['errorNum'] == 1) {
             return $member['errorMsg'];
         } else {
             Utils::ensureOpenId();
             $openId = Yii::$app->request->get('open_id');
             if ($openId) {
                 $model = UcenterMember::findOne(['openid' => $openId]);
                 if ($model) {
                     $model->openid = '';
                     $model->save();
                 }
             }
             Yii::$app->user->logout();
             return '修改成功';
         }
     }
 }
示例#5
0
 public function actionLogout()
 {
     Utils::ensureOpenId();
     $openId = Yii::$app->request->get('open_id');
     if ($openId) {
         $model = UcenterMember::findOne(['openid' => $openId]);
         if ($model) {
             $model->openid = '';
             $model->save();
         }
     }
     Yii::$app->user->logout();
     return $this->redirect(['site/main']);
 }