public function actionIndex()
 {
     $uid = Yii::$app->user->id;
     $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;
     }
     $uid = Yii::$app->user->id;
     $info = Info::find()->where(['member_id' => $uid])->one();
     $limitConfig = sinapay::getsiteConfig();
     if ($limitConfig) {
         $withdraw_max = $limitConfig->withdraw_max;
         $withdraw_min = $limitConfig->withdraw_min;
         $withdraw_times = $limitConfig->withdraw_num;
     }
     return $this->view('index', compact('info', 'withdraw_max', 'withdraw_min', 'withdraw_times'));
 }
 public function actionIndex()
 {
     $uid = Yii::$app->user->id;
     $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;
     }
     $limitConfig = sinapay::getsiteConfig();
     if ($limitConfig) {
         $ransom_max = $limitConfig->ransom_max;
         $ransom_min = $limitConfig->ransom_min;
         $ransom_times = $limitConfig->ransom_num;
     }
     $collect = AloneMethod::user_collect($uid)[data];
     //在投金额和在投收益
     $red_packet = member::get_user_red_packet($uid)[data];
     //个人账户
     $model_asset = Info::find()->where('member_id=' . Yii::$app->user->id)->one();
     //投资总额
     $invest_total = 0;
     $model_order = Order::find()->where('member_id=' . Yii::$app->user->id . " AND status=1")->all();
     if (count($model_order) > 0) {
         foreach ($model_order as $K => $V) {
             $invest_total += $V->money;
         }
     }
     $invest_total += $model_asset->profit;
     return $this->view('index', compact('invest_total', 'ransom_max', 'ransom_min', 'ransom_times', 'collect', 'red_packet'));
 }
 public function actionIndex()
 {
     if (Yii::$app->user->isGuest) {
         return $this->redirect(array('/site/signin'));
     }
     $uid = Yii::$app->user->id;
     $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;
     }
     if ($_GET) {
         $uid = Yii::$app->user->id;
         $info = Info::find()->where(['member_id' => $uid])->one();
         $product = Product::find(['id' => $_GET['id']])->one();
         //项目可投金额
         $kmoney = \frontend\actions\App\Invest::kmoney($_GET['id'])[data];
         $limitConfig = sinapay::getsiteConfig();
         if ($limitConfig) {
             $invest_max = $limitConfig->invest_max;
             $invest_min = $limitConfig->invest_min;
             $invest_times = $limitConfig->invest_num;
         }
         return $this->view('index', compact('info', 'product', 'invest_max', 'invest_min', 'invest_num', 'kmoney'));
     }
 }
Beispiel #4
0
 public function actionInvestinfos()
 {
     if (\yii::$app->user->isGuest) {
         $this->redirect(['site/login']);
     }
     $pid = $_GET['id'];
     $uid = yii::$app->user->id;
     $model = Product::find()->where('id=' . $pid)->one();
     $model_asset = Info::find()->where(['member_id' => Yii::$app->user->id])->one();
     $model_orders = Order::find()->where('product_id=' . $pid)->asArray()->all();
     //本期投资记录
     $query = (new Query())->select("C.real_name,A.start_money,A.start_at")->from("fund_orders AS A")->where("product_id=" . $pid)->join("left join", "ucenter_member AS C", "A.member_id = C.id")->orderBy('start_at DESC');
     $rows = $query;
     $pages = new Pagination(['totalCount' => $rows->count(), 'pageSize' => '8']);
     $array_investlog = $rows->offset($pages->offset)->limit($pages->limit)->all();
     //最大投资限额——(后台设置里取值)
     $limitConfig = sinapay::getsiteConfig();
     $invest_max = 10000;
     $invest_min = 5;
     $invest_times = 3;
     if ($limitConfig) {
         $invest_max = $limitConfig->invest_max;
         $invest_min = $limitConfig->invest_min;
         $invest_times = $limitConfig->invest_num;
         //当日投资次数
         $today_num = Log::find()->where('member_id = ' . $uid . '  AND create_at > ' . strtotime(date("Y-m-d")) . ' AND status=2')->count();
     }
     $k_money = Invest::kmoney($pid);
     return $this->render('investinfos', compact("invest_max", "invest_min", "invest_times", "today_num", "model", "k_money", "model_orders", "array_investlog", "pages", "model_asset"));
 }
Beispiel #5
0
 public function actionRedemption()
 {
     $uid = yii::$app->user->id;
     $isAuthentic = member::isAuthentic(yii::$app->user->id);
     if (!$isAuthentic) {
         echo "<script>alert('您还没有实名制认证')</script>";
         echo "<script>window.location.href='" . \yii\helpers\Url::to(['setting/setting']) . "'</script>";
         exit;
     }
     $is_bind = sinapay::isBinding($uid);
     if ($is_bind['errorNum'] == 0) {
         $result_bind = $is_bind['data'];
         $logo_bind = self::BankInfos();
     } elseif ($is_bind['errorNum'] != 0) {
         header("Content-type: text/html; charset=utf-8");
         echo "<script>alert('您还没有绑定银行卡');</script>";
         echo "<script>location.href='" . \yii\helpers\Url::to(['money/bindcard']) . "'</script>";
         exit;
     }
     //最大赎回限额——(后台设置里取值)
     $limitConfig = sinapay::getsiteConfig();
     $redemption_max = 10000;
     $redemption_min = 5;
     $redemption_times = 3;
     if ($limitConfig) {
         $redemption_max = $limitConfig->ransom_max;
         $redemption_min = $limitConfig->ransom_min;
         $redemption_times = $limitConfig->ransom_num;
         //当日充值次数
         $today_num = Log::find()->where('member_id = ' . $uid . '  AND create_at > ' . strtotime(date("Y-m-d")) . ' AND status=3')->count();
     }
     $model = UcenterMember::find()->where('id=' . Yii::$app->user->id)->one();
     $uid = Yii::$app->user->id;
     //个人账户
     $model_asset = Info::find()->where('member_id=' . Yii::$app->user->id)->one();
     //用户投资记录
     $model_income = Income::find()->where('member_id=' . Yii::$app->user->id)->all();
     //投资总额
     $invest_total = 0;
     $model_order = Order::find()->where('member_id=' . Yii::$app->user->id . " AND status=1")->all();
     if (count($model_order) > 0) {
         foreach ($model_order as $K => $V) {
             $invest_total += $V->money;
         }
     }
     $invest_total += $model_asset->profit;
     $bank_card = Withdrawals::showCard($uid);
     //银行卡号
     $balance = Withdrawals::showBlance($uid);
     //显示余额
     //赎回操作
     if (isset($_POST['money'])) {
         $money = $_POST['money'];
         try {
             $result = Withdrawals::User_redeem($uid, $money);
             if ($result) {
                 echo '赎回成功';
                 exit;
             }
         } catch (ErrorException $e) {
             echo $e->getMessage();
             exit;
         }
     }
     $config = AssetConfig::find()->select(['id', 'ransom_num', 'ransom_min', 'ransom_max'])->where(['id' => '2'])->asArray()->one();
     $infos_rar = $this->Ucenter();
     //用户数据包
     return $this->render('redemption', compact("bank_card", "balance", "infos_rar", "amount_total", "invest_total", "model", "result_bind", "logo_bind", "redemption_max", "redemption_min", "today_num", "redemption_times", 'config'));
 }