Exemplo n.º 1
0
function lastRepayment($binfo)
{
    $x = true;
    //因为下面有!x的判断,所以为了避免影响其他标,这里默认为true
    if ($binfo['borrow_type'] == 2) {
        $x = false;
        //返回借款人的借款担保额度
        $x = memberLimitLog($binfo['borrow_uid'], 8, $binfo['borrow_money'], $info = "{$binfo['id']}号标还款完成");
        if (!$x) {
            return false;
        }
        //返回投资人的投资担保额度
        $vocuhlist = M('borrow_vouch')->field("uid,vouch_money")->where("borrow_id={$binfo['id']}")->select();
        foreach ($vocuhlist as $vv) {
            $x = memberLimitLog($vv['uid'], 10, $vv['vouch_money'], $info = "您担保的{$binfo['id']}号标还款完成");
        }
    } elseif ($binfo['borrow_type'] == 1) {
        $x = false;
        $x = memberLimitLog($binfo['borrow_uid'], 7, $binfo['borrow_money'], $info = "{$binfo['id']}号标还款完成");
    }
    //如果是担保
    if (!$x) {
        return false;
    }
    //解冻保证金
    $_P_fee = get_global_setting();
    $accountMoney_borrower = M('member_money')->field('account_money,money_collect,money_freeze')->find($binfo['borrow_uid']);
    $datamoney_x['uid'] = $binfo['borrow_uid'];
    $datamoney_x['type'] = 24;
    $datamoney_x['affect_money'] = $binfo['borrow_money'] * $_P_fee['money_deposit'] / 100;
    $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'] - $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'];
    //会员帐户
    $datamoney_x['info'] = "对{$binfo['id']}还款完成解冻保证金";
    $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 ($bxid !== false && $x) {
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 2
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('修改失败'));
     }
 }
