Example #1
0
 public function actionPrivilege()
 {
     $investSum = InvestList::find()->where(['status' => InvestList::STATUS_PAYED, 'member_id' => wanhunet::$app->user->getId()])->joinWith(['invest' => function ($query) {
         /** @var \yii\db\ActiveQuery $query */
         $query->andWhere(['type' => Invest::TYPE_MONEY]);
     }])->sum('investment_sum');
     $friends = wanhunet::app()->member->findFriendIds();
     $fInveset = 0;
     if (count($friends) > 0) {
         $ids = [];
         foreach ($friends as $id) {
             $ids[] = $id['id'];
         }
         $fInveset = InvestList::find()->where(['status' => InvestList::STATUS_PAYED, 'member_id' => $ids])->joinWith(['invest' => function ($query) {
             /** @var \yii\db\ActiveQuery $query */
             $query->andWhere(['type' => Invest::TYPE_MONEY]);
         }])->sum('investment_sum');
     }
     $emMaxList = AssetMoney::find()->where(['type' => AssetMoney::TYPE_EXPERIENCE_MONEY_MAX, 'user_id' => wanhunet::$app->user->getId()])->orderBy('id desc')->joinWith(['actionUid'])->limit(50)->all();
     $einvestListModle = InvestList::find()->where(['status' => InvestList::STATUS_PAYED, 'member_id' => wanhunet::$app->user->getId()])->joinWith(['invest' => function ($query) {
         /** @var \yii\db\ActiveQuery $query */
         $query->andWhere(['type' => Invest::TYPE_EXPERIENCE_MONEY]);
     }]);
     $einvestListSum = $einvestListModle->sum('interest');
     $einvestList = $einvestListModle->limit(50)->orderBy('id desc')->all();
     return $this->view('privilege', ['myInveset' => $investSum, 'fInveset' => $fInveset, 'emMaxList' => $emMaxList, 'einvestList' => $einvestList, 'einvestListSum' => $einvestListSum]);
 }
Example #2
0
 private function getList($startTime = 0, $endTime = 0)
 {
     $endTime = $endTime == 0 ? time() : $endTime;
     $investLists = InvestList::find()->joinWith(['member' => function ($query) {
         /** @var \yii\db\ActiveQuery $query */
         $query->select(Member::$SELECT_ROW);
     }, 'invest'])->andWhere(['>=', InvestList::tableName() . '.created_at', $startTime])->andWhere(['<=', InvestList::tableName() . '.created_at', $endTime])->orderBy('id desc')->asArray()->all();
     foreach ($investLists as &$investList) {
         $this->makeView($investList);
     }
     return $investLists;
 }
Example #3
0
 public function actionOwnProfit()
 {
     $member = wanhunet::app()->member;
     $model = InvestList::find()->where(['member_id' => $member->getId()])->andWhere(['status' => InvestList::STATUS_PAYED])->orWhere(['status' => InvestList::STATUS_ORDER_TRIAL])->orderBy('id desc')->limit(50);
     $eModel = clone $model;
     $eModel = $eModel->joinWith(['invest' => function ($query) {
         /** @var \yii\db\ActiveQuery $query */
         $query->andWhere(['type' => Invest::TYPE_EXPERIENCE_MONEY])->orWhere(['type' => Invest::TYPE_REG]);
     }])->all();
     $mModel = clone $model;
     $mModel = $mModel->joinWith(['invest' => function ($query) {
         /** @var \yii\db\ActiveQuery $query */
         $query->andWhere(['type' => Invest::TYPE_MONEY]);
     }])->all();
     return $this->view('own_profit', ['eModel' => $eModel, 'mModel' => $mModel, 'member' => $member]);
 }
Example #4
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']));
     }
 }
Example #5
0
<?php

/** @var $invest */
$web = \wanhunet\wanhunet::getAlias('@web') . '/';
$isGuest = \wanhunet\wanhunet::$app->user->isGuest;
$isEm = $invest['type'] == \modules\invest\models\Invest::TYPE_EXPERIENCE_MONEY;
$investList = \modules\invest\models\InvestList::find()->where(['invest_id' => $invest['id'], \modules\invest\models\InvestList::tableName() . '.`status`' => \modules\invest\models\InvestList::STATUS_PAYED])->joinWith(["member" => function ($q) {
    /** @var \yii\db\ActiveQuery $q */
    $q->select(\modules\member\models\Member::$SELECT_ROW);
}])->asArray()->orderBy("id desc")->limit(10)->all();
$sum = $invest['orderSum']['10'] + $invest['orderSum']['20'];
$sheng = $invest['amount'] - $sum;
if ($sheng <= 0) {
    $investListCount = \modules\invest\models\InvestList::find()->where(['invest_id' => $invest['id'], \modules\invest\models\InvestList::tableName() . '.`status`' => \modules\invest\models\InvestList::STATUS_PAYED])->count();
    $investListLast = \modules\invest\models\InvestList::find()->where(['invest_id' => $invest['id'], \modules\invest\models\InvestList::tableName() . '.`status`' => \modules\invest\models\InvestList::STATUS_PAYED])->asArray()->orderBy("id desc")->one();
    $shouqingshijian = \wanhunet\helpers\Utils::timeCut($investListLast['pay_time'], $invest['buy_time_start']);
}
?>
<style type="text/css">
    @media screen and (min-width: 320px)
    body {
        font-size:

    16px

    ;
    }

    body {
        color: #3a3a3a;
        font-family: "Helvetica";