示例#1
0
 public function getInvestList()
 {
     return $this->hasOne(InvestList::className(), ['id' => 'invest_list_id']);
 }
示例#2
0
文件: list1.php 项目: suyuanen/p2p
月</p>

                                <p>年化利率<?php 
    echo $money->rate;
    ?>
%</p>

                                <p>到期能提取收益和本金</p>
                                <a href="<?php 
    echo \yii\helpers\Url::to(['view', 'id' => $money['id']]);
    ?>
"
                                   style="display: inline;">查看详情</a>
                            </div>
                            <?php 
    $orderSum = \modules\invest\models\InvestList::getAlreadyBuy($money);
    $sum = 0;
    foreach ($orderSum as $p) {
        $sum += $p;
    }
    ?>

                            <?php 
    if ($sum >= $money->amount) {
        ?>
                                <div class="inv3 mm" id="<?php 
        echo $money->id;
        ?>
">
                                    <p>
                                        已满标
示例#3
0
文件: list.php 项目: suyuanen/p2p
    ?>
%"></p>
                                </div>
                            </div>
                            <div class="baifenCout floatRight"><?php 
    echo $baifenbi;
    ?>
%</div>
                        </dd>
                        <dd class="clearFloat ManPeop">
                            <div class="liPeoNumLeft floatLeft clearFloat">
                                <i class="floatLeft"></i>

                                <em class="floatLeft">
                                    <?php 
    echo \modules\invest\models\InvestList::getAlreadyBuyCount($money);
    ?>
人已购买
                                </em>
                            </div>
                            <div class="LiPeoNumRight floatLeft clearFloat">
                                <i class="floatLeft"></i>
                                <em class="floatLeft">100%保本保息</em>
                            </div>
                        </dd>
                    </dl>
                </a>
            </li>
        <?php 
}
?>
示例#4
0
 public function actionPayWithBalance()
 {
     try {
         $pass = wanhunet::app()->member->validatePayPass(wanhunet::$app->request->post('paypass'));
         if (!$pass) {
             throw new ErrorException('密码验证错误', ErrorCode::Pay_pass_empty);
         }
         /** @var InvestList $order */
         $order = InvestList::findOne(wanhunet::$app->getSession()->get("order"));
         wanhunet::app()->member->payOrderWithBalance($order);
         wanhunet::$app->getSession()->remove('order');
         return $this->view('/invest/pay_return');
     } catch (\ErrorException $e) {
         if ($e->getCode() == ErrorCode::Pay_pass_empty) {
             return $this->goBack(['info' => $e->getMessage()], Url::to(['pay/pay-pass']));
         } else {
             return $this->goBack(['info' => $e->getMessage()], Url::to(['pay/pay-pass']));
         }
     }
 }
示例#5
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]);
 }
示例#6
0
文件: pay_pass.php 项目: suyuanen/p2p
<?php

/** @var \wanhunet\base\View $this */
if (($order = \wanhunet\wanhunet::$app->getSession()->get('order')) !== null) {
    if (is_array($order)) {
        $price = \modules\asset\models\AssetMoney::findOne($order[1])->getPrice();
        $action = \yii\helpers\Url::to(['pay/mention']);
    } else {
        $price = \modules\invest\models\InvestList::findOne($order)->getPrice();
        $action = \yii\helpers\Url::to(['pay/pay-with-balance']);
    }
}
?>
    <section class="login_bt divoi wh-addpage" style="padding:20px 8px 0;">
        <form class="wh-addform" id="form" action="<?php 
echo $action;
?>
" method="post">
            <div class="divoi_odi">
                <div class="login_td login-fall">
                    <input style="text-align:center;" type="password" name="paypass" placeholder="请输入交易密码"/>
                </div>
            </div>
            <p class="font-s16 wh-addptop mb10">为了保证资金安全,请输入您的交易密码,默认为登录密码</p>

            <p class="font-s16 mt20 mb10">支付金额:<span
                    class="hui8">
                <?php 
echo $price;
?>
                    元</span></p>
示例#7
0
 private function makeView(&$investList)
 {
     $investList['created_at'] = Utils::dateFormat('Y-m-d H:i:s', $investList['created_at']);
     $investList['updated_at'] = Utils::dateFormat('Y-m-d H:i:s', $investList['updated_at']);
     $investList['interest_time'] = Utils::dateFormat('Y-m-d H:i:s', $investList['interest_time']);
     $investList['pay_time'] = Utils::dateFormat('Y-m-d H:i:s', $investList['pay_time']);
     $investList['status'] = InvestList::get_status($investList['status']);
     $investList['interest_status'] = InvestList::get_status($investList['interest_status']);
     if ($investList['status'] == '终审通过') {
         $investList['interest_status'] = '已返息';
     }
     if (isset($investList['member'])) {
         $investList['member']['idcard_status'] = Member::get_auth_status($investList['member']['idcard_status']);
         $investList['member']['email_status'] = Member::get_auth_status($investList['member']['email_status']);
         $investList['member']['status'] = Member::get_record_status($investList['member']['status']);
         $investList['member']['created_at'] = Utils::dateFormat('Y-m-d', $investList['member']['created_at']);
         foreach ($investList['member'] as $key => &$memberInfo) {
             $investList['member_' . $key] = $memberInfo;
         }
         unset($investList['member']);
     }
     if (isset($investList['invest'])) {
         $investList['invest']['invest_status'] = InvestList::get_record_status($investList['invest']['invest_status']);
         $investList['invest']['created_at'] = Utils::dateFormat('Y-m-d', $investList['invest']['created_at']);
         $investList['invest']['updated_at'] = Utils::dateFormat('Y-m-d', $investList['invest']['updated_at']);
         $investList['invest']['buy_time_start'] = Utils::dateFormat('Y-m-d', $investList['invest']['buy_time_start']);
         $investList['invest']['buy_time_end'] = Utils::dateFormat('Y-m-d', $investList['invest']['buy_time_end']);
         $investList['invest']['type'] = Invest::get_type($investList['invest']['type']);
         foreach ($investList['invest'] as $key => &$investInfo) {
             $investList['invest_' . $key] = $investInfo;
         }
         unset($investList['invest']);
     }
 }