Exemplo n.º 3
0
    public function doEditWaitverify()
    {
        if ($_POST["isSave"] == 1) {
            unset($_POST["borrow_status"]);
        }
        $m = D(ucfirst($this->getActionName()));
        if (false === $m->create()) {
            $this->error($m->getError());
        }
        $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_status'] == 2 && $m->borrow_status != 2) {
            $this->error('已通过初审通过的借款不能改为别的状态');
            exit;
        }
        ////////////////////图片编辑///////////////////////
        foreach ($_POST['swfimglist'] as $key => $v) {
            $row[$key]['img'] = substr($v, 1);
            $row[$key]['info'] = $_POST['picinfo'][$key];
        }
        $m->updata = serialize($row);
        ////////////////////图片编辑///////////////////////
        if ($vm['borrow_status'] != 2 && $m->borrow_status == 2) {
            //新标提醒
            //newTip($m->id);
            MTip('chk8', $vm['borrow_uid'], $m->id);
            //自动投标
            if ($m->borrow_type == 1) {
                memberLimitLog($vm['borrow_uid'], 1, -$m->borrow_money, $info = "{$m->id}号标初审通过");
            } elseif ($m->borrow_type == 2) {
                memberLimitLog($vm['borrow_uid'], 2, -$m->borrow_money, $info = "{$m->id}号标初审通过");
            }
            $vss = M("members")->field("user_phone,user_name")->where("id = {$vm['borrow_uid']}")->find();
            SMStip("firstV", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $m->id), $m->id, array($vm['borrow_uid']));
        }
        //if($m->borrow_status==2) $m->collect_time = strtotime("+ {$m->collect_day} days");
        if ($m->borrow_status == 2) {
            //$m->collect_time = strtotime("+ {$m->collect_day} days");
            $m->collect_time = strtotime($m->schedular_time) + $m->collect_day * 24 * 3600;
            //$m->is_tuijian = 1;
        }
        $m->borrow_interest = getBorrowInterest($m->repayment_type, $m->borrow_money, $m->borrow_duration, $m->borrow_interest_rate);
        //保存当前数据对象
        if ($m->borrow_status == 2 || $m->borrow_status == 1) {
            $m->first_verify_time = time();
        } else {
            unset($m->first_verify_time);
        }
        unset($m->borrow_uid);
        $bs = intval($_POST['borrow_status']);
        $m->total = $m->repayment_type == 1 ? 1 : $m->borrow_duration;
        $m->reward_num = floatval($_POST["reward_type_{$_POST['reward_type']}_value"]);
        $_POST['reward_num'] = $m->reward_num;
        if (($result = $m->save()) !== false) {
            //保存成功
            if ($bs == 2 || $bs == 1) {
                $verify_info['borrow_id'] = intval($_POST['id']);
                $verify_info['deal_info'] = text($_POST['deal_info']);
                $verify_info['deal_user'] = $this->admin_id;
                $verify_info['deal_time'] = time();
                $verify_info['deal_status'] = $bs;
                if ($vm['first_verify_time'] > 0) {
                    M('borrow_verify')->save($verify_info);
                } else {
                    M('borrow_verify')->add($verify_info);
                }
            }
            $modmes = '修改成功';
            //自动投标
            if ($vm['borrow_status'] != 2 && $_POST['borrow_status'] == 2 && empty($vm['password']) == true) {
                autoInvest(intval($_POST['id']));
            }
            //群发短信、邮件
            // 			if($vm['borrow_status']<>2 && $_POST['borrow_status']==2){
            // 			}
            if ($vm['borrow_status'] != 1 && $_POST['borrow_status'] == 1) {
                MTip('chk7', $vm['borrow_uid'], $_POST['id']);
            }
            //日志记录
            if ($_POST["isSave"] == 1) {
                unset($vm["borrow_status"]);
            }
            if (empty($m->reward_type)) {
                unset($vm["reward_type"]);
            }
            saveDataLog($_POST['id'], $vm, $_POST, C('BORROW_LOG_KEY'), session('adminname'), $this->admin_id, $this->logOpType["BORROW_OPT"][0]);
            //成功提示
            if ($_POST["isSave"] == 1) {
                $modmes = "暂存成功";
            }
            $this->assign('waitSecond', '3');
            $this->assign('jumpUrl', __URL__ . "/" . session('listaction'));
            $this->success($modmes);
        } else {
            //失败提示
            $this->error('修改失败');
        }
    }
Exemplo n.º 4
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****************************/
 }
Exemplo n.º 5
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****************************/
 }
Exemplo n.º 6
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('修改失败'));
     }
 }
