示例#1
0
 public function detail()
 {
     $jsoncode = file_get_contents("php://input");
     //alogsm("detail",0,1,$jsoncode);
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (!is_array($arr) || empty($arr) || empty($arr['id']) || !in_array($arr['type'], array(3, 4, 5, 6, 7))) {
         ajaxmsg("查询错误!", 0);
     }
     $pre = C('DB_PREFIX');
     $id = intval($arr['id']);
     //$id = 30;
     $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php");
     //borrowinfo
     $borrowinfo = M("borrow_info bi")->field('bi.id as bid,bi.*,ac.title,ac.id')->join('lzh_article ac on ac.id= bi.danbao')->where('bi.id=' . $id)->find();
     if (!is_array($borrowinfo) || $borrowinfo['borrow_status'] == 0 && $this->uid != $borrowinfo['borrow_uid']) {
         ajaxmsg("数据有误", 0);
     }
     $borrowinfo['biao'] = $borrowinfo['borrow_times'];
     $borrowinfo['need'] = $borrowinfo['borrow_money'] - $borrowinfo['has_borrow'];
     $borrowinfo['lefttime'] = $borrowinfo['collect_time'] - time();
     $borrowinfo['progress'] = getFloatValue($borrowinfo['has_borrow'] / $borrowinfo['borrow_money'] * 100, 2);
     //$list['type'] = 1;
     $list['id'] = $id;
     $list['type'] = getleixing($borrowinfo);
     $list['borrow_name'] = $borrowinfo['borrow_name'];
     $list['borrow_money'] = $borrowinfo['borrow_money'];
     $list['borrow_interest_rate'] = $borrowinfo['borrow_interest_rate'];
     //$list['huankuan_type'] = $borrowinfo['repayment_type'];
     $list['repayment_type'] = $borrowinfo['repayment_type'];
     if ($list['repayment_type'] == 1) {
         $list['borrow_duration'] = $borrowinfo['borrow_duration'];
     } else {
         $list['borrow_duration'] = $borrowinfo['borrow_duration'];
     }
     $list['huankuan_type'] = $Bconfig['REPAYMENT_TYPE'][$borrowinfo['repayment_type']];
     $list['borrow_use'] = $Bconfig['REPAYMENT_TYPE'][$borrowinfo['borrow_use']];
     $list['borrow_min'] = $borrowinfo['borrow_min'];
     $list['borrow_max'] = $borrowinfo['borrow_max'] == "0" ? "无" : "{$borrowinfo['borrow_max']}";
     $list['progress'] = $borrowinfo['progress'];
     $list['need'] = $borrowinfo['need'];
     if ($borrowinfo['progress'] >= 100) {
         $list['lefttime'] = "已结束";
     } elseif ($borrowinfo['lefttime'] > 0) {
         $left_tian = floor($borrowinfo['lefttime'] / (60 * 60 * 24));
         $left_hour = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60) / 3600);
         $left_minute = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60) / 60);
         $left_second = floor($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60 - $left_minute * 60);
         $list['lefttime'] = $left_tian . "," . $left_hour . "," . $left_minute . "," . $left_second;
         //$list['lefttime'] = $left_tian."天".$left_hour."小时".$left_minute."分钟".$left_second."秒";
     } else {
         $list['lefttime'] = "已结束";
     }
     //$list['borrow_breif'] = $borrowinfo['borrow_info'];
     $list['borrow_breif'] = "<p style='color:#5c5c5c;font-size:13.5px;font-family: Droid Sans Fallback;'>" . strip_tags($borrowinfo['borrow_info']) . "</p>";
     $list['invest_num'] = M("borrow_investor")->where("borrow_id={$id}")->count("id");
     $minfo = M("members")->where("id={$borrowinfo['borrow_uid']}")->find();
     $list['credit_rating'] = getLeveIco($minfo['credits'], 3);
     $list['user_name'] = $minfo['user_name'];
     $list['imgpath'] = get_avatar($borrowinfo['borrow_uid']);
     $list['addtime'] = date("Y-m-d", $borrowinfo['add_time']);
     $list['loan_use'] = $this->gloconf['BORROW_USE'][$borrowinfo['borrow_use']];
     if ($borrowinfo['reward_type'] == 1) {
         $list['reward'] = $borrowinfo['reward_num'];
     } elseif ($borrowinfo['reward_type'] == 2) {
         $list['reward'] = $borrowinfo['reward_num'];
     } else {
         $list['reward'] = "0";
     }
     echo ajaxmsg($list);
 }