示例#8
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']));
     }
 }
示例#9
0
文件: params.php 项目: suyuanen/p2p
<?php

use modules\asset\behaviors\ExperienceMoney;
return ['adminEmail' => '*****@*****.**', 'behaviors' => [\modules\member\models\VerificationCode::className() => ['assetExperienceMoney' => ['class' => ExperienceMoney::className()]], \modules\member\models\Member::className() => ['asset' => ['class' => \modules\asset\behaviors\Asset::className(), 'assetConfig' => \modules\asset\models\Asset::className()], 'assetExperienceMoney' => ['class' => ExperienceMoney::className()]], \modules\asset\models\Asset::className() => ['asset_log' => ['class' => \modules\asset\behaviors\Log::className()], 'assetExperienceMoney' => ['class' => ExperienceMoney::className()]], \modules\invest\models\InvestList::className() => ['payedFinish' => \modules\invest\behaviors\InvestListPayed::className()], \modules\asset\models\AssetMoney::className() => [\modules\asset\behaviors\Log::className()], \modules\member\models\MemberOther::className() => [ExperienceMoney::className()]], 'events' => [\modules\asset\behaviors\Asset::className() => [\modules\member\models\Member::EVENT_AFTER_INSERT => \modules\asset\behaviors\Asset::FUNCTION_MEMBER_AFTER_INSERT], \modules\asset\behaviors\ExperienceMoney::className() => [\modules\member\models\VerificationCode::EVENT_VERIFY_SUCCESS_EMAIL => ExperienceMoney::FUNCTION_INC_EMAIL, \modules\member\models\VerificationCode::EVENT_VERIFY_SUCCESS_PHONE => ExperienceMoney::FUNCTION_INC_PHONE, \modules\asset\models\AssetMoney::EVENT_FINISH_PAY => ExperienceMoney::FUNCTION_INC_FIRST_MONEY, \modules\member\models\Member::EVENT_BEFORE_SAVE_IDCARD => ExperienceMoney::FUNCTION_INC_FIRST_IDCARD, \modules\member\models\MemberOther::EVENT_AFTER_INSERT => ExperienceMoney::FUNCTION_INT_BANGDING], \modules\invest\behaviors\InvestListPayed::className() => [\modules\invest\models\InvestList::EVENT_BEFORE_FINISH_PAY => \modules\invest\behaviors\InvestListPayed::FUNCTION_SET_INTEREST, \modules\invest\models\InvestList::EVENT_AFTER_FINISH_PAY => \modules\invest\behaviors\InvestListPayed::FUNCTION_SET_INTEREST_M], \modules\asset\behaviors\Log::className() => [\modules\asset\models\AssetMoney::EVENT_BEFORE_INSERT => \modules\asset\behaviors\Log::FUNCTION_BEFORE_INSERT]]];
示例#10
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]);
 }
示例#11
0
文件: view.php 项目: suyuanen/p2p
<?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";
示例#12
0
文件: Invest.php 项目: suyuanen/p2p
 /**
  * 通过用户请求生成订单
  * @param Order $order
  * @return InvestList
  * @throws ErrorException
  */
 public function markOrder(Order $order)
 {
     $price = $order->getPrice();
     $orderSum = InvestList::getAlreadyBuy($this);
     if (Config::getInstance()->getProperty('Invest.sumConfig') == 'both') {
         $sum = $orderSum[InvestList::STATUS_PAYED] + $orderSum[InvestList::STATUS_UNPAYED];
     } else {
         //TODO 可能出现问题由于这个是计算的已付的金额
         $sum = $orderSum[InvestList::STATUS_PAYED];
     }
     $rest = $this->amount - $sum;
     $eachMax = $this->each_max == 0 ? $this->amount : $this->each_max;
     $eachMin = $rest < $this->each_min ? $rest : $this->each_min;
     if ($price > $rest || $price > $eachMax) {
         throw new ErrorException('您购买的金额超出最大购买量', ErrorCode::Buy_each_max);
     }
     if ($price < $eachMin) {
         throw new ErrorException('您购买的金额小于最少购买量', ErrorCode::Buy_each_min);
     }
     if (time() > $this->buy_time_end || time() < $this->buy_time_start) {
         throw new ErrorException('您购买的不在购买时间内', ErrorCode::Buy_out_time);
     }
     if ($this->type == self::TYPE_EXPERIENCE_MONEY) {
         if ($price > wanhunet::app()->member->getExperienceMoneyMax()) {
             throw new ErrorException('您购买的金额超出您个人最大体验金购买量', ErrorCode::Buy_experience_money_max);
         }
     }
     /*if (InvestList::hasBuy(wanhunet::app()->member->getId(), $this->id)) {
           throw new ErrorException('您已经买过了', ErrorCode::Buy_has_buy);
       }*/
     //TODO 这个[[wanhunet::app()->member->getId()]] 应该动态配置
     $order->setUserId(wanhunet::app()->member->getId());
     $order->setProductId($this->id);
     $saveOrder = $order->saveOrder();
     if ($saveOrder) {
         $this->afterMarkOrder();
     }
     return $order;
 }