public function member() { $utype = C('XMEMBER_TYPE'); $area = get_Area_list(); $uid = intval($_GET['id']); $vo = M('members m')->field("m.user_email,m.customer_name,m.user_phone,m.id,m.credits,m.is_ban,m.user_type,m.user_name,m.integral,m.active_integral,mi.*,mm.*,mb.*")->join("{$this->pre}member_info mi ON mi.uid=m.id")->join("{$this->pre}member_money mm ON mm.uid=m.id")->join("{$this->pre}member_banks mb ON mb.uid=m.id")->where("m.id={$uid}")->find(); $vo['province'] = $area[$vo['province']]; $vo['city'] = $area[$vo['city']]; $vo['area'] = $area[$vo['area']]; $vo['province_now'] = $area[$vo['province_now']]; $vo['city_now'] = $area[$vo['city_now']]; $vo['area_now'] = $area[$vo['area_now']]; $vo['is_ban'] = $vo['is_ban'] == 0 ? "未冻结" : "<span style='color:red'>已冻结</span>"; $vo['user_type'] = $utype[$vo['user_type']]; //$vo['money_collect'] = M('investor_detail')->where(" investor_uid={$uid} AND status =7 ")->sum("capital+interest-interest_fee"); //$vo['money_need'] = M('investor_detail')->where(" borrow_uid={$uid} AND status in(4,7) ")->sum("capital+interest"); //$vo['money_all'] = $vo['account_money'] + $vo['money_freeze'] + $vo['money_collect'] - $vo['money_need']; $this->assign("capitalinfo", getMemberBorrowScan($uid)); $this->assign("wc", getUserWC($uid)); $this->assign("credit", getCredit($uid)); $this->assign("vo", $vo); $this->assign("user", $vo['user_name']); //*******2013-11-23************* $minfo = getMinfo($uid, true); $this->assign("minfo", $minfo); $this->assign('benefit', get_personal_benefit($uid)); //收益相关 $this->assign('out', get_personal_out($uid)); //支出相关 $this->assign('pcount', get_personal_count($uid)); $this->display(); }
/** * 资金信息 */ public function fund() { $this->assign('pcount', get_personal_count($this->uid)); $this->assign('benefit', get_personal_benefit($this->uid)); //收入 $minfo = getMinfo($this->uid, true); $this->assign("minfo", $minfo); $this->display(); }
public function summary($re = false) { $vlist = getMemberMoneySummary($this->uid); $this->assign("vo", $vlist); $this->assign('pcount', get_personal_count($this->uid)); $minfo = getMinfo($this->uid, true); $this->assign("minfo", $minfo); $this->assign('benefit', get_personal_benefit($this->uid)); //收入 $this->assign('out', get_personal_out($this->uid)); //支出 //////////////////////////////////////////////////////////////////// $data['html'] = $this->fetch(); exit(json_encode($data)); }
public function index() { $ucLoing = de_xie($_COOKIE['LoginCookie']); setcookie('LoginCookie', '', time() - 10 * 60, "/"); $this->assign("uclogin", $ucLoing); $this->assign("unread", $read = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id')); $this->assign("mstatus", M('members_status')->field(true)->find($this->uid)); $minfo = getMinfo($this->uid, true); $pin_pass = $minfo['pin_pass']; $has_pin = empty($pin_pass) ? "no" : "yes"; $this->assign("has_pin", $has_pin); $this->assign("memberinfo", M('members')->find($this->uid)); $this->assign("memberdetail", M('member_info')->find($this->uid)); $this->assign("minfo", $minfo); $this->assign('benefit', get_personal_benefit($this->uid)); $this->assign('out', get_personal_out($this->uid)); $this->assign("bank", M('member_banks')->field('bank_num')->find($this->uid)); $info = getMemberDetail($this->uid); $this->assign("info", $info); $this->assign("kflist", get_admin_name()); $list = array(); $pre = C('DB_PREFIX'); $rule = M('ausers u')->field('u.id,u.qq,u.phone')->join("{$pre}members m ON m.customer_id=u.id")->where("u.is_kf =1 and m.customer_id=0")->select(); //m.customer_id={$minfo['customer_id']} foreach ($rule as $key => $v) { $list[$key]['qq'] = $v['qq']; $list[$key]['phone'] = $v['phone']; } $this->assign("kfs", $list); $_SX = M('investor_detail')->field('deadline,interest,capital')->where("investor_uid = {$this->uid} AND status=7")->order("deadline ASC")->find(); $lastInvest['gettime'] = $_SX['deadline']; $lastInvest['interest'] = $_SX['interest']; $lastInvest['capital'] = $_SX['capital']; $this->assign("lastInvest", $lastInvest); $_SX = ""; $_SX = M('investor_detail')->field('deadline,sum(interest) as interest,sum(capital) as capital')->where("borrow_uid = {$this->uid} AND status=7")->group("borrow_id,sort_order")->order("deadline ASC")->find(); $lastBorrow['gettime'] = $_SX['deadline']; $lastBorrow['interest'] = $_SX['interest']; $lastBorrow['capital'] = $_SX['capital']; $this->assign("lastBorrow", $lastBorrow); $map = array(); $map['uid'] = $this->uid; $Log_list = getMoneyLog($map, 4); $this->assign("Log_list", $Log_list['list']); $this->assign("list", get_personal_count($this->uid)); $this->assign("uid", $map['uid']); $this->display(); }
public function login() { $returnData = array('login' => false, 'verify' => false, 'collection' => 0, 'lend' => 0); $isphone = false; if ($this->isMobile($_GET['username'])) { $isphone = true; $data['user_phone'] = text($_GET['username']); $data['user_pass'] = md5($_GET['password']); } else { $data['user_name'] = text($_GET['username']); $data['user_pass'] = md5($_GET['password']); } $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where($data)->find(); if (empty($vo) && true === $isphone) { unset($data['user_phone']); $data['user_name'] = text($_GET['username']); $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where($data)->find(); } if (empty($vo)) { $returnData['login'] = false; } else { $returnData['login'] = true; $uid = $vo['id']; $pre = C('DB_PREFIX'); $memberstatus = M("members m")->field("m.id,m.user_leve,m.time_limit,m.pin_pass,s.id_status,s.phone_status,s.email_status,s.video_status,s.face_status,m.user_phone")->join("{$pre}members_status s ON s.uid=m.id")->where("m.id={$uid}")->find(); if (empty($memberstatus['user_phone']) || $memberstatus['id_status'] != 1) { $returnData['verify'] = false; } else { $returnData['verify'] = true; } $minfo = getMinfo($vo['id'], true); $money_collect = $minfo['money_collect']; $invest_money = $this->getInvestMoney($vo['id']); $invest_money = $invest_money['investmoney']; if (empty($money_collect)) { $money_collect = "0.00"; } if (empty($invest_money)) { $invest_money = "0.00"; } $returnData['collection'] = $money_collect; $returnData['lend'] = $invest_money; } echo json_encode($returnData); }
public function login() { $returnData = array(); $isphone = false; if ($this->isMobile($_GET['username'])) { $isphone = true; $data['user_phone'] = text($_GET['username']); $data['user_pass'] = md5($_GET['password']); } else { $data['user_name'] = text($_GET['username']); $data['user_pass'] = md5($_GET['password']); } $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where($data)->find(); if (empty($vo) && true === $isphone) { unset($data['user_phone']); $data['user_name'] = text($_GET['username']); $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where($data)->find(); } if (empty($vo)) { $returnData['login'] = false; } else { $returnData['login'] = true; $uid = $vo['id']; $members_status = M('members_status')->field('id_status,phone_status,email_status')->where("uid ={$uid}")->find(); if ($members_status['id_status'] == 1) { $returnData['verify'] = true; } else { $returnData['verify'] = false; } $minfo = getMinfo($vo['id'], true); $money_collect = $minfo['money_collect']; $invest_money = $this->getInvestMoney($vo['id']); if (empty($money_collect)) { $money_collect = "0.00"; } $returnData['collection'] = $money_collect; $returnData['lend'] = $money_collect; echo json_encode($returnData); } }
public function withdraw($re = false) { $pre = C('DB_PREFIX'); $field = "m.user_name,m.user_phone,(mm.account_money+mm.back_money) all_money,mm.account_money,mm.back_money,i.real_name,b.bank_num,b.bank_name,b.bank_address"; $vo = M('members m')->field($field)->join("{$pre}member_info i on i.uid = m.id")->join("{$pre}member_money mm on mm.uid = m.id")->join("{$pre}member_banks b on b.uid = m.id")->where("m.id={$this->uid}")->find(); if (empty($vo['bank_num'])) { if (true === $re) { $this->assign("noview", true); return true; } $data['html'] = '<script type="text/javascript">alert("您还未绑定银行帐户,请先绑定");window.location.href="' . __APP__ . '/member/bank#fragment-1";</script>'; } else { $tqfee = explode("|", $this->glo['fee_tqtx']); $txxz_min = $this->glo['txxz_min']; $fee[0] = explode("-", $tqfee[0]); $fee[1] = explode("-", $tqfee[1]); $fee[2] = explode("-", $tqfee[2]); $this->assign("fee", $fee); $this->assign("txxz_min", (int) $txxz_min); $borrow_info = M("borrow_info")->field("sum(borrow_money+borrow_interest+borrow_fee) as borrow, sum(repayment_money+repayment_interest) as also")->where("borrow_uid = {$this->uid} and borrow_type=4 and borrow_status in (0,2,4,6,8,9,10)")->find(); $minfo = getMinfo($this->uid, true); $pin_pass = $minfo['pin_pass']; $has_pin = empty($pin_pass) ? "no" : "yes"; $this->assign("has_pin", $has_pin); $vo['all_money'] -= $borrow_info['borrow'] + $borrow_info['also']; $this->assign("borrow_info", $borrow_info); $this->assign("vo", $vo); $this->assign("memberinfo", M('members')->find($this->uid)); if (true === $re) { $this->assign("noview", false); return true; } $data['html'] = $this->fetch(); } if (true === $re) { return true; } exit(json_encode($data)); }
public function tinvestmoney() { $jsoncode = file_get_contents("php://input"); //alogsm("tinvestmoney",0,1,session("u_id").$jsoncode); if (!$this->uid) { ajaxmsg('请先登录', 0); exit; } $arr = array(); $arr = json_decode($jsoncode, true); if (intval($arr['uid']) != $this->uid) { ajaxmsg("查询错误!", 0); } if (!is_array($arr) || empty($arr) || empty($arr['borrow_id']) || empty($arr['pin']) || empty($arr['num']) || empty($arr['month']) || $arr['type'] != 2) { ajaxmsg("查询错误!", 0); } $_pin = $arr['pin']; $_borrow_id = $arr['borrow_id']; $_tnum = $arr['num']; $_month = $arr['month']; $borrow_id = intval($_borrow_id); $tnum = intval($_tnum); $month = intval($_month); $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid); $amoney = $m['account_money'] + $m['back_money']; $uname = session("u_user_name"); $binfo = M("transfer_borrow_info")->field("borrow_uid,borrow_interest_rate,transfer_out,transfer_back,transfer_total,per_transfer,is_show,deadline,min_month,increase_rate,reward_rate,borrow_duration")->find($borrow_id); if ($this->uid == $binfo['borrow_uid']) { ajaxmsg("不能去投自己的标", 0); } $max_month = $binfo['borrow_duration']; //getTransferLeftmonth($binfo['deadline']); $min_month = $binfo['min_month']; $max_num = $binfo['transfer_total'] - $binfo['transfer_out']; if ($tnum < 1) { ajaxmsg("购买份数必须大于等于1份!", 3); } if ($month < $min_month || $max_month < $month) { ajaxmsg("本标认购期限只能在'" . $min_month . "个月---" . $max_month . "个月'之间", 3); } if ($max_num < $tnum) { ajaxmsg("本标还能认购最大份数为" . $max_num . "份,请重新输入认购份数", 3); } $money = $binfo['per_transfer'] * $tnum; if ($amoney < $money) { ajaxmsg("尊敬的{$uname},您准备认购{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再认购.", __APP__ . "/member/charge#fragment-1", 2); } $vm = getMinfo($this->uid, "m.pin_pass,mm.invest_vouch_cuse,mm.money_collect"); $pin_pass = $vm['pin_pass']; $pin = md5($_pin); if ($pin != $pin_pass) { ajaxmsg("支付密码错误,请重试", 0); } $done = TinvestMoney($this->uid, $borrow_id, $tnum, $month); //投省心宝 if ($done === true) { $_msg['type'] = 2; $_msg['id'] = $borrow_id; $_msg['message'] = "恭喜成功认购{$tnum}份,共计{$money}元"; ajaxmsg($_msg, 1); } else { if ($done) { ajaxmsg($done, 3); } else { ajaxmsg("对不起,认购失败,请重试!", 3); } } }
public function ajax_invest() { if (!$this->uid) { ajaxmsg("请先登陆", 0); } $pre = c("DB_PREFIX"); $id = intval($_GET['id']); $num = intval($_GET['num']); $chooseWay = $_GET['chooseWay']; $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $field = "id,borrow_uid,borrow_money,borrow_interest_rate,borrow_duration,repayment_type,transfer_out,transfer_back,transfer_total,per_transfer,is_show,deadline,min_month,increase_rate,reward_rate"; $vo = M("transfer_borrow_info")->field($field)->find($id); if ($this->uid == $vo['borrow_uid']) { ajaxmsg("不能投自己的标", 0); } if ($vo['transfer_out'] == $vo['transfer_total']) { ajaxmsg("此标可认购份数为0", 0); } if ($vo['is_show'] == 0) { ajaxmsg("只能投正在借款中的标", 0); } $vo['transfer_leve'] = $vo['transfer_total'] - $vo['transfer_out']; $vo['uname'] = M("members")->getFieldById($vo['borrow_uid'], "user_name"); //$vo['leftday'] = ceil(($vo['collect_day']-time())/3600/24); $vm = getMinfo($this->uid, 'm.pin_pass,mm.account_money,mm.back_money,mm.money_collect'); $amoney = $vm['account_money'] + $vm['back_money']; $pin_pass = $vm['pin_pass']; $has_pin = empty($pin_pass) ? "no" : "yes"; //收益开始 $money = $vo['per_transfer']; //每月还息 $monthData['month_times'] = $vo['borrow_duration']; $monthData['account'] = $money; $monthData['year_apr'] = $vo['borrow_interest_rate']; $monthData['type'] = "all"; $repay_detail = EqualEndMonth($monthData); $vo['shouyi4'] = $repay_detail['repayment_account'] - $money; //利息复投 $monthData['month_times'] = $vo['borrow_duration']; $monthData['account'] = $money; $monthData['year_apr'] = $vo['borrow_interest_rate']; $monthData['type'] = "all"; $repay_detail = CompoundMonth($monthData); $vo['shouyi6'] = $repay_detail['repayment_account'] - $money; //收益结束 $this->assign("has_pin", $has_pin); $this->assign("vo", $vo); $this->assign("account_money", $amoney); $this->assign("Bconfig", $Bconfig); $this->assign("num", $num); $this->assign("chooseway", $chooseWay); $data['content'] = $this->fetch(); ajaxmsg($data); }
public function newbie_check() { if (!$this->uid) { ajaxmsg('请先登录', 3); exit; } $type = member_type($this->uid); if ($type['status'] != 3) { ajaxmsg("您是" . $type['type'] . "用户不能投标", 3); } $money = intval($_POST['money']); $borrow_id = intval($_POST['borrow_id']); $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid); $amoney = $m['account_money'] + $m['back_money']; $uname = session('u_user_name'); //用户名称 $vm = getMinfo($this->uid, 'm.pin_pass,mm.account_money,mm.back_money,mm.money_collect'); //这里用来判断 是否投过此新手标 根据$uid $is_access = M('newbie_record')->getFieldByInvest_uid($this->uid, 'id'); //$this->uid if ($is_access) { ajaxmsg("尊敬的财来用户,此标只能进行一次投标,您已经投过此标。", 3); } $binfo = M("newbie_bid")->find($borrow_id); //查询此新手标信息 if ($binfo['min'] > $money) { $this->error("尊敬的{$uname},本标最低投标金额为{$binfo['min']}元,请重新输入投标金额", 3); } else { if ($binfo['max'] < $money) { $this->error("尊敬的{$uname},本标最高投标金额为{$binfo['max']}元,请重新输入投标金额", 3); } } //这里判断是否使用了红包 $redvalue = intval($_POST['redvalue']); //红包面值 if ($redvalue) { // $redtotal=M("active_redpacket")->field('sum(facevalue) as f')->where('owner='.$this->uid)->select(); //查询红包总额 $myown = $redvalue + $amoney; //包括我的红包 if ($money > $myown) { $msg = '您的账户可用余额与所选代金券总额为' . $myown . ',不足支付所投资的金额' . $money; ajaxmsg($msg, 5); } else { $msg1 = '您的账户可用余额与红包总额为' . $myown . ',您确认投标' . $money . '元吗?'; ajaxmsg($msg1, 1); } } else { if ($amoney < $money) { $msg = '尊敬的' . $uname . ',您准备投标' . $money . '元,但您的账户可用余额为' . $amoney . '元,请先去充值再投标'; ajaxmsg($msg, 5); //$this->error("尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再投标.",__APP__."/member/charge#fragment-1"); } else { $msg1 = "尊敬的{$uname},您的账户可用余额为" . $amoney . ",您确认投标{$money}元吗?"; ajaxmsg($msg1, 6); } } //这里判断是否使用了红包(结束) }
public function save() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); if (!$this->uid || $arr['uid'] != $this->uid) { ajaxmsg("请先登录", 0); exit; } if (!is_array($arr) || empty($arr) || empty($arr['uid'])) { ajaxmsg("查询错误!", 0); } $pre = C('DB_PREFIX'); $id = intval($arr['id']); //$id = 30; $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now,m.is_vip,m.is_borrow")->where("m.id={$this->uid}")->find(); //var_dump($vminfo);die; if ($vminfo['is_vip'] == 0) { $_xoc = M('borrow_info')->where("borrow_uid={$this->uid} AND borrow_status in(0,2,4)")->count('id'); if ($_xoc > 0) { ajaxmsg("您有一个借款中的标,请等待审核", 0); } if (!($vminfo['user_leve'] > 0 && $vminfo['time_limit'] > time())) { ajaxmsg("请先通过VIP审核再发标", 0); } if ($vminfo['is_borrow'] == 0) { ajaxmsg("您目前不允许发布借款,如需帮助,请与客服人员联系!", 0); //$this->assign("waitSecond",3); } $vo = getMemberDetail($this->uid); if ($vo['province'] == 0 && $vo['province_now '] == 0 && $vo['province_now '] == 0 && $vo['city'] == 0 && $vo['city_now'] == 0) { ajaxmsg("请先填写个人详细资料后再发标", 0); } } $borrow['borrow_type'] = $arr['vkey']; //intval(cookie(text($_POST['vkey']))); //dump($borrow['borrow_type']);die; if ($borrow['borrow_type'] == 0) { ajaxmsg("校验数据有误,请重新发布", 0); } if (floatval($arr['borrow_interest_rate']) > $rate_lixt[1] || floatval($arr['borrow_interest_rate']) < $rate_lixt[0]) { ajaxmsg("提交的借款利率不在允许范围,请重试", 0); } $borrow['borrow_money'] = intval($arr['borrow_money']); $_minfo = getMinfo($this->uid, "m.pin_pass,mm.account_money,mm.back_money,mm.credit_cuse,mm.money_collect"); $_capitalinfo = getMemberBorrowScan($this->uid); /////////////////////////////////////////////////////// //$vo = M('members m')->field('mm.account_money,mm.back_money,(mm.account_money+mm.back_money) all_money,m.user_leve,m.time_limit')->join("{$pre}member_money mm on mm.uid = //m.id")->where("m.id={$this->uid} AND m.pin_pass='******'")->find(); $borrowNum = M('borrow_info')->field("borrow_type,count(id) as num,sum(borrow_money) as money,sum(repayment_money) as repayment_money")->where("borrow_uid = {$this->uid} AND borrow_status=6 ")->group("borrow_type")->select(); $borrowDe = array(); foreach ($borrowNum as $k => $v) { $borrowDe[$v['borrow_type']] = $v['money'] - $v['repayment_money']; } /////////////////////////////////////////////////// switch ($borrow['borrow_type']) { case 1: //普通标 if ($_minfo['credit_cuse'] < $borrow['borrow_money']) { ajaxmsg("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标", 0); } break; case 2: //新担保标 break; case 4: //净值标 $_netMoney = getFloatValue(0.9 * $_minfo['money_collect'] - $borrowDe[4], 2); if ($_netMoney < $borrow['borrow_money']) { ajaxmsg("您的净值额度{$_netMoney}元,小于您准备借款的金额,不能发标", 0); } break; case 5: //抵押标 //$borrow_type=5; break; } $borrow['borrow_uid'] = $this->uid; $borrow['borrow_name'] = text($arr['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($arr['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($arr['borrow_interest_rate']); if (strtolower($arr['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($arr['repayment_type']); } if ($borrow['repayment_type'] == '1' || $borrow['repayment_type'] == '5') { $borrow['total'] = 1; } else { $borrow['total'] = $borrow['borrow_duration']; //分几期还款 } $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($arr['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($arr['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($arr['borrow_info']); $borrow['reward_type'] = intval($arr['reward_type']); $borrow['reward_num'] = floatval($arr["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($arr['borrow_min']); $borrow['borrow_max'] = intval($arr['borrow_max']); //$borrow['province'] = $vminfo['province_now']; //$borrow['city'] = $vminfo['city_now']; //$borrow['area'] = $vminfo['area_now']; if ($arr['is_pass'] && intval($arr['is_pass']) == 1) { $borrow['password'] = md5($arr['password']); } $borrow['money_collect'] = floatval($arr['moneycollect']); //代收金额限制设置 //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); $borrow['borrow_fee'] = 0.0; if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] + $_minfo['back_money'] < $borrow['borrow_fee'] + $_reward_money) { ajaxmsg("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用", 0); } } //投标上传图片资料(暂隐) foreach ($arr['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $arr['picinfo'][$key]; } $borrow['updata'] = serialize($row); $newid = M("borrow_info")->add($borrow); $suo = array(); $suo['id'] = $newid; $suo['suo'] = 0; $suoid = M("borrow_info_lock")->add($suo); if ($newid) { ajaxmsg("借款发布成功,网站会尽快初审", 1); } else { ajaxmsg("发布失败,请先检查是否完成了个人详细资料然后重试", 0); } }
public function index() { // $this->duizhang(); $ucLoing = de_xie($_COOKIE['LoginCookie']); setcookie('LoginCookie', '', time() - 10 * 60, "/"); $this->assign("uclogin", $ucLoing); $this->assign("unread", $read = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id')); $this->assign("mstatus", M('members_status')->field(true)->find($this->uid)); $danbao = M('borrow_investor')->where("borrow_uid=" . $this->uid)->sum("guar_fee"); $this->assign("danbao", $danbao); //die(M()->getlastsql()); //echo $danbao;exit; //查询会员状态 $vip_status = M("members_status as ms")->field("ms.phone_status,ms.id_status,ms.email_status,ms.safequestion_status,lmb.uid")->join("left join lzh_member_banks as lmb on ms.uid=lmb.uid")->where('ms.uid=' . $this->uid)->find(); $this->vip = $vip_status; $minfo = getMinfo($this->uid, true); $pin_pass = $minfo['pin_pass']; $has_pin = empty($pin_pass) ? "no" : "yes"; $this->assign("has_pin", $has_pin); $this->assign("memberinfo", M('members')->find($this->uid)); $this->assign("memberdetail", M('member_info')->find($this->uid)); $this->assign("minfo", $minfo); //加上新手标的利息 2015-09-18 $benefit = get_personal_benefit($this->uid); //dump($benefit); //查询新手标的代收利息 $newbieinterest = M('newbie_record')->field('interest')->where('investid=' . $this->uid . ' and status=4')->find(); //echo M()->getLastSql(); $benefit['interest_collection'] = $benefit['interest_collection'] + $newbieinterest['interest']; $this->assign('benefit', $benefit); //var_dump(get_personal_benefit($this->uid)); $this->assign('out', get_personal_out($this->uid)); $this->assign("bank", M('member_banks')->field('bank_num')->find($this->uid)); $info = getMemberDetail($this->uid); $this->assign("info", $info); $this->assign("kflist", get_admin_name()); $list = array(); $pre = C('DB_PREFIX'); $rule = M('ausers u')->field('u.id,u.qq,u.phone')->join("{$pre}members m ON m.customer_id=u.id")->where("u.is_kf =1 and m.customer_id={$minfo['customer_id']}")->select(); foreach ($rule as $key => $v) { $list[$key]['qq'] = $v['qq']; $list[$key]['phone'] = $v['phone']; } $this->assign("kfs", $list); $_SX = M('investor_detail')->field('deadline,interest,capital')->where("investor_uid = {$this->uid} AND status=7")->order("deadline ASC")->find(); $lastInvest['gettime'] = $_SX['deadline']; $lastInvest['interest'] = $_SX['interest']; $lastInvest['capital'] = $_SX['capital']; $this->assign("lastInvest", $lastInvest); $_SX = ""; $_SX = M('investor_detail')->field('deadline,sum(interest) as interest,sum(capital) as capital')->where("borrow_uid = {$this->uid} AND status=7")->group("borrow_id,sort_order")->order("deadline ASC")->find(); $lastBorrow['gettime'] = $_SX['deadline']; $lastBorrow['interest'] = $_SX['interest']; $lastBorrow['capital'] = $_SX['capital']; $this->assign("lastBorrow", $lastBorrow); $map = array(); $map['uid'] = $this->uid; $Log_list = getMoneyLog($map, 4); $this->assign("Log_list", $Log_list['list']); $this->assign("list", get_personal_count($this->uid)); //以下是我的投资详细 $zwmap['investor_uid'] = $this->uid; $zwmap['status'] = 4; $zwmap['Borrow.borrow_type'] = array('neq', 9); $zwlist = getTenderList($zwmap, 1); //显示真实姓名 if (is_array($zwlist['list'])) { foreach ($zwlist['list'] as $zwkey => $zwval) { $borrow_uid = $zwval['borrow_uid']; $zwmap = " uid = {$borrow_uid} "; $real_name = M("member_info")->field('real_name')->where($zwmap)->limit(1)->select(); $zwlist['list'][$zwkey]['real_name'] = $real_name[0]['real_name']; unset($real_name); } } //曲线走势图 $result = M("month_detail")->where("user_id=" . $this->uid)->find(); //去掉前三个 $res = array_slice($result, 3); foreach ($res as $key => $value) { $arr[] = $value; } if (max($arr) >= 10000) { foreach ($arr as $key => $value) { $brr[] = $value / 10000; } $this->char = "万元"; } else { if (max($arr) >= 1000) { foreach ($arr as $key => $value) { $brr[] = $value / 1000; } $this->char = "千元"; } else { if (max($arr) >= 100) { foreach ($arr as $key => $value) { $brr[] = $value / 100; } $this->char = "百元"; } else { foreach ($arr as $key => $value) { $brr[] = $value; } $this->char = "元"; } } } if (count($brr) == 0) { $brr = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $this->char = "元"; } $brr = json_encode($brr); $this->arr = $brr; //传输到前端 //日历数据 具体日期具体还款 $month = date('m'); $firstday = date('Y-' . $month . '-01 00:00:00'); $firstsec = strtotime(date('Y-' . $month . '-01 00:00:00')); //零点零分零秒 $lastsec = strtotime(date('Y-m-d 23:59:59', strtotime($firstday . "+1 month -1 day"))); //要查询的月末 $investor_uid = $this->uid; //借款编号 借款者id 应收本金 应收利息 利息管理费 标的状态 还款时间 逾期罚金 借款者真实姓名 $caldata = M('investor_detail as lid')->field('lid.capital,lid.interest,lid.interest_fee,lid.deadline,lid.expired_money')->join("LEFT JOIN lzh_member_info as lmi on lid.borrow_uid = lmi.uid")->where("lid.investor_uid=" . $investor_uid . " and lid.repayment_time = '0' and lid.deadline>" . $firstsec . " and lid.deadline<" . $lastsec)->order('lid.deadline')->select(); foreach ($caldata as $key => $value) { $calender[] = array(date('md', $value['deadline']), $value['capital'] + $value['interest'] + $value['expired_money'] - $value['interest_fee']); } $temp = array(); foreach ($calender as $key => $value) { $key = $value['0']; $temp[$key] = isset($temp[$key]) ? $value['1'] + $temp[$key] : $value['1']; } foreach ($temp as $key => $value) { //$result[] = array('date' => $key, 'money' => $value); $result[] = array($key => $value); } $res = array_slice($result, 15); foreach ($res as $key => $value) { foreach ($value as $k => $v) { $ali[] = $k . '&' . $v; } } $this->ali = json_encode($ali); //最新日历数据遍历 // echo "<pre/>";var_dump($ali); //日历结束 //推荐项目 //正在进行的贷款 $searchMap = array(); $searchMap['Borrow.borrow_status'] = array("eq", '2'); $searchMap['Borrow.is_tuijian'] = array("in", '0,1'); $searchMap['Borrow.borrow_type'] = array("neq", 9); $searchMap['Borrow.is_new'] = array("eq", 0); $listBorrow = getBorrowList($searchMap, 3); $this->listBorrow = $listBorrow; $this->assign("list", $zwlist['list']); $this->assign("pagebar", $zwlist['page']); $this->assign('uid', $this->uid); //我的投资结束 $this->display(); }
public function save() { //if(!$this->uid) $this->error("请先登录",__APP__."/member/common/login"); //if(empty($_FILES['topic']['name'])){ // $this->error('请上传标题图片'); //} $borrow = array(); //$this->savePathNew = C('HOME_UPLOAD_DIR').'Product/'; //$this->thumbMaxWidth = C('PRODUCT_UPLOAD_W'); //$this->thumbMaxHeight = C('PRODUCT_UPLOAD_H'); //$this->saveRule = date("YmdHis",time()).rand(0,1000); //$info = $this->CUpload(); //$borrow['topic'] = $info[0]['savepath'].$info[0]['savename']; if ($_POST['borrow_uid'] == '') { $this->error('选择借款人不能为空!'); } if ($_POST['borrow_type'] == '') { $this->error('借款标类型不能为空!'); } if ($_POST['reward_type'] && ($_POST['reward_type_1_value'] > 6 || $_POST['reward_type_1_value'] < 0)) { $this->error("投标奖励超出范围!"); } if ($this->_post('stock_type') == '') { $this->error("选择配资类型不能为空!"); } $capital_name = htmlspecialchars($this->_post('capital_name')); $capital_card = htmlspecialchars($this->_post('capital_card')); $pre = C('DB_PREFIX'); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now")->where("m.id={$this->uid}")->find(); //相关的判断参数 $borrow['borrow_type'] = $this->_post('borrow_type'); if ($borrow['borrow_type'] == 0) { $this->error("校验数据有误,请重新发布"); } if (floatval($_POST['borrow_interest_rate']) > $rate_lixt[1] || floatval($_POST['borrow_interest_rate']) < $rate_lixt[0]) { $this->error("提交的借款利率超出允许范围,请重试", 0); } $borrow['borrow_money'] = intval($_POST['borrow_money']); $_minfo = getMinfo($this->uid, "m.pin_pass,mm.account_money,mm.back_money,mm.credit_cuse,mm.money_collect"); $_capitalinfo = getMemberBorrowScan($this->uid); /////////////////////////////////////////////////////// $borrowNum = M('borrow_info')->field("borrow_type,count(id) as num,sum(borrow_money) as money,sum(repayment_money) as repayment_money")->where("borrow_uid = {$this->uid} AND borrow_status=6 ")->group("borrow_type")->select(); $borrowDe = array(); foreach ($borrowNum as $k => $v) { $borrowDe[$v['borrow_type']] = $v['money'] - $v['repayment_money']; } /////////////////////////////////////////////////// switch ($borrow['borrow_type']) { case 1: //普通标 //if($_minfo['credit_cuse']<$borrow['borrow_money']) $this->error("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标"); break; case 2: //新担保标 //新担保标 case 3: //秒还标 break; case 4: //净值标 //$_netMoney = getFloatValue(0.9*$_minfo['money_collect']-$borrowDe[4],2); //if($_netMoney<$borrow['borrow_money']) $this->error("您的净值额度{$_netMoney}元,小于您准备借款的金额,不能发标"); break; case 5: //抵押标 //$borrow_type=5; break; } $borrow['borrow_uid'] = $this->_post("borrow_uid"); $borrow['borrow_name'] = text($_POST['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($_POST['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($_POST['borrow_interest_rate']); if (strtolower($_POST['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($_POST['repayment_type']); } if ($borrow['repayment_type'] == '1' || $borrow['repayment_type'] == '5') { $borrow['total'] = 1; } else { $borrow['total'] = $borrow['borrow_duration']; //分几期还款 } $borrow['capital_name'] = $capital_name; $borrow['capital_card'] = $capital_card; $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($_POST['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($_POST['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($_POST['borrow_info']); $borrow['reward_type'] = intval($_POST['reward_type']); $borrow['reward_num'] = floatval($_POST["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($_POST['borrow_min']); $borrow['borrow_max'] = intval($_POST['borrow_max']); $prow = array(); foreach ($_POST['swfimglist'] as $key => $v) { $prow[$key]['img'] = substr($v, 1); $prow[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = false === empty($prow) ? serialize($prow) : ''; /*$borrow['province'] = $vminfo['province_now']; $borrow['city'] = $vminfo['city_now']; $borrow['area'] = $vminfo['area_now'];*/ if ($_POST['is_pass'] && intval($_POST['is_pass']) == 1) { $borrow['password'] = md5($_POST['password']); } $borrow['money_collect'] = floatval($_POST['moneycollect']); //代收金额限制设置 //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); if ($borrow['repayment_type'] == 1) { //按天还 $fee_rate = is_numeric($fee_borrow_manage[0]) ? $fee_borrow_manage[0] / 100 : 0.001; $borrow['borrow_fee'] = getFloatValue($fee_rate * $borrow['borrow_money'] * $borrow['borrow_duration'], 2); } else { $fee_rate_1 = is_numeric($fee_borrow_manage[1]) ? $fee_borrow_manage[1] / 100 : 0.02; $fee_rate_2 = is_numeric($fee_borrow_manage[2]) ? $fee_borrow_manage[2] / 100 : 0.002; if ($borrow['borrow_duration'] > $fee_borrow_manage[3] && is_numeric($fee_borrow_manage[3])) { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); $borrow['borrow_fee'] += getFloatValue($fee_rate_2 * $borrow['borrow_money'] * ($borrow['borrow_duration'] - $fee_borrow_manage[3]), 2); } else { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); } } if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] + $_minfo['back_money'] < $borrow['borrow_fee'] + $_reward_money) { $this->error("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用"); } } if ($borrow['borrow_type'] == 2) { $borrow['danbao'] = $_POST['danbao']; $borrow['huilv'] = M('article')->where("id=" . $_POST['danbao'])->getField('art_keyword'); } //投标上传图片资料(暂隐) foreach ($_POST['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = serialize($row); $borrow['stock_the'] = $this->_post("stock_the"); $borrow['stock_bond_money'] = $this->_post("stock_bond_money"); $borrow['stock_type'] = $this->_post('stock_type'); $newid = M("borrow_info")->add($borrow); $suo = array(); $suo['id'] = $newid; $suo['suo'] = 0; $suoid = M("borrow_info_lock")->add($suo); if ($newid) { $this->success("借款发布成功,网站会尽快初审"); } else { $this->error("发布失败,请先检查是否完成了个人详细资料然后重试"); } }
public function investmoney() { //print_r($_POST);die; //if(!$this->uid) exit; if (!$this->uid) { ajaxmsg('请先登录', 3); exit; } $money = intval($_POST['money']); //var_dump($money);die; $borrow_id = intval($_POST['borrow_id']); //print_r($money); //print_r($borrow_id);die; $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid); //print_r($m);die; $amoney = $m['account_money'] + $m['back_money']; $uname = session('u_user_name'); if ($amoney < $money) { $this->error("尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再投标.", "http://qfw.taoweikeji.com/M/Center/cz_online"); /*if($this->error("尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再投标")){ $this->redirect("http://qfw.taoweikeji.com/M/Center/cz_online"); } */ } //echo "尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再投标";$this->redirect("http://qfw.taoweikeji.com/M/Center/cz_online"); //$this->error("尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再投标.");$this->redirect("http://qfw.taoweikeji.com/M/Center/cz_online"); //$this->error("尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再投标.","http://qfw.taoweikeji.com/M/Center/cz_online"); //$msg = "尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,您要先去充值吗?"; //ajaxmsg($msg,2); $vm = getMinfo($this->uid, 'm.pin_pass,mm.account_money,mm.back_money,mm.money_collect'); $pin_pass = $vm['pin_pass']; $pin = md5($_POST['pin']); if ($pin != $pin_pass) { $this->error("支付密码错误,请重试"); } $binfo = M("borrow_info")->field('borrow_money,money_invest_place,borrow_max,has_borrow,has_vouch,borrow_type,borrow_min,money_collect')->find($borrow_id); //dump($binfo);die; //var_dump($binfo);{ ["borrow_money"]=> string(7) "5000.00" ["money_invest_place"]=> string(1) "0" ["borrow_max"]=> string(1) "0" ["has_borrow"]=> string(4) "0.00" ["has_vouch"]=> string(4) "0.00" ["borrow_type"]=> string(1) "1" ["borrow_min"]=> string(2) "50" ["money_collect"]=> string(4) "0.00" } if ($money % $binfo['borrow_min'] != 0) { echo 0; //ajaxmsg("投标金额必须为起投金额的整数倍",3); $this->error("投标金额必须为起投金额的整数倍"); } ////////////////////////////////////待收金额限制 2013-08-26 fan/////////////////// if ($binfo['money_collect'] > 0) { if ($m['money_collect'] < $binfo['money_collect']) { echo 1; //ajaxmsg("此标设置有投标待收金额限制,您账户里必须有足够的待收才能投此标",3); $this->error("此标设置有投标待收金额限制,您账户里必须有足够的待收才能投此标"); } } $today_start = strtotime(date('Y-m-d', time()) . "00:00:00"); //$today_end = strtotime(date('Y-m-d', time())."23:59:59"); //echo $binfo['borrow_type'];die; if ($binfo['borrow_type'] == 3) { if ($binfo['money_invest_place'] > 0) { $M_affect_money = M('member_moneylog')->where('uid = ' . $this->uid . " AND type in (6,37) AND add_time > " . $today_start . " AND add_time < " . time())->sum('affect_money'); $money_place = $binfo['money_invest_place'] + $M_affect_money; if ($money_place > 0) { echo 2; //ajaxmsg("此标设置有当日投标金额限制,您还需投资".$money_place."元才能投此秒标",3); $this->error("此标设置有当日投标金额限制,您还需投资" . $money_place . "元才能投此秒标"); } } } ////////////////////////////////////待收金额限制 2013-08-26 fan/////////////////// //投标总数检测 $capital = M('borrow_investor')->where("borrow_id={$borrow_id} AND investor_uid={$this->uid}")->sum('investor_capital'); if ($capital + $money > $binfo['borrow_max'] && $binfo['borrow_max'] > 0) { $xtee = $binfo['borrow_max'] - $capital; $this->error("您已投标{$capital}元,此投上限为{$binfo['borrow_max']}元,你最多只能再投{$xtee}"); } //if($binfo['has_vouch']<$binfo['borrow_money'] && $binfo['borrow_type'] == 2) $this->error("此标担保还未完成,您可以担保此标或者等担保完成再投标"); $need = $binfo['borrow_money'] - $binfo['has_borrow']; //echo $need;(5000) $caninvest = $need - $binfo['borrow_min']; //echo $caninvest;(4950) //dump($money); //dump($caninvest); //dump($need);die; if ($money > $caninvest && $need == 0) { echo 3; $msg = "尊敬的{$uname},此标已被抢投满了,下次投标手可一定要快呦!"; $this->error($msg); } if ($binfo['borrow_min'] - $money > 0) { echo 4; $this->error("尊敬的{$uname},本标最低投标金额为{$binfo['borrow_min']}元,请重新输入投标金额"); } if ($need - $money < 0) { echo 5; $this->error("尊敬的{$uname},此标还差{$need}元满标,您最多只能再投{$need}元"); } else { //var_dump($this->uid);//(23) //var_dump($borrow_id);//(12) //var_dump($money);die;//(150) $done = investMoney($this->uid, $borrow_id, $money); //echo $done;die(); //var_dump($done);die; //echo $done;die; } if ($done === true) { //$this->success("恭喜成功投标{$money}元"); $this->redirect("http://qfw.taoweikeji.com/M/Invest/tb_success/money/{$money}"); /*art.dialog({ lock: true, background: '#ccc', // 背景色 opacity: 0.87, // 透明度 content: '恭喜成功投标{$money}元', icon: 'succeed', time:3, }); */ } else { if ($done) { //echo 7;die(); $this->error($done); } else { //echo 8; $this->error("对不起,投标失败,请重试!"); } } }
public function invest() { if (!$this->uid) { if ($this->isAjax()) { die("请先登录后投资"); } else { $this->redirect('M/pub/login'); } } if ($this->isAjax()) { $borrow_id = intval($this->_get('bid')); $tnum = intval($_POST['cnum']); $pre = c("DB_PREFIX"); $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid); $amoney = $m['account_money'] + $m['back_money']; $uname = session("u_user_name"); $binfo = M("transfer_borrow_info")->field("borrow_uid,borrow_interest_rate,transfer_out,transfer_back,transfer_total,\n per_transfer,is_show,deadline,min_month,increase_rate,reward_rate,borrow_duration")->find($borrow_id); if ($this->uid == $binfo['borrow_uid']) { ajaxmsg("不能去投自己的标", 0); } $month = $binfo['borrow_duration']; //手机版默认投资最大期限 $max_num = $binfo['transfer_total'] - $binfo['transfer_out']; if ($max_num < $tnum) { die("本标还能认购最大份数为" . $max_num . "份,请重新输入认购份数"); } $money = $binfo['per_transfer'] * $tnum; if ($amoney < $money) { die("尊敬的{$uname},您准备认购{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再认购"); } $vm = getMinfo($this->uid, "m.pin_pass,mm.invest_vouch_cuse,mm.money_collect"); $pin_pass = $vm['pin_pass']; $pin = md5($_POST['paypass']); // if ($pin != $pin_pass){ // die( "支付密码错误,请重试" ); // } $tinvest_id = TinvestMoney($this->uid, $borrow_id, $tnum, $month); //投企业直投 if ($tinvest_id) { //die('TRUE'); $loanconfig = FS("Webconfig/loanconfig"); $orders = 'T' . date("YmdHi") . $tinvest_id; // 发送到乾多多 $invest_qdd = M("escrow_account")->field('*')->where("uid={$this->uid}")->find(); $borrow_qdd = M("escrow_account")->field('*')->where("uid={$binfo['borrow_uid']}")->find(); $invest_info = M("transfer_borrow_investor")->field("reward_money, borrow_fee")->where("id={$tinvest_id}")->find(); $secodary = ''; import("ORG.Loan.Escrow"); $loan = new Escrow(); if ($invest_info['reward_money'] > 0.0) { // 投标奖励 $secodary[] = $loan->secondaryJsonList($invest_qdd['qdd_marked'], $invest_info['reward_money'], '二次分配', '投标奖励'); } if ($invest_info['borrow_fee'] > 0.0) { // 借款管理费 $secodary[] = $loan->secondaryJsonList($loanconfig['pfmmm'], $invest_info['borrow_fee'], '二次分配', '借款管理费'); } $secodary && ($secodary = json_encode($secodary)); $loanList = $loan->loanJsonList($invest_qdd['qdd_marked'], $borrow_qdd['qdd_marked'], $orders, 'T_' . $borrow_id, $money, $binfo['borrow_money'], '投标', "对{$borrow_id}号企业直投进行投标", $secodary); $loanJsonList = json_encode($loanList); $returnURL = C('WEB_URL') . U("tinvest/wapinvestReturn"); $notifyURL = C('WEB_URL') . U("tinvest/notify"); $data = $loan->transfer($loanJsonList, $returnURL, $notifyURL, 1, 1, 2, 1); // 自动到帐 $form = $loan->setForm($data, 'transfer'); // echo "aaaaaa";die(); echo $form . "正在跳转至乾多多。。。"; exit; } else { die("很遗憾,认购失败,请重试!"); } } else { $borrow_id = $this->_get('bid'); $pre = C('DB_PREFIX'); $borrowinfo = M("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($borrow_id); $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2); $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2); $borrowinfo['updata'] = unserialize($borrowinfo['updata']); $this->assign("vo", $borrowinfo); $user_info = M('member_money')->field("account_money+back_money as money ")->where("uid='{$this->uid}'")->find(); $this->assign('user_info', $user_info); $paypass = M("members")->field('pin_pass')->where('id=' . $this->uid)->find(); $this->assign('paypass', $paypass['pin_pass']); $this->display(); } }
public function verify() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); //ajaxmsg($this->uid); //var_dump($a);die; if (!is_array($arr) || empty($arr) || $arr['uid'] == "") { ajaxmsg("数据有误", 0); } if ($arr['uid'] != $this->uid) { ajaxmsg("您还未登陆,请先登陆!", 0); } $userinfo = M("members")->field('user_name')->where("id={$this->uid}")->find(); $mess = array(); $mess['uid'] = $this->uid; $mess['username'] = $userinfo['user_name']; $mess['head'] = get_avatar($mess['uid']); //头像 $minfo = getMinfo($mess['uid'], true); $mess['credits'] = getLeveIco($minfo['credits'], 3); //会员等级 $membermoney = M("member_money")->field(true)->where("uid={$mess['uid']}")->find(); if (is_array($membermoney)) { $mess['mayuse'] = $membermoney['account_money'] + $membermoney['back_money']; //可用 $mess['freeze'] = $membermoney['money_freeze']; //冻结 $mess['collect'] = $membermoney['money_collect']; //代收 $mess['total'] = $mess['mayuse'] + $mess['freeze'] + $mess['collect']; //总额 $lixi = get_personal_benefit($this->uid); $mess['benefit'] = $lixi['interest_collection']; } else { $mess['total'] = 0; $mess['mayuse'] = 0; $mess['freeze'] = 0; $mess['collect'] = 0; $mess['benefit'] = 0; } $pre = C('DB_PREFIX'); $vo = M("members m")->field("m.user_email,m.user_phone,m.id,m.user_leve,m.time_limit,s.id_status,s.phone_status,s.email_status,s.video_status,s.face_status")->join("{$pre}members_status s ON s.uid=m.id")->where("m.id={$this->uid}")->find(); $str = ""; if ($vo['id_status'] == 1) { $mess['id_status'] = 1; $vm = M("member_info")->field('idcard,real_name')->find($mess['uid']); $mess['real_name'] = $vm['real_name']; $mess['idcard'] = hidecard($vm['idcard'], 1); } elseif ($vo['id_status'] == 3) { $mess['id_status'] = 2; } else { $mess['id_status'] = 0; } if ($vo['phone_status'] == 1) { $mess['phone_status'] = 1; $mess['phone'] = hidecard($vo['user_phone'], 2); } else { $mess['phone_status'] = 0; } if ($vo['email_status'] == 1) { $mess['email_status'] = 1; $mess['email'] = $vo['user_email']; } else { $mess['email_status'] = 0; $mess['email'] = $vo['user_email']; } // if(M('escrow_account')->where("uid={$this->uid}")->count('uid')){ // // ajaxmsg('您已经绑定了托管账户,无需重复绑定',0); // $mess['escrow']=1; // }else{ // $mess['escrow']=0; // } $minfo = getMinfo($this->uid, true); $user_name = session('u_user_name'); //$this->assign("minfo",$minfo); $mess['credits'] = getLeveIco($minfo['credits'], 3); $mess['credit_cuse'] = $minfo['credit_cuse']; $mess['borrow_vouch_cuse'] = $minfo['borrow_vouch_cuse']; if ($minfo['time_limit'] > 0) { $mess['time_limit'] = date('Y-m-d', $minfo['time_limit']); } else { $mess['time_limit'] = "0"; } if ($minfo['credit_cuse'] == null) { $mess['credit_cuse'] = 0; } if ($minfo['borrow_vouch_cuse'] == null) { $mess['borrow_vouch_cuse'] = 0; } $user_qdd = M('escrow_account')->field("invest_auth,secondary_percent")->where("uid=" . $this->uid)->find(); if ($user_qdd['invest_auth'] == 0 || $user_qdd['secondary_percent'] == 0) { $mess['escrow_auth'] = 0; } else { $mess['escrow_auth'] = 1; } $vobank = M("member_banks")->field(true)->where("uid = {$this->uid} and bank_num !=''")->find(); if (empty($vobank['bank_num'])) { $mess['bank_status'] = 0; } else { $mess['bank_status'] = 1; } $kflist = get_admin_name(); $kflist = $kflist[$minfo['customer_id']]; if ($_kflist == null) { $mess['kflist'] = "暂未选择客服"; } $list = array(); $pre = C('DB_PREFIX'); $rule = M('ausers u')->field('u.id,u.qq,u.phone')->join("{$pre}members m ON m.customer_id=u.id")->where("u.is_kf =1 and m.customer_id={$minfo['customer_id']}")->select(); foreach ($rule as $key => $v) { $list[$key]['qq'] = $v['qq']; $list[$key]['phone'] = $v['phone']; } if ($rule == 0) { $mess['qq'] = '暂无QQ'; $mess['phone'] = '暂无客服电话'; } $money_info = M("member_money")->field("account_money, back_money")->where("uid={$this->uid}")->find(); $mess['common_money'] = empty($money_info['account_money']) ? '0.00' : $money_info['account_money']; $money_info = M("member_money")->field("account_money, back_money")->where("uid={$this->uid}")->find(); $mess['back_money'] = empty($money_info['back_money']) ? '0.00' : $money_info['back_money']; ajaxmsg($mess); }
public function vouchcheck() { $pre = C('DB_PREFIX'); if (!$this->uid) { ajaxmsg('', 3); } $pin = md5($_POST['pin']); $money = intval($_POST['vouch_money']); $vm = getMinfo($this->uid, "m.pin_pass,mm.invest_vouch_cuse"); $amoney = $vm['invest_vouch_cuse']; $uname = session('user_name'); $pin_pass = $vm['pin_pass']; $amoney = floatval($amoney); if ($pin != $pin_pass) { ajaxmsg("支付密码错误,请重试", 0); } if ($money > $amoney) { $msg = "尊敬的{$uname},您准备担保{$money}元,但您可用担保投资额度为{$amoney}元,要去申请更高额度吗?"; ajaxmsg($msg, 2); } else { $msg = "尊敬的{$uname},您可用担保投资额度为{$amoney}元,您确认担保{$money}元吗?"; ajaxmsg($msg, 1); } }
public function invest() { if (!$this->uid) { if ($this->isAjax()) { die("请先登录后投资"); } else { $this->redirect('M/pub/login'); } } if ($this->isAjax()) { $borrow_id = intval($this->_get('bid')); $tnum = intval($_POST['cnum']); $pre = c("DB_PREFIX"); $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid); $amoney = $m['account_money'] + $m['back_money']; $uname = session("u_user_name"); $binfo = M("transfer_borrow_info")->field("borrow_uid,borrow_interest_rate,transfer_out,transfer_back,transfer_total,\n per_transfer,is_show,deadline,min_month,increase_rate,reward_rate,borrow_duration")->find($borrow_id); if ($this->uid == $binfo['borrow_uid']) { ajaxmsg("不能去投自己的标", 0); } $month = $binfo['borrow_duration']; //手机版默认投资最大期限 $max_num = $binfo['transfer_total'] - $binfo['transfer_out']; if ($max_num < $tnum) { die("本标还能认购最大份数为" . $max_num . "份,请重新输入认购份数"); } $money = $binfo['per_transfer'] * $tnum; if ($amoney < $money) { die("尊敬的{$uname},您准备认购{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再认购"); } $vm = getMinfo($this->uid, "m.pin_pass,mm.invest_vouch_cuse,mm.money_collect"); $pin_pass = $vm['pin_pass']; $pin = md5($_POST['paypass']); if ($pin != $pin_pass) { die("支付密码错误,请重试"); } $done = TinvestMoney($this->uid, $borrow_id, $tnum, $month); //投企业直投 if ($done === true) { die('TRUE'); } else { if ($done) { die($done); } else { die("很遗憾,认购失败,请重试!"); } } } else { $borrow_id = $this->_get('bid'); $pre = C('DB_PREFIX'); $borrowinfo = M("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($borrow_id); $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2); $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2); $borrowinfo['updata'] = unserialize($borrowinfo['updata']); $this->assign("vo", $borrowinfo); $user_info = M('member_money')->field("account_money+back_money as money ")->where("uid='{$this->uid}'")->find(); $this->assign('user_info', $user_info); $paypass = M("members")->field('pin_pass')->where('id=' . $this->uid)->find(); $this->assign('paypass', $paypass['pin_pass']); $this->display(); } }
/** * @param intval $invest_uid // 投资人id * @param intval $borrow_id // 借款id * @param intval $invest_money // 投资金额必须为整数 * @param string $paypass // 支付密码 * @param string $invest_pass='' //投资密码 */ function checkInvest($invest_uid, $borrow_id, $invest_money, $paypass, $invest_pass = '') { $borrow_id = intval($borrow_id); $invest_uid = intval($invest_uid); if (!$paypass) { return L('please_enter') . L('paypass'); } if (!$invest_money) { return L('please_enter') . L('invest_money'); } if (!is_numeric($invest_money)) { return L('invest_money') . L('only_intval'); } $vm = getMinfo($invest_uid, 'm.pin_pass,mm.account_money,mm.back_money,mm.money_collect'); $pin_pass = $vm['pin_pass']; if (md5($paypass) != $pin_pass) { return L('paypass') . L('error'); } // 支付密码错误 if ($vm['account_money'] + $vm['back_money'] < $invest_money) { return L('lack_of_balance'); } $borrow = M('borrow_info')->field('id, borrow_uid, borrow_money, has_borrow, has_vouch, borrow_max,borrow_min, borrow_type, password, money_collect')->where("id='{$borrow_id}'")->find(); if (!$borrow) { // 没有读取到借款数据 return L('error_parameter'); } $need = $borrow['borrow_money'] - $borrow['has_borrow']; if ($borrow['borrow_uid'] == $invest_uid) { // 不能投自己的标 return L('not_cast_their_borrow'); } if (!empty($borrow['password']) && $borrow['password'] != md5($invest_pass)) { // 定向密码 return L('error_invest_password'); } if ($borrow['money_collect'] > 0 && $vm['money_collect'] < $borrow['money_collect']) { // 待收限制 return L('amount_to_be_received'); } if ($borrow['borrow_min'] > $invest_money) { // 最小投资 return L('not_less_than_min') . $borrow['borrow_min'] . L('yuan'); } if ($need - $invest_money < 0) { // 超出了借款资金 return L('error_max_invest_money') . $need . L('yuan'); } else { // 存在投满标情况 // 超出了最大投资 $capital = M('borrow_investor')->where("borrow_id={$borrow_id} AND investor_uid={$invest_uid}")->sum('investor_capital'); if ($borrow['borrow_max'] && $capital && $capital + $invest_money > $borrow['borrow_max']) { return L('beyond_invest_max'); } } // ($need - $invest_money) > $borrow['borrow_min'] 表示不是最后一笔投资 if ($need < $borrow['borrow_min'] * 2 && $invest_money != $need) { // 避免最后一笔投资剩余金额小于最小资金导致无法投递,再次最后一笔投资可以大于最大投资 return L('full_scale_investment') . $need . L('yuan'); } if ($borrow['borrow_max'] && $need > $borrow['borrow_min'] * 2 && $invest > $borrow['borrow_max']) { return L('beyond_invest_max'); } return 'TRUE'; }
public function ajax_invest() { if (!$this->uid) { ajaxmsg("请先登录", 0); } $pre = C("DB_PREFIX"); $id = intval($_GET['id']); $num = intval($_GET['num']); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $field = "id,borrow_uid,borrow_money,borrow_interest_rate,borrow_duration,repayment_type,transfer_out,transfer_back,transfer_total,per_transfer,is_show,deadline,min_month,increase_rate,reward_rate"; $vo = M("transfer_borrow_info")->field($field)->find($id); if ($this->uid == $vo['borrow_uid']) { ajaxmsg("不能去投自己的标", 0); } if ($vo['transfer_out'] == $vo['transfer_total']) { ajaxmsg("此标可认购份数为0", 0); } if ($vo['is_show'] == 0) { ajaxmsg("只能投正在借款中的标", 0); } $vo['transfer_leve'] = $vo['transfer_total'] - $vo['transfer_out']; $vo['uname'] = M("members")->getFieldById($vo['borrow_uid'], "user_name"); $vm = getMinfo($this->uid, 'm.pin_pass,mm.account_money,mm.back_money,mm.money_collect'); $amoney = $vm['account_money'] + $vm['back_money']; $pin_pass = $vm['pin_pass']; $has_pin = empty($pin_pass) ? "no" : "yes"; $this->assign("has_pin", $has_pin); $this->assign("vo", $vo); $this->assign("account_money", $amoney); $this->assign("Bconfig", $Bconfig); $this->assign("num", $num); $data['content'] = $this->fetch(); ajaxmsg($data); }
public function register4() { session("code_temp", NULL); session("send_time", NULL); session("temp_phone", NULL); session("name_temp", NULL); session("pwd_temp", NULL); $minfo = getMinfo($this->uid, true); $this->assign("uname", $minfo['user_name']); $global = get_global_setting(); $this->assign("reward", $global['reg_reward']); $this->display(); }
/** * 取消转让 * * @param intval $invest_id //债权id * @param strval $paypass // 支付密码 */ public function cancel($invest_id, $paypass) { $invest_id = intval($invest_id); $paypass = md5($paypass); $vm = getMinfo($this->uid, 'm.pin_pass'); if ($paypass != $vm['pin_pass']) { return false; exit; } if ($this->cancelDebt($invest_id, 1)) { return true; } else { return false; } }
function autoInvest($borrow_id) { $binfo = M("borrow_info")->field('borrow_name,borrow_uid,borrow_money,borrow_type,repayment_type,borrow_interest_rate,borrow_duration,has_vouch,has_borrow,borrow_max,borrow_min,can_auto')->find($borrow_id); if ($binfo['borrow_type'] == 3) { return true; } if ($binfo['can_auto'] == 0) { return true; } if ($binfo['borrow_type'] == 2 && $binfo['has_vouch'] < $binfo['borrow_money']) { return true; } $map['status'] = 1; $autolist = M("auto_borrow")->field(true)->where($map)->order("id asc")->select(); $needMoney = $binfo['borrow_money'] - $binfo['has_borrow']; $borrow_user_info = M('members')->field('user_type,scores')->find($binfo['borrow_uid']); $xmemtype = C('XMEMBER_TYPE'); $allrepaytype = C('REPAYMENT_TYPE'); $allbortype = C('BORROW_TYPE'); $have_auto_do = array(); $smsUid = ""; $emailUid = ""; $errinfo = array(); $errinfo['borrow_id'] = $borrow_id; foreach ($autolist as $key => $v) { $errinfo['fail_reason'] = ""; $errinfo['result'] = null; $errinfo['auto_id'] = $v['id']; if (in_array($v['uid'], $have_auto_do)) { $errinfo['fail_reason'] = "您已有其他自动投标设置已完成自动投标"; MTip("autoinvest", $v['uid'], $errinfo); continue; } if ($v['uid'] == $binfo['borrow_uid']) { $errinfo['fail_reason'] = "您不能投自己的标"; MTip("autoinvest", $v['uid'], $errinfo); continue; } if ($v['my_friend'] == 1 || $v['not_black'] == 1) { $vo = M('member_friend')->where("uid={$v['uid']} AND friend_id={$binfo['borrow_uid']}")->find(); if ($v['my_friend'] == 1 && $vo['apply_status'] != 1) { $errinfo['fail_reason'] = "您限制借款方必须是您的好友,但借款方不在您的好友列表或您未通过对方的好友请求"; MTip("autoinvest", $v['uid'], $errinfo); continue; } if ($v['not_black'] == 1 && $vo['apply_status'] == 3) { $errinfo['fail_reason'] = "您限制借款方必须不在您的黑名单中,但借款方已被您列入黑名单"; MTip("autoinvest", $v['uid'], $errinfo); continue; } } if (intval($v['target_user']) > 0 && intval($v['target_user']) != $borrow_user_info['user_type']) { $errinfo['fail_reason'] = "您限制借款方必须为网站的[{$xmemtype[$v['target_user']]}],但借款方为[{$xmemtype[$borrow_user_info['user_type']]}]"; MTip("autoinvest", $v['uid'], $errinfo); continue; } if ($v['borrow_credit_status'] == 1) { if (!($borrow_user_info['scores'] <= $v['borrow_credit_last'] && $borrow_user_info['scores'] >= $v['borrow_credit_first'])) { $errinfo['fail_reason'] = "您限制借款方信用积分必须在{$v['borrow_credit_first']}-{$v['borrow_credit_last']}之间,但借款方信用积分实为{$borrow_user_info['scores']}"; MTip("autoinvest", $v['uid'], $errinfo); continue; } } if (intval($v['repayment_type']) > 0) { if ($v['repayment_type'] != $binfo['repayment_type']) { $errinfo['fail_reason'] = "您限制借款方还款方式为[{$allrepaytype[$v['repayment_type']]}],但借款方还款方式为[{$allrepaytype[$binfo['repayment_type']]}]"; MTip("autoinvest", $v['uid'], $errinfo); continue; } } if ($v['timelimit_status'] == 1) { if (!($binfo['borrow_duration'] <= $v['timelimit_month_last'] && $binfo['borrow_duration'] >= $v['timelimit_month_first'])) { $durstr = "月"; if ($binfo['repayment_type'] == 1) { $durstr = "天"; } $errinfo['fail_reason'] = "您限制借款期限必须{$v['timelimit_month_first']}个月-{$v['timelimit_month_last']}个月之间,但该借款期限为{$binfo['borrow_duration']}{$durstr}"; MTip("autoinvest", $v['uid'], $errinfo); continue; } } if ($v['apr_status'] == 1) { if (!($binfo['borrow_interest_rate'] <= $v['apr_last'] && $binfo['borrow_interest_rate'] >= $v['apr_first'])) { $errinfo['fail_reason'] = "您限制借款年化利率必须在{$v['apr_first']}%-{$v['apr_last']}%之间,但该借款年化利率为{$binfo['borrow_interest_rate']}%"; MTip("autoinvest", $v['uid'], $errinfo); continue; } } if (intval($v['borrow_type']) > 0) { if ($v['borrow_type'] != $binfo['borrow_type']) { $errinfo['fail_reason'] = "您限制借款标类型必须为[{$allbortype[$v['borrow_type']]}],但该借款标类型为[{$allbortype[$binfo['borrow_type']]}]"; MTip("autoinvest", $v['uid'], $errinfo); continue; } } if ($v['tender_type'] == 1) { $investMoney = $v['tender_account']; } elseif ($v['tender_type'] == 2) { $investMoney = $v['tender_rate'] * $binfo['borrow_money'] / 100; } elseif ($v['tender_type'] == 3) { $vminfo = getMinfo($v['uid'], 'm.user_leve,m.time_limit,mm.account_money'); $investMoney = floor($vminfo['account_money']); } if ($investMoney < $binfo['borrow_min']) { if ($investMoney > 0) { $errinfo['fail_reason'] = "您的自动投资金额为{$investMoney}元,该标最低投资金额限制最低为{$binfo['borrow_min']}元"; MTip("autoinvest", $v['uid'], $errinfo); } continue; //不符合最低投资金额 } if ($investMoney > $binfo['borrow_max'] && $binfo['borrow_max'] > 0) { $errinfo['fail_reason'] = "您的自动投资金额为{$investMoney}元,该标投资金额限制最高为{$binfo['borrow_max']}元,已自动为您调整成{$binfo['borrow_max']}元"; $investMoney = $binfo['borrow_max']; } //不能超过标金额比例20% $sysmax = floor($binfo['borrow_money'] * 20 / 100); if ($investMoney > $sysmax && $sysmax > 0) { if (!empty($errinfo['fail_reason'])) { $errinfo['fail_reason'] = $errinfo['fail_reason'] . ";"; } $errinfo['fail_reason'] = $errinfo['fail_reason'] . "系统限制自动投标金额不能超过标金额20%,即{$sysmax}元,您的投标金额为{$investMoney}元,超过系统最大限制,已自动调整成{$sysmax}元"; $investMoney = $sysmax; } // 投标后的状态 $x = investMoney($v['uid'], $borrow_id, $investMoney, 1, $v['id']); if ($x === true) { $have_auto_do[] = $v['uid']; MTip('chk27', $v['uid'], $borrow_id); //sss $systips = M("sys_tip")->find($v['uid']); if (checkNeedTip($systips, 'autoborrow_3')) { $smsUid .= empty($smsUid) ? $v['uid'] : ",{$v['uid']}"; } if (checkNeedTip($systips, 'autoborrow_2')) { $emailUid .= empty($emailUid) ? $v['uid'] : ",{$v['uid']}"; } } else { if (strpos($x, "对不起,此标还差") !== false && strpos($x, "对不起,此标还差0元满标") === false) { $extbinfo = M("borrow_info")->field("borrow_money,has_borrow")->find($borrow_id); $havemoney = $extbinfo['has_borrow']; $investMoney = $extbinfo['borrow_money'] - $havemoney; if (!empty($errinfo['fail_reason'])) { $errinfo['fail_reason'] = $errinfo['fail_reason'] . ";"; } $x = ""; if ($investMoney > 0) { $errinfo['fail_reason'] = $errinfo['fail_reason'] . "此标剩余金额{$investMoney},已自动为您调整"; $x = investMoney($v['uid'], $borrow_id, $investMoney, 1, $v['id']); } else { $errinfo['fail_reason'] = $errinfo['fail_reason'] . "此标剩余金额{$investMoney},无法再投标"; } if ($x === true) { $errinfo['result'] = "成功"; MTip("autoinvest", $v['uid'], $errinfo); $have_auto_do[] = $v['uid']; $systips = M("sys_tip")->find($v['uid']); if (checkNeedTip($systips, 'autoborrow_3')) { $smsUid .= empty($smsUid) ? $v['uid'] : ",{$v['uid']}"; } if (checkNeedTip($systips, 'autoborrow_2')) { $emailUid .= empty($emailUid) ? $v['uid'] : ",{$v['uid']}"; } } else { if (!empty($errinfo['fail_reason']) && !empty($x)) { $errinfo['fail_reason'] = $errinfo['fail_reason'] . ";"; $errinfo['fail_reason'] = $errinfo['fail_reason'] . $x; } MTip("autoinvest", $v['uid'], $errinfo); } } else { if (!empty($errinfo['fail_reason'])) { $errinfo['fail_reason'] = $errinfo['fail_reason'] . ";"; } $errinfo['fail_reason'] = $errinfo['fail_reason'] . $x; MTip("autoinvest", $v['uid'], $errinfo); } } } $pre = C("DB_PREFIX"); //短信提醒 if (!empty($smsUid)) { $vphone = M("members")->alias("m")->join("{$pre}members_status ms on ms.uid=m.id")->field("m.user_phone")->where("m.id in({$smsUid}) and ms.phone_status=1")->select(); $sphone = ""; foreach ($vphone as $v) { $sphone .= empty($sphone) ? $v['user_phone'] : ",{$v['user_phone']}"; } $innerbody = "您设置的自动投标对第{$borrow_id}号借_款进行了投标"; SMStip3("autoinvest", $sphone, $innerbody, $borrow_id, $smsUid); } //邮件提醒 if (!empty($emailUid)) { $link = '<br /><a href="http://' . $_SERVER['HTTP_HOST'] . '/invest/' . $borrow_id . '.html" style="color:#91273d">点击查看借款标[' . $binfo['borrow_name'] . ']</a>'; $msgconfig = FS("Webconfig/msgconfig"); $sender = $msgconfig['stmp']['user']; $receivers = M("members")->alias("m")->join("{$pre}members_status ms on ms.uid=m.id")->field("m.user_email email,m.id uid,'to' type")->where("m.id in({$emailUid}) and ms.email_status=1")->select(); massEmailLog($innerbody, $innerbody . $link, "autoinvest", $sender, $receivers, null, null, $borrow_id); } }
public function save() { if (!$this->uid) { $this->error("请先登陆", __APP__ . "/member/common/login"); } $pre = C('DB_PREFIX'); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now")->where("m.id={$this->uid}")->find(); //相关的判断参数 $borrow['borrow_type'] = intval(cookie(text($_POST['vkey']))); if ($borrow['borrow_type'] == 0) { $this->error("校验数据有误,请重新发布"); } if (floatval($_POST['borrow_interest_rate']) > $rate_lixt[1] || floatval($_POST['borrow_interest_rate']) < $rate_lixt[0]) { $this->error("提交的借款利率超出允许范围,请重试", 0); } //if($_POST['borrow_btype']==0) $this->error("请选择标的类型"); $borrow['borrow_money'] = intval($_POST['borrow_money']); $_minfo = getMinfo($this->uid, "m.pin_pass,mm.account_money,mm.back_money,mm.credit_cuse,mm.money_collect"); $_capitalinfo = getMemberBorrowScan($this->uid); /////////////////////////////////////////////////////// $borrowNum = M('borrow_info')->field("borrow_type,count(id) as num,sum(borrow_money) as money,sum(repayment_money) as repayment_money")->where("borrow_uid = {$this->uid} AND borrow_status=6 ")->group("borrow_type")->select(); $borrowDe = array(); foreach ($borrowNum as $k => $v) { $borrowDe[$v['borrow_type']] = $v['money'] - $v['repayment_money']; } /////////////////////////////////////////////////// switch ($borrow['borrow_type']) { case 1: //普通标 if ($_minfo['credit_cuse'] < $borrow['borrow_money']) { $this->error("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标"); } break; case 2: //新担保标 //新担保标 case 3: //秒还标 break; case 4: //净值标 $_netMoney = getFloatValue(0.9 * $_minfo['money_collect'] - $borrowDe[4], 2); if ($_netMoney < $borrow['borrow_money']) { $this->error("您的净值额度{$_netMoney}元,小于您准备借款的金额,不能发标"); } break; case 5: //抵押标 //$borrow_type=5; break; } $borrow['borrow_uid'] = $this->uid; $borrow['borrow_name'] = text($_POST['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($_POST['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($_POST['borrow_interest_rate']); if (strtolower($_POST['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($_POST['repayment_type']); } if ($borrow['repayment_type'] == '1' || $borrow['repayment_type'] == '5') { $borrow['total'] = 1; } else { $borrow['total'] = $borrow['borrow_duration']; //分几期还款 } $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($_POST['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($_POST['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($_POST['borrow_info']); $borrow['reward_type'] = intval($_POST['reward_type']); $borrow['reward_num'] = floatval($_POST["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($_POST['borrow_min']); $borrow['borrow_max'] = intval($_POST['borrow_max']); $borrow['borrow_btype'] = intval($_POST['borrow_btype']); $borrow['ifdianzibiao'] = $_POST['ifdianzibiao']; $borrow['is_tuijian'] = $_POST['is_tuijian']; /*$borrow['province'] = $vminfo['province_now']; $borrow['city'] = $vminfo['city_now']; $borrow['area'] = $vminfo['area_now'];*/ if ($_POST['is_pass'] && intval($_POST['is_pass']) == 1) { $borrow['password'] = md5($_POST['password']); } $borrow['money_collect'] = floatval($_POST['moneycollect']); //代收金额限制设置 //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); if ($borrow['repayment_type'] == 1) { //按天还 $fee_rate = is_numeric($fee_borrow_manage[0]) ? $fee_borrow_manage[0] / 100 : 0.001; $borrow['borrow_fee'] = getFloatValue($fee_rate * $borrow['borrow_money'] * $borrow['borrow_duration'], 2); } else { $fee_rate_1 = is_numeric($fee_borrow_manage[1]) ? $fee_borrow_manage[1] / 100 : 0.02; $fee_rate_2 = is_numeric($fee_borrow_manage[2]) ? $fee_borrow_manage[2] / 100 : 0.002; if ($borrow['borrow_duration'] > $fee_borrow_manage[3] && is_numeric($fee_borrow_manage[3])) { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); $borrow['borrow_fee'] += getFloatValue($fee_rate_2 * $borrow['borrow_money'] * ($borrow['borrow_duration'] - $fee_borrow_manage[3]), 2); } else { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); } } if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] + $_minfo['back_money'] < $borrow['borrow_fee'] + $_reward_money) { $this->error("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用"); } } //投标上传图片资料(暂隐) foreach ($_POST['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = serialize($row); $newid = M("borrow_info")->add($borrow); //var_dump($borrow);exit; $suo = array(); $suo['id'] = $newid; $suo['suo'] = 0; $suoid = M("borrow_info_lock")->add($suo); if ($newid) { $this->success("借款发布成功,网站会尽快初审", __APP__ . "/member/borrowin#fragment-2"); } else { $this->error("发布失败,请先检查是否完成了个人详细资料然后重试"); } }
public function save() { if (!$this->uid) { $this->error("请先登陆", __APP__ . "/member/common/login"); } $pre = C('DB_PREFIX'); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now")->where("m.id={$this->uid}")->find(); //相关的判断参数 $borrow['borrow_type'] = intval(cookie(text($_POST['vkey']))); if ($borrow['borrow_type'] == 50) { $this->error("校验数据有误,请重新发布"); } $borrow['borrow_money'] = intval($_POST['borrow_money']); $_minfo = getMinfo($this->uid, true); $_capitalinfo = getMemberBorrowScan($this->uid); switch ($borrow['borrow_type']) { case 1: //普通标 if ($_minfo['credit_cuse'] < $borrow['borrow_money']) { $this->error("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标"); } break; case 2: //担保标 if ($_minfo['borrow_vouch_cuse'] < $borrow['borrow_money']) { $this->error("您的可用信用担保借款额度为{$_minfo['borrow_vouch_cuse']}元,小于您准备借款的金额,不能发标"); } break; case 3: //秒还标 break; case 4: //净值标 $_netMoney = getFloatValue($minfo['money_collect'], 2); //getNet($_minfo,$_capitalinfo); if ($_netMoney < $borrow['borrow_money']) { $this->error("您的净资产为{$_netMoney}元,小于您准备借款的金额,不能发标"); } break; case 5: //抵押标 //$borrow_type=5; break; } if ($borrow['borrow_type'] == 2) { //担保标 $borrow['reward_vouch_rate'] = floatval($_POST['vouch_rate']); $borrow['reward_vouch_money'] = getFloatValue($borrow['borrow_money'] * $borrow['reward_vouch_rate'] / 100, 2); $borrow['vouch_member'] = text($_POST['vouch_member']); } $borrow['borrow_uid'] = $this->uid; $borrow['borrow_name'] = text($_POST['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($_POST['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($_POST['borrow_interest_rate']); if (strtolower($_POST['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($_POST['repayment_type']); } if ($_POST['show_tbzj'] == 1) { $borrow['is_show_invest'] = 1; } //共几期(分几次还) $borrow['total'] = $borrow['repayment_type'] == 1 ? 1 : $borrow['borrow_duration']; //共几期(分几次还) $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($_POST['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($_POST['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($_POST['borrow_info']); $borrow['reward_type'] = intval($_POST['reward_type']); $borrow['reward_num'] = floatval($_POST["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($_POST['borrow_min']); $borrow['borrow_max'] = intval($_POST['borrow_max']); $borrow['province'] = $vminfo['province_now']; $borrow['city'] = $vminfo['city_now']; $borrow['area'] = $vminfo['area_now']; if ($_POST['is_pass'] && intval($_POST['is_pass']) == 1) { $borrow['password'] = md5($_POST['password']); } //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); if ($borrow['repayment_type'] == 1) { //按天还 $fee_rate = is_numeric($fee_borrow_manage[0]) ? $fee_borrow_manage[0] / 100 : 0.001; $borrow['borrow_fee'] = getFloatValue($fee_rate * $borrow['borrow_money'] * $borrow['borrow_duration'], 2); } else { $fee_rate_1 = is_numeric($fee_borrow_manage[1]) ? $fee_borrow_manage[1] / 100 : 0.02; $fee_rate_2 = is_numeric($fee_borrow_manage[2]) ? $fee_borrow_manage[2] / 100 : 0.002; if ($borrow['borrow_duration'] > $fee_borrow_manage[3] && is_numeric($fee_borrow_manage[3])) { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); $borrow['borrow_fee'] += getFloatValue($fee_rate_2 * $borrow['borrow_money'] * ($borrow['borrow_duration'] - $fee_borrow_manage[3]), 2); } else { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); } } if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { if ($borrow['reward_type'] == 1) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } elseif ($borrow['reward_type'] == 2) { $_reward_money = getFloatValue($borrow['reward_num'], 2); } } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] < $borrow['borrow_fee'] + $_reward_money) { $this->error("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用"); } } //投标上传图片资料(暂隐) foreach ($_POST['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = serialize($row); $borrow['is_tuijian'] = 1; $newid = M("borrow_info")->add($borrow); if ($newid) { $this->success("借款发布成功,网站会尽快初审", __APP__ . "/member/borrowin#fragment-1"); } else { $this->error("发布失败,请先检查是否完成了个人详细资料然后重试"); } }
public function summary() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); //alogsm("changepwd",0,1,$jsoncode); if (intval($arr['uid']) != $this->uid) { ajaxmsg("用户错误!", 0); } $vlist = getMemberMoneySummary($this->uid); $minfo = getMinfo($this->uid, true); $benefit = get_personal_benefit($this->uid); //收入 $out = get_personal_out($this->uid); //支出 $pcount = get_personal_count($this->uid); //可用现金金额: $canuse = $minfo['account_money'] + $minfo['back_money']; $data['canuse'] = empty($canuse) ? '0.00' : (string) $canuse; //待收总额: $data['money_collect'] = empty($minfo['money_collect']) ? '0.00' : (string) $minfo['money_collect']; //冻结总额: $data['money_freeze'] = empty($minfo['money_freeze']) ? '0.00' : (string) $minfo['money_freeze']; //账户资金总额: $all_money = $minfo['account_money'] + $minfo['back_money'] + $minfo['money_collect'] + $minfo['money_freeze']; $data['all_money'] = empty($all_money) ? '0.00' : (string) $all_money; //净赚利息: $data['getinterest'] = empty($benefit['interest']) ? '0.00' : (string) $benefit['interest']; //净付利息: $data['outinterest'] = empty($out['interest']) ? '0.00' : (string) $out['interest']; //支付会员认证费: $data['authenticate'] = empty($out['authenticate']) ? '0.00' : (string) $out['authenticate']; //借款管理费 $data['borrow_manage'] = empty($out['borrow_manage']) ? '0.00' : (string) $out['borrow_manage']; //逾期及催收费用: $data['overdue'] = empty($out['overdue']) ? '0.00' : (string) $out['overdue']; //累计提现手续费: $data['withdraw_fee'] = empty($out['withdraw_fee']) ? '0.00' : (string) $out['withdraw_fee']; //累计投标奖励: $data['ireward'] = empty($benefit['ireward']) ? '0.00' : (string) $benefit['ireward']; //累计支付投标奖励: $data['pay_tender'] = empty($out['pay_tender']) ? '0.00' : (string) $out['pay_tender']; //累计推广奖励: $data['spread_reward'] = empty($benefit['spread_reward']) ? '0.00' : (string) $benefit['spread_reward']; //累计线下充值奖励: $data['re_reward'] = empty($benefit['re_reward']) ? '0.00' : (string) $benefit['re_reward']; //累计续投奖励: $data['con_reward'] = empty($benefit['con_reward']) ? '0.00' : (string) $benefit['con_reward']; //累计充值手续费: $data['czfee'] = empty($benefit['czfee']) ? '0.00' : (string) $benefit['czfee']; //累计盈亏总额: $iomoney = $benefit['total'] - $out['total']; $data['iomoney'] = empty($iomoney) ? '0.00' : (string) $iomoney; //累计投资金额: $data['ljtz'] = empty($pcount['ljtz']) ? '0.00' : (string) $pcount['ljtz']; //累计借入金额: $data['jrje'] = empty($pcount['jrje']) ? '0.00' : (string) $pcount['jrje']; //累计充值金额 $data['payonline'] = empty($pcount['payonline']) ? '0.00' : (string) $pcount['payonline']; //累计提现金额: $data['withdraw'] = empty($pcount['withdraw']) ? '0.00' : (string) $pcount['withdraw']; //累计支付管理费: $data['commission'] = empty($pcount['commission']) ? '0.00' : (string) $pcount['commission']; //待收利息总额: $data['interest_collection'] = empty($benefit['interest_collection']) ? '0.00' : (string) $benefit['interest_collection']; //待付利息总额: $data['interest_pay'] = empty($benefit['interest_pay']) ? '0.00' : (string) $benefit['interest_pay']; ajaxmsg($data); }
public function actlogin_bak() { //setcookie('LoginCookie','',time()-10*60,"/"); //if($_SESSION['verify'] != md5(strtolower($_POST['sVerCode']))) //{ // ajaxmsg("验证码错误!",0); //} $jsoncode = file_get_contents("php://input"); //alogsm("android_login",0,1,session("u_id").$jsoncode); // $arr2 = array(); // $arr2['type'] = 'actlogin'; // // $arr2['tstatus'] = '1'; // $arr2['deal_time'] = time(); // $arr2['deal_info'] = $jsoncode; // $newid = M("auser_dologs")->add($arr2); $arr = array(); $arr = json_decode($jsoncode, true); false !== strpos($arr['sUserName'], "@") ? $data['user_email'] = text($arr['sUserName']) : ($data['user_name'] = text($arr['sUserName'])); $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where($data)->find(); if ($vo['is_ban'] == 1) { ajaxmsg("dd您的帐户已被冻结,请联系客服处理!", 0); } if (is_array($vo)) { if ($vo['user_pass'] == md5($arr['sPassword'])) { //本站登陆成功 $this->_memberlogin($vo['id']); //alogs("login",'','1',session("u_id")."登录成功"); $arr2 = array(); $arr2['type'] = 'actlogin'; $arr2['deal_user'] = $vo['user_name']; $arr2['tstatus'] = '1'; $arr2['deal_time'] = time(); $arr2['deal_info'] = $vo['user_name'] . "登录成功_" . $jsoncode; $newid = M("auser_dologs")->add($arr2); $mess = array(); $mess['uid'] = intval(session("u_id")); $mess['username'] = $vo['user_name']; $mess['phone'] = intval(session("u_user_phone")); $mess['head'] = get_avatar($mess['uid']); //头像 $minfo = getMinfo($mess['uid'], true); $mess['credits'] = getLeveIco($minfo['credits'], 3); //会员等级 $membermoney = M("member_money")->field(true)->where("uid={$mess['uid']}")->find(); if (is_array($membermoney)) { $mess['mayuse'] = $membermoney['account_money'] + $membermoney['back_money']; //可用 $mess['freeze'] = $membermoney['money_freeze']; //冻结 $mess['collect'] = $membermoney['money_collect']; //代收 $mess['total'] = $mess['mayuse'] + $mess['freeze'] + $mess['collect']; //总额 } else { $mess['total'] = 0; $mess['mayuse'] = 0; $mess['freeze'] = 0; $mess['collect'] = 0; } ajaxmsg($mess); } else { //本站登陆不成功 // $arr2 = array(); // $arr2['type'] = 'actlogin'; // $arr2['deal_user'] = $vo['user_name']; // $arr2['tstatus'] = '1'; // $arr2['deal_time'] = time(); // $arr2['deal_info'] = $vo['user_name']."登录密码错误,登录失败_".$jsoncode; // $newid = M("auser_dologs")->add($arr2); ajaxmsg("kk用户名或者密码错误!", 0); } } else { // $arr2 = array(); // $arr2['type'] = 'actlogin'; // // $arr2['tstatus'] = '1'; // $arr2['deal_time'] = time(); // $arr2['deal_info'] = "用户名或密码错误,登录失败_".$jsoncode; // $newid = M("auser_dologs")->add($arr2); ajaxmsg("kk用户名或者密码错误!", 0); } }
public function actlogin() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); setcookie('LoginCookie', '', time() - 10 * 60, "/"); //uc登录 require_once "./config.inc.php"; require "./uc_client/client.php"; //uc登录 list($uid, $username, $password, $email) = uc_user_login(text($arr['username']), $arr['password']); false !== strpos($arr['username'], "@") ? $data['user_email'] = text($arr['username']) : ($data['user_name'] = text($arr['username'])); $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where($data)->find(); if ($vo['is_ban'] == 1) { ajaxmsg("您的帐户已被冻结,请联系客服处理!", 0); } if ($uid > 0) { if (!$vo) { $regdata['txtUser'] = text($arr['username']); $regdata['txtPwd'] = text($arr['password']); $regdata['txtEmail'] = $email; $newuid = $this->ucreguser($regdata); if (is_numeric($newuid) && $newuid > 0) { //用户登录成功,设置 Cookie,加密直接用 uc_authcode 函数,用户使用自己的函数 //setcookie('LoginCookie', uc_authcode($uid."\t".$username, 'ENCODE')); //生成同步登录的代码 //$ucsynlogin = uc_user_synlogin($uid); //echo json_encode($ucsynlogin);exit; if (is_array($vo)) { if ($vo['user_pass'] == md5($arr['password'])) { //本站登录成功 $this->_memberlogin($vo['id']); //alogs("login",'','1',session("u_id")."登录成功"); $arr2 = array(); $arr2['type'] = 'actlogin'; $arr2['deal_user'] = $vo['user_name']; $arr2['tstatus'] = '1'; $arr2['deal_time'] = time(); $arr2['deal_info'] = $vo['user_name'] . "app登录成功"; $newid = M("auser_dologs")->add($arr2); $mess = array(); $mess['uid'] = intval(session("u_id")); $mess['username'] = $vo['user_name']; //$mess['phone'] = intval(session("u_user_phone")); $mess['head'] = get_avatar($mess['uid']); //头像 $minfo = getMinfo($mess['uid'], true); $mess['credits'] = getLeveIco($minfo['credits'], 3); //会员等级 $membermoney = M("member_money")->field(true)->where("uid={$mess['uid']}")->find(); if (is_array($membermoney)) { $mess['mayuse'] = $membermoney['account_money'] + $membermoney['back_money']; //可用 $mess['freeze'] = $membermoney['money_freeze']; //冻结 $mess['collect'] = $membermoney['money_collect']; //代收 $mess['total'] = $mess['mayuse'] + $mess['freeze'] + $mess['collect']; //总额 } else { $mess['total'] = 0; $mess['mayuse'] = 0; $mess['freeze'] = 0; $mess['collect'] = 0; } $pre = C('DB_PREFIX'); $vo = M("members m")->field("m.user_email,m.user_phone,m.id,m.user_leve,m.time_limit,m.pin_pass,s.id_status,s.phone_status,s.email_status,s.video_status,s.face_status")->join("{$pre}members_status s ON s.uid=m.id")->where("m.id={$mess['uid']}")->find(); $str = ""; if ($vo['id_status'] == 1) { $mess['id_status'] = 1; $vm = M("member_info")->field('idcard,real_name')->find($mess['uid']); $mess['real_name'] = $vm['real_name']; $mess['idcard'] = hidecard($vm['idcard'], 1); } elseif ($vo['id_status'] == 3) { $mess['id_status'] = 2; } else { $mess['id_status'] = 0; } if ($vo['phone_status'] == 1) { $mess['phone_status'] = 1; $mess['phone'] = hidecard($vo['user_phone'], 2); } else { $mess['phone_status'] = 0; } if ($vo['email_status'] == 1) { $mess['email_status'] = 1; $mess['email'] = $vo['user_email']; } else { $mess['email_status'] = 0; } /*if(M('escrow_account')->where("uid={$this->uid}")->count('uid')){ // ajaxmsg('您已经绑定了托管账户,无需重复绑定',0); $mess['escrow']=1; }else{ $mess['escrow']=0; } $user_qdd = M('escrow_account')->field("invest_auth,secondary_percent")->where("uid=".$this->uid)->find(); if($user_qdd['invest_auth'] == 0 || $user_qdd['secondary_percent'] == 0) { $mess['escrow_auth']=0; }else{ $mess['escrow_auth']=1; } */ $vobank = M("member_banks")->field(true)->where("uid = {$this->uid} and bank_num !=''")->find(); if (empty($vobank['bank_num'])) { $mess['bank_status'] = 0; } else { $mess['bank_status'] = 1; } $money_info = M("member_money")->field("account_money, back_money")->where("uid={$this->uid}")->find(); $mess['common_money'] = $money_info['account_money']; $money_info = M("member_money")->field("account_money, back_money")->where("uid={$this->uid}")->find(); $mess['back_money'] = $money_info['back_money']; } else { //本站登录不成功 // ajaxmsg("kk用户名或者密码错误!", 0); } } ajaxmsg($mess); } else { ajaxmsg($newuid, 0); } } else { session('u_id', $localuser['id']); session('u_user_name', $data['user_name']); $ucsynlogin = uc_user_synlogin($uid); if (is_array($vo)) { if ($vo['user_pass'] == md5($arr['password'])) { //本站登录成功 $this->_memberlogin($vo['id']); //alogs("login",'','1',session("u_id")."登录成功"); $arr2 = array(); $arr2['type'] = 'actlogin'; $arr2['deal_user'] = $vo['user_name']; $arr2['tstatus'] = '1'; $arr2['deal_time'] = time(); $arr2['deal_info'] = $vo['user_name'] . "app登录成功"; $newid = M("auser_dologs")->add($arr2); $mess = array(); $mess['uid'] = intval(session("u_id")); $mess['username'] = $vo['user_name']; //$mess['phone'] = intval(session("u_user_phone")); $mess['head'] = get_avatar($mess['uid']); //头像 $minfo = getMinfo($mess['uid'], true); $mess['credits'] = getLeveIco($minfo['credits'], 3); //会员等级 $membermoney = M("member_money")->field(true)->where("uid={$mess['uid']}")->find(); if (is_array($membermoney)) { $mess['mayuse'] = $membermoney['account_money'] + $membermoney['back_money']; //可用 $mess['freeze'] = $membermoney['money_freeze']; //冻结 $mess['collect'] = $membermoney['money_collect']; //代收 $mess['total'] = $mess['mayuse'] + $mess['freeze'] + $mess['collect']; //总额 } else { $mess['total'] = 0; $mess['mayuse'] = 0; $mess['freeze'] = 0; $mess['collect'] = 0; } $pre = C('DB_PREFIX'); $vo = M("members m")->field("m.user_email,m.user_phone,m.id,m.user_leve,m.time_limit,m.pin_pass,s.id_status,s.phone_status,s.email_status,s.video_status,s.face_status")->join("{$pre}members_status s ON s.uid=m.id")->where("m.id={$mess['uid']}")->find(); $str = ""; if ($vo['id_status'] == 1) { $mess['id_status'] = 1; $vm = M("member_info")->field('idcard,real_name')->find($mess['uid']); $mess['real_name'] = $vm['real_name']; $mess['idcard'] = hidecard($vm['idcard'], 1); } elseif ($vo['id_status'] == 3) { $mess['id_status'] = 2; } else { $mess['id_status'] = 0; } if ($vo['phone_status'] == 1) { $mess['phone_status'] = 1; $mess['phone'] = hidecard($vo['user_phone'], 2); } else { $mess['phone_status'] = 0; } if ($vo['email_status'] == 1) { $mess['email_status'] = 1; $mess['email'] = $vo['user_email']; } else { $mess['email_status'] = 0; } /*if(M('escrow_account')->where("uid={$this->uid}")->count('uid')){ // ajaxmsg('您已经绑定了托管账户,无需重复绑定',0); $mess['escrow']=1; }else{ $mess['escrow']=0; } $user_qdd = M('escrow_account')->field("invest_auth,secondary_percent")->where("uid=".$this->uid)->find(); if($user_qdd['invest_auth'] == 0 || $user_qdd['secondary_percent'] == 0) { $mess['escrow_auth']=0; }else{ $mess['escrow_auth']=1; } */ $vobank = M("member_banks")->field(true)->where("uid = {$this->uid} and bank_num !=''")->find(); if (empty($vobank['bank_num'])) { $mess['bank_status'] = 0; } else { $mess['bank_status'] = 1; } $money_info = M("member_money")->field("account_money, back_money")->where("uid={$this->uid}")->find(); $mess['common_money'] = $money_info['account_money'] ? $money_info['account_money'] : 0; $money_info = M("member_money")->field("account_money, back_money")->where("uid={$this->uid}")->find(); $mess['back_money'] = $money_info['back_money'] ? $money_info['back_money'] : 0; } else { //本站登录不成功 ajaxmsg("kk用户名或者密码错误!", 0); } } ajaxmsg($mess); //echo json_encode($ucsynlogin);exit; } } elseif ($uid == -1) { ajaxmsg("用户不存在,或被删除!", 0); } elseif ($uid == -2) { ajaxmsg("密码错误!", 0); } else { ajaxmsg("未知错误!", 0); } }
public function zjxx2() { $jsoncode = file_get_contents("php://input"); //alogsm("zjxx",0,1,session("u_id").$jsoncode); $minfo = getMinfo($this->uid, true); $this->assign("minfo", $minfo); $this->assign("unread", $read = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id')); $minfo = getMinfo($this->uid, true); $this->assign("minfo", $minfo); $this->assign("MinfoDone", getMemberInfoDone($this->uid)); $this->assign("mstatus", M('members_status')->field(true)->find($this->uid)); $this->assign("capitalinfo", getMemberBorrowScan($this->uid)); $this->assign("memberinfo", M('members')->find($this->uid)); $this->assign("memberdetail", M('member_info')->find($this->uid)); $_SX = M('investor_detail')->field('deadline,interest,capital')->where("investor_uid = {$this->uid} AND status=7")->order("deadline ASC")->find(); $toubiaojl = M('borrow_investor')->where("borrow_uid={$this->uid}")->sum('reward_money'); //支付投标奖励 $this->assign("toubiaojl", $toubiaojl); //支付投标奖励 ////////////////////////////////// $moneylog = M("member_moneylog")->field("type,sum(affect_money) as money")->where("uid={$this->uid}")->group("type")->select(); $row1 = array(); foreach ($moneylog as $vs) { $row1[$vs['type']]['money'] = $vs['money'] > 0 ? $vs['money'] : $vs['money'] * -1; } $map = array(); $map['withdraw_status'] = 2; $tx = M('member_withdraw')->field("uid,sum(withdraw_money) as withdraw_money,sum(withdraw_fee) as withdraw_fee")->where("uid={$this->uid} and withdraw_status=2")->group("uid")->select(); foreach ($tx as $vt) { $row1['tx']['withdraw_money'] = $vt['withdraw_money']; //成功提现金额 $row1['tx']['withdraw_fee'] = $vt['withdraw_fee']; //提现手续费 } $this->assign("list", $row1); $this->assign("bank", M('member_banks')->field('bank_num')->find($this->uid)); $czfee = M('member_payonline')->where("uid={$uid} AND status=1")->sum('fee'); //在线充值手续费总金额 $capitalinfo = getMemberBorrowScan($this->uid); $intotal = $capitalinfo['tj']['earnInterest'] + $row1['20']['money'] + $row1['34']['money'] + $row1['13']['money'] + $row1['32']['money']; //收入总和 //$outtotal = $capitalinfo['tj']['payInterest']+$toubiaojl+$row1['tx']['withdraw_money']+$row1['14']['money']+$row1['22']['money']+$row1['25']['money']+$row1['26']['money']+$row1['18']['money']+$row1['30']['money']+$row1['31']['money']-$czfee;//支出总和 $outtotal = $capitalinfo['tj']['payInterest'] + $toubiaojl + $row1['tx']['withdraw_fee'] + $row1['14']['money'] + $row1['22']['money'] + $row1['25']['money'] + $row1['26']['money'] + $row1['18']['money'] + $row1['30']['money'] + $row1['31']['money'] + $czfee; //支出总和 $dsbx = $capitalinfo['tj']['dsze'] + $capitalinfo['tj']['willgetInterest']; //待收本息 $this->assign("dsbx", $dsbx); $this->assign("intotal", $intotal); $this->assign("outtotal", $outtotal); ///////////////////////////////// $lastInvest['gettime'] = $_SX['deadline']; $lastInvest['interest'] = $_SX['interest']; $lastInvest['capital'] = $_SX['capital']; $this->assign("lastInvest", $lastInvest); $_SX = ""; $_SX = M('investor_detail')->field('deadline,sum(interest) as interest,sum(capital) as capital')->where("borrow_uid = {$this->uid} AND status=7")->group("borrow_id,sort_order")->order("deadline ASC")->find(); $lastBorrow['gettime'] = $_SX['deadline']; $lastBorrow['interest'] = $_SX['interest']; $lastBorrow['capital'] = $_SX['capital']; $this->assign("lastBorrow", $lastBorrow); //新加开始 $_list['zichanzonge'] = $minfo['account_money'] + $minfo['back_money'] + $minfo['money_collect'] + $minfo['money_freeze']; $_list['keyongyue'] = $minfo['account_money'] + $minfo['back_money']; $_list['money_freeze'] = $minfo['money_freeze'] != null ? $minfo['money_freeze'] : "0.00"; $_list['dsbx'] = $dsbx; $_list['willgetInterest'] = $capitalinfo['tj']['willgetInterest']; $_list['withdraw_money'] = $list['tx']['withdraw_money'] != null ? $list['tx']['withdraw_money'] : "0.00"; $_list['chongzhizonge'] = $list['27']['money'] + $list['3']['money']; $_list['zuijindaihuanjine'] = getFloatvalue($lastBorrow['interest'] + $lastBorrow['capital'], 2); if ($lastBorrow['gettime'] > 0) { $_list['zuijindaihuantime'] = date("Y-m-d", $lastBorrow['gettime']); } else { $_list['zuijindaihuantime'] = "无待还"; } $_list['zuijindaishoujine'] = getFloatvalue($lastInvest['capital'] + $lastInvest['interest'], 2); if ($lastInvest['gettime'] > 0) { $_list['zuijindaishoutime'] = date("Y-m-d", $lastInvest['gettime']); } else { $_list['zuijindaishoutime'] = "无待还"; } echo ajaxmsg($_list); //$this->display(); }
public function tinvestcheck() { $jsoncode = file_get_contents("php://input"); //alogsm("tinvestcheck",0,1,session("u_id").$jsoncode); if (!$this->uid) { ajaxmsg('请先登录', 0); exit; } $arr = array(); $arr = json_decode($jsoncode, true); if (intval($arr['uid']) != $this->uid) { ajaxmsg("查询错误!", 0); } if (!is_array($arr) || empty($arr) || empty($arr['borrowercustid']) || empty($arr['transamt']) || $arr['type'] != 2) { ajaxmsg("查询错误!", 0); } $pre = C("DB_PREFIX"); //$pin = md5($_POST['pin']); $borrow_id = $arr['borrowercustid']; $money = $arr['transamt']; $vm = getMinfo($this->uid, 'm.pin_pass,mm.account_money,mm.back_money,mm.money_collect'); $amoney = $vm['account_money'] + $vm['back_money']; $uname = session('u_user_name'); //$pin_pass = $vm['pin_pass']; $amoney = floatval($amoney); $uid = $this->uid; $binfo = M("borrow_info")->field('borrow_money,has_borrow,has_vouch,borrow_max,borrow_min,borrow_type,password,money_collect,borrow_uid')->find($borrow_id); // if(!empty($binfo['password'])){ // if(empty($_POST['borrow_pass'])) ajaxmsg("此标是定向标,必须验证投标密码",3); // else if($binfo['password']<>md5($_POST['borrow_pass'])) ajaxmsg("投标密码不正确",3); // } ////////////////////////////////////待收金额限制 2013-08-26 fan/////////////////// if ($binfo['money_collect'] > 0) { if ($vm['money_collect'] < $binfo['money_collect']) { ajaxmsg("此标设置有投标待收金额限制,您账户里必须有足够的待收才能投此标", 3); } } //限制投标不能为0元 ////////////////////////////////////待收金额限制 2013-08-26 fan/////////////////// //投标总数检测 $capital = M('borrow_investor')->where("borrow_id={$borrow_id} AND investor_uid={$this->uid}")->sum('investor_capital'); if ($capital + $money > $binfo['borrow_max'] && $binfo['borrow_max'] > 0) { $xtee = $binfo['borrow_max'] - $capital; ajaxmsg("您已投标{$capital}元,此投上限为{$binfo['borrow_max']}元,你最多只能再投{$xtee}", 3); } if ($uid == $binfo['borrow_uid']) { ajaxmsg("不能投资自己的借款标", 3); } $need = $binfo['borrow_money'] - $binfo['has_borrow']; $caninvest = $need - $binfo['borrow_min']; if ($money > $caninvest && $need - $money != 0) { $msg = "尊敬的{$uname},此标还差{$need}元满标,如果您投标{$money}元,将导致最后一次投标最多只能投" . ($need - $money) . "元,小于最小投标金额{$binfo['borrow_min']}元,所以您本次可以选择<font color='#FF0000'>满标</font>或者投标金额必须<font color='#FF0000'>小于等于{$caninvest}元</font>"; if ($caninvest < $binfo['borrow_min']) { $msg = "尊敬的{$uname},此标还差{$need}元满标,如果您投标{$money}元,将导致最后一次投标最多只能投" . ($need - $money) . "元,小于最小投标金额{$binfo['borrow_min']}元,所以您本次可以选择<font color='#FF0000'>满标</font>即投标金额必须<font color='#FF0000'>等于{$need}元</font>"; } ajaxmsg($msg, 3); } if ($binfo['borrow_min'] - $money > 0) { ajaxmsg("尊敬的{$uname},本标最低投标金额为{$binfo['borrow_min']}元,请重新输入投标金额", 3); //$this->error("尊敬的{$uname},本标最低投标金额为{$binfo['borrow_min']}元,请重新输入投标金额",3); } if ($need - $money < 0) { $this->error("尊敬的{$uname},此标还差{$need}元满标,您最多只能再投{$need}元", 3); } //if($pin<>$pin_pass) ajaxmsg("支付密码错误,请重试!",0); if ($money > $amoney) { $msg = "尊敬的{$uname},您准备投标{$money}元,但您的账户可用余额为{$amoney}元,您要先去充值吗?"; ajaxmsg($msg, 2); } else { $msg = "尊敬的{$uname},您的账户可用余额为{$amoney}元,您确认投标{$money}元吗?"; $_msg['message'] = $msg; $_msg['type'] = 2; $_msg['id'] = $borrow_id; ajaxmsg($_msg, 1); } }