예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
    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('修改失败');
        }
    }
예제 #4
0
 /**
  * 流标处理
  * 
  */
 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;
     }
 }
예제 #5
0
 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('修改失败'));
     }
 }
예제 #6
0
 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 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']."【友情提醒】");
     }
 }
예제 #8
0
 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();
     }
 }
예제 #9
0
 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("处理失败");
         }
     }
 }
예제 #10
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('修改失败'));
     }
 }
예제 #11
0
 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****************************/
 }
예제 #12
0
 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****************************/
 }
예제 #13
0
 public function doEdit()
 {
     $status = intval($_POST['status']);
     $uid = intval($_POST['id']);
     //$credits = intval($_POST['deal_credits']);
     $newxid = setMemberStatus($uid, 'id', $status, 2, '实名');
     $userdata = M('members')->field('user_name,user_phone')->find($uid);
     if ($status == 1) {
         $data['status'] = 1;
         $data['deal_info'] = $deal_info;
         $new = M("name_apply")->where("uid={$uid}")->save($data);
         SMStip("realname", $userdata['user_phone'], array("#USERANEM#"), array($userdata['user_name']));
     } else {
         SMStip("norealname", $userdata['user_phone'], array("#USERANEM#"), array($userdata['user_name']));
         $data['deal_info'] = $deal_info;
         $new = M("name_apply")->where("uid={$uid}")->save($data);
     }
     if ($newxid) {
         alogs("Memberid", $newxid, 1, '成功执行了会员实名认证的操作!备注信息:' . $deal_info);
         //管理员操作日志
         $this->success("审核成功", __URL__ . "/index" . session('listaction'));
     } else {
         alogs("Memberid", $newxid, 0, '执行会员实名认证的操作失败!备注信息:' . $deal_info);
         //管理员操作日志
         $this->error("审核失败");
     }
 }
예제 #14
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****************************/
 }
