예제 #1
0
 public function userinfo()
 {
     //自动对帐
     $usr = M("members")->field("usrid")->where("id=" . $this->uid)->find();
     $usrid = $usr['usrid'];
     import("ORG.Huifu.Huifu");
     $huifu = new Huifu();
     $result = $huifu->queryBalanceBg($usrid);
     if (strcmp($result['RespCode'], "000") == 0) {
         $accountval = $result['AvlBal'];
         $freezeval = $result['FrzBal'];
         $moneyinfo = M("member_money")->where("uid=" . $this->uid)->find();
         $account_money = str2val_money($accountval) - str2val_money($moneyinfo['back_money']);
         $freeze_money = str2val_money($freezeval);
         $data['money_freeze'] = $freeze_money;
         $data['account_money'] = $account_money;
         M("member_money")->where("uid=" . $this->uid)->save($data);
     } else {
         header("Content-type: text/html; charset=utf-8");
         echo $_POST['RespDesc'];
     }
     //结束
     $mess = array();
     $mess['uid'] = intval(session("u_id"));
     $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where("id={$mess['uid']}")->find();
     $mess['username'] = $vo['user_name'];
     $mess['phone'] = intval(session("u_user_phone"));
     $mess['head'] = get_avatar($mess['uid']);
     //头像
     $minfo = getMinfo($mess['uid'], true);
     $mess['credits'] = getLeveIco($minfo['credits'], 3);
     //会员等级
     $membermoney = M("member_money")->field(true)->where("uid={$mess['uid']}")->find();
     if (is_array($membermoney)) {
         $mess['mayuse'] = $membermoney['account_money'] + $membermoney['back_money'];
         //可用
         $mess['freeze'] = $membermoney['money_freeze'];
         //冻结
         $mess['collect'] = $membermoney['money_collect'];
         //代收
         $mess['total'] = $mess['mayuse'] + $mess['freeze'] + $mess['collect'];
         //总额
     } else {
         $mess['total'] = 0;
         $mess['mayuse'] = 0;
         $mess['freeze'] = 0;
         $mess['collect'] = 0;
     }
     ajaxmsg($mess);
 }
예제 #2
0
 public function duizhang()
 {
     $usrid = isset($_GET['usrid']) ? $_GET['usrid'] : "6000060023304729";
     $debug = $_REQUEST['debug'] ? $_REQUEST['debug'] : '';
     import("ORG.Huifu.Huifu");
     $huifu = new Huifu();
     $res = $huifu->queryBalanceBg($usrid);
     if ($debug != '') {
         echo "<pre>";
         print_r($res);
         echo "</pre>";
     } else {
         echo json_encode($res);
     }
 }
