Ejemplo n.º 1
0
 /**
  * 贷款详情
  */
 public function detailAction()
 {
     $uid = $this->urlParam();
     !$uid and $this->pageError('param');
     $detail = Loan::findByUid($uid);
     !$detail and $this->pageError('param');
     $repayList = Repay::findByUid($uid);
     $this->view->setVars(['detail' => $detail, 'repayList' => $repayList]);
 }
Ejemplo n.º 2
0
 public static function doRepay($id, $data)
 {
     $repay = Repay::findFirst($id);
     if (!$repay) {
         return false;
     }
     foreach ($data as $field => $value) {
         $repay->{$field} = $value;
     }
     if ($repay->update()) {
         return true;
     }
     $repay->outputErrors($repay);
     return false;
 }
Ejemplo n.º 3
0
 private function account_summary($xml)
 {
     if (!$this->bind_check($xml)) {
         return;
     }
     $uid = $this->user_profile->id;
     $from = $xml->FromUserName;
     $to = $xml->ToUserName;
     $url = _url('/user');
     if (ENV == 'dev') {
         $url = preg_replace('/^https/', 'http', $url);
     }
     $account = Account::get($uid);
     if (!$account) {
         $account = new Account();
     }
     $unuse_coupon = Coupon::total_available($uid);
     // 		$my_profit = $account->my_profit();
     $repay_sum_need = Repay::get_sum_amount_by_uid($uid, Repay::STATUS_NEW);
     $prj_count = Order::get_prj_count_by_uid($uid, array(Order::STATUS_PAYDONE, Order::STATUS_NEW, Order::STATUS_BLOCK));
     // 		$platform_interest_done = PlatformInterest::get_total_amount_by_uid($uid, Trade::STATUS_DONE);
     $platform_interest_new = PlatformInterest::get_total_amount_by_uid($uid, Trade::STATUS_NEW);
     // 		$stock_transfer_done = StockTransfer::get_total_amount_by_uid($uid, Trade::STATUS_DONE);
     $lqjh_account = LqjhAccount::get($uid);
     // 		$qxjh_amount = ApolloOrder::get_amount_by_uid($uid, ApolloOrder::STATUS_PAYDONE);
     if ($lqjh_account) {
         $lqjh_amount = $lqjh_account->get_amount();
     } else {
         $lqjh_amount = 0;
     }
     $bxjh_repay_new = BxjhRepay::get_sum_amount_by_uid($uid, BxjhRepay::STATUS_NEW);
     // 		$bxjh_platform_interest_new = BxjhPlatformInterest::get_sum_amount_by_uid($uid, BxjhPlatformInterest::STATUS_NEW);
     $repay_sum_already = Account::get_total_profit($uid);
     $asset = Account::get_total_asset($uid);
     $remain_amount = Account::get_remain_amount($uid);
     $ret_text = '';
     $ret_text .= "总资产 (元): " . Money::show_money($asset) . "\n";
     $ret_text .= "账户余额(元): " . Money::show_money($remain_amount) . "\n";
     $ret_text .= "累计收益(元): " . Money::show_money($repay_sum_already) . "\n";
     $ret_text .= "\n";
     // 		$ret_text .= "在投项目(个): " . $prj_count . "\n";
     $ret_text .= "待收本金(元): " . Money::show_money($repay_sum_need->total_amount - $repay_sum_need->total_interest + $bxjh_repay_new->total_amount - $bxjh_repay_new->total_interest) . "\n";
     $ret_text .= "零钱金额(元): " . Money::show_money($lqjh_amount) . "\n";
     // 		$ret_text .= "待收利息(元): " . Money::show_money($repay_sum_need->total_interest+ $platform_interest_new) . "\n";
     $ret_text .= "\n";
     $ret_text .= "未用投资券总价值(元): " . Money::show_money($unuse_coupon) . "\n\n";
     $ret_text = preg_replace('/<\\/?span>/', '', $ret_text);
     $news_arr = array(array('title' => '账户概览', 'desc' => $ret_text, 'link' => $url));
     $this->wx_reply->imm_reply_news($to, $from, $news_arr);
 }
Ejemplo n.º 4
0
 public function repay()
 {
     $id = $this->data['id'];
     unset($this->data['id']);
     return Repay::doRepay($id, $this->data);
 }