public function moneymmcharge() { import("ORG.Loan.Escrow"); $charge = new Escrow(); $data = M('escrow_account')->field('*')->where('uid=' . $this->uid)->find(); if (!$data) { $this->error('请先绑定托管账户', '/member/bank#fragment-2'); } $add = array('uid' => $this->uid, 'add_time' => time(), 'money' => $_POST['money']); $id = M("member_payonline")->add($add); //利用返回id 查找表自动生成的 orderno(平台充值单号) if (!$id) { $this->error('订单生成出错!'); } $orders = date("YmdHi") . $id; $Amount = floatval($_POST['money']); $ReturnURL = 'http://' . $_SERVER['HTTP_HOST'] . U('/member/charge/wapchargeReturn'); $NotifyURL = 'http://' . $_SERVER['HTTP_HOST'] . U("/member/Notify/charge"); $RechargeType = '2'; $FeeType = '1'; //dump($data['platform_marked']);die; $array = $charge->Moneymoremorecharge($data['qdd_marked'], $data['platform_marked'], $orders, $Amount, $ReturnURL, $NotifyURL, $RechargeType, $FeeType); file_put_contents("C:\\www\tsx\\App\\Runtime\\a.txt", json_encode($array)); $form = $charge->setForm($array, 'charge'); echo $form; exit; }
/** * 转账操作 * */ public function index() { if ($this->isPost()) { $transfer['username'] = text($_POST['user']); $user = M('members')->field('id, user_name')->where("user_name='{$transfer['username']}'")->find(); if (!$user['id']) { $this->error('用户不存在'); } $user_qdd = M('escrow_account')->field('qdd_marked')->where("uid={$user['id']}")->find(); if (!$user_qdd['qdd_marked']) { $this->error('对方没有绑定托管账号'); } $transfer['money'] = floatval($_POST['money']); if ($transfer['money'] <= 0.0) { $this->error('资金必须大于0.00元'); } $transfer['remark'] = text($_POST['remark']); if (!trim($transfer['remark'])) { $this->error('备注不能为空'); } $transfer['uid'] = $user['id']; $transfer['orders'] = 'zz' . build_order_no(); $transfer['operator'] = session('admin_user_name'); $transfer['operator_id'] = $this->admin_id; $transfer['add_time'] = time(); $transfer['add_ip'] = get_client_ip(); if ($id = M('transfer')->add($transfer)) { $loanconfig = FS("Webconfig/loanconfig"); import("ORG.Loan.Escrow"); $loan = new Escrow(); $loanList[] = $loan->loanJsonList($loanconfig['pfmmm'], $user_qdd['qdd_marked'], $transfer['orders'], 'zhuanzhang', $transfer['money'], '', '转账', $transfer['remark']); $loanJsonList = json_encode($loanList); $returnURL = 'http://' . $_SERVER['HTTP_HOST'] . U("returnurl"); $notifyURL = 'http://' . $_SERVER['HTTP_HOST'] . U("Home/Notify/transfer"); $data = $loan->transfer($loanJsonList, $returnURL, $notifyURL, 3, 1, 2, 1); $form = $loan->setForm($data, 'transfer'); echo $form; exit; //$this->success("转账成功!"); } else { $this->error('转账失败'); } } else { $user_name = isset($_GET['user_name']) ? urldecode($_GET['user_name']) : ''; $this->assign('user_name', $user_name); $this->display(); } }
/** * 绑定乾多多账号 * */ public function bindingAccount() { header("Content-type:text/html;charset=utf-8"); $status = M('members_status')->field('*')->where("uid={$this->uid}")->find(); //$status['email_status']!=1 && $this->error('请先认证邮箱再来绑定托管账户', '/member/verify#fragment-1'); $status['phone_status'] != 1 && $this->error('请先认证手机号再来绑定托管账户', '/M/verify/cellphone'); $status['id_status'] != 1 && $this->error('请先实名认证再来绑定托管账户', '/M/verify/idcard'); if (M('escrow_account')->where("uid={$this->uid}")->count('uid')) { $this->error('您已经绑定了托管账户,无需重复绑定', '/member.html'); } $user_info = M('members')->field('user_name, user_email, user_phone')->where("id={$this->uid}")->find(); $id_info = M("member_info")->field('idcard, real_name')->where("uid={$this->uid}")->find(); import("ORG.Loan.Escrow"); $loan = new Escrow(); $data = $loan->wapregisterAccount($user_info['user_phone'], $user_info['user_email'], $id_info['real_name'], $id_info['idcard'], $user_info['user_name']); $form = $loan->setForm($data, 'register'); echo $form; exit; }
public function authorize($auth) { //dump($_POST); $vau = M('escrow_account')->where("uid={$this->uid}")->find(); $MoneyId = $vau['qdd_marked']; //用户乾多多标识 $Platform = $vau['platform_marked']; //平台乾多多标识//"";// $str = implode(',', $auth); //dump($auth); $TypeOpen = $str; //$_POST['AuthorizeTypeOpen'];//开启授权类型1.投标 2.还款。3.二次分配审核。将所有数字有英文(,)连成字符串 $TypeClose = ""; //$_POST['AuthorizeTypeClose'];//关闭授权类型1.投标 2.还款。3.二次分配审核。将所有数字有英文(,)连成字符串 $Remark1 = ''; //$_POST['Remark1']; $Remark2 = ''; //$_POST['Remark2']; $Remark3 = ''; //$_POST['Remark3']; $ReturnURL = 'http://' . $_SERVER['HTTP_HOST'] . U("/member/authorize/authorizereturn"); // 返回地址 $NotifyURL = 'http://' . $_SERVER['HTTP_HOST'] . "/Notice/authorizenotify"; // 通知地址 $row = M("escrow_account")->where("uid=" . $this->uid)->find(); //dump($row);exit; $open = explode(',', $TypeOpen); $close = explode(',', $TypeClose); import("ORG.Loan.Escrow"); $loan = new Escrow(); //dump($loan); $authdata = $loan->authorize($MoneyId, $Platform, $TypeOpen, $TypeClose, $Remark1, $Remark2, $Remark3, $ReturnURL, $NotifyURL); //dump($authdata);exit; $form = $loan->setForm($authdata, 'authorize'); echo $form; //return $form; }
public function invest() { if (!$this->uid) { if ($this->isAjax()) { die("请先登录后投资"); } else { $this->redirect('M/pub/login'); } } if ($this->isAjax()) { $borrow_id = intval($this->_get('bid')); $tnum = intval($_POST['cnum']); $pre = c("DB_PREFIX"); $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid); $amoney = $m['account_money'] + $m['back_money']; $uname = session("u_user_name"); $binfo = M("transfer_borrow_info")->field("borrow_uid,borrow_interest_rate,transfer_out,transfer_back,transfer_total,\n per_transfer,is_show,deadline,min_month,increase_rate,reward_rate,borrow_duration")->find($borrow_id); if ($this->uid == $binfo['borrow_uid']) { ajaxmsg("不能去投自己的标", 0); } $month = $binfo['borrow_duration']; //手机版默认投资最大期限 $max_num = $binfo['transfer_total'] - $binfo['transfer_out']; if ($max_num < $tnum) { die("本标还能认购最大份数为" . $max_num . "份,请重新输入认购份数"); } $money = $binfo['per_transfer'] * $tnum; if ($amoney < $money) { die("尊敬的{$uname},您准备认购{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再认购"); } $vm = getMinfo($this->uid, "m.pin_pass,mm.invest_vouch_cuse,mm.money_collect"); $pin_pass = $vm['pin_pass']; $pin = md5($_POST['paypass']); // if ($pin != $pin_pass){ // die( "支付密码错误,请重试" ); // } $tinvest_id = TinvestMoney($this->uid, $borrow_id, $tnum, $month); //投企业直投 if ($tinvest_id) { //die('TRUE'); $loanconfig = FS("Webconfig/loanconfig"); $orders = 'T' . date("YmdHi") . $tinvest_id; // 发送到乾多多 $invest_qdd = M("escrow_account")->field('*')->where("uid={$this->uid}")->find(); $borrow_qdd = M("escrow_account")->field('*')->where("uid={$binfo['borrow_uid']}")->find(); $invest_info = M("transfer_borrow_investor")->field("reward_money, borrow_fee")->where("id={$tinvest_id}")->find(); $secodary = ''; import("ORG.Loan.Escrow"); $loan = new Escrow(); if ($invest_info['reward_money'] > 0.0) { // 投标奖励 $secodary[] = $loan->secondaryJsonList($invest_qdd['qdd_marked'], $invest_info['reward_money'], '二次分配', '投标奖励'); } if ($invest_info['borrow_fee'] > 0.0) { // 借款管理费 $secodary[] = $loan->secondaryJsonList($loanconfig['pfmmm'], $invest_info['borrow_fee'], '二次分配', '借款管理费'); } $secodary && ($secodary = json_encode($secodary)); $loanList = $loan->loanJsonList($invest_qdd['qdd_marked'], $borrow_qdd['qdd_marked'], $orders, 'T_' . $borrow_id, $money, $binfo['borrow_money'], '投标', "对{$borrow_id}号企业直投进行投标", $secodary); $loanJsonList = json_encode($loanList); $returnURL = C('WEB_URL') . U("tinvest/wapinvestReturn"); $notifyURL = C('WEB_URL') . U("tinvest/notify"); $data = $loan->transfer($loanJsonList, $returnURL, $notifyURL, 1, 1, 2, 1); // 自动到帐 $form = $loan->setForm($data, 'transfer'); // echo "aaaaaa";die(); echo $form . "正在跳转至乾多多。。。"; exit; } else { die("很遗憾,认购失败,请重试!"); } } else { $borrow_id = $this->_get('bid'); $pre = C('DB_PREFIX'); $borrowinfo = M("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($borrow_id); $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2); $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2); $borrowinfo['updata'] = unserialize($borrowinfo['updata']); $this->assign("vo", $borrowinfo); $user_info = M('member_money')->field("account_money+back_money as money ")->where("uid='{$this->uid}'")->find(); $this->assign('user_info', $user_info); $paypass = M("members")->field('pin_pass')->where('id=' . $this->uid)->find(); $this->assign('paypass', $paypass['pin_pass']); $this->display(); } }
public function Invest() { if (!$this->uid) { if ($this->isAjax()) { die("请先登录后投资"); } else { $this->redirect('M/pub/login'); } } $loanconfig = FS("Webconfig/loanconfig"); if ($this->isAjax()) { // ajax提交投资信息 $borrow_id = intval($this->_get('bid')); //$borrow_id ='22'; $invest_money = intval($this->_post('invest_money')); //die($borrow_id); $paypass = $this->_post('paypass'); $invest_pass = isset($_POST['invest_pass']) ? $_POST['invest_pass'] : ''; $binfo = M("borrow_info")->field('borrow_money,borrow_max,has_borrow,has_vouch,borrow_type,borrow_min,money_collect, borrow_uid')->find($borrow_id); $status = checkInvest($this->uid, $borrow_id, $invest_money, $paypass, $invest_pass); if ($status == 'TRUE') { $invest_id = investMoney($this->uid, $borrow_id, $invest_money); if ($invest_id == true) { $orders = date("YmdHi") . $invest_id; $invest_qdd = M("escrow_account")->field('*')->where("uid={$this->uid}")->find(); $borrow_qdd = M("escrow_account")->field('*')->where("uid={$binfo['borrow_uid']}")->find(); $invest_info = M("borrow_investor")->field("reward_money, borrow_fee")->where("id={$invest_id}")->find(); $secodary = ''; import("ORG.Loan.Escrow"); $loan = new Escrow(); if ($invest_info['reward_money'] > 0.0) { // 投标奖励 $secodary[] = $loan->secondaryJsonList($invest_qdd['qdd_marked'], $invest_info['reward_money'], '二次分配', '支付投标奖励'); } if ($invest_info['borrow_fee'] > 0.0) { // 借款管理费 $secodary[] = $loan->secondaryJsonList($loanconfig['pfmmm'], $invest_info['borrow_fee'], '二次分配', '支付平台借款管理费'); } $secodary && ($secodary = json_encode($secodary)); // 投标奖励 $loanList[] = $loan->loanJsonList($invest_qdd['qdd_marked'], $borrow_qdd['qdd_marked'], $orders, $borrow_id, $invest_money, $binfo['borrow_money'], '投标', "对{$borrow_id}号投标", $secodary); $loanJsonList = json_encode($loanList); //$returnURL = C('WEB_URL').U("invest/investReturn"); $returnURL = 'http://' . $_SERVER['HTTP_HOST'] . U("/invest/wapinvestReturn"); $notifyURL = 'http://' . $_SERVER['HTTP_HOST'] . U("invest/notify"); //echo $returnURL." notifyURL:".$notifyURL;die(); //var_dump($loanJsonList);die(); $data = $loan->transfer($loanJsonList, $returnURL, $notifyURL); //var_dump($data);die(); $form = $loan->setForm($data, 'transfer'); echo $form . "正在跳转至乾多多。。。"; //die('TRUE'); exit; //die('TURE'); } elseif ($invest_id) { die($invest_id); } else { die(L('investment_failure')); } } else { die($status); } } else { $borrow_id = $this->_get('bid'); $borrow_info = M("borrow_info")->field('borrow_duration, borrow_money, borrow_interest, borrow_interest_rate, has_borrow, borrow_min, borrow_max, password, repayment_type')->where("id='{$borrow_id}'")->find(); $this->assign('borrow_info', $borrow_info); $this->assign('borrow_pass', $borrow_info . password); $user_info = M('member_money')->field("account_money+back_money as money ")->where("uid='{$this->uid}'")->find(); $this->assign('user_info', $user_info); $paypass = M("members")->field('pin_pass')->where('id=' . $this->uid)->find(); $this->assign('paypass', $paypass['pin_pass']); $this->display(); } }
public function hkwithdraw() { $pre = C('DB_PREFIX'); $money_info = M("member_money")->field("account_money, back_money")->where("uid={$this->uid}")->find(); $amount = floatval($_POST['Amount']); if ($amount > $money_info['back_money']) { $this->error('回款资金余额不足'); } $amount > $money_info['account_money'] + $money_info['back_money'] && $this->error('提现金额超过了可用资金金额!'); //被注释了 $tx['uid'] = $this->uid; $tx['add_ip'] = get_client_ip(); $tx['add_time'] = time(); $tx['withdraw_money'] = $amount; $nid = M('member_withdraw')->add($tx); $field = "m.user_name,m.user_phone,(mm.account_money+mm.back_money) all_money,mm.account_money,mm.back_money,i.real_name,b.bank_num,b.bank_name,b.bank_address,b.bank_province,b.bank_city"; $vo = M('members m')->field($field)->join("{$pre}member_info i on i.uid = m.id")->join("{$pre}member_money mm on mm.uid = m.id")->join("{$pre}member_banks b on b.uid = m.id")->where("m.id={$this->uid}")->find(); if (empty($vo['bank_num'])) { $data['html'] = '<script type="text/javascript">alert("您还未绑定银行帐户,请先绑定");window.location.href="' . __APP__ . '/member/bank#fragment-1";</script>'; } else { $tqfee = explode("|", $this->glo['fee_tqtx']); $fee[0] = explode("-", $tqfee[0]); $fee[1] = explode("-", $tqfee[1]); $fee[2] = explode("-", $tqfee[2]); $this->assign("fee", $fee); $borrow_info = M("borrow_info")->field("sum(borrow_money+borrow_interest+borrow_fee) as borrow, sum(repayment_money+repayment_interest) as also")->where("borrow_uid = {$this->uid} and borrow_type=4 and borrow_status in (0,2,4,6,8,9,10)")->find(); $vo['all_money'] -= $borrow_info['borrow'] + $borrow_info['also']; $vo['OrderNo'] = $nid; } $va = M('escrow_account')->where("uid={$this->uid}")->find(); $submitdata['WithdrawMoneymoremore'] = $va['qdd_marked']; if ($nid) { $submitdata['OrderNo'] = date("YmdHi") . $nid; } $submitdata['CardNo'] = $vo['bank_num']; $submitdata['CardType'] = 0; //(0.借记卡 1.信用卡) $submitdata['BankCode'] = $vo['bank_name']; //银行代码 $submitdata['BranchBankName'] = ''; //auto_charset($vo['bank_name']);// $submitdata['Province'] = $vo['bank_province']; $submitdata['City'] = $vo['bank_city']; $submitdata['FeePercent'] = 100; //$vo['']; $submitdata['Amount'] = $amount; //$submitdata['txtPassword']=$vo[''];//提现密码 $submitdata['PlatformMoneymoremore'] = $va['platform_marked']; $submitdata['Remark1'] = ''; //dump($submitdata);exit; import("ORG.Loan.Escrow"); $loan = new Escrow(); $data = $loan->withdraws($submitdata); $form = $loan->setForm($data, 'withdraw'); echo $form; exit; }