public function bindbank() { $oldaccount = M('member_banks')->getFieldByUid($this->uid, 'bank_num'); $data['uid'] = $this->uid; $data['bank_num'] = text($_POST['account']); $data['bank_name'] = text($_POST['bankname']); $data['bank_address'] = text($_POST['bankaddress']); $data['bank_province'] = text($_POST['province']); $data['bank_city'] = text($_POST['cityName']); $data['add_ip'] = get_client_ip(); $data['add_time'] = time(); //短信校验 $smscode = text($_POST['smscode']); if (!is_verify($this->uid, $smscode, 11, 10 * 60)) { ajaxmsg('短信验证码不对,请重新输入!', 0); } if ($oldaccount) { $old = text($_POST['oldaccount']); if ($old != $oldaccount) { ajaxmsg('原银卡号不对', 0); } $newid = M('member_banks')->save($data); } else { $newid = M('member_banks')->add($data); } if ($newid) { MTip('chk2', $this->uid); ajaxmsg(); } else { ajaxmsg('操作失败,请重试', 0); } }
public function bindbank() { $bank_info = M('member_banks')->field("uid, bank_num")->where("uid=" . $this->uid)->find(); !$bank_info['uid'] && ($data['uid'] = $this->uid); $data['bank_num'] = text($_POST['account']); $data['bank_name'] = text($_POST['bankname']); $data['bank_address'] = text($_POST['bankaddress']); $data['bank_province'] = text($_POST['province']); $data['bank_city'] = text($_POST['cityName']); $data['add_ip'] = get_client_ip(); $data['add_time'] = time(); if ($bank_info['uid']) { /////////////////////新增银行卡修改锁定开关 开始 20130510 fans/////////////////////////// if (intval($this->glo['edit_bank']) != 1 && $bank_info['bank_num']) { ajaxmsg("为了您的帐户资金安全,银行卡已锁定,如需修改,请联系客服", 0); } /////////////////////新增银行卡修改锁定开关 结束 20130510 fans/////////////////////////// $old = text($_POST['oldaccount']); if ($bank_info['bank_num'] && $old != $bank_info['bank_num']) { ajaxmsg('原银卡号不对', 0); } $newid = M('member_banks')->where("uid=" . $this->uid)->save($data); } else { $newid = M('member_banks')->add($data); } if ($newid) { MTip('chk2', $this->uid); ajaxmsg(); } else { ajaxmsg('操作失败,请重试', 0); } }
public function changepass() { $old = md5($_POST['oldpwd']); $newpwd1 = md5($_POST['newpwd1']); $c = M('members')->where("id={$this->uid} AND user_pass = '******'")->count('id'); if ($c == 0) { ajaxmsg('', 2); } $newid = M('members')->where("id={$this->uid}")->setField('user_pass', $newpwd1); if ($newid) { MTip('chk1', $this->uid); ajaxmsg(); } else { ajaxmsg('', 0); } }
public function withdraw() { import("ORG.Loan.Escrow"); $loan = new Escrow(); if ($loan->withdrawVerify($_POST)) { $orders = $_POST['OrderNo']; $id = substr($orders, 12); $vo = M('member_withdraw')->field('uid,withdraw_money,withdraw_fee,withdraw_status, loanno')->where("id={$id}")->find(); $uid = $vo['uid']; if ($_POST['ResultCode'] == '88' && !$vo['withdraw_status']) { // 成功 $FreeLimit = $_POST['FreeLimit']; $FeeWithdraws = $_POST['FeeWithdraws']; $Amount = $_POST['Amount']; $updata['withdraw_status'] = 1; $updata['second_fee'] = $_POST['FeeWithdraws']; $updata['withdraw_fee'] = $FeeWithdraws; $updata['loanno'] = $_POST['LoanNo']; $xid = M('member_withdraw')->where("uid={$vo['uid']} AND id={$id}")->save($updata); if ($xid) { $amoney = $_POST['Amount'] - $_POST['FeeWithdraws']; memberMoneyLog($uid, 29, $_POST['Amount'], "提现成功,扣除实际手续费" . $FeeWithdraws . "元,到帐金额" . $amoney . "元", '0', '@网站管理员@', 0); MTip('chk6', $uid); echo "SUCCESS"; notifyMsg('提现', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'SUCCESS'); exit; } } elseif ($_POST['ResultCode'] == '89' && $vo['withdraw_status'] == 1) { //退回资金 $updata['withdraw_status'] = 2; $xid = M('member_withdraw')->where("uid={$uid} AND id={$id}")->save($updata); if ($xid) { memberMoneyLog($uid, 5, $_POST['Amount'], "提现退回资金{$_POST['Amount']}元", '0', '@网站管理员@', 0); notifyMsg('提现退回', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'SUCCESS'); echo "SUCCESS"; exit; } } notifyMsg('提现', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], ''); } }
/** * 提现通知地址 * */ public function withdraw() { if ($_POST['ResultCode'] == '88') { import("ORG.Loan.Escrow"); $loan = new Escrow(); if ($loan->withdrawVerify($_POST)) { $updata['withdraw_status'] = 1; $id = $_REQUEST['OrderNo']; $vo = M('member_withdraw')->field('uid,money,fee,member_status')->where("id='{$id}'")->find(); //if($vo['status']!=0 || !is_array($vo)) return; $xid = $withdrawlog->where("uid={$vo['uid']} AND id='{$id}'")->save($updata); $tmoney = floatval($vo['money'] - $vo['fee']); memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); if (M('member_withdraw')->save($updata)) { notifyMsg('提现', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'SUCCESS'); echo "SUCCESS"; exit; } notifyMsg('提现', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], ''); } } }
public function actwithdraw() { $pre = C('DB_PREFIX'); $withdraw_money = floatval($_POST['amount']); $pwd = md5($_POST['pwd']); $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(); if (!is_array($vo)) { ajaxmsg("", 0); } if ($vo['all_money'] < $withdraw_money) { ajaxmsg("提现额大于帐户余额", 2); } $wmap['uid'] = $this->uid; if (1 == 1 || $vo['user_leve'] > 0 && $vo['time_limit'] > time()) { $fee = 5; if ($vo['all_money'] - $withdraw_money - $fee < 0) { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@'); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } else { $fee = 5; if ($vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现,自动扣减手续费" . $fee . "元"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,自动扣减手续费" . $fee . "元", '0', '@网站管理员@', -$fee); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } }
public function index() { //访问首页跳转到https // if($_SERVER['SERVER_PORT'] != '443'){ // header('HTTP/1.1 301 Moved Permanently'); // //$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; // //header('Location: https://www.cailai.com' . $_SERVER['PHP_SELF'] . $request_uri); // header('Location: https://www.cailai.com/'); // } $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 9; $parm['limit'] = 7; $this->assign("noticeList", getArticleList($parm)); //网站公告 //统计 2015 07 22 $statictis = M('home_tongji')->find(); $this->statictis = $statictis; //投资达人列表 $daren = M("amount_top")->select(); $this->daren = $daren; //新手标 $newbie = M("newbie_bid")->where('logic_del!=9')->find(); $this->gary = $newbie; // //转让专区 $map = array(); $map['d.status'] = array("in", "2,4"); $parm = array(); $parm['map'] = $map; D("DebtBehavior"); $Debt = new DebtBehavior(); $lists = $Debt->listAll($parm, 2, false); //print_r($lists); //dump($lists); //die; $this->assign("lists", $lists); ///////////////债权转让结束 gwf 2014-10-21////////////// //新手标开始----201509-08 // $newmatch = array(); // $newmatch['b.logic_del']=array("neq",'9');//逻辑删除 9为 默认删除掉 // //$newmatch['b.is_tuijian']=array("in",'0,1'); // $parm=array(); // $parm['map'] = $newmatch; // $parm['limit'] = 1; // $parm['orderby']="b.id DESC"; // $listBorrowNew = getNewBie($parm); // // dump($listBorrowNew); // $gary=$listBorrowNew['list']['0']; // dump($gary); // array(2) { ["list"]=> array(3) { [0]=> array(5) { ["id"]=> string(1) "3" ["bidname"]=> string(1) "4" ["borrow_uid"]=> string(1) "5" ["bidtime"]=> string(1) "7" ["rate"]=> string(2) "12" } [1]=> array(5) { ["id"]=> string(1) "2" ["bidname"]=> string(1) "3" ["borrow_uid"]=> string(1) "4" ["bidtime"]=> string(1) "7" ["rate"]=> string(2) "12" } [2]=> array(5) { ["id"]=> string(1) "1" ["bidname"]=> string(1) "2" ["borrow_uid"]=> string(1) "3" ["bidtime"]=> string(1) "7" ["rate"]=> string(2) "12" } } ["page"]=> string(0) "" } //只需在前端遍历数组 //新手标结束----201509-08 lj //正在进行的贷款 $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.is_tuijian'] = array("in", '0,1'); $searchMap['b.borrow_type'] = array("neq", 9); $searchMap['b.is_new'] = array("eq", 0); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 10; //$parm['orderby']="b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); //dump($listBorrow);die; $this->assign("listBorrow", $listBorrow); ///////////////企业直投推荐开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $parm['limit'] = 1; $parm['map'] = $searchMap; $parm['orderby'] = "bi.is_tuijian desc,bi.id desc"; $listTBorrowa = getTBorrowList($parm); $this->assign("listTBorrowa", $listTBorrowa); ///////////////企业直投推荐开始 gwf 2014-10-21////////////// ///////////////企业直投列表开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $searchMap['bi.borrow_status'] = array('neq', '3'); $searchMap['bi.borrow_type'] = array("eq", "9"); $parm['map'] = $searchMap; $parm['limit'] = 4; $parm['orderby'] = "bi.id DESC,bi.borrow_status ASC"; $listTBorrow = getTBorrowList($parm); //dump($listTBorrow);die; $this->assign("listTBorrow", $listTBorrow); ///////////////企业直投列表结束 gwf 2014-10-21////////////// $this->display(); /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function doEditWaitmoney() { $m = D(ucfirst($this->getActionName())); if (false === $m->create()) { $this->error($m->getError()); } $vm = M('borrow_info')->field('borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time,borrow_fee,money_collect')->find($m->id); if ($vm['borrow_money'] != $m->borrow_money || $vm['borrow_interest_rate'] != $m->borrow_interest_rate || $vm['borrow_duration'] != $m->borrow_duration || $vm['repayment_type'] != $m->repayment_type || $vm['borrow_fee'] != $m->borrow_fee) { $this->error('招标中的借款不能再更改‘还款方式’,‘借款种类’,‘借款金额’,‘年化利率’,‘借款期限’,‘借款管理费’'); exit; } //招标中的借款流标 if ($m->borrow_status == 3) { alogs("borrowRefuse", 0, 1, '流标操作成功!'); //管理员操作日志 //流标返回 $appid = borrowRefuse($m->id, 2); if (!$appid) { alogs("borrowRefuse", 0, 0, '流标操作失败!'); //管理员操作日志 $this->error("流标失败"); } MTip('chk11', $vm['borrow_uid'], $m->id); $m->second_verify_time = time(); //流标操作相当于复审 $verify_info['borrow_id'] = $m->id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = $this->admin_id; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = $m->borrow_status; if ($vm['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vm['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $m->id)); } else { if ($vm['collect_day'] < $m->collect_day) { $spanday = $m->collect_day - $vm['collect_day']; $m->collect_time = strtotime("+ {$spanday} day", $vm['collect_time']); } unset($m->second_verify_time); } //保存当前数据对象 unset($m->borrow_uid); ////////////////////图片编辑/////////////////////// foreach ($_POST['swfimglist'] as $key => $v) { $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $m->updata = serialize($row); ////////////////////图片编辑/////////////////////// if ($result = $m->save()) { //保存成功 //$this->assign("waitSecond",10000); alogs("borrowing", 0, 1, '招标中的借款操作修改成功!'); //管理员操作日志 //成功提示 $this->assign('jumpUrl', __URL__ . "/" . session('listaction')); $this->success(L('修改成功')); } else { alogs("borrowing", 0, 0, '招标中的借款操作修改失败!'); //管理员操作日志 //失败提示 $this->error(L('修改失败')); } }
public function doEditWaitmoney() { //复审的时候这些信息不允许更改 unset($_POST["repayment_type"]); unset($_POST["borrow_money"]); unset($_POST["borrow_interest_rate"]); unset($_POST["borrow_duration"]); unset($_POST["reward_type"]); unset($_POST["can_auto"]); unset($_POST["is_tuijian"]); unset($_POST["borrow_type"]); unset($_POST["borrow_fee"]); unset($_POST["collect_day"]); unset($_POST["borrow_max"]); $m = D(ucfirst($this->getActionName())); if (false === $m->create()) { $this->error($m->getError()); } //$vm = M('borrow_info')->field('borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time')->find($m->id); $vm = M('borrow_info')->alias('bi')->field('borrow_uid,borrow_status,borrow_type,first_verify_time,password,updata,borrow_name,borrow_money,borrow_interest_rate,repayment_type,borrow_duration, borrow_info,pro_provide,can_auto,is_tuijian,borrow_fee,collect_day,borrow_max,reward_type,reward_num,bv.deal_info')->join("left join {$this->pre}borrow_verify bv on bi.id=bv.borrow_id")->where(array("bi.id" => $m->id))->find(); // if( $vm['borrow_money']<>$m->borrow_money || // $vm['borrow_interest_rate']<>$m->borrow_interest_rate || // $vm['borrow_duration']<>$m->borrow_duration || // $vm['borrow_type']<>$m->borrow_type || // $vm['repayment_type']<>$m->repayment_type // ){ // $this->error('招标中的借款不能再更改‘还款方式’,‘借款种类’,‘借款金额’,‘年化利率’,‘借款期限’'); // exit; // } //招标中的借款流标 if ($m->borrow_status == 3) { //流标返回 $appid = borrowRefuse($m->id, 2); if (!$appid) { $this->error("流标失败"); } MTip('chk11', $vm['borrow_uid'], $m->id); $m->second_verify_time = time(); //流标操作相当于复审 $verify_info['borrow_id'] = $m->id; $verify_info['deal_info_2'] = text($_POST['deal_info']); $verify_info['deal_user_2'] = $this->admin_id; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = $m->borrow_status; if ($vm['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vm['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id']), $verify_info['borrow_id'], array($vm['borrow_uid'])); } else { if ($vm['collect_day'] < $m->collect_day) { $spanday = $m->collect_day - $vm['collect_day']; $m->collect_time = strtotime("+ {$spanday} day", $vm['collect_time']); } unset($m->second_verify_time); } //保存当前数据对象 unset($m->borrow_uid); ////////////////////图片编辑/////////////////////// foreach ($_POST['swfimglist'] as $key => $v) { $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $m->updata = serialize($row); ////////////////////图片编辑/////////////////////// if (($result = $m->save()) !== false) { //保存成功 //$this->assign("waitSecond",10000); //成功提示 // 日志记录 unset($vm["repayment_type"]); unset($vm["borrow_money"]); unset($vm["borrow_interest_rate"]); unset($vm["borrow_duration"]); unset($vm["reward_type"]); unset($vm["reward_num"]); unset($vm["can_auto"]); unset($vm["is_tuijian"]); unset($vm["borrow_type"]); unset($vm["borrow_fee"]); unset($vm["collect_day"]); unset($vm["borrow_max"]); saveDataLog($_POST['id'], $vm, $_POST, C('BORROW_LOG_KEY'), session('adminname'), $this->admin_id, $this->logOpType["BORROW_OPT"][0]); $this->assign('jumpUrl', __URL__ . "/" . session('listaction')); $this->success('修改成功'); } else { //失败提示 $this->error('修改失败'); } }
public function index() { $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 26; $parm['limit'] = 4; $this->assign("noticeList", getArticleList($parm)); //网站公告 $a = loan_total_info(); //var_dump($a); $d['a1'] = M('members m')->where($map)->count('m.id'); //假的 $d['a2'] = $a['ordinary_total']; $d['a3'] = $a['num_total']; $d['a4'] = $a['has_also']; $d['a5'] = $a['arrears']; //var_dump($d); $this->assign("a1", $d); //正在进行的贷款 $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); //$searchMap['b.is_tuijian']=array("in",'0,1'); //$searchMap['b.borrow_btype']=1; $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 6; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); //var_dump($listBorrow); $this->assign("listBorrow", $listBorrow); $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['_string'] = "b.is_tuijian = 1"; $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 2; $parm['_string'] = "b.is_tuijian = 1"; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow1 = getBorrowList($parm); $this->assign("listBorrow1", $listBorrow1); //测试时间获取函数开始 //$date = date("Y-m-d",time()); //$ret = get_date($date,'m'); //dump($ret);exit; //测试时间获取函数结束 //////////////////////调取数据//////////// $money_log = get_money_log(0); $borrowOutNum = M("borrow_info")->where("borrow_status in(6,7,8,9)")->count("id"); $transferBorrowOutNum = M("transfer_borrow_info")->count("id"); $mborrowOutNum = $borrowOutNum + $transferBorrowOutNum; $shouyi = M('borrow_info')->sum('borrow_interest'); $this->assign("shouyi", $shouyi); $this->assign("mcount", M("members")->count("id")); $this->assign("mborrowOut", $money_log['17']['money']); $this->assign("mborrowOutNum", $mborrowOutNum); //////////////////////调取数据//////////// //正在进行的贷款 ///////////////省心宝列表开始 fan 2013-10-21////////////// $parm = array(); $searchMap = array(); //$searchMap['borrow_status']=2; //$searchMap['b.on_off']=1; //$searchMap['b.is_jijin']=0; //$searchMap['b.is_show'] = array('in','0,1'); $searchMap['b.borrow_status'] = array('neq', '3'); //$searchMap['b.online_time']=array("lt",time()); $parm['map'] = $searchMap; $parm['limit'] = 3; //$parm['orderby'] = "b.is_show desc,b.progress asc"; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); ///////////////省心宝列表结束 fan 2013-10-21////////////// ///////////////省心宝列表开始 fan 2014-06-13////////////// /* hycd $parm = array(); $searchMap = array(); //$searchMap['borrow_status']=2; //$searchMap['is_tuijian']=0; $searchMap['on_off']=1; $searchMap['is_jijin']=1; $searchMap['b.online_time']=array("lt",time()+300); $parm['map'] = $searchMap; $parm['limit'] = 2; $parm['orderby'] = "b.is_show desc,b.borrow_status ASC,b.borrow_duration ASC,b.online_time desc"; $listFBorrow = getTBorrowList($parm); $this->assign("listFBorrow",$listFBorrow); $this->assign('Bconfig',$Bconfig);*/ $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.is_tuijian'] = array("in", '0,1'); //$searchMap['b.borrow_btype']=2; $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 2; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listFBorrow = getTBorrowList($parm); //var_dump($listBorrow); $this->assign("listFBorrow", $listFBorrow); ///////////////省心宝列表结束 fan 2014-06-13/////////////// $this->display(); /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function setpassword() { if (true === $_SESSION['vphone'] && $_SESSION['retrieve_name']) { $password = $_POST['psw']; $password1 = $_POST['psw1']; if (empty($password)) { ajaxmsg('请输入密码', 0); } if ($password != $password1) { ajaxmsg('两次密码不一样', 0); } $vo = M('members')->field('id,user_phone,user_pass')->where(array('user_name' => $_SESSION['retrieve_name']))->find(); if (!$vo) { ajaxmsg('参数错误', 0); } if ($vo['user_phone'] != $_SESSION['retrieve_phone']) { ajaxmsg('验证码不正确'); } if (md5($password) == $vo['user_pass']) { ajaxmsg('密码修改成功'); } $newid = M('members')->where("id={$vo['id']}")->setField('user_pass', md5($password)); if ($newid) { MTip('chk1', $vo['id']); ajaxmsg('密码修改成功'); } else { ajaxmsg('修改失败', 0); } } else { ajaxmsg('参数错误1', 0); } }
function autoInvest($borrow_id) { $binfo = M("borrow_info")->field('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['can_auto'] == '0') { exit; } $map['a.is_use'] = 1; $map['borrow_type'] = 1; if ($map['a.end_time'] > 0) { $map['a.end_time'] = array("gt", time()); } $autolist = M("auto_borrow a")->join(C('DB_PREFIX') . "member_money m ON a.uid=m.uid")->join(C('DB_PREFIX') . "members ms ON a.uid=ms.id")->field("a.*,ms.usrid, m.account_money+m.back_money as money")->where($map)->order("a.invest_time asc")->select(); $needMoney = $binfo['borrow_money'] - $binfo['has_borrow']; $pre = C('DB_PREFIX'); $info2 = M("members m")->field("m.usrid")->join("{$pre}borrow_info s ON s.borrow_uid=m.id")->where("s.id = " . $borrow_id)->find(); $borrowerid = $info2['usrid']; $borrowid = $borrow_id; $usrid = array(); $transamt = array(); foreach ($autolist as $key => $v) { if (!$needMoney) { break; } if ($v['uid'] == $binfo['borrow_uid']) { continue; } $num_max1 = intval($v['money'] - $v['account_money']); //账户余额-设置的最少剩余金额,即可用的投资金额数 $num_max4 = $binfo['borrow_money'] / 10; //不能超过10% //大于最大投标且设置最大投标 if ($investMoney > $binfo['borrow_max'] && $binfo['borrow_max'] > 0) { $investMoney = $binfo['borrow_max']; } if ($num_max1 > $v['invest_money']) { //如果可用的投资金额大于最大投资金额,则投资金额等于最大投资金额 $investMoney = $v['invest_money']; } else { $investMoney = $num_max1; //如果未设置投标后账户余额,则会投出全部余额 } if ($investMoney > $needMoney) { $investMoney = $needMoney; } else { if ($binfo['borrow_min']) { //设置了最小投标 如果直接满标则不考虑最小投标 if ($investMoney < $binfo['borrow_min']) { // 小于最低投标 continue; //不符合最低投资金额 } elseif ($needMoney - $investMoney > 0 && $needMoney - $investMoney < $binfo['borrow_min']) { // 剩余金额小于最小投标金额 if ($investMoney - $binfo['borrow_min'] >= $binfo['borrow_min']) { // 投资金额- 最小投资金额 大于最小投资金额 $investMoney = $investMoney - $binfo['borrow_min']; // 投资 = 投资-最小投资(保证下次投资金额大于最小投资金额) } else { continue; } } } } //投资金额不能大于借款金额的10% if ($investMoney > $num_max4) { $investMoney = $num_max4; } if ($investMoney % $binfo['borrow_min'] != 0) { continue; } $tiaojian = "{$needMoney} > 0"; //可投金额大于0 if ($v['interest_rate'] > 0) { $tiaojian .= " && " . $binfo['borrow_interest_rate'] . " >= " . $v['interest_rate']; //利率范围 } if ($v['duration_from'] > 0 && $v['duration_to'] > 0 && $v['duration_from'] <= $v['duration_to']) { $tiaojian .= " && (" . $binfo['borrow_duration'] . " >= " . $v['duration_from'] . " || " . $v['duration_from'] . "==0) && (" . $binfo['borrow_duration'] . " <= " . $v['duration_to'] . " || " . $v['duration_to'] . "==0)"; //借款期限范围 } $tiaojian .= " && " . $investMoney . " >= " . $v['min_invest']; $tiaojian .= " && (" . $v['money'] . " - " . $v['account_money'] . ") >= " . $investMoney; //余额限制 if ($tiaojian) { $usrid[] = $v['usrid']; $transamt[] = $investMoney; $needMoney = $needMoney - $investMoney; // 减去剩余已投金额 MTip('chk27', $v['uid'], $borrow_id, $v['id']); //sss M('auto_borrow')->where('id = ' . $v['id'])->save(array("invest_time" => time())); } } /////////////////////////////////////////////////////汇付托管 2014-10-09/////////////////////////////////////////////////////////////// import("ORG.Huifu.Huifu"); $huifu = new Huifu(); $huifu->autoTender_multi($usrid, $transamt, $borrowerid, $borrowid); /////////////////////////////////////////////////////汇付托管 END/////////////////////////////////////////////////////////////// return true; }
public function actwithdraw() { $pre = C('DB_PREFIX'); $withdraw_money = floatval($_POST['amount']); $pwd = md5($_POST['pwd']); $vo = M('members m')->field('mm.account_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(); if (!is_array($vo)) { ajaxmsg("", 0); } if ($vo['account_money'] < $withdraw_money) { ajaxmsg("提现额大于帐户余额", 2); } $start = strtotime(date("Y-m-d", time()) . " 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $wmap['uid'] = $this->uid; $wmap['withdraw_status'] = array("neq", 3); $wmap['add_time'] = array("between", "{$start},{$end}"); $today_money = M('member_withdraw')->where($wmap)->sum('withdraw_money'); if ($vo['user_leve'] > 0 && $vo['time_limit'] > time()) { if ($today_money + $withdraw_money > 1000000) { $message = "您是特权会员,单日提现上限为100万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $tqfee = explode("|", $this->glo['fee_tqtx']); $fee = getFloatValue($tqfee[0] * $withdraw_money / 100, 2); $fee > $tqfee[1] ? $fee = $tqfee[1] : ''; if (1 == 2 && $vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } else { if ($today_money + $withdraw_money > 300000) { $message = "您是普通会员,单日提现上限为30万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $tqfee = $this->glo['fee_pttx']; $fee = getFloatValue($tqfee * $withdraw_money / 100, 2); if ($vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -($withdraw_money + $fee), "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } }
public function index() { $per = C('DB_PREFIX'); //公司动态 $parm = array(); $parm['type_id'] = 321; $parm['limit'] = 5; $parm['need_content'] = true; $this->assign("noticeList", getArticleList($parm)); /*//行业动态 /*$parm['type_id'] = 398; $parm['limit'] = 1; $parm['need_content'] = true; $this->assign("buzList",getArticleList($parm));*/ //公司动态 $parm['type_id'] = 396; $parm['limit'] = 5; $parm['need_content'] = true; $this->assign("gsdtList", getArticleList($parm)); //行业新闻 /*//粤商动态 $parm['type_id'] = 396; $parm['limit'] = 17; $parm['need_content'] = true; $this->assign("trendList",getArticleList($parm)); //粤商动态*/ /*//最新功能 $parm = array(); $parm['type_id'] = 395; $parm['limit'] = 8; $this->assign("newestFunctionList",getArticleList($parm)); //最新功能*/ //常见问题 $parm = array(); $parm['type_id'] = 392; $parm['limit'] = 6; $this->assign("questionList", getArticleList($parm)); //常见问题 //首页动态图片新闻 $this->assign("picnew", M("article")->where("is_homepicnews=1 and type_id=396")->order("id desc")->find()); //首页动态图片新闻 //首页行业图片新闻 $this->assign("buzpicnew", M("article")->where("is_homepicnews=1 and type_id=338")->order("id desc")->find()); //首页行业图片新闻 //成功的借款 $parm = array(); $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '6,7'); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "b.id DESC"; $successBorrow = getBorrowList($parm); $this->assign("successBorrow", $successBorrow); //成功的借款 //逾期的借款 $parm = array(); $searchMap = array(); $searchMap['borrow_status'] = 8; $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "b.id DESC"; $breakBorrow = getBorrowList($parm); $this->assign("breakBorrow", $breakBorrow); //逾期的借款 //正在进行的贷款 $searchMap = array(); $searchMap['borrow_status'] = array("in", '2,4,6,7'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $parm = array(); date_default_timezone_set('Asia/Shanghai'); $ntime = date('Y-m-d H:i:s'); $searchMap['schedular_time'] = array("LT", $ntime); $parm['map'] = $searchMap; $parm['limit'] = 5; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); $this->assign("Bconfig", $Bconfig); $this->assign("listBorrow", $listBorrow); //正在进行的贷款 //可投标的借款 $searchMap = array(); $searchMap['borrow_status'] = array("in", '2'); $parm = array(); $parm['map'] = $searchMap; $this->assign("doingnum", getBorrowList($parm, true)); //可投标的借款 //最热借款 $searchMap = array(); $searchMap['borrow_status'] = array("in", '6,7,8,9'); $searchMap['full_time'] = array("gt", 0); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 10; $parm['hotest'] = true; $parm['orderby'] = "IFNULL(b.`full_time`,0)-IFNULL(bv.`deal_time`,0) ASC"; $listBorrowHotest = getBorrowList($parm); $this->assign("listBorrowHotest", $listBorrowHotest); //最热借款 //推荐的贷款 $searchMap = array(); $searchMap['borrow_status'] = array("in", '2,4,6,7'); $searchMap['is_tuijian'] = 1; //$searchMap['collect_time']=array('gt',time()); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 1; $parm['orderby'] = "b.id DESC"; $listBorrowtj = getBorrowList($parm); $this->assign("listBorrow_tj", $listBorrowtj); //推荐的贷款 $this->assign("mcount", M("members")->count("id")); $this->assign("mborrowOut", M("borrow_info")->where("borrow_status in(6,7,8,9)")->sum("borrow_money")); $this->assign("mborrowOutNum", M("borrow_info")->where("borrow_status in(6,7,8,9)")->count("id")); //地区文章列表 $artList = getAreaTypeList(array("limit" => 7, "area_id" => $this->siteInfo['id'], 'type_id' => 0)); $this->assign("newlist", $artList); //地区文章列表 if ($this->uid) { $this->assign("m_minfo", M('members')->field('credits')->find($this->uid)); $this->assign("unread", $read = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id')); } //近期投资 $this->assign("recentList", getRecentList(10)); //近期还款 $nearlyStartTime = strtotime("-3 days"); $nearlyStartDate = date('Y-m-d', $nearlyStartTime); $nearlyEndTime = strtotime("{$nearlyStartDate} 1 month -1 day"); $map = array(); $map['d.status'] = array("neq", 0); $map['d.deadline'] = array("between", $nearlyStartTime . ',' . $nearlyEndTime); $nearlylist = getTenderList($map, null, 10, 'd.deadline asc'); $this->assign("recentPayList", $nearlylist['list']); //////////////////////////排行榜////////////////// $map = array(); $start = strtotime(date("Y-m-d", time()) . " 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $map['add_time'] = array("between", "{$start},{$end}"); $listPmday = getranklist($map, 10); $this->assign("pmDay", $listPmday); $map = array(); $start = strtotime("-7 day", strtotime(date("Y-m-d", time()) . " 00:00:00")); //strtotime(date("Y-m-d",time())." 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $map['add_time'] = array("between", "{$start},{$end}"); $listPmweek = getranklist($map, 10); $this->assign("pmWeek", $listPmweek); $map = array(); $xdat = explode("|", $this->glo['rankDate']); $start = strtotime($xdat[0] . " 00:00:00"); $end = strtotime($xdat[1] . " 23:59:59"); $map['add_time'] = array("between", "{$start},{$end}"); $listPmMonth = getranklist($map, 10); $this->assign("pmMonth", $listPmMonth); //资金统计 $map = array(); $list = M("member_moneylog")->field('type,sum(affect_money) as money')->where($map)->group('type')->select(); $row = array(); $name = C('MONEY_LOG'); foreach ($list as $v) { $row[$v['type']]['money'] = $v['money'] > 0 ? $v['money'] : $v['money'] * -1; $row[$v['type']]['name'] = $name[$v['type']]; } $this->assign('staticslist', $row); //理财产品 //$financial_arr = getFinancialData(); //$this->assign('financial_arr',$financial_arr); //////////////////////////////////////////// $this->display(); /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = $type = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid'], $borrow_id); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; //会员帐户 $_xstr = "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id']), $verify_info['borrow_id'], array($vbx['borrow_uid'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
private function withdrawDone($status, $nid, $oid) { $done = false; $withdrawlog = D('member_withdraw'); if ($this->locked) { return false; } $this->locked = true; switch ($status) { case 1: $updata['status'] = $status; $updata['tran_id'] = text($oid); $vo = M('member_withdraw')->field('uid,money,fee,status')->where("nid='{$nid}'")->find(); if ($vo['status'] != 0 || !is_array($vo)) { return; } $xid = $withdrawlog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); $tmoney = floatval($vo['money'] - $vo['fee']); memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); //if(!$newid){ // $updata['status'] = 0; // $Moneylog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); // return false; //} //$vx = M("members")->field("user_phone,user_name")->find($vo['uid']); //SMStip("payonline",$vx['user_phone'],array("#USERANEM#","#MONEY#"),array($vx['user_name'],$vo['money'])); break; case 2: $updata['status'] = $status; $updata['tran_id'] = text($oid); $xid = $withdrawlog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); break; case 3: $updata['status'] = $status; $xid = $withdrawlog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); break; } if ($status > 0) { if ($xid) { $done = true; } } $this->locked = false; return $done; }
public function changepass() { $old = md5($_POST['oldpwd']); $newpwd1 = md5($_POST['newpwd1']); $c = M('members')->where("id={$this->uid} AND user_pass = '******'")->count('id'); if ($c == 0) { ajaxmsg('', 2); } $newid = M('members')->where("id={$this->uid}")->setField('user_pass', $newpwd1); //require_once "./config.inc.php"; //require "./uc_client/client.php"; //$username = M("members")->find($this->uid); //$ucresult = uc_user_edit($username['user_name'], $_POST['oldpwd'], $_POST['newpwd1']); if ($newid) { MTip('chk1', $this->uid); ajaxmsg(); } else { ajaxmsg('', 0); } }
public function index() { session('invitation_code', $_GET['i']); $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 43; $parm['limit'] = 7; $this->assign("noticeList", getArticleList($parm)); unset($parm); //网站公告 //新闻 $parm['type_id'] = 2; $parm['limit'] = 6; $this->assign("newsList", getArticleList($parm)); unset($parm); //新闻 ///////////////散标列表开始////////////// $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.is_tuijian'] = array("in", '0,1'); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 5; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); $this->assign("listBorrow", $listBorrow); ///////////////散标列表结束////////////// ///////////////累计会员人数//////////// $members = M('members')->count(); $this->assign("members", $members); //会员总数 ///////////////累计会员人数//////////// ///////////////累计配资人数//////////// //$member_num = M("members")->count(); //$this->assign("member_num",$member_num); ///////////////累计配资人数//////////// $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $this->assign("Bconfig", $Bconfig); //////天天盈////////////// $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.stock_type'] = array("in", '1,2,3,4'); //$searchMap['b.is_tuijian']=array("in",'0,1'); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 5; $parm['orderby'] = "b.borrow_status asc ,b.first_verify_time desc"; $dayslists = getBorrowList($parm); $this->assign("dayslists", $dayslists); $progress = ''; if ($dayslists['list']) { foreach ($dayslists['list'] as $val) { $progress[] = (int) $val['progress']; } } $this->assign('progress', $progress ? json_encode($progress) : ''); /** //月月盈 $searchMap1 = array(); $searchMap1['b.borrow_status']=array("in",'2,4,6,7'); $searchMap1['b.stock_type']=array("eq",'2'); //$searchMap['b.is_tuijian']=array("in",'0,1'); $parm1=array(); $parm1['map'] = $searchMap1; $parm1['limit'] =2; $parm1['orderby']="b.borrow_status asc ,b.first_verify_time desc"; $monthlists = getBorrowList($parm1); $this->assign("monthlists",$monthlists); **/ ///////////////累计配资金额//////////// $borrow_sum = M("borrow_info")->where(array('borrow_status' => array("in", '6,7,9,10')))->sum("borrow_money"); ///////////////为客户赚取收益//////////// $investor_profit = M("borrow_info")->where(array('borrow_status' => array("in", '6,7,9,10')))->sum("borrow_interest"); $this->assign("investor_profit", $investor_profit); ///////////////为客户赚取收益//////////// $this->assign("borrow_sum", $borrow_sum); ///////////////累计配资金额//////////// ///////////////配资盈利列表//////////// //$shares_list = M("shares_record r")->join("lzh_shares_apply a ON a.id = r.shares_id")->where("r.profit_loss > 0")->field("r.profit_loss,a.principal,a.shares_money,a.u_name")->order("r.add_time DESC")->limit(7)->select(); //$this->assign("shares_list",getRetRate($shares_list)); ///////////////配资盈利列表//////////// ///媒体报道 $mediaslist = M("media")->where(" is_show = 1 ")->order(" link_order desc ")->limit(14)->select(); $this->assign("mediaslist", $mediaslist); ///////////////配资列表//////////// //$shares_apply = M("shares_apply")->where("status in(2,3,6)")->field("u_name,shares_money,examine_time")->order("examine_time DESC")->limit(20)->select(); //echo M()->getLastSql();exit; //$this->assign("shares_apply",$shares_apply); ///////////////配资列表//////////// ///////////////企业直投列表开始 fan 2013-10-21////////////// $parm = array(); $searchMap = array(); $searchMap['b.is_show'] = array('in', '0,1'); $searchMap['b.borrow_status'] = array('neq', '3'); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "b.is_tuijian desc,b.is_show desc,b.progress asc"; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); ///////////////企业直投列表结束 fan 2013-10-21////////////// if (ListMobile()) { if ($this->uid && M('members')->where('id=' . $this->uid . ' and ent=1')->count()) { $redbag = M('redbag')->order('id desc')->where('status=1')->find(); //判断活动是否存在 $rid = $redbag['id']; if ($rid) { $usered = M('redbag_list')->where('uid=' . $this->uid . ' and pid=' . $rid)->count(); //判断是否领过红包 if (!$usered) { $redinfo = M('redbag_list')->order('id asc')->where('uid=0 and pid=' . $rid . ' and status=1')->find(); //判断是否还有剩余红包 if ($redinfo) { $this->assign('isredbag', true); } } } } } //if($_GET['debug']){ $this->display(); //}else{ // $this->display('indexv'); //} exit; /****************************募集期内标未满,自动流标 新增 2013-03-13*************************\***/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function changepwd() { $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); } if (!is_array($arr) || empty($arr) || empty($arr['oldpwd']) || empty($arr['newpwd'])) { ajaxmsg("数据错误!", 0); } require_once "uc_client/config.inc.php"; require "uc_client/client.php"; $old = $arr['oldpwd']; $newpwd1 = $arr['newpwd']; $user_name = M("members")->where("id=" . $this->uid)->getField("user_name"); $r = uc_user_edit($user_name, $old, $newpwd1); if ($r > 0) { MTip('chk1', $this->uid); ajaxmsg("密码修改成功"); } else { ajaxmsg("原密码错误", 0); } }
public function actwithdraw() { $pre = C('DB_PREFIX'); $withdraw_money = floatval($_POST['amount']); $pwd = md5($_POST['pwd']); $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(); if (!is_array($vo)) { ajaxmsg("", 0); } //=======================20151209 if (bccomp($withdraw_money, $vo['all_money']) == 1) { ajaxmsg("提现额大于帐户余额", 2); } //if($vo['all_money']<$withdraw_money) ajaxmsg("提现额大于帐户余额",2); $start = strtotime(date("Y-m-d",time())." 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $wmap['uid'] = $this->uid; $wmap['withdraw_status'] = array("neq", 3); $wmap['add_time'] = array("between", "{$start},{$end}"); $today_money = M('member_withdraw')->where($wmap)->sum('withdraw_money'); $today_time = M('member_withdraw')->where($wmap)->count('id'); $tqfee = explode("|", $this->glo['fee_tqtx']); $fee[0] = explode("-", $tqfee[0]); $fee[1] = explode("-", $tqfee[1]); $fee[2] = explode("-", $tqfee[2]); $one_limit = $fee[2][0]; $txxz_min = $this->glo['txxz_min']; if ($withdraw_money < $txxz_min || $withdraw_money > $one_limit) { ajaxmsg("单笔提现金额限制为{$txxz_min}-{$one_limit}元", 2); } /* $today_limit = $fee[2][1]/$fee[2][0]; if($today_time>=$today_limit){ $message = "一天最多只能提现{$today_limit}次"; ajaxmsg($message,2); } */ if (1 == 1 || $vo['user_leve'] > 0 && $vo['time_limit'] > time()) { if ($today_money + $withdraw_money > $fee[2][1]) { $message = "单日提现上限为{$fee[2][1]}元。您今日已经申请提现金额:{$today_money}元,当前申请金额为:{$withdraw_money}元,已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $itime = strtotime(date("Y-m", time()) . "-01 00:00:00") . "," . strtotime(date("Y-m-", time()) . date("t", time()) . " 23:59:59"); $wmapx['uid'] = $this->uid; $wmapx['withdraw_status'] = array("neq", 3); $wmapx['add_time'] = array("between", "{$itime}"); $times_month = M("member_withdraw")->where($wmapx)->count("id"); $tqfee1 = explode("|", $this->glo['fee_tqtx']); $fee1[0] = explode("-", $tqfee1[0]); $fee1[1] = explode("-", $tqfee1[1]); if ($withdraw_money - $vo['back_money'] > 0) { $maxfee1 = ($withdraw_money - $vo['back_money']) * $fee1[0][0] / 1000; if ($maxfee1 >= $fee1[0][1]) { $maxfee1 = $fee1[0][1]; } $maxfee2 = $vo['back_money'] * $fee1[1][0] / 1000; if ($maxfee2 >= $fee1[1][1]) { $maxfee2 = $fee1[1][1]; } $fee = $maxfee1 + $maxfee2; $fee = $fee > $fee1[0][2] ? $fee : $fee1[0][2]; $money = $withdraw_money - $vo['back_money']; $moneydata['withdraw_back_money'] = $vo['back_money']; } else { $fee = $vo['back_money'] * $fee1[1][0] / 1000; //$fee = $withdraw_money*$fee1[1][0]/1000; if ($fee >= $fee1[1][1]) { $fee = $fee1[1][1]; } $moneydata['withdraw_back_money'] = $withdraw_money; } if ($vo['all_money'] - $withdraw_money - $fee < 0) { //$withdraw_money = ($withdraw_money - $fee); $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@',0); memberMoneyLog($this->uid, 4, -$withdraw_money, "申请提现", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@',-$fee); //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@'); memberMoneyLog($this->uid, 4, -$withdraw_money, "申请提现", '0', '@网站管理员@'); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } else { //普通会员暂未使用 if ($today_money + $withdraw_money > 300000) { $message = "您是普通会员,单日提现上限为30万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $tqfee = $this->glo['fee_pttx']; $fee = getFloatValue($tqfee * $withdraw_money / 100, 2); if ($vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现,自动扣减手续费" . $fee . "元"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,自动扣减手续费" . $fee . "元", '0', '@网站管理员@', -$fee); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } }
public function index() { $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 9; $parm['limit'] = 7; $this->assign("noticeList", getArticleList($parm)); //网站公告 /* //正在进行的贷款 $searchMap = array(); $searchMap['borrow_status']=array("in",'2,4,6,7'); $searchMap['is_tuijian']=array("in",'0,1'); $searchMap['deadline']=strtotime("deadline"); $parm=array(); $parm['map'] = $searchMap; $parm['limit'] = 1; $parm['orderby']="b.id DESC,b.borrow_status ASC"; $listBorrow = getBorrowList($parm); $this->assign("listBorrow",$listBorrow); //散标开始 $Bconfig = require C("APP_ROOT")."Conf/borrow_config.php"; $per = C('DB_PREFIX'); //预发标的借款 $parm=array(); $searchMap = array(); $searchMap['borrow_status']=array("in",'9'); $searchMap['b.borrow_status']=0; $parm['map'] = $searchMap; $parm['limit'] = 5; $parm['orderby']="b.id DESC"; $list = getBorrowList($parm); //dump($list);die; $this->assign("list",$list); ///////////////债权转让开始 gwf 2014-10-21////////////// $map = array(); $map['d.status']=array("in","2,4"); $parm = array(); $parm['map'] = $map; D("DebtBehavior"); $Debt = new DebtBehavior(); $lists = $Debt->listAll($parm ,3, true); $this->assign("lists", $lists); ///////////////债权转让结束 gwf 2014-10-21////////////// ///////////////企业直投推荐开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $parm['limit'] =1; $parm['map'] = $searchMap; $parm['orderby'] = "bi.is_tuijian desc,bi.id desc"; $listTBorrowa = getTBorrowList($parm); $this->assign("listTBorrowa",$listTBorrowa); ///////////////企业直投推荐开始 gwf 2014-10-21////////////// */ //的借款 //还款中的借款总额 @董强 $map = array(); $map['borrow_status'] = array("in", "6,7"); $Repayment = M("borrow_info")->field("SUM(borrow_money) as money")->where($map)->select(); $this->assign("Repayment_money", $Repayment[0]['money']); //还款中的借款总额 END //正常还款完成利息总额 @董强 $where = array(); $where['status'] = array("in", "5,6,7"); $Repayment_lx = M("borrow_investor")->field("SUM(investor_interest) as investor_interest")->where($where)->select(); $this->assign("investor_interest", $Repayment_lx[0]['investor_interest']); //正常还款完成利息总额 END// $parm = array(); $searchMap = array(); $searchMap['b.borrow_status'] = array('neq', '3'); $searchMap['b.borrow_type'] = array("neq", "9"); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "b.id DESC"; $list = getBorrowList($parm); //dump($list);die; $this->assign("list", $list); ///////////////企业直投列表开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $searchMap['bi.borrow_status'] = array('neq', '3'); $searchMap['bi.borrow_type'] = array("eq", "9"); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "bi.borrow_status ASC"; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); ///////////////企业直投列表结束 gwf 2014-10-21////////////// $this->display(); /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function liubiao() { $borrow_id = intval($_REQUEST['id']); $of = fopen("./out/liu_borrow_" . $borrow_id . ".txt", 'w'); //创建并打开 fwrite($of, "\nborrow_id=\n" . $borrow_id); $time = time(); $pre = C('DB_PREFIX'); $borrowInvestor = D('transfer_borrow_investor'); $binfo = M("transfer_borrow_info")->field("borrow_money,borrow_uid,borrow_duration,repayment_type")->where("id = {$borrow_id}")->find(); $investorList = $borrowInvestor->field('id,investor_uid,borrow_uid,investor_capital,investor_interest,invest_fee')->where("borrow_id={$borrow_id}")->select(); // print_r($investorList); $borrowInvestor->startTrans(); M('transfer_investor_detail')->where("borrow_id={$borrow_id}")->delete(); $tipList = $borrowInvestor->field('id,investor_uid')->where("borrow_id={$borrow_id}")->group('investor_uid')->select(); foreach ($tipList as $tk => $tv) { MTip('chk15', $tv['investor_uid'], $borrow_id); // } $bstatus = 3; $upborrow_info = M('transfer_borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); // 处理借款概要 $buname = M('members')->field("user_name")->where("id = {$binfo['borrow_uid']}")->find(); // 处理借款概要 if (is_array($investorList) && $investorList != null) { $status = array(); $status['status'] = 3; $status['deal_time'] = time(); $upsummary_res = M('transfer_borrow_investor')->where("borrow_id={$borrow_id}")->save($status); $moneynewid_x_temp = true; $upchange_temp = true; $upinvestor_temp = true; foreach ($investorList as $k => $v) { $investor_uid[$k] = $v['investor_uid']; $accountMoney_investor = M("member_money")->field(true)->find($investor_uid[$k]); $datamoney_x['uid'] = $investor_uid[$k]; $datamoney_x['type'] = 8; $datamoney_x['affect_money'] = $v['investor_capital']; if (!empty($zengjia[$datamoney_x['uid']])) { $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $v['investor_capital'] + $zengjia[$datamoney_x['uid']]['account_money']; // $datamoney_x['collect_money'] = $accountMoney_investor['money_collect'] - $v['investor_capital'] + $v['invest_fee'] + $zengjia[$datamoney_x['uid']]['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; } else { $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $v['investor_capital']; //投标不成功返回充值资金池,且返回募集期利息 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect'] - $v['investor_capital'] + $v['invest_fee']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; } // 新增 $zengjia[$datamoney_x['uid']]['account_money'] = empty($zengjia[$datamoney_x['uid']]['account_money']) ? $v['investor_capital'] : $zengjia[$datamoney_x['uid']]['account_money'] + $v['investor_capital']; //增加本金、募集期利息 $zengjia[$datamoney_x['uid']]['money_collect'] = empty($zengjia[$datamoney_x['uid']]['money_collect']) ? -$v['investor_capital'] - $v['investor_interest'] + $v['invest_fee'] : $zengjia[$datamoney_x['uid']]['money_collect'] - $v['investor_capital'] - $v['investor_interest'] + $v['invest_fee']; //-本金-利息+手续费 // 累计 $leiji[$datamoney_x['uid']]['account_money'] = empty($leiji[$datamoney_x['uid']]['account_money']) ? $accountMoney_investor['account_money'] + $v['investor_capital'] : $leiji[$datamoney_x['uid']]['account_money'] + $v['investor_capital']; //增加本金 $leiji[$datamoney_x['uid']]['money_collect'] = empty($leiji[$datamoney_x['uid']]['money_collect']) ? $accountMoney_investor['money_collect'] - $v['investor_capital'] - $v['investor_interest'] + $v['invest_fee'] : $leiji[$datamoney_x['uid']]['money_collect'] - $v['investor_capital'] - $v['investor_interest'] + $v['invest_fee']; $leiji[$datamoney_x['uid']]['money_freeze'] = $accountMoney_investor['money_freeze']; $leiji[$datamoney_x['uid']]['back_money'] = $accountMoney_investor['back_money']; // 会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; // 会员帐户 $_xstr = "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回投标冻结资金" . $v['investor_capital'] . "元"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $v['borrow_uid']; //$binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname['user_name']; $moneynewid_x = M('member_moneylog')->add($datamoney_x); $moneynewid_x_temp = $moneynewid_x_temp && $moneynewid_x; // ////// if ($of) { fwrite($of, "\ninvest_id=" . $v['id']); fwrite($of, "\n投资额=" . $v['investor_capital']); fwrite($of, "\nbinfo=\n"); fwrite($of, var_export($binfo, true)); // fwrite($of, "\ndatamoney_x=\n"); fwrite($of, var_export($datamoney_x, true)); // fwrite($of, "\nmmoney_x=\n"); fwrite($of, var_export($mmoney_x, true)); // fwrite($of, "\nzengjia=\n"); fwrite($of, var_export($zengjia, true)); // fwrite($of, "\nleiji=\n"); fwrite($of, var_export($leiji, true)); // fwrite($of, "\nmoneynewid_x=" . $moneynewid_x); fwrite($of, "\nupchange=" . $upchange); fwrite($of, "\nupinvestor=" . $upinvestor . "\n"); } // ////// } $leiji_new = array_keys($leiji); // 还款操作 $bxid_temp = true; for ($x = 0; $x < count($leiji); $x++) { $mdata = $leiji[$leiji_new[$x]]; $xuid = $leiji_new[$x]; $bxid = M('member_money')->where("uid={$xuid}")->save($mdata); $bxid_temp = $bxid_temp && $bxid; // ///// if ($of) { fwrite($of, "\nbxid{$x}=" . $bxid); } // ///// } // //// if ($of) { fwrite($of, "\ndatamoney_x_z=\n"); fwrite($of, var_export($datamoney_x, true)); // fwrite($of, "\nmmoney_x_z=\n"); fwrite($of, var_export($mmoney_x, true)); // fwrite($of, "\nzengjia_z=\n"); fwrite($of, var_export($zengjia, true)); // fwrite($of, "\nleiji_z=\n"); fwrite($of, var_export($leiji, true)); // fwrite($of, "\nleiji_new=\n"); fwrite($of, var_export($leiji_new, true)); // fwrite($of, "\nmoneynewid_x_temp=" . $moneynewid_x_temp); // fwrite($of, "\nupchange_temp=" . $upchange_temp); // fwrite($of, "\nupinvestor_temp=" . $upinvestor_temp); fwrite($of, "\nbxid_temp=" . $bxid_temp); fwrite($of, "\nupsummary_res=" . $upsummary_res); } // ///// } else { $moneynewid_x_temp = true; $bxid_temp = true; $upsummary_res = true; } // ///// if ($of) { fwrite($of, "\nmoneynewid_x_temp=" . $moneynewid_x_temp); fwrite($of, "\nbxid_temp=" . $bxid_temp); fwrite($of, "\nupsummary_res=" . $upsummary_res); fwrite($of, "\nupborrow_info=" . $upborrow_info); fwrite($of, "\nEnd\n\n"); } // ///// if ($moneynewid_x_temp && $upsummary_res && $bxid_temp && $upborrow_info) { $borrowInvestor->commit(); $this->assign('jumpUrl', __URL__); $this->success(L('流标成功')); } else { $borrowInvestor->rollback(); $this->error(L('流标失败')); } MTip('chk11', $vbx['borrow_uid'], $borrow_id); fclose($of); //关 }
function autoInvest($borrow_id) { $datag = get_global_setting(); $binfo = M("borrow_info")->field('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['can_auto'] == '0') { return; } $map['a.is_use'] = 1; $map['a.borrow_type'] = 1; $map['a.end_time'] = array("gt", time()); $autolist = M("auto_borrow a")->join(C('DB_PREFIX') . "member_money m ON a.uid=m.uid")->field("a.*, m.account_money+m.back_money as money")->where($map)->order("a.invest_time asc")->select(); $needMoney = $binfo['borrow_money'] - $binfo['has_borrow']; foreach ($autolist as $key => $v) { if (!$needMoney) { break; } if ($v['uid'] == $binfo['borrow_uid']) { continue; } $num_max1 = intval($v['money'] - $v['account_money']); //账户余额-设置的最少剩余金额,即可用的投资金额数 $num_max4 = $binfo['borrow_money'] * $datag['auto_rate'] / 100; //不能超过10% if ($v['invest_money'] > $binfo['borrow_max'] && $binfo['borrow_max'] > 0) { // 大于最大投标 且设置最大投标 $investMoney = $binfo['borrow_max']; } if ($num_max1 > $v['invest_money']) { //如果可用的投资金额大于最大投资金额,则投资金额等于最大投资金额 $investMoney = $v['invest_money']; } else { $investMoney = $num_max1; //如果未设置投标后账户余额,则会投出全部余额 } if ($investMoney > $needMoney) { $investMoney = $needMoney; } else { if ($binfo['borrow_min']) { //设置了最小投标 如果直接满标则不考虑最小投标 if ($investMoney < $binfo['borrow_min']) { // 小于最低投标 continue; //不符合最低投资金额 } elseif ($needMoney - $investMoney > 0 && $needMoney - $investMoney < $binfo['borrow_min']) { // 剩余金额小于最小投标金额 if ($investMoney - $binfo['borrow_min'] >= $binfo['borrow_min']) { // 投资金额- 最小投资金额 大于最小投资金额 $investMoney = $investMoney - $binfo['borrow_min']; // 投资 = 投资-最小投资(保证下次投资金额大于最小投资金额) } else { continue; } } } } if ($investMoney > $num_max4) { //投资金额不能大于借款金额的10% $investMoney = $num_max4; } if ($investMoney % $binfo['borrow_min'] != 0 && $investMoney % $binfo['borrow_min'] > 0) { //如果当前可投金额不是最小投资金额的整数倍 $investMoney = $binfo['borrow_min'] * floor($investMoney % $binfo['borrow_min']); } if ($v['interest_rate'] > 0) { if (!($binfo['borrow_interest_rate'] >= $v['interest_rate'])) { //利率范围 continue; } } if ($v['duration_from'] > 0 && $v['duration_to'] > 0 && $v['duration_from'] <= $v['duration_to']) { //借款期限范围 if (!($binfo['borrow_duration'] >= $v['duration_from'] && $binfo['borrow_duration'] <= $v['duration_to'])) { continue; } } if (!($investMoney >= $v['min_invest'])) { // continue; } if (!($v['money'] - $v['account_money'] >= $investMoney)) { //余额限制 continue; } if ($needMoney <= 0) { //可投金额必须大于0 continue; } $x = investMoney($v['uid'], $borrow_id, $investMoney, 1); if ($x === true) { $needMoney = $needMoney - $investMoney; // 减去剩余已投金额 MTip('chk27', $v['uid'], $borrow_id, $v['id']); //sss M('auto_borrow')->where('id = ' . $v['id'])->save(array("invest_time" => time())); } } return true; }
/** * 流标处理 * */ public function auditBids() { import("ORG.Loan.Escrow"); $loan = new Escrow(); if ($loan->loanAuditVerify($_POST)) { $str = ''; if ($_POST['ResultCode'] == 88) { $borrow_id = loanBorrowId($_POST['LoanNoList']); if (!$borrow_id) { echo 'error'; exit; } $borrow = M("borrow_info")->field('borrow_uid, first_verify_time, borrow_status')->where("id={$borrow_id}")->find(); if ($borrow['borrow_status'] != 2) { echo 'SUCCESS'; exit; } //流标返回 $appid = borrowRefuse($borrow_id, 2); if (!$appid) { alogs("borrowRefuse", 0, 0, '流标操作失败!'); //管理员操作日志 echo 'error'; exit; } else { alogs("borrowRefuse", 0, 1, '流标操作成功!'); //管理员操作日志 } MTip('chk11', $borrow['borrow_uid'], $borrow_id); $vss = M("members")->field("user_phone,user_name")->where("id = {$borrow['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //保存当前数据对象 $borrow_save = array('second_verify_time' => time(), 'borrow_status' => 3); if ($result = M('borrow_info')->where("id={$borrow_id}")->save($borrow_save)) { //保存成功 preg_match('/([0-9]+)/', $_POST['Remark1'], $id_arr); $admin_id = $id_arr[0]; //流标操作相当于复审 $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['Remark1']); $verify_info['deal_user_2'] = $admin_id; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($borrow['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } notifyMsg('流标', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'SUCCESS'); $str = 'SUCCESS'; } else { notifyMsg('流标', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'ERROR'); $str = 'error'; } } notifyMsg('流标', $_POST, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], $str); echo $str; exit; } }
/** * @param intval $uid 用户id * @param flaot $money 提现金额 * @param string $paypass 支付密码 */ function checkCash($uid, $money, $paypass) { $pre = C('DB_PREFIX'); $uid = intval($uid); if (!$money && !$paypass) { die('数据不完整'); } $paypass = md5($paypass); $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={$uid} AND m.pin_pass='******'")->find(); if (!is_array($vo)) { return '支付密码不正确'; } $datag = get_global_setting(); if ($vo['all_money'] < $money) { return "提现额大于帐户余额"; } $start = strtotime(date("Y-m-d", time()) . " 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $wmap['uid'] = $uid; $wmap['withdraw_status'] = array("neq", 3); $wmap['add_time'] = array("between", "{$start},{$end}"); $today_time = M('member_withdraw')->where($wmap)->count('id'); $today_money = M('member_withdraw')->where($wmap)->sum('withdraw_money'); $tqfee = explode("|", $datag['fee_tqtx']); $fee[0] = explode("-", $tqfee[0]); $fee[1] = explode("-", $tqfee[1]); $fee[2] = explode("-", $tqfee[2]); $one_limit = $fee[2][0] * 10000; $today_limit = $fee[2][1] / $fee[2][0]; if ($money < 100 || $money > $one_limit) { return "单笔提现金额限制为100-{$one_limit}元"; } if ($today_time >= $today_limit) { return "一天最多只能提现{$today_limit}次"; } if ($vo['user_leve'] > 0 && $vo['time_limit'] > time()) { if ($today_money + $money > $fee[2][1] * 10000) { return "单日提现上限为{$fee[2][1]}万元。您今日已经申请提现金额:{$today_money}元,当前申请金额为:{$money}元,已超出单日上限,请您修改申请金额或改日再申请提现"; } $itime = strtotime(date("Y-m", time()) . "-01 00:00:00") . "," . strtotime(date("Y-m-", time()) . date("t", time()) . " 23:59:59"); $wmapx['uid'] = $uid; $wmapx['withdraw_status'] = array("neq", 3); $wmapx['add_time'] = array("between", "{$itime}"); $times_month = M("member_withdraw")->where($wmapx)->count("id"); $tqfee1 = explode("|", $datag['fee_tqtx']); $fee1[0] = explode("-", $tqfee1[0]); $fee1[1] = explode("-", $tqfee1[1]); if ($money - $vo['back_money'] >= 0) { $maxfee1 = ($money - $vo['back_money']) * $fee1[0][0] / 1000; if ($maxfee1 >= $fee1[0][1]) { $maxfee1 = $fee1[0][1]; } $maxfee2 = $vo['back_money'] * $fee1[1][0] / 1000; if ($maxfee2 >= $fee1[1][1]) { $maxfee2 = $fee1[1][1]; } $fee = $maxfee1 + $maxfee2; $money = $money - $vo['back_money']; } else { $fee = $vo['back_money'] * $fee1[1][0] / 1000; if ($fee >= $fee1[1][1]) { $fee = $fee1[1][1]; } } if ($vo['all_money'] - $money - $fee < 0) { $moneydata['withdraw_money'] = $money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($uid, 4, -$money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $uid); return 'TRUE'; } } else { $moneydata['withdraw_money'] = $money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($uid, 4, -$money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@'); MTip('chk6', $uid); return 'TRUE'; } } } return '申请失败,请重试'; }
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); } }
private function payDone($status, $nid, $oid, $payResult = "") { $done = false; $Moneylog = M('member_payonline'); if ($this->locked) { return false; } $this->locked = true; $Moneylog->startTrans(); $vo = $Moneylog->lock(true)->field('uid,money,fee,status')->where("nid='{$nid}'")->find(); if (!is_array($vo) || $vo['status'] == 1) { $Moneylog->commit(); return $done; } switch ($status) { case 1: $updata['status'] = $status; $updata['tran_id'] = text($oid); $updata['pay_result'] = $payResult; $xid = $Moneylog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); $tmoney = floatval($vo['money'] - $vo['fee']); if ($xid) { $newid = memberMoneyLog($vo['uid'], 3, $tmoney, "充值订单号:" . $oid); } //更新成功才充值,避免重复充值 if (!$newid) { $updata['status'] = 0; $Moneylog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); $Moneylog->commit(); return false; } MTip("payonline", $vo['uid'], $vo['money']); break; case 2: $updata['status'] = $status; $updata['tran_id'] = text($oid); $updata['pay_result'] = $payResult; $xid = $Moneylog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); break; case 3: $updata['status'] = $status; $updata['pay_result'] = $payResult; $xid = $Moneylog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); break; } if ($status > 0) { if ($xid) { $done = true; } } $Moneylog->commit(); $this->locked = false; return $done; }
public function actwithdraw() { $jsoncode = file_get_contents("php://input"); // alogsm("actwithdraw",0,1,session("u_id").$jsoncode); $arr = array(); $arr = json_decode($jsoncode, true); if (!is_array($arr) || empty($arr) || empty($arr['amount']) || empty($arr['pwd'])) { //alogsm("actwithdraw_fail",0,1,"请求错误!");// ajaxmsg("请求错误!", 0); } if (intval($arr['uid']) != $this->uid) { //alogsm("actwithdraw_fail",0,1,"用户错误!");// ajaxmsg("用户错误!", 0); } $pre = C('DB_PREFIX'); $withdraw_money = floatval($arr['amount']); $pwd = md5($arr['pwd']); //alogsm("actwithdraw_pwd",0,1,$arr['pwd']."-".$arr['amount']);// $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(); if (!is_array($vo)) { ajaxmsg("", 0); } //alogsm("actwithdraw_密码是否错误",0,1,is_array($vo));// if ($vo['all_money'] < $withdraw_money) { ajaxmsg("提现额大于帐户余额", 2); } $start = strtotime(date("Y-m-d", time()) . " 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $wmap['uid'] = $this->uid; $wmap['withdraw_status'] = array("neq", 3); $wmap['add_time'] = array("between", "{$start},{$end}"); $today_money = M('member_withdraw')->where($wmap)->sum('withdraw_money'); $today_time = M('member_withdraw')->where($wmap)->count('id'); $tqfee = explode("|", $this->glo['fee_tqtx']); $fee[0] = explode("-", $tqfee[0]); $fee[1] = explode("-", $tqfee[1]); $fee[2] = explode("-", $tqfee[2]); $one_limit = $fee[2][0] * 10000; if ($withdraw_money < 100 || $withdraw_money > $one_limit) { //alogsm("actwithdraw_fail",0,1,"单笔提现金额限制为100-{$one_limit}元");// ajaxmsg("单笔提现金额限制为100-{$one_limit}元", 2); } $today_limit = $fee[2][1] / $fee[2][0]; if ($today_time >= $today_limit) { $message = "一天最多只能提现{$today_limit}次"; //alogsm("actwithdraw_fail",0,1,$message);// ajaxmsg($message, 2); } if (1 == 1 || $vo['user_leve'] > 0 && $vo['time_limit'] > time()) { if ($today_money + $withdraw_money > $fee[2][1] * 10000) { $message = "单日提现上限为{$fee[2][1]}万元。您今日已经申请提现金额:{$today_money}元,当前申请金额为:{$withdraw_money}元,已超出单日上限,请您修改申请金额或改日再申请提现"; //alogsm("actwithdraw_fail",0,1,$message);// ajaxmsg($message, 2); } $itime = strtotime(date("Y-m", time()) . "-01 00:00:00") . "," . strtotime(date("Y-m-", time()) . date("t", time()) . " 23:59:59"); $wmapx['uid'] = $this->uid; $wmapx['withdraw_status'] = array("neq", 3); $wmapx['add_time'] = array("between", "{$itime}"); $times_month = M("member_withdraw")->where($wmapx)->count("id"); if ($withdraw_money - $vo['back_money'] >= 0) { $maxfee1 = ($withdraw_money - $vo['back_money']) * $fee[0][0] / 1000; if ($maxfee1 >= $fee[0][1]) { $maxfee1 = $fee[0][1]; } $maxfee2 = $vo['back_money'] * $fee[1][0] / 1000; if ($maxfee2 >= $fee[1][1]) { $maxfee2 = $fee[1][1]; } $fee = $maxfee1 + $maxfee2; $money = $withdraw_money - $vo['back_money']; } else { $fee = $vo['back_money'] * $fee[1][0] / 1000; if ($fee >= $fee[1][1]) { $fee = $fee[1][1]; } } if ($vo['all_money'] - $withdraw_money - $fee < 0) { //$withdraw_money = ($withdraw_money - $fee); $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@',-$fee); memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } else { //普通会员暂未使用 if ($today_money + $withdraw_money > 300000) { $message = "您是普通会员,单日提现上限为30万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; //alogsm("actwithdraw_fail",0,1,$message);// ajaxmsg($message, 2); } $tqfee = $this->glo['fee_pttx']; $fee = getFloatValue($tqfee * $withdraw_money / 100, 2); if ($vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现,自动扣减手续费" . $fee . "元"); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,自动扣减手续费" . $fee . "元", '0', '@网站管理员@', -$fee); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } //alogsm("actwithdraw_fail",0,1,"对不起,提现出错,请重试");// ajaxmsg("对不起,提现出错,请重试", 2); } }
public function bindbank() { $info = M("members")->field("usrid")->where("id=" . $this->uid)->find(); $usrid = $info['usrid']; import("ORG.Huifu.Huifu"); $huifu = new Huifu(); $info = $huifu->userBindCard($usrid); exit; $bank_info = M('member_banks')->field("uid, bank_num")->where("uid=" . $this->uid)->find(); !$bank_info['uid'] && ($data['uid'] = $this->uid); $data['bank_num'] = text($_POST['account']); $data['bank_name'] = text($_POST['bank_name']); $data['bank_address'] = text($_POST['bankaddress']); $data['bank_province'] = text($_POST['province_name']); $data['bank_city'] = text($_POST['city_name']); $data['add_ip'] = get_client_ip(); $data['add_time'] = time(); if ($bank_info['uid']) { /////////////////////新增银行卡修改锁定开关 开始 20130510 fans/////////////////////////// if (intval($this->glo['edit_bank']) != 1 && $bank_info['bank_num']) { ajaxmsg("为了您的帐户资金安全,银行卡已锁定,如需修改,请联系客服", 0); } /////////////////////新增银行卡修改锁定开关 结束 20130510 fans/////////////////////////// $old = text($_POST['oldaccount']); if ($bank_info['bank_num'] && $old != $bank_info['bank_num']) { ajaxmsg('原银卡号不对', 0); } $newid = M('member_banks')->where("uid=" . $this->uid)->save($data); } else { $newid = M('member_banks')->add($data); $info = M("huifulog")->field("usrid")->where("uid=" . $this->uid)->find(); $usrid = $info['usrid']; $bankaccount = text($_POST['account']); $bankcode = text($_POST['bank_code']); $prov_code = text($_POST['province_code']); $prov = M("bankarea")->field("code")->where("id=" . $prov_code)->find(); $bankprov = $prov['code']; $city_code = text($_POST['city_code']); $city = M("bankarea")->field("code")->where("id=" . $city_code)->find(); $bankarea = $city['code']; //$isdefault = $_POST['isdefault']?'Y':'N'; import("ORG.Huifu.Huifu"); $huifu = new Huifu(); $info = $huifu->BgBindCard($usrid, $bankaccount, $bankcode, $bankprov, $bankarea, $isdefault); $usrid = $info['UsrCustId']; $username = M("huifulog")->distinct(true)->field("uid,username")->where("usrid=" . $usrid)->find(); $data = array(); $data['uid'] = $username['uid']; $data['username'] = $username['username']; $data['rescode'] = $info['RespCode']; $data['cmdid'] = $info['CmdId']; $data['usrid'] = $info['UsrCustId']; $data['trxid'] = ""; //没有交易流水号 $data['addtime'] = time(); //file_put_contents("C:/c.txt",json_encode($info)); M("huifulog")->add($data); } if ($newid) { MTip('chk2', $this->uid); ajaxmsg(); } else { ajaxmsg('操作失败,请重试', 0); } }