Example #1
0
 public function actionDoinvest()
 {
     $uid = Yii::$app->user->id;
     if ($_POST) {
         $money = $_POST['money'];
         $pid = $_POST['product_id'];
         $result = Invest::Invest($uid, $pid, $money);
         Invest::gold($uid, $money);
         //体验金
         if ($result['errorNum'] == 1) {
             return $result['errorMsg'];
         } else {
             return '您已成功完成了投资';
         }
     }
 }
Example #2
0
 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'));
     }
 }
Example #3
0
 /**
  * Auther:langxi
  *
  * app获取项目的可投金额
  */
 public function actionKmoney()
 {
     $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('pid', $data)) {
                 $pid = $data['pid'];
                 $result = Invest::kmoney($pid);
             } else {
                 $result = array('errorNum' => '1', 'errorMsg' => '参数错误', 'data' => null);
             }
         }
     } catch (ErrorException $e) {
         Yii::error("app获取项目的可投金额---异常 方法:actionKmoney 参数:" . json_encode($result['data']), "app");
         Yii::trace($e->getMessage(), "app");
         $result = array('errorNum' => '7', 'errorMsg' => '服务器异常,请联系管理员', 'data' => null);
     }
     $result = App::AppReturn($result);
     return $result;
 }
Example #4
0
 public function actionProductlist()
 {
     if ($_REQUEST) {
         $page = intval($_REQUEST[page]);
         $page_num = intval($_REQUEST[num]);
         try {
             $result = Invest::product_list($page_num, $page);
         } catch (Exception $ex) {
             $result = '';
         }
         $datas = json_encode($result[data]);
         echo $datas;
     }
 }