예제 #15
0
파일: Lib.php 프로젝트: hutao1004/yintt
function borrowRepayment($borrow_id, $sort_order, $type = 1)
{
    //type 1:会员自己还,2网站代还
    $pre = C('DB_PREFIX');
    $done = false;
    $borrowDetail = D('investor_detail');
    $binfo = M("borrow_info")->field("id,borrow_name,borrow_uid,borrow_type,borrow_money,borrow_duration,repayment_type,has_pay,total,deadline")->find($borrow_id);
    $b_member = M('members')->field("user_name")->find($binfo['borrow_uid']);
    if ($binfo['has_pay'] >= $sort_order) {
        return "本期已还过,不用再还";
    }
    if ($binfo['has_pay'] == $binfo['total']) {
        return "此标已经还完,不用再还";
    }
    if ($binfo['has_pay'] + 1 < $sort_order) {
        return "对不起,此借款第" . ($binfo['has_pay'] + 1) . "期还未还,请先还第" . ($binfo['has_pay'] + 1) . "期";
    }
    if ($binfo['deadline'] < time() && $type == 2) {
        return "此标还没逾期,不用代还";
    }
    //流转标与普通标,判断还款期数不一样
    $voxe = $borrowDetail->field('sort_order,sum(capital) as capital, sum(interest) as interest,sum(interest_fee) as interest_fee,deadline,substitute_time')->where("borrow_id={$borrow_id}")->group('sort_order')->select();
    foreach ($voxe as $ee => $ss) {
        if ($ss['sort_order'] == $sort_order) {
            $vo = $ss;
        }
    }
    if ($vo['deadline'] < time()) {
        //此标已逾期
        $is_expired = true;
        if ($vo['substitute_time'] > 0) {
            $is_substitute = true;
        } else {
            $is_substitute = false;
        }
        //逾期的相关计算
        $expired_days = getExpiredDays($vo['deadline']);
        $expired_money = getExpiredMoney($expired_days, $vo['capital'], $vo['interest']);
        $call_fee = getExpiredCallFee($expired_days, $vo['capital'], $vo['interest']);
        //逾期的相关计算
    } else {
        $is_expired = false;
        $expired_days = 0;
        $expired_money = 0;
        $call_fee = 0;
    }
    //流转标与普通标,判断还款期数不一样
    MTip('chk25', $binfo['borrow_uid'], $borrow_id);
    //sss
    $accountMoney_borrower = M('member_money')->field('money_freeze,money_collect,account_money')->find($binfo['borrow_uid']);
    if ($type == 1 && $binfo['borrow_type'] != 3 && round($accountMoney_borrower['account_money'], 2) < round($vo['capital'] + $vo['interest'] + $expired_money + $call_fee, 2)) {
        return "帐户可用余额不足,本期还款共需" . ($vo['capital'] + $vo['interest'] + $expired_money + $call_fee) . "元,请先充值";
    }
    if ($is_substitute && $is_expired) {
        //已代还后的会员还款,则只需要对会员的帐户进行操作后然后更新还款时间即可返回
        $borrowDetail->startTrans();
        $datamoney_x['uid'] = $binfo['borrow_uid'];
        $datamoney_x['type'] = 11;
        $datamoney_x['affect_money'] = -($vo['capital'] + $vo['interest']);
        $datamoney_x['account_money'] = $accountMoney_borrower['account_money'] + $datamoney_x['affect_money'];
        $datamoney_x['collect_money'] = $accountMoney_borrower['money_collect'];
        $datamoney_x['freeze_money'] = $accountMoney_borrower['money_freeze'];
        //会员帐户
        $mmoney_x['money_freeze'] = $datamoney_x['freeze_money'];
        $mmoney_x['money_collect'] = $datamoney_x['collect_money'];
        $mmoney_x['account_money'] = $datamoney_x['account_money'];
        //会员帐户
        $datamoney_x['info'] = "对{$borrow_id}号标第{$sort_order}期还款";
        $datamoney_x['add_time'] = time();
        $datamoney_x['add_ip'] = get_client_ip();
        $datamoney_x['target_uid'] = 0;
        $datamoney_x['target_uname'] = '@网站管理员@';
        $moneynewid_x = M('member_moneylog')->add($datamoney_x);
        if ($moneynewid_x) {
            $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x);
        }
        //单独记录还款本金
        $datamoney_x['type'] = 32;
        $datamoney_x['affect_money'] = -$vo['capital'];
        $datamoney_x['info'] = "对{$borrow_id}号标第{$sort_order}期还款本金金额";
        M('member_moneylog')->add($datamoney_x);
        //逾期了
        //逾期罚息
        $accountMoney_borrower = M('member_money')->field('money_freeze,money_collect,account_money')->find($binfo['borrow_uid']);
        $datamoney_x = array();
        $mmoney_x = array();
        $datamoney_x['uid'] = $binfo['borrow_uid'];
        $datamoney_x['type'] = 30;
        $datamoney_x['affect_money'] = -$expired_money;
        $datamoney_x['account_money'] = $accountMoney_borrower['account_money'] + $datamoney_x['affect_money'];
        $datamoney_x['collect_money'] = $accountMoney_borrower['money_collect'];
        $datamoney_x['freeze_money'] = $accountMoney_borrower['money_freeze'];
        //会员帐户
        $mmoney_x['money_freeze'] = $datamoney_x['freeze_money'];
        $mmoney_x['money_collect'] = $datamoney_x['collect_money'];
        $mmoney_x['account_money'] = $datamoney_x['account_money'];
        //会员帐户
        $datamoney_x['info'] = "{$borrow_id}号标第{$sort_order}期的逾期罚息";
        $datamoney_x['add_time'] = time();
        $datamoney_x['add_ip'] = get_client_ip();
        $datamoney_x['target_uid'] = 0;
        $datamoney_x['target_uname'] = '@网站管理员@';
        $moneynewid_x = M('member_moneylog')->add($datamoney_x);
        if ($moneynewid_x) {
            $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x);
        }
        //催收费
        $accountMoney_borrower = M('member_money')->field('money_freeze,money_collect,account_money')->find($binfo['borrow_uid']);
        $datamoney_x = array();
        $mmoney_x = array();
        $datamoney_x['uid'] = $binfo['borrow_uid'];
        $datamoney_x['type'] = 31;
        $datamoney_x['affect_money'] = -$call_fee;
        $datamoney_x['account_money'] = $accountMoney_borrower['account_money'] + $datamoney_x['affect_money'];
        $datamoney_x['collect_money'] = $accountMoney_borrower['money_collect'];
        $datamoney_x['freeze_money'] = $accountMoney_borrower['money_freeze'];
        //会员帐户
        $mmoney_x['money_freeze'] = $datamoney_x['freeze_money'];
        $mmoney_x['money_collect'] = $datamoney_x['collect_money'];
        $mmoney_x['account_money'] = $datamoney_x['account_money'];
        //会员帐户
        $datamoney_x['info'] = "{$borrow_id}号标第{$sort_order}期的逾期催收费";
        $datamoney_x['add_time'] = time();
        $datamoney_x['add_ip'] = get_client_ip();
        $datamoney_x['target_uid'] = 0;
        $datamoney_x['target_uname'] = '@网站管理员@';
        $moneynewid_x = M('member_moneylog')->add($datamoney_x);
        if ($moneynewid_x) {
            $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x);
        }
        //逾期了
        $day = ceil(($vo['deadline'] - time()) / (3600 * 24));
        if ($day > 0 && $day <= 3) {
            //正常还款
            $d_status = 1;
        } elseif ($day > -3 && $day <= 0) {
            //
            $d_status = 3;
        } elseif ($day <= -3) {
            //逾期还款
            $d_status = 5;
        } elseif ($day > 3) {
            //提前还款
            $d_status = 2;
        }
        $updetail_res = M()->execute("update `{$pre}investor_detail` set `repayment_time`=" . time() . ",`receive_interest`=({$vo['interest']}-{$vo['interest_fee']}),`call_fee`={$call_fee},`expired_money`={$expired_money},`expired_days`={$expired_days},`status`={$d_status} WHERE `borrow_id`={$borrow_id} AND `sort_order`={$sort_order}");
        //更新借款信息
        $upborrowsql = "update `{$pre}borrow_info` set ";
        $upborrowsql .= "`repayment_money`=`repayment_money`+{$vo['capital']}";
        $upborrowsql .= ",`repayment_interest`=`repayment_interest`+ {$vo['interest']}";
        if ($sort_order == $binfo['total'] || $binfo['repayment_type'] == 1) {
            $upborrowsql .= ",`borrow_status`=7";
        }
        //还款完成
        $upborrowsql .= ",`has_pay`={$sort_order}";
        //代还则不记录还到第几期,避免会员还款时,提示已还过
        if ($is_expired) {
            $upborrowsql .= ",`expired_money`=`expired_money`+{$expired_money}";
        }
        //代还则不记录还到第几期,避免会员还款时,提示已还过
        $upborrowsql .= " WHERE `id`={$borrow_id}";
        $upborrow_res = M()->execute($upborrowsql);
        //更新借款信息
        //if($updetail_res&&$bxid&&$upborrow_res){
        if ($updetail_res && $upborrow_res) {
            $borrowDetail->commit();
            return true;
        } else {
            $borrowDetail->rollback();
            return false;
        }
    }
    //流转标与普通标,判断还款期数不一样
    $detailList = $borrowDetail->field('invest_id,investor_uid,capital,interest,interest_fee,borrow_id,total')->where("borrow_id={$borrow_id} AND sort_order={$sort_order}")->select();
    //流转标与普通标,判断还款期数不一样
    //积分与还款状态处理
    if ($type == 1) {
        //客户自己还款才需要记录这些操作
        $day_span = ceil(($vo['deadline'] - time()) / (3600 * 24));
        $credits_money = intval($vo['capital'] / 100);
        $credits_info = "对第{$borrow_id}号标的";
        $objectFlag = "borrow_" . $borrow_id . "_" . $sort_order;
        if ($day_span > 0 && $day_span <= 3) {
            //正常还款
            $credits_result = memberCreditsLog($binfo['borrow_uid'], 3, $credits_money, $credits_info . "正常还款奖励经验", $objectFlag);
            $scores_result = memberScoresLog($binfo['borrow_uid'], 3, $credits_money, $credits_info . "正常还款奖励积分", $objectFlag);
            $idetail_status = 1;
        } elseif ($day_span > -3 && $day_span <= 0) {
            //迟还
            $credits_result = memberCreditsLog($binfo['borrow_uid'], 4, $credits_money * -3, $credits_info . "迟还惩罚经验", $objectFlag);
            $scores_result = memberScoresLog($binfo['borrow_uid'], 4, $credits_money * -3, $credits_info . "迟还惩罚积分", $objectFlag);
            $idetail_status = 3;
        } elseif ($day_span <= -3) {
            //逾期还款
            $credits_result = memberCreditsLog($binfo['borrow_uid'], 5, $credits_money * -10, $credits_info . "逾期还款惩罚经验", $objectFlag);
            $scores_result = memberScoresLog($binfo['borrow_uid'], 5, $credits_money * -10, $credits_info . "逾期还款惩罚积分", $objectFlag);
            $idetail_status = 5;
        } elseif ($day_span > 3) {
            //提前还款
            $credits_result = memberCreditsLog($binfo['borrow_uid'], 6, $credits_money * 2, $credits_info . "提前还款奖励经验", $objectFlag);
            $scores_result = memberScoresLog($binfo['borrow_uid'], 6, $credits_money * 2, $credits_info . "提前还款奖励积分", $objectFlag);
            $idetail_status = 2;
        }
        if (!$credits_result || !$scores_result) {
            return "因积分经验记录失败,未完成还款操作";
        }
    }
    //积分与还款状态处理
    $borrowDetail->startTrans();
    //对借款者帐户进行减少
    $bxid = true;
    if ($type == 1) {
        $bxid = false;
        $datamoney_x['uid'] = $binfo['borrow_uid'];
        $datamoney_x['type'] = 11;
        $datamoney_x['affect_money'] = -($vo['capital'] + $vo['interest']);
        $datamoney_x['account_money'] = $accountMoney_borrower['account_money'] + $datamoney_x['affect_money'];
        $datamoney_x['collect_money'] = $accountMoney_borrower['money_collect'];
        $datamoney_x['freeze_money'] = $accountMoney_borrower['money_freeze'];
        //会员帐户
        $mmoney_x['money_freeze'] = $datamoney_x['freeze_money'];
        $mmoney_x['money_collect'] = $datamoney_x['collect_money'];
        $mmoney_x['account_money'] = $datamoney_x['account_money'];
        //会员帐户
        $datamoney_x['info'] = "对{$borrow_id}号标第{$sort_order}期还款";
        $datamoney_x['add_time'] = time();
        $datamoney_x['add_ip'] = get_client_ip();
        $datamoney_x['target_uid'] = 0;
        $datamoney_x['target_uname'] = '@网站管理员@';
        $moneynewid_x = M('member_moneylog')->add($datamoney_x);
        if ($moneynewid_x) {
            $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x);
        }
        //单独记录还款本金
        $datamoney_x['type'] = 32;
        $datamoney_x['affect_money'] = -$vo['capital'];
        $datamoney_x['info'] = "对{$borrow_id}号标第{$sort_order}期还款本金金额";
        M('member_moneylog')->add($datamoney_x);
        //逾期了
        if ($is_expired) {
            //逾期罚息
            if ($expired_money > 0) {
                $accountMoney_borrower = M('member_money')->field('money_freeze,money_collect,account_money')->find($binfo['borrow_uid']);
                $datamoney_x = array();
                $mmoney_x = array();
                $datamoney_x['uid'] = $binfo['borrow_uid'];
                $datamoney_x['type'] = 30;
                $datamoney_x['affect_money'] = -$expired_money;
                $datamoney_x['account_money'] = $accountMoney_borrower['account_money'] + $datamoney_x['affect_money'];
                $datamoney_x['collect_money'] = $accountMoney_borrower['money_collect'];
                $datamoney_x['freeze_money'] = $accountMoney_borrower['money_freeze'];
                //会员帐户
                $mmoney_x['money_freeze'] = $datamoney_x['freeze_money'];
                $mmoney_x['money_collect'] = $datamoney_x['collect_money'];
                $mmoney_x['account_money'] = $datamoney_x['account_money'];
                //会员帐户
                $datamoney_x['info'] = "{$borrow_id}号标第{$sort_order}期的逾期罚息";
                $datamoney_x['add_time'] = time();
                $datamoney_x['add_ip'] = get_client_ip();
                $datamoney_x['target_uid'] = 0;
                $datamoney_x['target_uname'] = '@网站管理员@';
                $moneynewid_x = M('member_moneylog')->add($datamoney_x);
                if ($moneynewid_x) {
                    $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x);
                }
            }
            //催收费
            if ($call_fee > 0) {
                $accountMoney_borrower = M('member_money')->field('money_freeze,money_collect,account_money')->find($binfo['borrow_uid']);
                $datamoney_x = array();
                $mmoney_x = array();
                $datamoney_x['uid'] = $binfo['borrow_uid'];
                $datamoney_x['type'] = 31;
                $datamoney_x['affect_money'] = -$call_fee;
                $datamoney_x['account_money'] = $accountMoney_borrower['account_money'] + $datamoney_x['affect_money'];
                $datamoney_x['collect_money'] = $accountMoney_borrower['money_collect'];
                $datamoney_x['freeze_money'] = $accountMoney_borrower['money_freeze'];
                //会员帐户
                $mmoney_x['money_freeze'] = $datamoney_x['freeze_money'];
                $mmoney_x['money_collect'] = $datamoney_x['collect_money'];
                $mmoney_x['account_money'] = $datamoney_x['account_money'];
                //会员帐户
                $datamoney_x['info'] = "{$borrow_id}号标第{$sort_order}期的逾期催收费";
                $datamoney_x['add_time'] = time();
                $datamoney_x['add_ip'] = get_client_ip();
                $datamoney_x['target_uid'] = 0;
                $datamoney_x['target_uname'] = '@网站管理员@';
                $moneynewid_x = M('member_moneylog')->add($datamoney_x);
                if ($moneynewid_x) {
                    $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x);
                }
            }
        }
        //逾期了
    }
    //对借款者帐户进行减少
    //更新借款信息
    $upborrowsql = "update `{$pre}borrow_info` set ";
    $upborrowsql .= "`repayment_money`=`repayment_money`+{$vo['capital']}";
    $upborrowsql .= ",`repayment_interest`=`repayment_interest`+ {$vo['interest']}";
    if ($sort_order == $binfo['total'] || $binfo['repayment_type'] == 1) {
        $upborrowsql .= ",`borrow_status`=7";
    }
    //还款完成
    //如果是网站代还的,则记录代还金额
    if ($type == 2) {
        $total_subs = $vo['capital'] + $vo['interest'];
        $upborrowsql .= ",`substitute_money`=`substitute_money`+ {$total_subs}";
    }
    //如果是网站代还的,则记录代还金额
    if ($type == 1) {
        $upborrowsql .= ",`has_pay`={$sort_order}";
    }
    //代还则不记录还到第几期,避免会员还款时,提示已还过
    if ($is_expired) {
        $upborrowsql .= ",`expired_money`=`expired_money`+{$expired_money}";
    }
    //代还则不记录还到第几期,避免会员还款时,提示已还过
    $upborrowsql .= " WHERE `id`={$borrow_id}";
    $upborrow_res = M()->execute($upborrowsql);
    //更新借款信息
    //更新还款详情表
    if ($type == 2) {
        //网站代还
        $updetail_res = M()->execute("update `{$pre}investor_detail` set `receive_capital`=`capital`,`substitute_time`=" . time() . " ,`substitute_money`=`substitute_money`+{$total_subs},`status`=4 WHERE `borrow_id`={$borrow_id} AND `sort_order`={$sort_order}");
    } else {
        $updetail_res = M()->execute("update `{$pre}investor_detail` set `receive_capital`=`capital` ,`receive_interest`=(`interest`-`interest_fee`),`repayment_time`=" . time() . ", `status`={$idetail_status} WHERE `borrow_id`={$borrow_id} AND `sort_order`={$sort_order}");
    }
    //更新还款详情表
    //更新还款概要表
    $smsUid = "";
    foreach ($detailList as $v) {
        $getInterest = $v['interest'] - $v['interest_fee'];
        $upsql = "update `{$pre}borrow_investor` set ";
        $upsql .= "`receive_capital`=`receive_capital`+{$v['capital']},";
        $upsql .= "`receive_interest`=`receive_interest`+ {$getInterest},";
        if ($type == 2) {
            $total_s_invest = $v['capital'] + $getInterest;
            $upsql .= "`substitute_money` = `substitute_money` + {$total_s_invest},";
        }
        if ($sort_order == $binfo['total'] || $binfo['repayment_type'] == 1) {
            $upsql .= "`status`=5,";
        }
        //还款完成
        $upsql .= "`paid_fee`=`paid_fee`+{$v['interest_fee']}";
        $upsql .= " WHERE `id`={$v['invest_id']}";
        $upinfo_res = M()->execute($upsql);
        //对投资帐户进行增加
        if ($upinfo_res) {
            $accountMoney = M('member_money')->field('money_freeze,money_collect,account_money')->find($v['investor_uid']);
            $datamoney['uid'] = $v['investor_uid'];
            $datamoney['type'] = $type == 2 ? "10" : "9";
            $datamoney['affect_money'] = $v['capital'] + $v['interest'];
            //先收利息加本金,再扣管理费
            $datamoney['account_money'] = $accountMoney['account_money'] + $datamoney['affect_money'];
            $datamoney['collect_money'] = $accountMoney['money_collect'] - $datamoney['affect_money'];
            $datamoney['freeze_money'] = $accountMoney['money_freeze'];
            //会员帐户
            $mmoney['money_freeze'] = $datamoney['freeze_money'];
            $mmoney['money_collect'] = $datamoney['collect_money'];
            $mmoney['account_money'] = $datamoney['account_money'];
            //会员帐户
            $datamoney['info'] = $type == 2 ? "网站对{$v['borrow_id']}号标第{$sort_order}期代还" : "会员对{$v['borrow_id']}号标第{$sort_order}期还款";
            $datamoney['add_time'] = time();
            $datamoney['add_ip'] = get_client_ip();
            if ($type == 2) {
                $datamoney['target_uid'] = 0;
                $datamoney['target_uname'] = '@网站管理员@';
            } else {
                $datamoney['target_uid'] = $binfo['borrow_uid'];
                $datamoney['target_uname'] = $b_member['user_name'];
            }
            $moneynewid = M('member_moneylog')->add($datamoney);
            if ($moneynewid) {
                $xid = M('member_money')->where("uid={$datamoney['uid']}")->save($mmoney);
            }
            $systips = M("sys_tip")->find($v['investor_uid']);
            if ($type == 2) {
                MTip('chk18', $v['investor_uid'], $borrow_id);
                //sss
                if (checkNeedTip($systips, 'altpay_3')) {
                    $smsUid .= empty($smsUid) ? $v['investor_uid'] : ",{$v['investor_uid']}";
                }
            } else {
                MTip('chk16', $v['investor_uid'], $borrow_id);
                //sss
                if (checkNeedTip($systips, 'getpay_3')) {
                    $smsUid .= empty($smsUid) ? $v['investor_uid'] : ",{$v['investor_uid']}";
                }
            }
            //利息管理费
            $xid_z = true;
            if ($v['interest_fee'] > 0 && $type == 1) {
                $xid_z = false;
                $accountMoney = M('member_money')->field('money_freeze,money_collect,account_money')->find($v['investor_uid']);
                $datamoney_z['uid'] = $v['investor_uid'];
                $datamoney_z['type'] = 23;
                $datamoney_z['affect_money'] = -$v['interest_fee'];
                //扣管理费
                $datamoney_z['account_money'] = $mmoney['account_money'] + $datamoney_z['affect_money'];
                $datamoney_z['collect_money'] = $mmoney['money_collect'];
                $datamoney_z['freeze_money'] = $mmoney['money_freeze'];
                //会员帐户
                $mmoney_z['money_freeze'] = $datamoney_z['freeze_money'];
                $mmoney_z['money_collect'] = $datamoney_z['collect_money'];
                $mmoney_z['account_money'] = $datamoney_z['account_money'];
                //会员帐户
                $datamoney_z['info'] = "收到第{$v['borrow_id']}号标第{$sort_order}期还款的利息管理费";
                $datamoney_z['add_time'] = time();
                $datamoney_z['add_ip'] = get_client_ip();
                $datamoney_z['target_uid'] = 0;
                $datamoney_z['target_uname'] = '@网站管理员@';
                $moneynewid_z = M('member_moneylog')->add($datamoney_z);
                if ($moneynewid_z) {
                    $xid_z = M('member_money')->where("uid={$datamoney_z['uid']}")->save($mmoney_z);
                }
            }
            //利息管理费
        }
        //对投资帐户进行增加
    }
    //邮件提醒
    $subject = "您借出的借款[" . $binfo['borrow_name'] . "]收到了新的还款";
    $link = '<br /><a href="http://' . $_SERVER['HTTP_HOST'] . '/invest/' . $borrow_id . '.html" style="color:#91273d">点击查看[' . $binfo['borrow_name'] . ']</a>';
    if ($type == 2) {
        investDetailEmail($subject, $subject . $link, 'chk18', "altpay_2", $borrow_id);
    } else {
        investDetailEmail($subject, $subject . $link, 'chk16', "getpay_2", $borrow_id);
    }
    //更新还款概要表
    //echo "$updetail_res && $upinfo_res && $xid &&$upborrow_res && $bxid && $xid_z";
    if ($updetail_res !== false && $upinfo_res !== false && $xid !== false && $upborrow_res !== false && $bxid !== false && $xid_z !== false) {
        $borrowDetail->commit();
        $_last = true;
        if (($binfo['total'] == $binfo['has_pay'] + 1 || $binfo['repayment_type'] == 1) && $type == 1) {
            $_last = false;
            $_last = lastRepayment($binfo);
            //最后一笔还款
        }
        if ($_last === false) {
            return "因满标操作未完成,还款操作失败";
        }
        $done = true;
        $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']}";
        }
        SMStip("payback", $sphone, array("#ID#", "#ORDER#"), array($borrow_id, $sort_order), $borrow_id, explode(',', $smsUid));
    } else {
        $borrowDetail->rollback();
    }
    return $done;
}
예제 #16
0
 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;
 }
예제 #17
0
 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('修改失败'));
     }
 }
예제 #18
0
 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("处理失败");
         }
     }
 }
예제 #19
0
 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****************************/
 }