public function actionInvesting() { //TODO //累计金额 $money_total = Log::find()->select("sum(step) as step")->where(['action' => 'Invest/invest', 'status' => Log::STATUS_INVEST_SUC])->andWhere(['>', 'create_at', 1441641600])->asArray()->one()['step']; //累计收益 $income_total = (new Query())->select("sum(smoney) as smoney")->from("fund_income")->where('created_at >= 1441641600 ')->one(); //累计人数 $people_total = UcenterMember::find()->where('created_at >= 1441641600 ')->count(); //项目数量 $product_total = Product::find()->where('create_at >= 1441641600 ')->count(); //担保机构 $cat_id = Cat::find()->where("name='担保机构'")->one()->id; $guarantee = Link::find()->where('cat_id=' . $cat_id)->limit(4)->asArray()->all(); //投资项目列表 // $invest_query = (new Query()) // ->select("*") // ->from("fund_product") // ->orderBy('start_at DESC'); //TODO $invest_query = (new Query())->select("*")->where('create_at >= 1441641600 ')->from("fund_product")->orderBy('start_at DESC'); //分页 $pages = new Pagination(['totalCount' => $invest_query->count(), 'pageSize' => 5]); $invest_datas = $invest_query->offset($pages->offset)->limit($pages->limit)->all(); //最新投资记录 $query = (new Query())->select("C.real_name,A.money,A.start_at")->from("fund_orders AS A")->where('A.start_at >= 1441641600 ')->join("left join", "ucenter_member AS C", "A.member_id = C.id")->orderBy("start_at DESC"); $pages_new = new Pagination(['totalCount' => $query->count(), 'pageSize' => '8']); $invest_new = $query->offset($pages_new->offset)->limit($pages_new->limit)->all(); return $this->render('investing', compact("pages", "invest_datas", "invest_new", "pages_new", "income_total", "people_total", "product_total", "guarantee", "money_total")); }
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')); } }
public function actionDetaile() { $pid = $_GET['id']; $product = Product::find()->where(['id' => $pid])->one(); return $this->view('detaile', ['product' => $product]); }
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")); }
<thead> <tr> <th>ID</th> <th>用户名 </th> <th>项目</th> <th>金额</th> <th>购买时间</th> </tr> </thead> <tbody> <?php foreach ($model as $item) { ?> <?php $product = Product::find()->where(['id' => $item['product_id']])->asArray()->one(); $member = UcenterMember::find()->where(['id' => $item['member_id']])->asArray()->one(); ?> <tr data-key="1"> <td><?php echo $item['id']; ?> </td> <td><?php echo $member['username']; ?> </td> <td><?php echo $product['title']; ?> </td>