コード例 #1
0
ファイル: class.borrow_summary.php プロジェクト: GStepOne/CI
 /**
  * 设置响应的消息体  返回值必须是json
  * 
  */
 public function get_response()
 {
     //传入的用户名和密码bname
     $bid = $this->request_arr['bid'];
     //借标(产品)id
     if (!$bid) {
         $this->result['code'] = 107;
         return $sdata = (object) array();
     }
     $data = $this->getSingleList($bid);
     if (empty($data)) {
         return $sdata = (object) array();
     }
     $sdata['bname'] = $data['borrow_name'];
     $sdata['interest_rate'] = (double) $data['borrow_interest_rate'];
     $sdata['ratio'] = intval(number_format($data['has_borrow'] / $data['borrow_money'] * 100, 2, '.', ''));
     $sdata['borrow_money'] = (double) $data['borrow_money'];
     $sdata['borrow_duration'] = (double) $data['borrow_duration'];
     $sdata['repayment_type'] = repaymentType($data['repayment_type']);
     $sdata['add_datetime'] = date('Y-m-d H:i:s', $data['add_time']);
     $sdata['borrow_min'] = (double) $data['borrow_min'];
     $sdata['borrow_max'] = (double) $data['borrow_max'];
     $sdata['is_new'] = (int) $data['is_new'];
     $sdata['can_invest_money'] = (double) ($data['borrow_money'] - $data['has_borrow']);
     $sdata['remained_time'] = (int) $data['collect_time'] - time();
     //剩余时间
     return $sdata;
 }
コード例 #2
0
ファイル: class.borrow_pact.php プロジェクト: GStepOne/CI
 /**
  * 设置响应的消息体  返回值必须是json
  * 
  */
 public function get_response()
 {
     //传入的用户名和密码bname
     $bid = $this->request_arr['bid'];
     //借标(产品)id
     $data = $this->getPact($bid);
     //生成借款编号
     $data['ppid'] = 'CAILAI-0001-' . date('Ymd', $data['first_verify_time']) . '-' . $data['id'];
     $data['rday'] = '每月';
     $data['rtype'] = repaymentType($data['repayment_type']);
     $data['borrow_use_text'] = pactUse($data['borrow_use']);
     return $data;
 }
コード例 #3
0
ファイル: class.borrow_list.php プロジェクト: GStepOne/CI
 /**
  * 设置响应的消息体  返回值必须是json
  * 
  */
 public function get_response()
 {
     //传入的用户名和密码
     $pageSize = $this->request_arr['page_size'] ? $this->request_arr['page_size'] : 50;
     //每页显示数
     $currentPage = $this->request_arr['page_num'] ? $this->request_arr['page_num'] : 1;
     //页码,当前页
     $total = $this->getTotal();
     //总页数
     $pageNum = ceil($total / $pageSize);
     $data = (array) array();
     //传入的页数参数$currentPage 大于总页数 $pageNum,则返回空数组
     if ($currentPage > $pageNum || $currentPage == 0) {
         return $data;
     }
     $offset = ($currentPage - 1) * $pageSize;
     $listData = $this->getList($offset, $pageSize);
     //id ,,,,,,has_borrow,
     if (empty($listData)) {
         return $data;
     }
     foreach ($listData as $k => $v) {
         $backList[$k]['bid'] = (int) $v['id'];
         $backList[$k]['bname'] = $v['borrow_name'];
         $backList[$k]['interest_rate'] = (int) $v['borrow_interest_rate'];
         $backList[$k]['ratio'] = intval(number_format($v['has_borrow'] / $v['borrow_money'] * 100, 2, '.', ''));
         $backList[$k]['borrow_money'] = floatval(number_format($v['borrow_money'], 2, '.', ''));
         $backList[$k]['borrow_duration'] = (double) $v['borrow_duration'];
         $backList[$k]['borrow_type'] = repaymentType($v['repayment_type']);
         $backList[$k]['borrow_min'] = intval($v['borrow_min']);
         if ($v['borrow_status'] == 3) {
             $backList[$k]['borrow_status'] = '已流标';
         } elseif ($v['borrow_status'] == 4) {
             $backList[$k]['borrow_status'] = '复审中';
         } elseif ($v['borrow_status'] == 6) {
             $backList[$k]['borrow_status'] = '还款中';
         } elseif ($v['borrow_status'] > 6) {
             $backList[$k]['borrow_status'] = '已完成';
         } else {
             $backList[$k]['borrow_status'] = '立即投标';
         }
     }
     return $backList;
 }
コード例 #4
0
ファイル: class.borrow_info.php プロジェクト: GStepOne/CI
 public function getBorrowPaying($userId)
 {
     $db = core::db()->getConnect('CAILAI', true);
     $sql = sprintf("SELECT bi.id AS bid, bi.borrow_name AS bname, bi.repayment_type, bi.borrow_money , bi.repayment_money, bi.borrow_interest_rate, bi.total AS total_periods, bi.has_pay AS payed_periods, d.deadline FROM  %s AS bi LEFT JOIN %s AS d ON d.borrow_id = bi.id WHERE (bi.borrow_uid = '%s') AND (bi.borrow_status = '%s') GROUP BY bi.id ORDER BY d.deadline DESC ", $this->table, $this->tableid, $userId, 6);
     $zw = $db->query($sql);
     $data = array();
     while ($row = $db->fetchArray($zw)) {
         $row['bid'] = (int) $row['bid'];
         $row['total_periods'] = (int) $row['total_periods'];
         $row['payed_periods'] = (int) $row['payed_periods'];
         $row['borrow_money'] = (double) $row['borrow_money'];
         $row['repayment_money'] = (double) $row['repayment_money'];
         $row['borrow_interest_rate'] = (double) $row['borrow_interest_rate'];
         $row['next_pay_date'] = date('Y-m-d', $row['deadline']);
         unset($row['deadline']);
         $row['repayment_type'] = repaymentType($row['repayment_type']);
         $data[] = $row;
     }
     return $data = (array) $data;
 }