예제 #3
0
 /**
 +----------------------------------------------------------
 * 默认操作   即使数据
 +----------------------------------------------------------
 */
 public function duizhang()
 {
     if (empty($_POST) || empty($_POST[searchtel])) {
         //分页处理
         import("ORG.Util.Page");
         $dbObj = M('member_moneyfuto mf');
         $total = $dbObj->count();
         $p = new Page($total, 2);
         $page = $p->show();
         $Lsql = "{$p->firstRow},{$p->listRows}";
         $data = $dbObj->where('1=1')->order('uid ASC')->limit($Lsql)->select();
         $dbObj = M('member_info');
         //获取分页的条数
         $backlist = array();
         $row = null;
         $lenght = count($data);
         for ($i = 0; $i < $lenght; $i++) {
             $uid = $data[$i]['uid'];
             $row = $dbObj->field('real_name,cell_phone')->where("uid='{$uid}'")->find();
             $backlist[$i]['blackname'] = $row['real_name'];
             $backlist[$i]['id'] = $uid;
             $backlist[$i]['telephone'] = $row['cell_phone'];
             $backlist[$i]['locmoney'] = $data[$i]['money_usable'];
             $backlist[$i]['money_freeze'] = $data[$i]['money_freeze'];
             $backlist[$i]['money'] = $data[$i]['money_count'];
             $backlist[$i]['Webmoney_money'] = $data[$i]['AvlBal'];
             $backlist[$i]['Webmoney_freeze'] = $data[$i]['FrzBal'];
             $backlist[$i]['Acc'] = $data[$i]['AccBal'];
             //   echo $data[$i]['is_unsual'],'<br/>';
             $backlist[$i]['flage'] = $data[$i]['is_unsual'] == '1' ? 'red' : '';
             //   if($data[$i]['flage'])
         }
         $this->assign('page', $page);
         $this->assign('backlist', $backlist);
         $this->display();
         return;
     }
     $phone = $_POST['searchtel'];
     $pre = C('DB_PREFIX');
     $members = M('members m');
     $data = $members->field("m.usrid as usrid,m.id as id,m.user_name as telephone,\n          mm.money_freeze as money_freeze,mm.account_money as account_money,mm.back_money as back_money")->where("m.user_name='{$phone}' AND usrid !=''")->join("{$pre}member_money mm ON mm.uid=m.id")->select();
     $members = M('member_info');
     import("ORG.Huifu.Huifu");
     $huifu = new Huifu();
     $lenght = count($data);
     for ($i = 0; $i < $lenght; $i++) {
         $id = $data[$i]['id'];
         $name = $members->field('real_name')->where("uid={$id}")->find();
         $data[$i]['locmoney'] = number_format($data[$i]['account_money'] + $data[$i]['back_money'], 2);
         $data[$i]['money'] = number_format($data[$i]['account_money'] + $data[$i]['back_money'] + $data[$i]['money_freeze'], 2);
         $data[$i]['blackname'] = '<b>' . $name['real_name'] . '</b>';
         $data[$i]['money_freeze'] = number_format($data[$i]['money_freeze'], 2);
         $res = $huifu->queryBalanceBg($data[$i]['usrid']);
         $data[$i]['Webmoney_freeze'] = $res['FrzBal'];
         $data[$i]['Webmoney_money'] = $res['AvlBal'];
         $data[$i]['Acc'] = $res['AcctBal'];
         if ($data[$i]['Acc'] != $data[$i]['money']) {
             $data[$i]['flage'] = 'red';
         } else {
             $data[$i]['flage'] = '';
         }
     }
     $this->assign('backlist', $data);
     $this->display();
 }
