public function index() { $key = $_GET['key']; $arg = file_get_contents($this->updir . "config.txt"); $arga = explode("|", $arg); $rate = intval($arga[1]); if ($key != $arga[2]) { exit("fail|密钥错误"); } $total = 0; if ($rate > 0) { $list = M("member_money")->field("uid,account_money")->where("account_money>0")->select(); $i = 0; foreach ($list as $v) { $amoney = getFloatValue($v['account_money'] * $rate / 10000, 2); $re = memberMoneyLog($v['uid'], 32, $amoney, date("Y年m月d日") . "利息"); if ($re) { $i++; $total += $amoney; } } $all = count($list); $str = "共{$all}人需要发布利息,共成功对{$i}人发放共计{$total}元利息"; echo "success|{$str}"; } else { echo "success|利率为0,不返利"; } echo "\r\n" . date("Y-m-d H:i:s", time()); exit; }
public function actupleve() { $money = intval($_POST['upmoney']); $vo = M('members')->field('user_leve,account_money,time_limit,recommend_id')->find($this->uid); $levemoney = $vo['account_money'] - $money; if ($levemoney < 0) { ajaxmsg("帐户余额不足", 0); } $vo['time_limit'] > time() ? $oldtime = $vo['time_limit'] : ($oldtime = time()); if ($money == 25) { $time_limit = strtotime(date("Y-m-d", strtotime("+1 months", $oldtime)) . " 23:59:59"); } elseif ($money == 100) { $time_limit = strtotime(date("Y-m-d", strtotime("+6 months", $oldtime)) . " 23:59:59"); } elseif ($money == 150) { $time_limit = strtotime(date("Y-m-d", strtotime("+12 months", $oldtime)) . " 23:59:59"); } $res = memberMoneyLog($this->uid, 2, $money, "会员特权延长至" . date("Y-m-d", $time_limit) . "到期"); if ($res) { $xmoney = M('members')->getFieldById($vo['recommend_id'], 'reward_money'); memberMoneyLog($vo['recommend_id'], 13, 5, session('u_user_name') . "升级特权会员奖励"); $sdata['id'] = $this->uid; $sdata['time_limit'] = $time_limit; $sdata['user_leve'] = 1; $newid = M('members')->save($sdata); if ($newid) { ajaxmsg(); } else { ajaxmsg("升级出错,请重试", 0); } } else { ajaxmsg("帐户余额处理出错,请重试", 0); } }
public function face() { if (!$this->uid) { ajaxmsg("请先登陆", 0); } $vs = M('members_status')->getFieldByUid($this->uid, 'face_status'); if ($vs == 1) { ajaxmsg("您已通过现场认证,无需再次认证", 0); } $vxs = M('face_apply')->where("uid={$this->uid} AND apply_status=0")->count('id'); if ($vxs >= 1) { ajaxmsg("您已经提交申请,请等待客服人员处理", 0); } $newid = memberMoneyLog($this->uid, 26, -$this->glo['fee_face'], $info = "申请现场认证"); if ($newid) { $save['uid'] = $this->uid; $save['add_time'] = time(); $save['add_ip'] = get_client_ip(); $save['apply_status'] = 0; $newidx = M('face_apply')->add($save); if ($newidx) { ajaxmsg("申请成功,请等待客服与您联系"); } else { ajaxmsg("申请失败,请重试"); } } else { ajaxmsg("申请失败,请重试"); } }
public function doEdit() { $id = intval($_POST['id']); $status = intval($_POST['status']); $tran_id = text($_POST['tran_id']); $statusx = M('member_payonline')->getFieldById($id, "status"); if ($statusx != 0) { $this->error("请不要重复提交表单"); } if ($status == 1) { if (empty($tran_id)) { $this->error("如充值成功,请输入相应支付平台的对账订单号!"); return; } $tran_counts = M('member_payonline')->where(array("tran_id" => $tran_id))->count("1"); if ($tran_counts > 0) { $this->error("该对账订单号已经存在!"); return; } $vo = M('member_payonline')->field('money,fee,uid,way')->find($id); $newid = memberMoneyLog($vo['uid'], 27, $vo['money'] - $vo['fee'], "管理员手动审核充值"); if ($newid) { $save['deal_user'] = session('adminname'); $save['deal_uid'] = $this->admin_id; $save['status'] = 1; $save['tran_id'] = $tran_id; M('member_payonline')->where("id={$id}")->save($save); $vx = M('members')->field("user_name,user_phone")->find($vo['uid']); if ($vo['way'] == "off") { SMStip("payoffline", $vx['user_phone'], array("#USERANEM#", "#MONEY#"), array($vx['user_name'], $vo['money']), null, array($vo['uid'])); } else { SMStip("payonline", $vx['user_phone'], array("#USERANEM#", "#MONEY#"), array($vx['user_name'], $vo['money']), null, array($vo['uid'])); } $this->success("处理成功"); } else { $this->error("处理失败"); } } else { $save['deal_user'] = session('adminname'); $save['deal_uid'] = $this->admin_id; $save['status'] = 3; $newid = M('member_payonline')->where("id={$id}")->save($save); if ($newid) { $this->success("处理成功"); } else { $this->error("处理失败"); } } }
protected function payDone() { if ($this->locked) { return false; } $this->locked = true; $newid = memberMoneyLog($this->orderInfo['uid'], 3, $this->orderInfo['money'], "充值订单号:" . $this->orderInfo['pay_no'], 0, '@网站管理员@'); //更新成功才充值,避免重复充值 $this->locked = false; $this->okLog($newid, $this->orderInfo['pay_no'] . '金额发放', __METHOD__, $this->orderInfo['uid']); M('member_payonline')->where(array('pay_no' => $this->orderInfo['pay_no']))->save(array('payres' => $newid)); if ($newid) { $vx = M('members')->find($this->orderInfo['uid']); SMStip("payonline", $vx['user_phone'], array("#USERANEM#", "#MONEY#"), array($vx['user_name'], $this->orderInfo['money'])); } return $newid; }
public function _doEditFilter($m) { $m->deal_time = time(); $m->deal_user = session('adminname'); $vox = M("member_withdraw")->field(true)->find($m->id); if ($vox['withdraw_status'] != 3 && $m->withdraw_status == 3) { $lm = M('members')->getFieldById($vox['uid'], 'account_money'); addInnerMsg($uid, "您的提现申请审核未通过", "您的提现申请审核未通过"); memberMoneyLog($vox['uid'], 12, $vox['withdraw_money'], "提现未通过,返还"); } elseif ($vox['withdraw_status'] != 2 && $m->withdraw_status == 2) { $um = M('members')->field("user_name,user_phone")->find($vox['uid']); addInnerMsg($uid, "您的提现已完成", "您的提现已完成"); memberMoneyLog($vox['uid'], 29, -$vox['withdraw_money'], "提现成功,减去冻结资金,到帐金额" . ($vox['withdraw_money'] - intval($_POST['withdraw_fee']))); SMStip("withdraw", $um['user_phone'], array("#USERANEM#", "#MONEY#"), array($um['user_name'], $vox['withdraw_money'] - intval($_POST['withdraw_fee'])), null, array($vox['uid'])); } elseif ($vox['withdraw_status'] != 1 && $m->withdraw_status == 1) { addInnerMsg($uid, "您的提现申请已通过", "您的提现申请已通过,正在处理中"); } return $m; }
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 ajaxredbag() { if (!$this->uid) { ajaxmsg('未登录不能领取', 0); } else { //认证 后才能投标 $pre = C('DB_PREFIX'); $memberstatus = M("members m")->field("m.id,m.user_leve,m.time_limit,m.pin_pass,s.id_status,s.phone_status,s.email_status,s.video_status,s.face_status,m.user_phone")->join("{$pre}members_status s ON s.uid=m.id")->where("m.id={$this->uid}")->find(); $rooturl = __ROOT__; if ($memberstatus['id_status'] != 1 && empty($memberstatus['user_phone'])) { ajaxmsg('进行手机、实名认证后才能领取!', 2); exit; } else { if (empty($memberstatus['user_phone'])) { ajaxmsg('进行手机认证后才能领取!', 2); exit; } else { if ($memberstatus['id_status'] != 1) { ajaxmsg('进行实名认证后才能领取!', 3); exit; } } } //$vphone = M('members')->field('user_phone')->find($this->uid); //if(empty($vphone['user_phone'])){ // ajaxmsg('进行手机认证后才能领取!',2); //} } $redbag = M('redbag')->order('id desc')->where('status=1')->find(); //判断活动是否存在 $id = $redbag['id']; if (!$id) { ajaxmsg('活动不存在', 0); } $usered = M('redbag_list')->where('uid=' . $this->uid . ' and pid=' . $id)->count(); //判断是否领过红包 //已经领取过了 if ($usered) { ajaxmsg('您已经领过了', 0); } $redinfo = M('redbag_list')->order('id asc')->where('uid=0 and pid=' . $id . ' and status=1')->find(); //判断是否还有剩余红包 if ($redbag['prize_num']) { $num = M('redbag_list')->where(' pid=' . $id . ' and redtype=1')->count(); if ($redbag['prize_num'] > $num) { if (rand(1, $redbag['bonus_count']) <= $redbag['prize_num']) { $newid = memberMoneyLog($this->uid, 49, $redbag['prize_max'], '领取wap注册红包' . $redbag['prize_max'] . '元'); if ($newid) { M('redbag_list')->add(array('money' => $redbag['prize_max'], 'pid' => $id, 'status' => 2, 'redtype' => 1, 'addtime' => time(), 'usetime' => time(), 'uid' => $this->uid)); ajaxmsg($redbag['prize_max']); } } } } if (!$redinfo) { M('redbag')->where('id=' . $id)->save(array('status' => 2)); ajaxmsg('红包已被抢光', 0); } $prize = floatval($redinfo['money']); $newid = memberMoneyLog($this->uid, 49, $prize, '领取wap注册红包' . $prize . '元'); if ($newid) { M('redbag_list')->where('id=' . $redinfo['id'])->save(array('uid' => $this->uid, 'usetime' => time(), 'status' => 2)); if (!M('redbag_list')->where('uid=0')->count()) { M('redbag')->where('id=' . $id)->save(array('status' => 2)); } ajaxmsg($redinfo['money']); } else { ajaxmsg('领取失败,请刷新后重试'); } }
public function doEdit() { $model = D("member_withdraw"); $status = intval($_POST['withdraw_status']); $id = intval($_POST['id']); $deal_info = $_POST['deal_info']; $secondfee = floatval($_POST['withdraw_fee']); $info = $model->field('add_time')->where("id={$id} and (withdraw_status!=0)")->find(); if ($info['add_time']) { $this->error("此提现初审已处理过,请不要重复处理!"); } if (false === $model->create()) { $this->error($model->getError()); } //保存当前数据对象 $model->withdraw_status = $status; $model->deal_info = $deal_info; $model->deal_time = time(); $model->deal_user = session('adminname'); //////////////////////// $field = 'w.*,w.id,w.uid,(mm.account_money+mm.back_money) all_money'; $vo = M("member_withdraw w")->field($field)->join("lzh_member_money mm on w.uid = mm.uid")->find($id); $um = M('members')->field("user_name,user_phone")->find($vo['uid']); if ($vo['withdraw_status'] != 3 && $status == 3) { addInnerMsg($vo['uid'], "您的提现申请审核未通过", "您的提现申请审核未通过,处理说明:" . $deal_info); SMStip("nowithdraw", $um['user_phone'], array("#USERANEM#", "#MONEY#"), array($um['user_name'], $vo['withdraw_money'])); //memberMoneyLog($vo['uid'],12,$vo['withdraw_money'],"提现未通过,返还",'0','@网站管理员@'); memberMoneyLog($vo['uid'], 12, $vo['withdraw_money'], "提现未通过,返还", '0', '@网站管理员@', 0, $vo['withdraw_back_money']); $model->success_money = 0; } else { if ($vo['withdraw_status'] != 2 && $status == 2) { addInnerMsg($vo['uid'], "您的提现已完成", "您的提现已完成"); // 统一为;都从当笔提现中扣减手续费 /*if( ($vo['all_money'] - $vo['second_fee'])<0 ){ memberMoneyLog($vo['uid'],29,-($vo['withdraw_money']-$vo['second_fee']),"提现成功,扣除实际手续费".$vo['second_fee']."元,减去冻结资金,到帐金额".($vo['withdraw_money']-$vo['second_fee'])."元",'0','@网站管理员@',0,-$vo['second_fee']); $model->success_money = $vo['withdraw_money']; //SMStip("withdraw",$um['user_phone'],array("#USERANEM#","#MONEY#"),array($um['user_name'],($vo['withdraw_money']-$vo['second_fee']))); }else{ memberMoneyLog($vo['uid'],29,-($vo['withdraw_money']),"提现成功,扣除实际手续费".$vo['second_fee']."元,减去冻结资金,到帐金额".($vo['withdraw_money'])."走下",'0','@网站管理员@'); $model->success_money = $vo['withdraw_money']; //SMStip("withdraw",$um['user_phone'],array("#USERANEM#","#MONEY#"),array($um['user_name'],$vo['withdraw_money'])); }*/ memberMoneyLog($vo['uid'], 29, -($vo['withdraw_money'] - $vo['second_fee']), "提现成功,扣除手续费" . $vo['second_fee'] . "元,实到帐金额" . ($vo['withdraw_money'] - $vo['second_fee']) . "元", '0', '@网站管理员@', 0, -$vo['second_fee']); $model->success_money = $vo['withdraw_money']; } elseif ($vo['withdraw_status'] != 1 && $status == 1) { addInnerMsg($vo['uid'], "您的提现申请已通过", "您的提现申请已通过,正在处理中"); // 统一为;都从当笔提现中扣减手续费 /*if($vo['all_money'] <=$secondfee ){ memberMoneyLog($vo['uid'],36,-($vo['withdraw_money']),"提现申请已通过,扣除实际手续费".$secondfee."元,到帐金额".($vo['withdraw_money']-$secondfee)."元",'0','@网站管理员@',-$secondfee); $model->success_money = $vo['withdraw_money']-$secondfee; }else{ memberMoneyLog($vo['uid'],36,-$vo['withdraw_money'],"提现申请已通过,扣除实际手续费".$secondfee."元,到帐金额".($vo['withdraw_money'])."元",'0','@网站管理员@',-$secondfee); $model->success_money = $vo['withdraw_money']; }*/ memberMoneyLog($vo['uid'], 36, -$secondfee, "提现申请已通过,扣除手续费" . $secondfee . "元,到帐金额" . ($vo['withdraw_money'] - $secondfee) . "元", '0', '@网站管理员@', -$secondfee); $model->success_money = $vo['withdraw_money'] - $secondfee; $model->withdraw_fee = $vo['withdraw_fee']; $model->second_fee = $secondfee; } } ////////////////////////// $result = $model->save(); if ($result) { //保存成功 alogs("withdraw", $id, $status, $deal_info); //管理员操作日志 //成功提示 $this->assign('jumpUrl', __URL__); $this->success(L('修改成功')); } else { alogs("withdraw", $id, $status, '提现处理操作失败!'); //管理员操作日志 //$this->assign("waitSecond",10000); //失败提示 $this->error(L('修改失败')); } $vm = M("member_moneylog")->field("info")->where("uid = {$vo['uid']} and type=36")->limit(1)->order('id desc')->select(); if (!empty($um['user_phone'])) { // sendsms($um['user_phone'],$vm[0]['info']."【友情提醒】"); } }
protected function lotteryLog($good) { $log = array(); $log['uid'] = $this->uid; $log['type'] = 2; $log['gid'] = $good['id']; $log['name'] = $good['title']; $log['price'] = $good['value']; $log['cost'] = $this->glo['lottery_cost']; $log['num'] = 1; $log['info'] = "积分抽奖抽中"; $log['add_ip'] = get_client_ip(); $log['add_time'] = time(); $log['status'] = 2; //已领取 $log['way'] = 0; //直接领取 if ($good['category'] == '1') { //抽中的是礼金 memberMoneyLog($this->uid, 45, $good['value'], "积分抽奖抽中‘{$good['title']}’一份"); //抽中投资礼金 } else { if ($good['category'] == '2') { memberIntegralLog($this->uid, 4, $good['value'], "积分抽奖抽中‘{$good['title']}’一份"); //抽中积分 } else { $log['status'] = 0; //未领取 $log['way'] = 2; //快递 } } addInnerMsg($this->uid, "积分抽奖抽中‘{$good['title']}’一份", "积分抽奖抽中‘{$good['title']}’一份"); M("market_log")->add($log); //更新奖品列表 $data = array(); if ($good['last_num'] - 1 >= 0) { $data['last_num'] = $good['last_num'] - 1; $data['hits'] = $good['hits'] + 1; } else { $data['last_num'] = 0; $data['hits'] = $good['num']; $data['is_sys'] = 0; } M("market_jifenlist")->where("id={$good['id']}")->save($data); return true; }
function investMoney($uid, $borrow_id, $money, $_is_auto = 0, $invest_info_id, $reqext = 0) { //2015-09-30 lj 红包最后一笔扣不了钱 // require_once('config/config.db.php'); $pre = DB_PREFIX; $done = false; $datag = get_global_setting(); //$fee_invest_manage = explode("|",$datag['fee_invest_manage']); /////////////////////////////锁表 zhang 2015-5-5//////////////////////////////////////////////// $bdb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PWD); $bdb->beginTransaction(); $bId = $borrow_id; $sql = "SELECT suo FROM lzh_borrow_info_lock WHERE id = ? FOR UPDATE"; $stmt1 = $bdb->prepare($sql); $stmt1->bindParam(1, $bId); //绑定第一个参数值 $stmt1->execute(); /////////////////////////////锁表 zhang 2015-5-5//////////////////////////////////////////////// $sqlbi = 'SELECT borrow_uid,borrow_money,borrow_interest_rate,borrow_type,borrow_duration,repayment_type,has_borrow,reward_money,money_collect,manage_rate,danbao FROM lzh_borrow_info WHERE id = ? limit 1'; $stmt2 = $bdb->prepare($sqlbi); $stmt2->bindParam(1, $borrow_id); $stmt2->execute(); while ($rowbi = $stmt2->fetch(PDO::FETCH_ASSOC)) { $binfo = $rowbi; } //新加入了奖金reward_money到资金总额里 $sql = "SELECT m.user_leve,m.time_limit,mm.account_money,mm.back_money,mm.money_collect FROM {$pre}members AS m LEFT JOIN {$pre}member_money mm ON mm.uid=m.id WHERE m.id= ? limit 1"; $stmt = $bdb->prepare($sql); $stmt->bindParam(1, $uid); //绑定第一个参数值 $stmt->execute(); // var_dump($stmt2->queryString); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $vminfo = $row; } // $vminfo = getMinfo($uid,'m.user_leve,m.time_limit,mm.account_money,mm.back_money,mm.money_collect'); // if(($vminfo['account_money']+$vminfo['back_money']+$binfo['reward_money'])<$money) { // return "您当前的可用金额为:".($vminfo['account_money']+$vminfo['back_money']+$binfo['reward_money'])." 对不起,可用余额不足,不能投标"; // } // // ////////////新增投标时检测会员的待收金额是否大于标的设置的代收金额限制,大于就可投标,小于就不让投标 2013-08-26 fan////////////// // // if($binfo['money_collect']>0){//判断是否设置了投标待收金额限制 // if($vminfo['money_collect']<$binfo['money_collect']){ // return "对不起,此标设置有投标待收金额限制,您当前的待收金额为".$vminfo['money_collect']."元,小于该标设置的待收金额限制".$binfo['money_collect']."元。"; // } // } ////////////新增投标时检测会员的待收金额是否大于标的设置的代收金额限制,大于就可投标,小于就不让投标 2013-08-26 fan////////////// //不同会员级别的费率 //($vminfo['user_leve']==1 && $vminfo['time_limit']>time())?$fee_rate=($fee_invest_manage[1]/100):$fee_rate=($fee_invest_manage[0]/100); $fee_rate = $datag['fee_invest_manage'] / 100; //投入的钱 $havemoney = $binfo['has_borrow']; // if(($binfo['borrow_money'] - $havemoney -$money)<0) // { // return "对不起,此标还差".($binfo['borrow_money'] - $havemoney)."元满标,您最多投标".($binfo['borrow_money'] - $havemoney)."元"; // } $sql = "SELECT SUM(investor_capital) AS investor_capital FROM {$pre}borrow_investor WHERE borrow_id = ? LIMIT 1"; $stmt = $bdb->prepare($sql); $stmt->bindParam(1, $borrow_id); $stmt->execute(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $borrow_invest = $row; } // $borrow_invest = M("borrow_investor")->where('borrow_id = {$borrow_id}')->sum('investor_capital');//新加投资金额检测 /***获取积分比率****/ // $fee = M('members')->where("id=".$uid)->getField('integral'); $sql = "SELECT integral FROM {$pre}members WHERE id=? limit 1"; $stmt = $bdb->prepare($sql); $stmt->bindParam(1, $uid); $stmt->execute(); // // file_put_contents('/tmp/444',date('m-d H:i:s')."monthDataDetail".print_r($sql,true)."\n",FILE_APPEND); // while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $fee = $row; } $fs = $fs = (require_once 'config/config.leveinvestconfig.php'); foreach ($fs as $val) { if ($fee > $val['start'] && $fee < $val['end']) { $rate = floatval($val['rate']) / 100; break; } } /***获取积分比率结束****/ $investinfo['status'] = 1; //等待复审 $investinfo['borrow_id'] = $borrow_id; $investinfo['investor_uid'] = $uid; //投资者 $investinfo['borrow_uid'] = $binfo['borrow_uid']; //借款者 $investinfo['investor_fee'] = $binfo['manage_rate'] * $money; //管理费 if ($binfo['danbao'] != 0) { // $guarrate=M("member_guarrate")->field("guarrate")->where("uid={$binfo['danbao']}")->find();//担保费率 $sql = "SELECT guarrate FROM {$pre}member_guarrate WHERE uid=? limit 1"; $stmt = $bdb->prepare($sql); $stmt->bindParam(1, $binfo['danbao']); $stmt->execute(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $fee = $row; } $investinfo['guar_fee'] = $guarrate['guarrate'] * $money / 100; } /////////////////////////////////////新加投资金额检测///////////////////////////////////////////// if ($borrow_invest['investor_capital'] > $binfo['borrow_money']) { $investinfo['investor_capital'] = $binfo['borrow_money'] - $binfo['has_borrow']; } else { $investinfo['investor_capital'] = $money; } /////////////////////////////////////新加投资金额检测///////////////////////////////////////////// $investinfo['is_auto'] = $_is_auto; $investinfo['add_time'] = time(); //还款详细公共信息START $handler = mysql_connect(DB_HOST, DB_USER, DB_PWD); mysql_select_db(DB_NAME); mysql_query("SET AUTOCOMMIT=0"); //设置为不自动提交,因为MYSQL默认立即执行 mysql_query("START TRANSACTION"); //开始事务定义 //还款概要公共信息START $savedetail = array(); switch ($binfo['repayment_type']) { case 1: //按天到期还款 //还款概要START $investinfo['investor_interest'] = getFloatValue($binfo['borrow_interest_rate'] / 360 * $investinfo['investor_capital'] * $binfo['borrow_duration'] / 100, 4); $investinfo['invest_fee'] = getFloatValue($fee_rate * $investinfo['investor_interest'] * (1 - $rate), 4); //修改投资人的天标利息管理费2013-03-19 fan $investinfo['invest_fee_yh'] = getFloatValue($fee_rate * $investinfo['investor_interest'], 4); //修改投资人的天标利息管理费2013-03-19 fan //$invest_info_id = M('borrow_investor')->add($investinfo); // M('borrow_investor')->where("id=".$invest_info_id)->save($investinfo); foreach ($investinfo as $key => $val) { $upSql .= "{$key}={$val},"; } $upSql = rtrim($upSql, ","); $sql = sprintf("UPDATE %s SET {$upSql} where id=%s", "{$pre}borrow_investor", $invest_info_id); $rtype = mysql_query($sql); //还款概要END $investdetail['borrow_id'] = $borrow_id; $investdetail['invest_id'] = $invest_info_id; $investdetail['investor_uid'] = $uid; $investdetail['borrow_uid'] = $binfo['borrow_uid']; $investdetail['capital'] = $investinfo['investor_capital']; $investdetail['interest'] = $investinfo['investor_interest']; $investdetail['interest_fee'] = $fee_rate * $investinfo['invest_fee'] * (1 - $rate); $investdetail['interest_fee_yh'] = $fee_rate * $investinfo['invest_fee']; $investdetail['status'] = 0; $investdetail['sort_order'] = 1; $investdetail['total'] = 1; $savedetail[] = $investdetail; break; case 2: //每月还款 //还款概要START $monthData['type'] = "all"; $monthData['money'] = $investinfo['investor_capital']; $monthData['year_apr'] = $binfo['borrow_interest_rate']; $monthData['duration'] = $binfo['borrow_duration']; $repay_detail = EqualMonth($monthData); $investinfo['investor_interest'] = $repay_detail['repayment_money'] - $investinfo['investor_capital']; $investinfo['invest_fee'] = getFloatValue($fee_rate * $investinfo['investor_interest'] * (1 - $rate), 4); $investinfo['invest_fee_yh'] = getFloatValue($fee_rate * $investinfo['investor_interest'], 4); //$invest_info_id = M('borrow_investor')->add($investinfo); // M('borrow_investor')->where("id=".$invest_info_id)->save($investinfo); foreach ($investinfo as $key => $val) { $upSql .= "{$key}={$val},"; } $upSql = rtrim($upSql, ","); $sql = sprintf("UPDATE %s SET {$upSql} where id=%s", "{$pre}borrow_investor", $invest_info_id); $rtype = mysql_query($sql); //还款概要END $monthDataDetail['money'] = $investinfo['investor_capital']; $monthDataDetail['year_apr'] = $binfo['borrow_interest_rate']; $monthDataDetail['duration'] = $binfo['borrow_duration']; $repay_list = EqualMonth($monthDataDetail); $i = 1; //file_put_contents(C('WEB_ROOT').'a.txt', json_encode($repay_list));exit; foreach ($repay_list as $key => $v) { $investdetail['borrow_id'] = $borrow_id; $investdetail['invest_id'] = $invest_info_id; $investdetail['investor_uid'] = $uid; $investdetail['borrow_uid'] = $binfo['borrow_uid']; $investdetail['capital'] = $v['capital']; $investdetail['interest'] = $v['interest']; $investdetail['interest_fee'] = getFloatValue($fee_rate * $v['interest'] * (1 - $rate), 4); $investdetail['interest_fee_yh'] = getFloatValue($fee_rate * $v['interest'], 4); $investdetail['status'] = 0; $investdetail['sort_order'] = $i; $investdetail['total'] = $binfo['borrow_duration']; $i++; $savedetail[] = $investdetail; } break; case 3: //按季分期还款 //还款概要START $monthData['month_times'] = $binfo['borrow_duration']; $monthData['account'] = $investinfo['investor_capital']; $monthData['year_apr'] = $binfo['borrow_interest_rate']; $monthData['type'] = "all"; $repay_detail = EqualSeason($monthData); $investinfo['investor_interest'] = $repay_detail['repayment_money'] - $investinfo['investor_capital']; $investinfo['invest_fee'] = getFloatValue($fee_rate * $investinfo['investor_interest'] * (1 - $rate), 4); $investinfo['invest_fee_yh'] = getFloatValue($fee_rate * $investinfo['investor_interest'], 4); //$invest_info_id = M('borrow_investor')->add($investinfo); // M('borrow_investor')->where("id=".$invest_info_id)->save($investinfo); foreach ($investinfo as $key => $val) { $upSql .= "{$key}={$val},"; } $upSql = rtrim($upSql, ","); $sql = sprintf("UPDATE %s SET {$upSql} where id=%s", "{$pre}borrow_investor", $invest_info_id); $rtype = mysql_query($sql); //还款概要END $monthDataDetail['month_times'] = $binfo['borrow_duration']; $monthDataDetail['account'] = $investinfo['investor_capital']; $monthDataDetail['year_apr'] = $binfo['borrow_interest_rate']; $repay_list = EqualSeason($monthDataDetail); $i = 1; foreach ($repay_list as $key => $v) { $investdetail['borrow_id'] = $borrow_id; $investdetail['invest_id'] = $invest_info_id; $investdetail['investor_uid'] = $uid; $investdetail['borrow_uid'] = $binfo['borrow_uid']; $investdetail['capital'] = $v['capital']; $investdetail['interest'] = $v['interest']; $investdetail['interest_fee'] = getFloatValue($fee_rate * $v['interest'] * (1 - $rate), 4); $investdetail['interest_fee_yh'] = getFloatValue($fee_rate * $v['interest'], 4); $investdetail['status'] = 0; $investdetail['sort_order'] = $i; $investdetail['total'] = $binfo['borrow_duration']; $i++; $savedetail[] = $investdetail; } break; case 4: //每月还息到期还本 $monthData['month_times'] = $binfo['borrow_duration']; $monthData['account'] = $investinfo['investor_capital']; $monthData['year_apr'] = $binfo['borrow_interest_rate']; $monthData['type'] = "all"; $repay_detail = EqualEndMonth($monthData); $investinfo['investor_interest'] = $repay_detail['repayment_account'] - $investinfo['investor_capital']; $investinfo['invest_fee'] = getFloatValue($fee_rate * $investinfo['investor_interest'] * (1 - $rate), 4); $investinfo['invest_fee_yh'] = getFloatValue($fee_rate * $investinfo['investor_interest'], 4); //$invest_info_id = M('borrow_investor')->add($investinfo); foreach ($investinfo as $key => $val) { $upSql .= "{$key}={$val},"; } $upSql = rtrim($upSql, ","); $sql = sprintf("UPDATE %s SET {$upSql} where id=%s", "{$pre}borrow_investor", $invest_info_id); $rtype = mysql_query($sql); // M('borrow_investor')->where("id=".$invest_info_id)->save($investinfo); //还款概要END $monthDataDetail['month_times'] = $binfo['borrow_duration']; $monthDataDetail['account'] = $investinfo['investor_capital']; $monthDataDetail['year_apr'] = $binfo['borrow_interest_rate']; //file_put_contents('/tmp/abc',date('m-d H:i:s')."monthDataDetail".print_r($monthDataDetail,true)."\n",FILE_APPEND); $repay_list = EqualEndMonthBYWHH($monthDataDetail); //file_put_contents('/tmp/abc',date('m-d H:i:s')."repay_list".print_r($repay_list,true)."\n",FILE_APPEND); $i = 1; foreach ($repay_list as $key => $v) { $investdetail['borrow_id'] = $borrow_id; $investdetail['invest_id'] = $invest_info_id; $investdetail['investor_uid'] = $uid; $investdetail['borrow_uid'] = $binfo['borrow_uid']; $investdetail['capital'] = $v['capital']; $investdetail['interest'] = $v['interest']; $investdetail['interest_fee'] = getFloatValue($fee_rate * $v['interest'] * (1 - $rate), 4); $investdetail['interest_fee_yh'] = getFloatValue($fee_rate * $v['interest'], 4); $investdetail['status'] = 0; $investdetail['sort_order'] = $i; $investdetail['total'] = $binfo['borrow_duration']; $i++; $savedetail[] = $investdetail; } // file_put_contents('/tmp/abc',date('m-d H:i:s')."savedetail".print_r($savedetail,true)."\n",FILE_APPEND); break; case 5: //一次性还款 $monthData['month_times'] = $binfo['borrow_duration']; $monthData['account'] = $investinfo['investor_capital']; $monthData['year_apr'] = $binfo['borrow_interest_rate']; $monthData['type'] = "all"; $repay_detail = EqualEndMonthOnly($monthData); $investinfo['investor_interest'] = $repay_detail['repayment_account'] - $investinfo['investor_capital']; $investinfo['invest_fee'] = getFloatValue($fee_rate * $investinfo['investor_interest'] * (1 - $rate), 4); $investinfo['invest_fee_yh'] = getFloatValue($fee_rate * $investinfo['investor_interest'], 4); //$invest_info_id = M('borrow_investor')->add($investinfo); $sql = sprintf("UPDATE %s SET investor_interest =%s,invest_fee =%s,invest_fee_yh=%s where id=%s", "{$pre}borrow_investor", $investinfo['investor_interest'], $investinfo['invest_fee'], $investinfo['invest_fee_yh'], $invest_info_id); $rtype = mysql_query($sql); // M('borrow_investor')->where("id=".$invest_info_id)->save($investinfo); //还款概要END $monthDataDetail['month_times'] = $binfo['borrow_duration']; $monthDataDetail['account'] = $investinfo['investor_capital']; $monthDataDetail['year_apr'] = $binfo['borrow_interest_rate']; $monthDataDetail['type'] = "all"; $repay_list = EqualEndMonthOnly($monthDataDetail); $investdetail['borrow_id'] = $borrow_id; $investdetail['invest_id'] = $invest_info_id; $investdetail['investor_uid'] = $uid; $investdetail['borrow_uid'] = $binfo['borrow_uid']; $investdetail['capital'] = $repay_list['capital']; $investdetail['interest'] = $repay_list['interest']; $investdetail['interest_fee'] = getFloatValue($fee_rate * $repay_list['interest'] * (1 - $rate), 4); $investdetail['interest_fee_yh'] = getFloatValue($fee_rate * $repay_list['interest'], 4); $investdetail['status'] = 0; $investdetail['sort_order'] = 1; $investdetail['total'] = 1; $savedetail[] = $investdetail; break; } foreach ($savedetail as $key => $val) { // $invest_defail_id = M('investor_detail')->add($val);//保存还款详情 $vol = ' (' . implode(',', array_keys($val)) . ')'; $vlaue = ' (' . implode(',', $val) . ')'; $invest_defail_id = mysql_query("INSERT INTO {$pre}investor_detail {$vol} VALUES {$vlaue}"); } // $last_have_money = M("borrow_info")->getFieldById($borrow_id,"has_borrow"); $result = mysql_query("SELECT has_borrow FROM {$pre}borrow_info WHERE id = {$borrow_id} LIMIT 1"); while ($row = mysql_fetch_assoc($result)) { $last_have_money = $row['has_borrow']; } // $last_have_money = $last_have_money['has_borrow']; $lasthavemoney = $last_have_money + $money; $sql = "update {$pre}borrow_info set `has_borrow`= {$lasthavemoney},borrow_times=borrow_times+1 WHERE `id`={$borrow_id}"; $upborrow_res = mysql_query($sql); //更新投标进度 if ($invest_defail_id && $rtype && $upborrow_res) { //还款概要和详情投标进度都保存成功 $bdb->commit(); mysql_query("COMMIT"); //执行事务 // $investMoney->commit(); file_put_contents('/tmp/4.txt', date('m-d H:i:s') . " comminvest::" . print_r($reqext, true) . "\n", FILE_APPEND); $res = memberMoneyLog($uid, 6, -($money - $reqext), "对{$borrow_id}号标进行投标", $binfo['borrow_uid']); //($uid,$type,$amoney,$info="",$target_uid="",$target_uname="",$fee=0,$reqext=0){ $today_reward = explode("|", $datag['today_reward']); if ($binfo['repayment_type'] == '1') { //如果是天标,则执行1个月的续投奖励利率 $reward_rate = floatval($today_reward[0]); } else { if ($binfo['borrow_duration'] == 1) { $reward_rate = floatval($today_reward[0]); } else { if ($binfo['borrow_duration'] == 2) { $reward_rate = floatval($today_reward[1]); } else { $reward_rate = floatval($today_reward[2]); } } } ////////////////////////////////////////回款续投奖励规则 fan 2013-07-20//////////////////////////// //$reward_rate = floatval($datag['today_reward']);//floatval($datag['today_reward']);//当日回款续投奖励利率 if ($binfo['borrow_type'] != 3) { //如果是秒标(borrow_type==3),则没有续投奖励这一说 $vd['add_time'] = array("lt", time()); $vd['investor_uid'] = $uid; //$borrow_invest_count = M("borrow_investor")->where($vd)->count('id');//检测是否投过标且大于一次 $sqlbic = sprintf("SELECT count(id) AS total FROM %s WHERE investor_uid=%s AND add_time<%s", "{$pre}borrow_investor", $uid, time()); // $borrow_invest_count = mysql_query("SELECT count(id) FROM {$pre}borrow_investor WHERE investor_uid") $resultbic = mysql_query($sqlbic); while ($rowbic = mysql_fetch_assoc($resultbic)) { $borrow_invest_count = $rowbic['total']; } if ($reward_rate > 0 && $vminfo['back_money'] > 0 && $borrow_invest_count > 0) { //首次投标不给续投奖励 if ($money > $vminfo['back_money']) { //如果投标金额大于回款资金池金额,有效续投奖励以回款金额资金池总额为标准,否则以投标金额为准 $reward_money_s = $vminfo['back_money']; } else { $reward_money_s = $money; } $save_reward['borrow_id'] = $borrow_id; $save_reward['reward_uid'] = $uid; $save_reward['invest_money'] = $reward_money_s; //如果投标金额大于回款资金池金额,有效续投奖励以回款金额资金池总额为标准,否则以投标金额为准 $save_reward['reward_money'] = $reward_money_s * $reward_rate / 1000; //续投奖励 $save_reward['reward_status'] = 0; $save_reward['add_time'] = time(); $save_reward['add_ip'] = get_client_ip(); //$newidxt = M("today_reward")->add($save_reward); $vol = ' (' . implode(',', array_keys($save_reward)) . ')'; $vlaue = ' (' . implode(',', $save_reward) . ')'; $invest_defail_id = mysql_query("INSERT INTO {$pre}today_reward {$vol} VALUES {$vlaue}"); } else { $result = true; } } /////////////////////////回款续投奖励结束 2013-05-10 Dqsy/////////////////////////////// //////////////////////邀请奖励开始//////////////////////////////////////// $sqlm = sprintf("SELECT user_name,recommend_id,usrid FROM %s WHERE id = %s LIMIT 1", "{$pre}members", $uid); $result = mysql_query($sqlm); $vo = mysql_fetch_assoc($result); // $vo = M('members')->field('user_name,recommend_id,usrid')->find($uid); $sql = sprintf("SELECT usrid FROM %s WHERE id = %s LIMIT 1 ", "{$pre}members", $vo['recommend_id']); $result = mysql_query($sql); $recommend_usrid = mysql_fetch_assoc($result); // $recommend_usrid = M('members')->field("usrid")->where("id = {$vo['recommend_id']}")->find(); $_rate = $datag['award_invest'] / 1000; //推广奖励 $jiangli = getFloatValue($_rate * $investinfo['investor_capital'], 2); if ($vo['recommend_id'] != 0) { $obj = core::Singleton('huifu.huifu'); $obj->transfer($jiangli, $recommend_usrid['usrid']); memberMoneyLog($vo['recommend_id'], 13, $jiangli, $vo['user_name'] . "对{$borrow_id}号标投资成功,你获得推广奖励" . $jiangli . "元。", $uid); } /////////////////////邀请奖励结束///////////////////////////////////////// //$aaa = M('investor_detail')->where('invest_id =2629')->count(); //if($aaa !=3 ){ // exit('aaaaa'); //} if ($lasthavemoney == $binfo['borrow_money']) { borrowFull($borrow_id, $binfo['borrow_type']); //满标,标记为还款中,更新相关数据 } if (!$res) { //没有正常记录和扣除帐户余额的话手动回滚 // M('investor_detail')->where("invest_id={$invest_info_id}")->delete(); // M('borrow_investor')->where("id={$invest_info_id}")->delete(); //更新投标进度 // $upborrowsql = "update `{$pre}borrow_info` set "; // $upborrowsql .= "`has_borrow`=".$havemoney.",`borrow_times`=`borrow_times`-1"; // $upborrowsql .= " WHERE `id`={$borrow_id}"; // $upborrow_res = M()->execute($upborrowsql); //更新投标进度 $done = false; } else { $done = true; } } else { mysql_query("ROOLBACK"); } mysql_query("SET AUTOCOMMIT=1"); mysql_close($handler); return $done; }
public function doEdit() { $id = intval($_POST['id']); $status = intval($_POST['status']); $statusx = M('member_payonline')->getFieldById($id, "status"); if ($statusx != 0) { $this->error("请不要重复提交表单"); } if ($status == 1) { $vo = M('member_payonline')->field('money,fee,uid,way')->find($id); $newid = memberMoneyLog($vo['uid'], 27, $vo['money'] - $vo['fee'], "管理员手动审核充值"); if ($newid) { //////////////////////////// if ($vo['way'] == "off") { $tqfee = explode("|", $this->glo['offline_reward']); $fee[0] = explode("-", $tqfee[0]); $fee[2] = explode("-", $tqfee[2]); $fee[1] = floatval($tqfee[1]); $fee[3] = floatval($tqfee[3]); $fee[4] = floatval($tqfee[4]); $fee[5] = floatval($tqfee[5]); if ($vo['money'] >= $fee[0][0] && $vo['money'] <= $fee[0][1]) { $fee_rate = 0 < $fee[1] ? $fee[1] / 1000 : 0; } else { if ($vo['money'] >= $fee[2][0] && $vo['money'] <= $fee[2][1]) { $fee_rate = 0 < $fee[3] ? $fee[3] / 1000 : 0; } else { if ($vo['money'] >= $fee[4]) { $fee_rate = 0 < $fee[5] ? $fee[5] / 1000 : 0; } else { $fee_rate = 0; } } } $newidx = memberMoneyLog($vo['uid'], 32, $vo['money'] * $fee_rate, "线下充值奖励"); } ///////////////////////////// /* $offline_reward = explode("|",$this->glo['offline_reward']); if($vo['money']>$offline_reward[0]){ $fee_rate = 0<$offline_reward[1]?($offline_reward[1]/1000):0; $newidx = memberMoneyLog($vo['uid'],32,$vo['money']*$fee_rate,"线下充值奖励"); }*/ $save['deal_user'] = session('adminname'); $save['deal_uid'] = $this->admin_id; $save['status'] = 1; M('member_payonline')->where("id={$id}")->save($save); $vx = M('members')->field("user_name,user_phone")->find($vo['uid']); if ($vo['way'] == "off") { SMStip("payoffline", $vx['user_phone'], array("#USERANEM#", "#MONEY#"), array($vx['user_name'], $vo['money'])); } else { SMStip("payonline", $vx['user_phone'], array("#USERANEM#", "#MONEY#"), array($vx['user_name'], $vo['money'])); } alogs("Paylog", 0, 1, '执行了管理员手动审核充值操作!'); //管理员操作日志 $this->success("处理成功"); } else { alogs("Paylog", 0, 1, '执行管理员手动审核充值操作失败!'); //管理员操作日志 $this->error("处理失败"); } } else { $save['deal_user'] = session('adminname'); $save['deal_uid'] = $this->admin_id; $save['status'] = 3; $newid = M('member_payonline')->where("id={$id}")->save($save); if ($newid) { $this->success("处理成功"); } else { $this->error("处理失败"); } } }
/** * 充值 * @param unknown_type $post */ public function net_save($post) { $usrid = $post['UsrCustId']; $db = core::Singleton('comm.db.activeRecord'); $db->connect('CAILAI'); $info = $db->get_one(array('usrid' => $usrid), '', 'lzh_huifulog'); $nowtime = time(); $data = array(); $data['uid'] = $info['uid']; //用户UID $data['username'] = $info['username']; //用户名 $data['rescode'] = $post['RespCode']; //返回码 $data['cmdid'] = $post['CmdId']; //消息类型 $data['usrid'] = $post['UsrCustId']; //用户客户号 $data['ordid'] = $post['OrdId']; //订单号 $data['orddate'] = $post['OrdDate']; //订单日期 $data['trxid'] = $post['TrxId']; //交易流水号 $data['addtime'] = $nowtime; //记录时间 $condition['uid'] = $data['uid']; $condition['ordid'] = $data['ordid']; $num = $db->count_all($condition, 'lzh_huifulog'); if ($num === 0) { $db->insert($data, 'lzh_huifulog'); } if (strcmp($post['RespCode'], "000") == 0) { //member_paylog表记录充值日志 $paylog = array(); $paylog['uid'] = $info['uid']; //用户UID $paylog['usrid'] = $post['UsrCustId']; //用户客户号 $paylog['ordid'] = $post['OrdId']; //订单号 $paylog['orddate'] = $post['OrdDate']; //订单日期 $paylog['transamt'] = $post['TransAmt']; //充值金额 $paylog['trxid'] = $post['TrxId']; //交易流水号 $paylog['feeamt'] = $post['FeeAmt']; //充值手续费 $paylog['feecustid'] = $post['FeeCustId']; //手续费扣款客户号 $paylog['feeacctid'] = $post['FeeAcctId']; //手续费扣款子账户号 $paylog['addtime'] = $nowtime; //记录时间 $condition['uid'] = $paylog['uid']; $condition['ordid'] = $paylog['ordid']; $num = $db->count_all($condition, 'lzh_member_paylog'); //$num = M("member_paylog")->where($condition)->count(); //----------------如果用户通过快捷支付的方式,那么相当于绑卡了, by whh 2015-03-05------------- if (trim($post['GateBusiId']) == 'QP') { $bankdata['uid'] = $info['uid']; $bankdata['bank_num'] = $post['CardId']; //开户银行帐号 $bankdata['bank_name'] = $post['GateBankId']; //开户银行代号 $bankdata['add_ip'] = ''; $bankdata['add_time'] = time(); //M('member_banks')->add($bankdata); $db->insert($bankdata, 'lzh_member_banks'); unset($bankdata); } //-------------------------------------------------------------------------------------------- if ($num == 0) { //M("member_paylog")->add($paylog); $db->insert($paylog, 'lzh_member_paylog'); //file_put_contents('/tmp/deal',date('m-d H:i:s')." uid : ".print_r($paylog['uid'],true)."\n",FILE_APPEND); //file_put_contents('/tmp/deal',date('m-d H:i:s')." TransAmt : ".print_r(str2val_money($post['TransAmt']),true)."\n",FILE_APPEND); //file_put_contents('/tmp/deal',date('m-d H:i:s')." ordid : ".print_r("充值订单号:".$paylog['ordid'],true)."\n",FILE_APPEND); //require_once('function/function.comm.php'); memberMoneyLog($paylog['uid'], 3, str2val_money($post['TransAmt']), "充值订单号:" . $paylog['ordid'], 0, ''); // $info = $db->get_one(array('uid' => $info['uid']), '', 'lzh_member_info'); // $bdb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PWD); $sql = "SELECT real_name FROM lzh_member_info WHERE uid = ? limit 1 "; $stmt1 = $bdb->prepare($sql); $stmt1->bindParam(1, $info['uid']); //绑定第一个参数值 $stmt1->execute(); while ($memberd = $stmt1->fetch(PDO::FETCH_ASSOC)) { $memberInfo = $memberd; } $bdb = null; $timeT = date('Y-m-d H:i'); $sendms = "尊敬的财来网投资人{$memberInfo['real_name']},您于{$timeT}分,在财来网汇付宝充值{$post['TransAmt']}元已到账。请关注投资标的信息。详情请咨询客户经理,或致电400-079-8558"; //取现成功发送短信 sendsms($info['username'], $sendms); file_put_contents('/tmp/chongzhi.txt', "{$info['username']}:" . print_r($sendms, true) . "\n", FILE_APPEND); } } }
public function doMoneyEdit() { $id = intval($_POST['id']); $uid = $id; $info = text($_POST['info']); $done = false; if (floatval($_POST['account_money']) != 0) { $done = memberMoneyLog($uid, 71, floatval($_POST['account_money']), $info); } if (floatval($_POST['money_freeze']) != 0) { $done = false; $done = memberMoneyLog($uid, 72, floatval($_POST['money_freeze']), $info); } if (floatval($_POST['money_collect']) != 0) { $done = false; $done = memberMoneyLog($uid, 73, floatval($_POST['money_collect']), $info); } //记录 $this->assign('jumpUrl', __URL__ . "/index" . session('listaction')); if ($done) { alogs("Members", 0, 1, '成功执行了会员余额调整的操作!'); //管理员操作日志 $this->success("操作成功"); } else { alogs("Members", 0, 0, '执行会员余额调整的操作失败!'); //管理员操作日志 $this->error("操作失败"); } }
private function payDone($status, $nid, $oid) { $done = false; $Moneylog = D('member_payonline'); if ($this->locked) { return false; } $this->locked = true; switch ($status) { case 1: $updata['status'] = $status; $updata['tran_id'] = text($oid); $vo = M('member_payonline')->field('uid,money,fee,status')->where("nid='{$nid}'")->find(); //if($vo['status']!=0 || !is_array($vo)) return; if (!is_array($vo)) { return false; } else { if ($vo['status'] == 1) { return true; } } $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, 0, '@网站管理员@'); } //更新成功才充值,避免重复充值 //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 = $Moneylog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); break; case 3: $updata['status'] = $status; $xid = $Moneylog->where("uid={$vo['uid']} AND nid='{$nid}'")->save($updata); break; } if ($status > 0) { if ($xid) { $done = true; } } $this->locked = false; return $done; }
function synlogin($get, $post) { $uid = $get['uid']; $username = $get['username']; if (!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; } $vo = M("members")->field("id,user_name")->where("user_name='{$username}'")->find(); if (is_array($vo)) { //登陆 foreach ($vo as $key => $v) { session("u_{$key}", $v); } $up['uid'] = $vo['id']; $up['add_time'] = time(); $up['ip'] = get_client_ip(); M('member_login')->add($up); } else { //注册 require DISCUZ_ROOT . "uc_client/client.php"; $dataUc = uc_get_user($username); $data['user_name'] = text($username); $data['user_pass'] = text($get['password']); $data['user_email'] = text($dataUc[2]); $count = M('members')->where("user_email = '{$data['user_email']}' OR user_name='{$data['user_name']}'")->count('id'); if ($count > 0) { exit; } $data['reg_time'] = time(); $data['reg_ip'] = get_client_ip(); $data['lastlog_time'] = time(); $data['lastlog_ip'] = get_client_ip(); $newid = M('members')->add($data); if ($newid) { session('u_id', $newid); session('u_user_name', $data['user_name']); Notice(1, $newid); memberMoneyLog($newid, 1, $this->glo['award_reg'], "注册奖励"); } } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); _setcookie('Example_auth', _authcode($uid . "\t" . $username, 'ENCODE')); }
/** * @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 '申请失败,请重试'; }
public function backwithdraw() { $id = intval($_GET['id']); $map['withdraw_status'] = 0; $map['uid'] = $this->uid; $map['id'] = $id; $vo = M('member_withdraw')->where($map)->find(); if (!is_array($vo)) { ajaxmsg('', 0); } $newid = M('member_withdraw')->where($map)->delete(); $lm = M('members')->getFieldById($this->uid, 'account_money'); if ($newid) { $res = memberMoneyLog($this->uid, 5, $vo['withdraw_money'], "撤消提现"); } if ($res) { ajaxmsg(); } else { ajaxmsg("", 0); } }
public function doEdit() { $status = intval($_POST['status']); $uid = intval($_POST['id']); $uif = $_POST['deal_info']; if ($status == 1) { memberCreditsLog($uid, 2, intval($this->glo["real_score"]), "实名认证通过经验奖励"); memberScoresLog($uid, 2, intval($this->glo["real_score"]), "实名认证通过积分奖励"); memberMoneyLog($uid, 25, -$this->glo['fee_idcard'], $info = "实名认证通过"); $newxid = M("members_status")->where("uid={$uid}")->setField('id_status', 1); $dealInfo = M("member_info")->where("uid={$uid}")->setField('deal_info', $uif); //deal_info字段存在member_info表 addInnerMsg($uid, "您的实名认证申请已经通过", "您的实名认证申请已经通过"); } else { $newxid = M("members_status")->where("uid={$uid}")->setField('id_status', 0); addInnerMsg($uid, "您的实名认证申请未能通过", "未通过原因:" . $uif); } if ($newxid) { $this->success("审核成功", __URL__ . "/index" . session('listaction')); } else { $this->error("审核失败"); } }
public function doMoneyEdit() { $id = intval($_POST['id']); $uid = $id; $info = text($_POST['info']); $done = false; $token = intval($_POST['token']); if ($_SESSION["token"] != $token) { $this->error("操作失败,请不要重复提交"); exit; } if (floatval($_POST['account_money']) != 0) { $done = memberMoneyLog($uid, 71, floatval($_POST['account_money']), $info); } if (floatval($_POST['money_freeze']) != 0) { $done = false; $done = memberMoneyLog($uid, 72, floatval($_POST['money_freeze']), $info); } if (floatval($_POST['money_collect']) != 0) { $done = false; $done = memberMoneyLog($uid, 73, floatval($_POST['money_collect']), $info); } //记录 $_SESSION["token"] = ""; $this->assign('jumpUrl', __URL__ . "/index" . session('listaction')); if ($done) { $this->success("操作成功"); } else { $this->error("操作失败"); } }
public function doEdit() { // echo $_POST[deal_info]; // echo "<br/>"; $model = D(ucfirst($this->getActionName())); if (false === $model->create()) { $this->error($model->getError()); } //保存当前数据对象 if ($result = $model->save()) { //保存成功 if ($_POST['status'] == 1) { $vx = M('vip_apply')->field("uid,kfid,deal_info")->find(intval($_POST['id'])); $uid = $vx['uid']; $dealInfo = $vx['deal_info']; $datag = get_global_setting(); $aUser = get_admin_name(); $newx = memberMoneyLog($uid, 14, -$datag['fee_vip'], "升级VIP成功"); memberLimitLog($uid, 11, $this->glo['limit_vip'], "VIP审核通过"); memberCreditsLog($uid, 9, intval($this->glo["vip_exp"]), "VIP审核通过经验奖励"); memberScoresLog($uid, 9, intval($this->glo["vip_score"]), "VIP审核通过积分奖励"); addInnerMsg($uid, "您的VIP申请审核已通过", "您的VIP申请审核已通过."); $vo = M("members")->field("user_phone,user_name,account_money,recommend_id")->where("id = {$uid}")->find(); SMStip("vip", $vo['user_phone'], array("#USERANEM#"), array($vo['user_name']), null, array($uid)); if ($newx) { $xmoney = M('members')->getFieldById($vo['recommend_id'], 'reward_money'); memberMoneyLog($vo['recommend_id'], 13, $datag['reward_vip_money'], $vo['user_name'] . "获得被邀请会员VIP升级奖励"); $vmo = M('members')->field("user_leve,time_limit,delicated_customer")->find($vx['uid']); $savex['customer_id'] = $vx['kfid']; $savex['customer_name'] = $aUser[$vx['kfid']]; $savex['user_leve'] = 1; if (empty($vmo["delicated_customer"])) { $savex['delicated_customer'] = $vx['kfid']; } if ($vmo['time_limit'] > time()) { $savex['time_limit'] = strtotime("+1 year", $vmo['time_limit']); } else { $savex['time_limit'] = strtotime("+1 year"); } M('members')->where("id={$uid}")->save($savex); } } else { $vx = M('vip_apply')->field("uid,kfid,deal_info")->find(intval($_POST['id'])); $uid = $vx['uid']; $dealInfo = $vx['deal_info']; addInnerMsg($uid, "您的VIP申请审核未通过", "未通过原因:" . $dealInfo); } //成功提示 $this->assign('jumpUrl', __URL__ . "/" . session('listaction')); $this->success(L('修改成功')); } else { //失败提示 $this->error(L('修改失败')); } }
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; }
function borrowApproved($borrow_id) { $pre = C('DB_PREFIX'); $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_name,borrow_type,reward_type,reward_num,borrow_fee,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital,investor_interest')->where("borrow_id={$borrow_id}")->select(); $endTime = strtotime(date("Y-m-d", time()) . " 23:59:59"); if ($binfo['repayment_type'] == 1) { $deadline_last = strtotime("+{$binfo['borrow_duration']} day", $endTime); } else { $deadline_last = strtotime("+{$binfo['borrow_duration']} month", $endTime); } $borrowInvestor->startTrans(); //更新投资概要 $_investor_num = count($investorList); foreach ($investorList as $key => $v) { if ($binfo['reward_type'] > 0) { if ($binfo['reward_type'] == 1) { $_reward_money = getFloatValue($v['investor_capital'] * $binfo['reward_num'] / 100, 4); } elseif ($binfo['reward_type'] == 2) { $_reward_money = getFloatValue($binfo['reward_num'] / $_investor_num, 4); } } $investorList[$key]['reward_money'] = floatval($_reward_money); MTip('chk14', $v['investor_uid'], $borrow_id); //sss $saveinfo = array(); $saveinfo['id'] = $v['id']; $saveinfo['reward_money'] = floatval($_reward_money); $saveinfo['deadline'] = $deadline_last; $saveinfo['status'] = 4; //还款中 $upsummary_res = $borrowInvestor->save($saveinfo); } //邮件提醒 $subject = "您投标的借款[" . $binfo['borrow_name'] . "]成功了"; $link = '<br /><a href="http://' . $_SERVER['HTTP_HOST'] . '/invest/' . $borrow_id . '.html" style="color:#91273d">点击查看[' . $binfo['borrow_name'] . ']</a>'; investEmail($subject, $subject . $link, 'chk14', "investsuccess_2", $borrow_id); //更新投资概要 //更新借款信息 $upborrow_res = M()->execute("update `{$pre}borrow_info` set `deadline`={$deadline_last} WHERE `id`={$borrow_id}"); //更新借款信息 //更新投资详细 switch ($binfo['repayment_type']) { case 2: //每月还款 //每月还款 case 3: //每季还本 //每季还本 case 4: //期未还本 for ($i = 1; $i <= $binfo['borrow_duration']; $i++) { $deadline = 0; $deadline = strtotime("+{$i} month", $endTime); $updetail_res = M()->execute("update `{$pre}investor_detail` set `deadline`={$deadline},`status`=7 WHERE `borrow_id`={$borrow_id} AND `sort_order`={$i}"); } break; case 1: //按天一次性还款 $deadline = 0; $deadline = $deadline_last; $updetail_res = M()->execute("update `{$pre}investor_detail` set `deadline`={$deadline},`status`=7 WHERE `borrow_id`={$borrow_id}"); break; } //更新投资详细 if ($updetail_res !== false && $upsummary_res !== false && $upborrow_res !== false) { $done = true; $borrowInvestor->commit(); //借款者帐户 $_P_fee = get_global_setting(); $_borraccount = memberMoneyLog($binfo['borrow_uid'], 17, $binfo['borrow_money'], "第{$borrow_id}号标复审通过,借款金额入帐"); //借款入帐 if (!$_borraccount) { return false; } //借款者帐户处理出错 $_borrfee = memberMoneyLog($binfo['borrow_uid'], 18, -$binfo['borrow_fee'], "第{$borrow_id}号标借款成功,扣除借款管理费"); //借款 if (!$_borrfee) { return false; } //借款者帐户处理出错 $_freezefee = memberMoneyLog($binfo['borrow_uid'], 19, -$binfo['borrow_money'] * $_P_fee['money_deposit'] / 100, "第{$borrow_id}号标借款成功,冻结{$_P_fee['money_deposit']}%的保证金"); //冻结保证金 if (!$_freezefee) { return false; } //借款者帐户处理出错 //借款者帐户 //投资者帐户 $_investor_num = count($investorList); $_remoney_do = true; foreach ($investorList as $v) { //投标奖励 if ($v['reward_money'] > 0) { $_remoney_do = false; $_reward_m = memberMoneyLog($v['investor_uid'], 20, $v['reward_money'], "第{$borrow_id}号标复审通过,获取投标奖励", $binfo['borrow_uid']); $_reward_m_give = memberMoneyLog($binfo['borrow_uid'], 21, -$v['reward_money'], "第{$borrow_id}号标复审通过,支付投标奖励", $v['investor_uid']); if ($_reward_m && $_reward_m_give) { $_remoney_do = true; } } //投标奖励 $remcollect = memberMoneyLog($v['investor_uid'], 15, $v['investor_capital'], "第{$borrow_id}号标复审通过,冻结本金成为待收金额", $binfo['borrow_uid']); $reinterestcollect = memberMoneyLog($v['investor_uid'], 28, $v['investor_interest'], "第{$borrow_id}号标复审通过,应收利息成为待收金额", $binfo['borrow_uid']); //////////////////////邀请奖励开始//////////////////////////////////////// /* $vo = M('members')->field('user_name,recommend_id')->find($v['investor_uid']); $_rate = $_P_fee['award_invest']/1000;//推广奖励 if($vo['recommend_id']!=0){ if(($binfo['borrow_type']=='1' || $binfo['borrow_type']=='2' || $binfo['borrow_type']=='5' || $binfo['borrow_type']=='6') ){ if($binfo['repayment_type']!='1')$jiangli = round($_rate * $v['investor_capital'],2); else $jiangli = round($_rate * $v['investor_capital'] * $binfo['borrow_duration'] / 30, 2); memberMoneyLog($vo['recommend_id'],13,$jiangli,$vo['user_name']."对{$borrow_id}号标投资成功,你获得推广奖励".$jiangli."元。",$v['investor_uid']); } } */ /////////////////////邀请奖励结束///////////////////////////////////////// //投标经验跟积分 memberCreditsLog($v['investor_uid'], 10, $v['investor_capital'], "投资经验奖励", "borrow_investor" . "_" . $v["id"]); memberScoresLog($v['investor_uid'], 10, $v['investor_capital'] / 10, "投资积分奖励", "borrow_investor" . "_" . $v["id"]); } if (!$_remoney_do || !$remcollect || !$reinterestcollect) { return false; } //投资者帐户处理出错 //投资者帐户 } else { $borrowInvestor->rollback(); } return $done; }
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 editalipay() { if ($this->isPost()) { $savedata['id'] = $this->_post("id"); $savedata['status'] = $this->_post("status"); if ($savedata['status'] == 2) { $alimodel = M("member_alipay"); $alipay = $alimodel->find($savedata['id']); memberMoneyLog($alipay['uid'], 54, $alipay['money'], "支付宝充值"); $ret = $alimodel->save($savedata); $offl['uid'] = $alipay['uid']; $offl['nid'] = 'alipay'; $offl['money'] = $alipay['money']; $offl['fee'] = 0; $offl['way'] = 'alipay'; $offl['status'] = '1'; $offl['add_time'] = time(); $offl['add_ip'] = get_client_ip(); $offl['tran_id'] = ""; $offl['off_bank'] = ""; $offl['off_way'] = ""; $offl['deal_user'] = ""; $offl['deal_user'] = session('adminname'); $offl['deal_uid'] = $this->admin_id; $offl['payimg'] = ""; M("member_payonline")->add($offl); if ($ret) { $vx = M('members')->field("user_name,user_phone")->find($offl['uid']); SMStip("alipay", $vx['user_phone'], array("#USERANEM#", "#MONEY#"), array($vx['user_name'], $offl['money'])); // $info = '您在手投网股票配资平台支付宝充值'.$offl['money'].'元已充值成功!【手投网】'; // $ret = sendsms($vx['user_phone'],$info); $this->success("操作成功!"); } else { $this->error("操作失败!"); } } else { $ret = M("member_alipay")->save($savedata); $alimodel = M("member_alipay"); $alipay = $alimodel->find($savedata['id']); $offl['uid'] = $alipay['uid']; $offl['nid'] = 'alipay'; $offl['money'] = $alipay['money']; $offl['fee'] = 0; $offl['way'] = 'alipay'; $offl['status'] = 3; $offl['add_time'] = time(); $offl['add_ip'] = get_client_ip(); $offl['tran_id'] = ""; $offl['off_bank'] = ""; $offl['off_way'] = ""; $offl['deal_user'] = ""; $offl['deal_user'] = session('adminname'); $offl['deal_uid'] = $this->admin_id; $offl['payimg'] = ""; M("member_payonline")->add($offl); if ($ret) { $vx = M('members')->field("user_name,user_phone")->find($offl['uid']); SMStip("noalipay", $vx['user_phone'], array("#USERANEM#", "#MONEY#"), array($vx['user_name'], $offl['money'])); $this->success("操作成功!"); } else { $this->error("操作失败!"); } } } else { $this->display(); } }
public function buya($paypass, $invest_id) { $check_result = $this->checkBuya($paypass, $invest_id); //dump($check_result);die; if ($check_result === 'TRUE') { $debt_info = $this->Model->field("transfer_price, sell_uid, money")->where("invest_id={$invest_id}")->find(); $buy_user = M("member_money")->field("account_money, back_money, money_collect")->where("uid={$this->uid}")->find(); $sell_user = M("member_money")->field("account_money, money_collect")->where("uid={$debt_info['sell_uid']}")->find(); if ($debt_info['transfer_price'] > $buy_user['account_money'] + $buy_user['back_money']) { return 'insufficient_account_balance'; } $buy_user['back_money'] = $buy_user['back_money'] - $debt_info['transfer_price']; if ($buy_user['back_money'] < 0) { $buy_user['account_money'] = $buy_user['account_money'] + $buy_user['back_money']; $buy_user['back_money'] = 0; } $buy_user['money_collect'] += $debt_info['money']; // 转让手续费扣除 $datag = get_global_setting(); $debt_fee = $datag['debt_fee']; // 百分比 $fee = round($debt_info['transfer_price'] * $debt_fee / 100, 2); //转让方增加资金 $sell_user['account_money'] += $debt_info['transfer_price'] - $fee; $sell_user['money_collect'] = $sell_user['money_collect'] - $debt_info['money']; // 减去待收 // 转让序列号 $serial = "ZQZR-" . date("YmdHis") . mt_rand(1000, 9999); $serialid_count = $this->Model->where("serialid>{$serial}")->count(); $serialid = $serial + $serialid_count + 1; $debt = array('buy_time' => time(), 'buy_uid' => $this->uid, 'status' => 1, 'serialid' => $serialid); $this->Model->startTrans(); //$investor_status = M("borrow_investor")->where("id={$invest_id}")->save(array('debt_uid'=>$this->uid)); //$detail_status = M("investor_detail")->where("invest_id={$invest_id} and status in (6,7,0)")->save(array('investor_uid'=>$this->uid)); $debt_status = $this->Model->where("invest_id={$invest_id}")->save($debt); $sell_user_status = M("member_money")->where("uid={$debt_info['sell_uid']}")->save($sell_user); $buy_user_status = M("member_money")->where("uid={$this->uid}")->save($buy_user); if ($debt_status && $sell_user_status && $buy_user_status) { $this->Model->commit(); $this->moneyLog($this->uid, 46, -$debt_info['transfer_price'], $debt_info['money'], "购买{$serialid}号债权", $debt_info['sell_uid']); $this->moneyLog($debt_info['sell_uid'], 47, $debt_info['transfer_price'], $debt_info['money'], "转让{$serialid}号债权", $this->uid); memberMoneyLog($debt_info['sell_uid'], 48, -$fee, "转让{$serialid}号债权手续费(转让金额的{$debt_fee}%)"); //return 'TRUE'; return '购买成功'; } else { $this->Model->rollback(); //return 'buy_error'; return '购买失败'; } } else { return $check_result; } }
protected function sendPrize($vo, $dd) { $vo['prize'] = floatval($vo['prize']); $newid = memberMoneyLog($vo['uid'], 55, $vo['prize'], $vo['adesc']); if ($newid) { $data = array(); $data['username'] = $vo['name']; $data['uid'] = $vo['uid']; $data['dateline'] = time(); $data['prize'] = $vo['prize']; $data['art_info'] = $vo['adesc']; $data['pid'] = $dd['id']; M('activity_diy_log')->add($data); //SMStip("diyactivity",$vo['phone'],array("#ITEMNAME#,#USERANEM#","#MONEY#"),array($dd['art_title'],$vo['name'],$vo['prize'])); alogs("Paylog", 0, 1, '执行了管理员发放活动奖励!' . $dd['art_title']); //管理员操作日志 return true; } else { alogs("Paylog", 0, 1, '执行了管理员发放活动奖励!'); //管理员操作日志 return false; } }
public function loansreturn() { file_put_contents('/tmp/debugwhh', date('m-d H:i:s') . "\$_POST:" . print_r($_POST, true) . "\n", FILE_APPEND); if (strcmp($_POST['RespCode'], "000") == 0) { $mem = new Memcache(); $mem->connect("127.0.0.1", 11211); $key = 'loansreturn-' . $_POST['CmdId'] . '-' . $_POST['OutCustId']; $has = $mem->get($key); if ($has) { sleep(1); //return ; } else { //设置4秒 $mem->set($key, 1, 0, 1); } unset($mem, $has, $key); } $usrid = $_POST['OutCustId']; $info = M("huifulog")->distinct(true)->field("uid,username")->where("usrid=" . $usrid)->find(); $data = array(); $data['uid'] = $info['uid']; //用户UID $data['username'] = $info['username']; //用户名 $data['rescode'] = $_POST['RespCode']; //返回码 $data['cmdid'] = $_POST['CmdId']; //消息类型 $data['usrid'] = $_POST['OutCustId']; //用户客户号(出账人客户号) $data['ordid'] = $_POST['OrdId']; //订单号 $data['orddate'] = $_POST['OrdDate']; //订单日期 $data['trxid'] = ""; $data['merpriv'] = $_POST['MerPriv']; $data['addtime'] = time(); //记录时间 //解冻金额是否减掉 $reqext = 0; $reqext = $_POST['RespExt']; //代金券的内容json字符串 $reqext = json_decode(urldecode($reqext), 1); $reqext = $reqext['LoansVocherAmt']; file_put_contents('/tmp/debugwhh', date('m-d H:i:s') . "reqext:" . print_r($reqext, true) . "\n", FILE_APPEND); $condition['uid'] = $data['uid']; $condition['ordid'] = $data['ordid']; $num = M("huifulog")->where($condition)->count(); $md = M()->getLastSql(); file_put_contents('/tmp/debugwhh', date('m-d H:i:s') . "\\md:" . print_r($md, true) . "\n", FILE_APPEND); if ($num == 0) { M("huifulog")->add($data); if (strcmp($_POST['RespCode'], "000") == 0) { $temp = base64_decode($data['merpriv']); $pos1 = strpos($temp, '{'); $pos2 = strpos($temp, '}'); $len = $pos2 - $pos1 + 1; $merpriv = substr($temp, $pos1, $len); $merpriv = json_decode($merpriv, true); $borrowid = $merpriv['borrowid']; //标ID $investid = $merpriv['investid']; //投资ID $binfo = M("borrow_info")->field("borrow_type,reward_type,reward_num,borrow_fee,borrow_money,borrow_uid,borrow_duration,repayment_type,manage_rate")->find($borrowid); //还款时间 $endTime = strtotime(date("Y-m-d", time()) . " 23:59:59"); //逾期时刻 if ($binfo['borrow_type'] == 3 || $binfo['repayment_type'] == 1) { $deadline = strtotime("+{$binfo['borrow_duration']} day", $endTime); //天标或秒标 } else { $deadline = strtotime("+{$binfo['borrow_duration']} month", $endTime); //月标 } //更新投资信息 $investinfo = array(); $investinfo['deadline'] = $deadline; $investinfo['status'] = 4; //复审通过,还款中 M("borrow_investor")->where("id=" . $investid)->save($investinfo); //更新还款信息 switch ($binfo['repayment_type']) { case 2: //每月还款 //每月还款 case 3: //每季还本 //每季还本 case 4: //期未还本 for ($i = 1; $i <= $binfo['borrow_duration']; $i++) { $repaymentinfo = array(); $deadlines = strtotime("+{$i} month", $endTime); //月还款时间 $repaymentinfo['deadline'] = $deadlines; $repaymentinfo['status'] = 7; //复审通过,还款中 M("investor_detail")->where("invest_id={$investid} AND `sort_order` ={$i}")->save($repaymentinfo); } break; case 1: //按天一次性还款 //按天一次性还款 case 5: //一次性还款 $repaymentinfo = array(); $repaymentinfo['deadline'] = $deadline; //一次性还款时间 $repaymentinfo['status'] = 7; //复审通过,还款中 M("investor_detail")->where("invest_id=" . $investid)->save($repaymentinfo); break; } //解冻保证金要减去代金券 20150831 if ($reqext) { $investor_capital = str2val_money($_POST['TransAmt'] - $reqext); $tip = "第{$borrowid}号标复审通过,冻结本金成为待收金额.使用代金券{$reqext}元"; } else { $investor_capital = str2val_money($_POST['TransAmt']); $tip = "第{$borrowid}号标复审通过,冻结本金成为待收金额."; } //因为要给代收金额加上代金券的钱 所以要添加一个变量。20150831 by lj memberMoneyLog($data['uid'], 15, $investor_capital, $tip, $binfo['borrow_uid'], '', 0, $reqext); file_put_contents('/tmp/debugwhh', date('m-d H:i:s') . "is_null_req:" . print_r($reqext, true) . "\n", FILE_APPEND); $daishou = M('investor_detail')->field('interest')->where("investor_uid = {$data['uid']} and borrow_id = {$borrowid} and invest_id ={$investid}")->sum('interest'); memberMoneyLog($data['uid'], 28, $daishou, "第{$borrowid}号标复审通过,应收利息成为待收利息", $binfo['borrow_uid']); //memberMoneyLog($vo['recommend_id'],13,$jiangli,$vo['user_name']."对{$borrow_id}号标投资成功,你获得推广奖励".$jiangli."元。",$v['investor_uid']); $id = M("borrow_investor")->field('id')->where("borrow_id=" . $borrowid)->order('id desc')->find(); if ($id['id'] == $investid) { $borrowinfo = array(); $borrowinfo['deadline'] = $deadline; $borrowinfo['borrow_status'] = 6; M("borrow_info")->where("id=" . $borrowid)->save($borrowinfo); //更新借款信息 //投标代金券放入客户代收金额*/ memberMoneyLog($binfo['borrow_uid'], 17, $binfo['borrow_money'], "第{$borrowid}号标复审通过,借款金额入帐"); //投标代金券放入客户代收金额结束*/ $total = M("borrow_info")->field("danbao,borrow_money")->where("id=" . $borrowid)->find(); //如果担保公司存在 if ($total['danbao'] != 0) { $Guar = M('members')->field("usrid,id")->where("id = " . $total['danbao'])->find(); $guar_rate = M('member_guarrate')->where("uid = " . $total['danbao'])->find(); //担保费率 $rates_fee = $guar_rate['guarrate'] * $binfo['borrow_money'] / 100; memberMoneyLog($binfo['borrow_uid'], 104, -$rates_fee, "第{$borrowid}号标借款成功,扣除担保费"); //借款者付出担保费 memberMoneyLog($Guar['id'], 105, $rates_fee, "第{$borrowid}号标借款成功,获得担保费"); //担保者获得担保费 } memberMoneyLog($binfo['borrow_uid'], 18, -$binfo['borrow_fee'], "第{$borrowid}号标借款成功,扣除借款管理费"); //借款保证金 $_P_fee = get_global_setting(); $info1 = M("members")->field("usrid")->find($binfo['borrow_uid']); $usrid = $info1['usrid']; $transamt = $_P_fee['money_deposit'] * $total['borrow_money'] / 100; import("ORG.Huifu.Huifu"); $huifu = new Huifu(); $huifu->usrFreezeBg($usrid, $transamt, $borrowid); } } echo "RECV_ORD_ID_" . $_POST['OrdId']; } }
public function backwithdraw() { $id = intval($_GET['id']); $map['withdraw_status'] = 0; $map['uid'] = $this->uid; $map['id'] = $id; $vo = M('member_withdraw')->where($map)->find(); if (!is_array($vo)) { ajaxmsg('', 0); } /////////////////////////////////////////////// $field = "(mm.account_money+mm.back_money) all_money,mm.account_money,mm.back_money"; $m = M('member_money mm')->field($field)->where("mm.uid={$this->uid}")->find(); //////////////////////////////////////////////////// $newid = M('member_withdraw')->where($map)->delete(); if ($newid) { $res = memberMoneyLog($this->uid, 5, $vo['withdraw_money'], "撤消提现", '0', '@网站管理员@'); } if ($res) { ajaxmsg(); } else { ajaxmsg("", 0); } }
public function doEdit() { $model = D(ucfirst($this->getActionName())); $info = $model->field('deal_time')->where('id=' . intval($_POST['id']))->find(); if ($info['deal_time']) { $this->error("此申请已处理过,请不要重复提交!"); } if (false === $model->create()) { $this->error($model->getError()); } $model->deal_time = time(); $model->deal_user = session('admin_id'); //保存当前数据对象 if ($result = $model->save()) { //保存成功 if ($_POST['status'] == 1) { $vx = M('vip_apply')->field("uid,kfid")->find(intval($_POST['id'])); $uid = $vx['uid']; $datag = get_global_setting(); $aUser = get_admin_name(); $result = memberMoneyLog($uid, 14, -$datag['fee_vip'], "升级VIP成功"); $newx = setMemberStatus($uid, 'vip', $_POST['status'], 13, 'vip'); memberLimitLog($uid, 11, $this->glo['limit_vip'], "VIP审核通过"); addInnerMsg($uid, "您的VIP申请审核已通过", "您的VIP申请审核已通过"); $vo = M("members")->field("user_phone,user_name,recommend_id")->where("id = {$uid}")->find(); SMStip("vip", $vo['user_phone'], array("#USERANEM#"), array($vo['user_name'])); if ($newx) { $vmo = M('members')->field("user_leve,time_limit")->find($vx['uid']); $savex['customer_id'] = $vx['kfid']; $savex['customer_name'] = $aUser[$vx['kfid']]; $savex['user_leve'] = 1; if ($vmo['time_limit'] > time()) { $savex['time_limit'] = strtotime("+1 year", $vmo['time_limit']); } else { $savex['time_limit'] = strtotime("+1 year"); } M('members')->where("id={$uid}")->save($savex); } alogs("Vipapply", 0, 1, 'VIP申请审核通过!'); //管理员操作日志 } else { addInnerMsg($uid, "您的VIP申请审核未通过", "您的VIP申请审核未通过"); alogs("Vipapply", 0, 0, 'VIP申请审核未通过!'); //管理员操作日志 } //成功提示 $this->assign('jumpUrl', __URL__); $this->success(L('修改成功')); } else { //失败提示 $this->error(L('修改失败')); } }