Exemplo n.º 7
0
 public function doEditWaitverify_1()
 {
     //执行二审yjy20140824
     $m = D(ucfirst($this->getActionName()));
     if (false === $m->create()) {
         $this->error($m->getError());
     }
     $vm = M('borrow_info')->field('borrow_uid,borrow_status,borrow_type,first_verify_time,password,updata,danbao,vouch_money,money_collect,borrow_name,borrow_money,borrow_info')->find($m->id);
     //yjy borrow_name,money
     if ($vm['borrow_status'] == 2 && $m->borrow_status != 2) {
         $this->error('已通过初审通过的借款不能改为别的状态');
         exit;
     }
     ////////////////////图片编辑///////////////////////
     if (!empty($_POST['swfimglist'])) {
         foreach ($_POST['swfimglist'] as $key => $v) {
             $row[$key]['img'] = substr($v, 1);
             $row[$key]['info'] = $_POST['picinfo'][$key];
         }
         $m->updata = serialize($row);
     }
     ////////////////////图片编辑///////////////////////
     if ($vm['borrow_status'] != 2 && $m->borrow_status == 2) {
         //新标提醒
         //newTip($m->id);
         MTip('chk8', $vm['borrow_uid'], $m->id);
         //自动投标
         if ($m->borrow_type == 1) {
             memberLimitLog($vm['borrow_uid'], 1, -$m->borrow_money, $info = "{$m->id}号标二审通过");
         } elseif ($m->borrow_type == 2) {
             memberLimitLog($vm['borrow_uid'], 2, -$m->borrow_money, $info = "{$m->id}号标二审通过");
         }
         $vss = M("members")->field("user_phone,user_name,user_email")->where("id = {$vm['borrow_uid']}")->find();
         SMStip("firstV", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $m->id));
     }
     //if($m->borrow_status==2) $m->collect_time = strtotime("+ {$m->collect_day} days");
     if ($m->borrow_status == 2) {
         $m->collect_time = strtotime("+ {$m->collect_day} days");
         //$m->is_tuijian = 1;
     }
     $m->borrow_interest = getBorrowInterest($m->repayment_type, $m->borrow_money, $m->borrow_duration, $m->borrow_interest_rate);
     //保存当前数据对象
     if ($m->borrow_status == 2 || $m->borrow_status == 1) {
         $m->first_verify_time = time();
     } else {
         unset($m->first_verify_time);
     }
     unset($m->borrow_uid);
     $bs = intval($_POST['borrow_status']);
     if ($result = $m->save()) {
         //保存成功
         if ($bs == 2 || $bs == 1) {
             $verify_info['borrow_id'] = intval($_POST['id']);
             $verify_info['deal_info'] = text($_POST['deal_info']);
             $verify_info['deal_user'] = $this->admin_id;
             $verify_info['deal_time'] = time();
             $verify_info['deal_status'] = $bs;
             if ($vm['first_verify_time'] > 0) {
                 M('borrow_verify')->save($verify_info);
             } else {
                 M('borrow_verify')->add($verify_info);
             }
         }
         if ($vm['borrow_status'] != 2 && $_POST['borrow_status'] == 2 && empty($vm['password']) == true) {
             autoInvest(intval($_POST['id']));
             //yjy 自动投标执行函数
         }
         //if($vm['borrow_status']<>2 && $_POST['borrow_status']==2)) autoInvest(intval($_POST['id']));
         alogs("doEditWait", $result, 1, '初审操作成功!');
         //管理员操作日志
         //成功提示
         //echo "ok";exit;
         //$this->sendemail();
         //$vss['user_email']='*****@*****.**';
         $sm = sendemail($vss['user_email'], '初审操作成功!', '您的借款申请初审操作成功!<br><br>借款项目:' . $vm['borrow_name'] . ', 金额:' . $vm['borrow_money'] . '元, ' . date("Y年m月d日 H:i:s", strtotime(time())) . '<br><br>说明:' . $vm['borrow_info'] . '<br><br><a href=http://www.daikuan.net>[河北贷信通]</a>');
         //yjy20140702
         $this->assign('jumpUrl', __CONTROLLER__ . "/" . session('listaction'));
         $this->success(L('修改成功'));
     } else {
         alogs("doEditWait", $result, 0, '初审操作失败!');
         //管理员操作日志
         //失败提示
         $this->error(L('修改失败'));
     }
 }
Exemplo n.º 8
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****************************/
 }
Exemplo n.º 9
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****************************/
 }
