Example #1
0
 public function actionList()
 {
     $invest = Invest::find()->where(['invest_status' => Invest::STATUS_ACTIVE])->andWhere(['>=', 'buy_time_end', time()])->andWhere(['<=', 'buy_time_start', time()])->limit(10)->orderBy('id desc');
     $experiences = clone $invest;
     $experiences = $experiences->andWhere(['type' => Invest::TYPE_EXPERIENCE_MONEY])->all();
     $moneys = clone $invest;
     $moneys = $moneys->andWhere(['type' => Invest::TYPE_MONEY])->all();
     return $this->view('list', ['experiences' => $experiences, 'moneys' => $moneys]);
 }
Example #2
0
 public function actionIndex()
 {
     $model = Invest::find()->orderBy('id desc')->all();
     foreach ($model as $k => $v) {
         $model[$k]['created_at'] = date("Y-m-d H:i:s", $v['created_at']);
         $model[$k]['updated_at'] = date("Y-m-d H:i:s", $v['updated_at']);
         $model[$k]['invest_status'] = Invest::get_record_status($v['invest_status']);
         $model[$k]['buy_time_start'] = date("Y-m-d H:i:s", $v['buy_time_start']);
         $model[$k]['buy_time_end'] = date("Y-m-d H:i:s", $v['buy_time_end']);
         $model[$k]['type'] = Invest::get_type($model[$k]['type']);
     }
     return $model;
 }
Example #3
0
 public function actionSignupFinish()
 {
     try {
         $member = wanhunet::app()->member;
         $wechat_id = $member->getOtherInfo(MemberOther::TABLE_WECHAT);
         /** @var ShareGift $shateGift */
         $shateGift = ShareGift::find()->where(['wechat_id' => $wechat_id->row])->one();
         $limit = $shateGift->gift_limit;
         /** @var Invest $invest */
         $invest = Invest::find()->where(["type" => Invest::TYPE_REG])->one();
         if (InvestList::hasBuy($member->getId(), $invest->id)) {
             $investOrder = InvestList::find()->where(["member_id" => $member->getId()])->andWhere(['invest_id' => $invest->id])->andWhere(['status' => self::STATUS_PAYED])->one();
         } else {
             $investOrder = new InvestList();
             $investOrder->investment_sum = $limit;
             $investOrder->invest_id = $invest->id;
             $order = $invest->markOrderReg($investOrder);
             $investOrder->finishPay(new Event());
             $shateGift->has_gift = ShareGift::HAS_GIFT;
             $shateGift->user_id = $member->id;
             $shateGift->save();
         }
         return $this->view("signup_finish", ['info' => $investOrder]);
     } catch (\Exception $e) {
         //            throw $e;
         return $this->redirect(Url::to(['site/signin']));
     }
 }