示例#2
0
 public function detail()
 {
     $jsoncode = file_get_contents("php://input");
     //alogsm("detail",0,1,$jsoncode);
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (!is_array($arr) || empty($arr) || empty($arr['id']) || !in_array($arr['type'], array(3, 4, 5, 6, 7))) {
         ajaxmsg("查询错误!", 0);
     }
     $pre = C('DB_PREFIX');
     $id = intval($arr['id']);
     //$id = 30;
     $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php");
     //borrowinfo
     $borrowinfo = M("borrow_info bi")->field('bi.id as bid,bi.*,ac.title,ac.id')->join('lzh_article ac on ac.id= bi.danbao')->where('bi.id=' . $id)->find();
     if (!is_array($borrowinfo) || $borrowinfo['borrow_status'] == 0 && $this->uid != $borrowinfo['borrow_uid']) {
         ajaxmsg("数据有误", 0);
     }
     $borrowinfo['biao'] = $borrowinfo['borrow_times'];
     $borrowinfo['need'] = $borrowinfo['borrow_money'] - $borrowinfo['has_borrow'];
     $borrowinfo['lefttime'] = $borrowinfo['collect_time'] - time();
     $borrowinfo['progress'] = getFloatValue($borrowinfo['has_borrow'] / $borrowinfo['borrow_money'] * 100, 2);
     //$list['type'] = 1;
     $list['id'] = $id;
     $list['type'] = getleixing($borrowinfo);
     $list['borrow_name'] = $borrowinfo['borrow_name'];
     $list['borrow_money'] = $borrowinfo['borrow_money'];
     $list['borrow_interest_rate'] = $borrowinfo['borrow_interest_rate'];
     $list['repayment_type'] = $borrowinfo['repayment_type'];
     if ($list['repayment_type'] == 1) {
         $list['borrow_duration'] = $borrowinfo['borrow_duration'] . "天";
     } else {
         $list['borrow_duration'] = $borrowinfo['borrow_duration'] . "个月";
     }
     $list['huankuan_type'] = $Bconfig['REPAYMENT_TYPE'][$borrowinfo['repayment_type']];
     $list['borrow_use'] = $Bconfig['REPAYMENT_TYPE'][$borrowinfo['borrow_use']];
     $list['borrow_min'] = $borrowinfo['borrow_min'];
     $list['borrow_max'] = $borrowinfo['borrow_max'] == "0" ? "无" : "{$borrowinfo['borrow_max']}";
     $list['progress'] = $borrowinfo['progress'];
     $list['need'] = $borrowinfo['need'];
     if ($borrowinfo['lefttime'] > 0) {
         $left_tian = floor($borrowinfo['lefttime'] / (60 * 60 * 24));
         $left_hour = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60) / 3600);
         $left_minute = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60) / 60);
         $left_second = floor($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60 - $left_minute * 60);
         $list['lefttime'] = $left_tian . "," . $left_hour . "," . $left_minute . "," . $left_second;
     } else {
         $list['lefttime'] = "已结束";
     }
     $list['borrow_info'] = $borrowinfo['borrow_info'];
     $list['invest_num'] = M("borrow_investor")->where("borrow_id={$id}")->count("id");
     $minfo = M("members")->where("id={$borrowinfo['borrow_uid']}")->find();
     $list['user_name'] = $minfo['user_name'];
     $list['imgpath'] = get_avatar($borrowinfo['borrow_uid']);
     $list['addtime'] = date("Y-m-d", $borrowinfo['add_time']);
     if ($borrowinfo['reward_type'] == 1) {
         $list['reward'] = $borrowinfo['reward_num'] . "%";
     } elseif ($borrowinfo['reward_type'] == 2) {
         $list['reward'] = $borrowinfo['reward_num'];
     } else {
         $list['reward'] = "0";
     }
     echo ajaxmsg($list);
     //评论
     //$cmap['tid'] = $id;
     //		$clist = getCommentList($cmap,5);
     //		$this->assign("Bconfig",$Bconfig);
     //		$this->assign("gloconf",$this->gloconf);
     //		$this->assign("commentlist",$clist['list']);
     //		$this->assign("commentpagebar",$clist['page']);
     //		$this->assign("commentcount",$clist['count']);
     //		$this->display();
 }