Exemplo n.º 10
0
 public function doEditWaitverify()
 {
     $m = D(ucfirst($this->getActionName()));
     if (false === $m->create()) {
         $this->error($m->getError());
     }
     $vm = M('borrow_info')->field('id,borrow_name,reward_num,borrow_money,capital_name,borrow_duration,repayment_type,borrow_interest_rate,borrow_uid,borrow_status,borrow_type,first_verify_time,password,updata,danbao,vouch_money,money_collect,can_auto')->find($m->id);
     $rate_lixt = explode("|", $this->glo['rate_lixi']);
     $borrow_duration = explode("|", $this->glo['borrow_duration']);
     $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']);
     if (floatval($_POST['borrow_interest_rate']) > $rate_lixt[1] || floatval($_POST['borrow_interest_rate']) < $rate_lixt[0]) {
         $this->error("提交的借款利率不在允许范围,请重试", 0);
         exit;
     }
     if ($m->repayment_type == '1' && ($m->borrow_duration > $borrow_duration_day[1] || $m->borrow_duration < $borrow_duration_day[0])) {
         $this->error("提交的借款期限不在允许范围,请去网站设置处重新设置系统参数", 0);
         exit;
     }
     if ($m->repayment_type != '1' && ($m->borrow_duration > $borrow_duration[1] || $m->borrow_duration < $borrow_duration[0])) {
         $this->error("提交的借款期限不在允许范围,请去网站设置处重新设置系统参数", 0);
         exit;
     }
     ////////////////////图片编辑///////////////////////
     if (!empty($_POST['swfimglist'])) {
         foreach ($_POST['swfimglist'] as $key => $v) {
             $row[$key]['img'] = substr($v, 1);
             $row[$key]['info'] = $_POST['picinfo'][$key];
         }
         $m->updata = serialize($row);
     }
     ////////////////////图片编辑///////////////////////
     if ($vm['borrow_status'] != 2 && $m->borrow_status == 2) {
         //新标提醒
         //newTip($m->id);
         MTip('chk8', $vm['borrow_uid'], $m->id);
         //自动投标
         if ($m->borrow_type == 1) {
             memberLimitLog($vm['borrow_uid'], 1, -$m->borrow_money, $info = "{$m->id}号标初审通过");
         } elseif ($m->borrow_type == 2) {
             memberLimitLog($vm['borrow_uid'], 2, -$m->borrow_money, $info = "{$m->id}号标初审通过");
         }
         $vss = M("members")->field("user_phone,user_name")->where("id = {$vm['borrow_uid']}")->find();
         SMStip("firstV", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $m->id));
     }
     //if($m->borrow_status==2) $m->collect_time = strtotime("+ {$m->collect_day} days");
     if ($m->borrow_status == 2) {
         $m->collect_time = strtotime("+ {$m->collect_day} days");
         $m->reward_num = $_POST['reward_num'];
         //$m->is_tuijian = 1;
     }
     $m->money_invest_place = intval($_POST['money_invest_place']);
     $m->borrow_interest = getBorrowInterest($m->repayment_type, $m->borrow_money, $m->borrow_duration, $m->borrow_interest_rate);
     //保存当前数据对象
     if ($m->borrow_status == 2 || $m->borrow_status == 1) {
         $m->first_verify_time = time();
     } else {
         unset($m->first_verify_time);
     }
     unset($m->borrow_uid);
     $bs = intval($_POST['borrow_status']);
     //新加接口数据准备
     $toId = M('member_to')->where(array('username' => array('like', $vm['capital_name'])))->getField('id');
     if (empty($toId)) {
         $toId = M('member_to')->add(array('username' => $vm['capital_name']));
     }
     //按天到期还款、一次性还款    4
     //按月分期还款  3
     //每月还息到期还本  1
     $lilv = array(1 => 4, 5 => 4, 2 => 3, 4 => 1);
     $yottarr = array('subject_id' => $m->id, 'is_test' => '0', 'type' => 0, 'name' => $m->borrow_name, 'borrow_type' => '1', 'desc' => $m->borrow_info, 'reward' => $vm['reward_num'], 'reward_type' => '1', 'url' => MU("Home/invest", "invest", array("id" => $m->id, "suffix" => C("URL_HTML_SUFFIX")), true), 'borrow_username' => $toId, 'account' => $m->borrow_money, 'period' => $m->borrow_duration, 'period_type' => 1 == $m->repayment_type ? 1 : 0, 'apr' => $m->borrow_interest_rate, 'repay_style' => $lilv[$m->repayment_type], 'status' => '2', 'addtime' => time());
     //结束新加
     if ($result = $m->save()) {
         //保存成功
         if (2 == $bs && $this->yott()) {
             $yott = new yott();
             $res = json_decode($yott->createP2p($yottarr));
             //记录日志
             M('yott_log')->add(array('dateline' => time(), 'apitype' => 'createp2p', 'apidata' => json_encode($yottarr), 'code' => $res->code, 'msg' => $res->msg));
         }
         if ($bs == 2 || $bs == 1) {
             $verify_info['borrow_id'] = intval($_POST['id']);
             $verify_info['deal_info'] = text($_POST['deal_info']);
             $verify_info['deal_user'] = $this->admin_id;
             $verify_info['deal_time'] = time();
             $verify_info['deal_status'] = $bs;
             if ($vm['first_verify_time'] > 0) {
                 M('borrow_verify')->save($verify_info);
             } else {
                 M('borrow_verify')->add($verify_info);
             }
         }
         if ($vm['borrow_status'] != 2 && $_POST['borrow_status'] == 2 && $vm['can_auto'] == 1 && empty($vm['password']) == true) {
             if ($vm['borrow_type'] != 3) {
                 autoInvest(intval($_POST['id']));
             }
         }
         //if($vm['borrow_status']<>2 && $_POST['borrow_status']==2)) autoInvest(intval($_POST['id']));
         alogs("doEditWait", $result, 1, '初审操作成功!');
         //管理员操作日志
         //成功提示
         $this->assign('jumpUrl', __URL__ . "/" . session('listaction'));
         $this->success(L('修改成功'));
     } else {
         alogs("doEditWait", $result, 0, '初审操作失败!');
         //管理员操作日志
         //失败提示
         $this->error(L('修改失败'));
     }
 }