예제 #4
0
파일: von.php 프로젝트: GStepOne/CI
//整合数据一部分是数据库,一部分是web端应用
$select = "SELECT real_name FROM lzh_member_info WHERE ";
// $where="1=2";
$sql = '';
$Money_data = array();
$lenght = count($data);
for ($i = 0; $i < $lenght; $i++) {
    $id = $data[$i]['id'];
    $Money_data[$i]['uid'] = $id;
    $sql = $select . "uid={$id}";
    $name = mysql_query($sql, $mysqllink);
    $Money_data[$i]['locmoney'] = $data[$i]['account_money'] + $data[$i]['back_money'];
    $Money_data[$i]['money'] = $data[$i]['account_money'] + $data[$i]['back_money'] + $data[$i]['money_freeze'];
    $Money_data[$i]['blackname'] = $name[$i]['blackname'];
    $Money_data[$i]['money_freeze'] = $data[$i]['money_freeze'];
    $res = $huifu->queryBalanceBg($data[$i]['usrid']);
    $Money_data[$i]['FrzBal'] = $res['FrzBal'];
    $Money_data[$i]['FrzBal'] = explode(',', $Money_data[$i]['FrzBal']);
    $Money_data[$i]['FrzBal'] = implode('', $Money_data[$i]['FrzBal']);
    $Money_data[$i]['AvlBal'] = $res['AvlBal'];
    $Money_data[$i]['AvlBal'] = implode('', explode(',', $Money_data[$i]['AvlBal']));
    $Money_data[$i]['AcctBal'] = $res['AcctBal'];
    $Money_data[$i]['AcctBal'] = implode('', explode(',', $Money_data[$i]['AcctBal']));
    //var_dump($res['AcctBal'],$Money_data[$i]['AcctBal']);
    // echo $Money_data[$i]['AcctBal'].'|'.$Money_data[$i]['money'].'|'.'<br/>';
    if (floatval($Money_data[$i]['AcctBal']) == floatval($Money_data[$i]['money'])) {
        $Money_data[$i]['flage'] = 'red';
    } else {
        $Money_data[$i]['flage'] = '';
    }
}
예제 #5
0
 public function duizhang()
 {
     $usr = M("members")->field("usrid")->where("id=" . $this->uid)->find();
     $usrid = $usr['usrid'];
     import("ORG.Huifu.Huifu");
     $huifu = new Huifu();
     $result = $huifu->queryBalanceBg($usrid);
     if (strcmp($result['RespCode'], "000") == 0) {
         $accountval = $result['AvlBal'];
         $freezeval = $result['FrzBal'];
         $moneyinfo = M("member_money")->where("uid=" . $this->uid)->find();
         $account_money = str2val_money($accountval) - str2val_money($moneyinfo['back_money']);
         $freeze_money = str2val_money($freezeval);
         $data['money_freeze'] = $freeze_money;
         $data['account_money'] = $account_money;
         M("member_money")->where("uid=" . $this->uid)->save($data);
     } else {
         header("Content-type: text/html; charset=utf-8");
         echo $_POST['RespDesc'];
     }
 }
예제 #6
0
 public function duizhang()
 {
     $usrid = "6000060000699141";
     import("ORG.Huifu.Huifu");
     $huifu = new Huifu();
     $res = $huifu->queryBalanceBg($usrid);
     echo "<pre>";
     print_r($res);
     echo "</pre>";
 }