Exemplo n.º 11
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****************************/
 }
Exemplo n.º 12
0
 public function doEditWaitverify()
 {
     $result = 1;
     $m = D(ucfirst($this->getActionName()));
     if (false === $m->create()) {
         $this->error($m->getError());
     }
     $borrow_info_id = $m->id;
     $vm = M('borrow_info as bi')->field('bi.borrow_name,bi.borrow_min,bi.borrow_uid,bi.borrow_status,bi.borrow_type,bi.first_verify_time,bi.password,bi.updata,bi.danbao,bi.vouch_money,bi.money_collect,bi.can_auto,bi.add_time,bi.toubiao_telephone,bd.house,bd.mortgage,bd.contract,bd.credit,bd.bank,bd.marriage,bd.identity,bd.source,bd.pledge,bd.risk')->JOIN("lzh_borrow_detail as bd on bi.id=bd.bid", "LEFT")->where("bi.id=" . $m->id)->find();
     $rate_lixt = explode("|", $this->glo['rate_lixi']);
     $borrow_duration = explode("|", $this->glo['borrow_duration']);
     $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']);
     if (floatval($_POST['borrow_interest_rate']) > $rate_lixt[1] || floatval($_POST['borrow_interest_rate']) < $rate_lixt[0]) {
         $this->error("提交的借款利率超出允许范围,请重试", 0);
         exit;
     }
     if ($m->repayment_type == '1' && ($m->borrow_duration > $borrow_duration_day[1] || $m->borrow_duration < $borrow_duration_day[0])) {
         $this->error("提交的借款期限超出允许范围,请去网站设置处重新设置系统参数", 0);
         exit;
     }
     if ($m->repayment_type != '1' && ($m->borrow_duration > $borrow_duration[1] || $m->borrow_duration < $borrow_duration[0])) {
         $this->error("提交的借款期限超出允许范围,请去网站设置处重新设置系统参数", 0);
         exit;
     }
     ////////////////////图片编辑///////////////////////
     if (!empty($_POST['swfimglist'])) {
         foreach ($_POST['swfimglist'] as $key => $v) {
             $row[$key]['img'] = substr($v, 1);
             $row[$key]['info'] = $_POST['picinfo'][$key];
         }
         $m->updata = serialize($row);
     }
     ////////////////////图片编辑///////////////////////
     if ($vm['borrow_status'] != 2 && $m->borrow_status == 2) {
         MTip('chk8', $vm['borrow_uid'], $m->id);
         //自动投标
         if ($m->borrow_type == 1) {
             memberLimitLog($vm['borrow_uid'], 1, -$m->borrow_money, $info = "{$m->id}号标初审通过");
         } elseif ($m->borrow_type == 2) {
             memberLimitLog($vm['borrow_uid'], 2, -$m->borrow_money, $info = "{$m->id}号标初审通过");
         }
         $vss = M("members")->field("user_phone,user_name")->where("id = {$vm['borrow_uid']}")->find();
         SMStip("firstV", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $m->id));
     }
     if ($m->borrow_status == 2) {
         $m->collect_time = strtotime("+ {$m->collect_day} days");
         //$m->is_tuijian = 1;
     }
     $m->borrow_interest = getBorrowInterest($m->repayment_type, $m->borrow_money, $m->borrow_duration, $m->borrow_interest_rate);
     //保存当前数据对象
     $add_times = date("Y-m-d", $vm['add_time']);
     $sum = intval($_POST['borrow_duration']);
     $m->deadline = strtotime(date("Y-m-d", strtotime("{$add_times} +{$sum} month")));
     if ($m->borrow_status == 2 || $m->borrow_status == 1) {
         $m->first_verify_time = time();
     } else {
         unset($m->first_verify_time);
     }
     unset($m->borrow_uid);
     $bs = intval($_POST['borrow_status']);
     $m->toubiao_telephone = trim($_POST['toubiao_telephone']);
     $m->toubiao_telephone = trim($_POST['is_new']);
     //添加新的数据信息到borrow_detail表里面 20150727
     $bd = M("borrow_detail");
     $bd->bid = $_POST['bid'];
     $bd->house = $_POST['house'];
     $bd->mortgage = $_POST['mortgage'];
     $bd->contract = $_POST['contract'];
     $bd->credit = $_POST['credit'];
     $bd->bank = $_POST['bank'];
     $bd->marriage = $_POST['marriage'];
     $bd->identity = $_POST['identity'];
     $bd->description = $_POST['description'];
     $bd->source = $_POST['source'];
     $bd->pledge = $_POST['pledge'];
     $bd->risk = $_POST['risk'];
     $has_bid = $bd->getFieldByBid($m->id, "bdid");
     unset($bd->id);
     if ($has_bid) {
         $res = $bd->data($bd->create())->where("bdid=" . $has_bid)->save();
     } else {
         $res = $bd->add();
     }
     if ($result = $m->save() && $res) {
         //保存成功
         if ($bs == 2 || $bs == 1) {
             $verify_info['borrow_id'] = intval($_POST['id']);
             $verify_info['deal_info'] = text($_POST['deal_info']);
             $verify_info['deal_user'] = $this->admin_id;
             $verify_info['deal_time'] = time();
             $verify_info['deal_status'] = $bs;
             if ($vm['first_verify_time'] > 0) {
                 M('borrow_verify')->save($verify_info);
             } else {
                 M('borrow_verify')->add($verify_info);
             }
         }
         //初审未通过
         if ($bs == 1) {
             addInnerMsg($vm['borrow_uid'], "初审未通过", $_POST['deal_info']);
         } else {
             if ($bs == 2) {
                 if ($vm['borrow_min'] < 5000) {
                     $db_push = M('cailaipush.information', 'push_');
                     $db_push->member_id = $vm['borrow_uid'];
                     $db_push->title = '新标上线';
                     $db_push->content = $vm['borrow_name'];
                     $db_push->borrow_id = $borrow_info_id;
                     $db_push->range_type = 1;
                     $db_push->flag = 0;
                     $db_push->insert_time = time();
                     $db_push->add();
                 }
             }
         }
         //自动投标
         if ($vm['borrow_status'] != 2 && $_POST['borrow_status'] == 2 && $vm['can_auto'] == 1 && empty($vm['password']) == true && strlen($vm['toubiao_telephone']) < 11) {
             autoInvest(intval($_POST['id']));
         }
         alogs("doEditWait", $result, 1, '初审操作成功!');
         //管理员操作日志
         //成功提示
         $this->assign('jumpUrl', __URL__ . "/" . session('listaction'));
         $this->success(L('修改成功'));
     } else {
         alogs("doEditWait", $result, 0, '初审操作失败!');
         //管理员操作日志
         //失败提示
         $this->error(L('修改失败'));
     }
 }