예제 #7
0
 public function autorepayment()
 {
     $token = $_GET['key'];
     $config = file_get_contents($this->updir . 'config.txt');
     list($startime, $condition, $key) = explode('|', $config, 3);
     if ($key != $token) {
         exit('服务器拒绝响应');
     }
     $glodata = get_global_setting();
     $pre = C("DB_PREFIX");
     $strOut = "<br/>-----------正在执行企业直投自动还款程序:服务器当前时间" . date("Y-m-d H:i:s", time()) . "---------------<br/>";
     $transfer_investor_detail = M('transfer_investor_detail');
     $map = array();
     //$map['deadline'] = array("lt",time()+86400);
     $map['status'] = 7;
     $field = 'id,invest_id,interest,investor_uid,borrow_uid,borrow_id,capital,interest_fee,sort_order';
     $lists = $transfer_investor_detail->field($field)->where($map)->select();
     //$this->pre($lists);
     if (empty($lists)) {
         return -1;
     }
     import("ORG.Huifu.Huifu");
     $Huifu = new Huifu();
     $Updateb = M('transfer_investor_detail');
     $transfer_investor_detail->startTrans();
     foreach ($lists as $rows) {
         $usrid = M('members')->getFieldById($rows['borrow_uid'], 'Usrid');
         $respose = $Huifu->queryBalanceBg($usrid);
         $acctBal = str2val_money($respose['AcctBal']);
         $this->pre($acctBal);
         $accountMoney_borrower = M('member_money')->field('money_freeze,money_collect,account_money,back_money')->find($v['borrow_uid']);
         if ($accountMoney_borrower['account_money'] + $accountMoney_borrower['back_money'] < $v['capital'] + $v['interest']) {
             return "帐户可用余额不足,本期还款共需" . ($v['capital'] + $v['interest']) . "元,请先充值!";
         }
         //借款者减少
         $datamoney_x['uid'] = $v['borrow_uid'];
         $datamoney_x['type'] = 11;
         $datamoney_x['affect_money'] = -($v['capital'] + $v['interest']);
         if ($datamoney_x['affect_money'] + $accountMoney_borrower['back_money'] < 0) {
             //如果需要还款的金额大于回款资金池资金总额
             $datamoney_x['account_money'] = floatval($accountMoney_borrower['account_money'] + $accountMoney_borrower['back_money'] + $datamoney_x['affect_money']);
             $datamoney_x['back_money'] = 0;
         } else {
             $datamoney_x['account_money'] = $accountMoney_borrower['account_money'];
             $datamoney_x['back_money'] = floatval($accountMoney_borrower['back_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'];
         $mmoney_x['back_money'] = $datamoney_x['back_money'];
         //会员帐户
         $datamoney_x['info'] = "对{$v['borrow_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);
         }
         //借款者减少
         $vo = M("transfer_borrow_investor")->field("transfer_month,transfer_num")->where("id={$v['invest_id']}")->find();
         $update_investor = array();
         $update_investor['id'] = $v['invest_id'];
         $update_investor['status'] = 2;
         //还款完成
         $update_investor['receive_capital'] = array("exp", "`receive_capital`+{$v['capital']}");
         $update_investor['receive_interest'] = array("exp", "`receive_interest`+{$v['interest']}-{$v['interest_fee']}");
         $update_investor['back_time'] = time();
         $investor = M("transfer_borrow_investor")->save($update_investor);
         $update_borrow = array();
         $update_borrow['id'] = $v['borrow_id'];
         $update_borrow['transfer_back'] = array("exp", "`transfer_back`+{$vo['transfer_num']}");
         $update_borrow['borrow_status'] = 7;
         //还款完成
         $summary = M("transfer_borrow_info")->save($update_borrow);
         $mapdetail['id'] = $v['id'];
         $updetail['status'] = 1;
         //还款完成
         $updetail['receive_capital'] = array("exp", "`receive_capital`+{$v['capital']}");
         $updetail['receive_interest'] = array("exp", "`receive_interest`+{$v['interest']}-{$v['interest_fee']}");
         $updetail['repayment_time'] = time();
         $detail = M("transfer_investor_detail")->where($mapdetail)->save($updetail);
         //$strOut .= "成功还款第{$v['borrow_id']}号企业直投<br/>";
         ////////////////////////////////////////////////////对投资帐户进行增加  开始//////////////////////////////////////////////////
         if ($investor && $summary && $detail) {
             $accountMoney = M('member_money')->field('money_freeze,money_collect,account_money,back_money')->find($v['investor_uid']);
             $datamoney['uid'] = $v['investor_uid'];
             $datamoney['type'] = "44";
             $datamoney['affect_money'] = $v['capital'] + $v['interest'] - $v['interest_fee'];
             //收利息加本金,并且扣管理费
             $datamoney['account_money'] = $accountMoney['account_money'];
             $datamoney['back_money'] = $accountMoney['back_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'];
             $mmoney['back_money'] = $datamoney['back_money'];
             //会员帐户
             $datamoney['info'] = "收到借款人对{$v['borrow_id']}号企业直投的还款";
             $datamoney['add_time'] = time();
             $datamoney['add_ip'] = get_client_ip();
             $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);
             }
         }
         ////////////////////////////////////////////////////对投资帐户进行增加 结束//////////////////////////////////////////////////
     }
     if ($investor && $summary && $detail && $moneynewid && $xid) {
         $Updateb->commit();
         $strOut .= "成功还款第{$v['borrow_id']}号企业直投<br/>";
     } else {
         $strOut .= "第{$v['borrow_id']}号企业直投还款失败<br/>";
         $Updateb->rollback();
     }
     $data = $strOut . "\r\n" . date("Y-m-d H:i:s", time());
     //服务器时间
     echo $data;
 }