Example #1
0
/**
* 获得用户余额
* @param int $user_id
* @param int $user_type
* @return 
* 	 * 			pMerCode 6 “平台”账号 否 由IPS颁发的商户号
				pErrCode 4 返回状态 否 0000成功; 9999失败;
				pErrMsg 100 返回信息 否 状态0000:成功 除此乊外:反馈实际原因
				pIpsAcctNo 30 IPS账户号 否 查询时提交
				pBalance 10 可用余额 否 带正负符号,带小数点,最多保留两位小数
				pLock 10 冻结余额 否 带正负符号,带小数点,最多保留两位小数
				pNeedstl 10 未结算余额 否 带正负符号,带小数点,最多保留两位小数
*/
function GetIpsUserMoney($user_id, $user_type = 0)
{
    $class_name = getCollName();
    require_once APP_ROOT_PATH . "system/collocation/" . $class_name . "_collocation.php";
    $collocation_class = $class_name . "_collocation";
    $collocation_object = new $collocation_class();
    $result = $collocation_object->QueryForAccBalance($user_id, $user_type);
    return $result;
}
 public function relation_export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     if (isset($_REQUEST['id']) && intval(strim($_REQUEST['id'])) > 0) {
     } else {
         return;
     }
     if ($limit) {
         $limit = " limit " . $limit;
     }
     $className = getCollName();
     //环迅
     if (strtolower($className) == "ips") {
         $condition = " where  1=1 ";
         $condition .= " and t.pid = " . intval(strim($_REQUEST['id']));
         $GLOBALS['tmpl']->assign('id', intval(strim($_REQUEST['id'])));
         $sql = "select t.*,t.id as mid,l.* from " . DB_PREFIX . "ips_transfer_detail as t LEFT JOIN " . DB_PREFIX . "ips_transfer it on t.pid = it.id\r\n\tLEFT JOIN " . DB_PREFIX . "deal_load l on l.deal_id = it.deal_id ";
         $count_sql = "select count(*) from " . DB_PREFIX . "ips_transfer_detail as t \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "ips_transfer it on t.pid = it.id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load l on l.deal_id = it.deal_id ";
         $list = $GLOBALS['db']->getAll($sql . $condition . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
         //print_r($count);die;
         //$name=$this->getActionName();
     } elseif (strtolower($className) == "yeepay") {
         $condition = " where  bizType = 'TENDER' and is_complete_transaction = 1 and t.code ='1' and is_callback = 1 ";
         $condition .= " and t.id = " . intval(strim($_REQUEST['id']));
         $GLOBALS['tmpl']->assign('id', intval(strim($_REQUEST['id'])));
         $sql = "select t.*,t.id as mid,l.*,u.user_name, 'Y' as pStatus,FROM_UNIXTIME(t.update_time,'%Y-%m-%d') as pIpsDetailTime,\r\n\t\t\trequestNo as pIpsDetailBillNo,l.money as pTrdAmt,fee as pIpsFee\r\n\t\t\t from " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load l on l.deal_id = t.tenderOrderNo and l.pMerBillNo = t.requestNo \r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = t.platformUserNo ";
         $count_sql = "select count(*) from " . DB_PREFIX . "yeepay_cp_transaction as t \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load l on l.deal_id = t.tenderOrderNo and l.pMerBillNo = t.requestNo \r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = t.platformUserNo ";
         $list = $GLOBALS['db']->getAll($sql . $condition . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     } elseif (strtolower($className) == "baofoo") {
         $condition = " where  action_type = '2' and t.code ='CSD000' and is_callback = 1 ";
         $condition .= " and t.id = " . intval(strim($_REQUEST['id']));
         $GLOBALS['tmpl']->assign('id', intval(strim($_REQUEST['id'])));
         $sql = "select t.*,t.id as mid,l.*,u.user_name,FROM_UNIXTIME(req_time/1000,'%Y-%m-%d') as pIpsDetailTime,\r\n\t\t\torder_id as pIpsDetailBillNo,l.money as pTrdAmt,fee as pIpsFee,'Y' as pStatus\r\n\t\t\t from " . DB_PREFIX . "baofoo_business as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load l on l.deal_id = t.cus_id and l.pMerBillNo = t.order_id \r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = t.load_user_id ";
         $count_sql = "select count(*) from " . DB_PREFIX . "baofoo_business as t \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load l on l.deal_id = t.cus_id and l.pMerBillNo = t.order_id \r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = t.load_user_id ";
         $list = $GLOBALS['db']->getAll($sql . $condition . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
         //print_r($count);die;
         //$name=$this->getActionName();
     }
     if ($list) {
         register_shutdown_function(array(&$this, 'relation_export_csv'), $page + 1);
         $list_value = array('id' => '""', 'user_name' => '""', 'pTrdAmt' => '""', 'pStatus' => '""', 'pIpsDetailTime' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,投资人,交易金额,转账状态,明细处理时间");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $list_value["id"] = '"' . iconv('utf-8', 'gbk', $v["mid"]) . '"';
             $list_value["user_name"] = '"' . iconv('utf-8', 'gbk', $v["user_name"]) . '"';
             $list_value["pTrdAmt"] = '"' . iconv('utf-8', 'gbk', $v["pTrdAmt"]) . '"';
             if (strim($v["pStatus"])) {
                 $list_value["pStatus"] = '"' . iconv('utf-8', 'gbk', l("P_TRANSFER_STATUS_" . $v["pStatus"])) . '"';
             } else {
                 $list_value["pStatus"] = "";
             }
             $list_value["pIpsDetailTime"] = '"' . iconv('utf-8', 'gbk', $v["pIpsDetailTime"]) . '"';
             $content .= implode(",", $list_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=order_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
 function SincerityGoldUnfreeze()
 {
     $user_id = intval(strim($_REQUEST['user_id']));
     $user_type = intval(strim($_REQUEST['user_type']));
     $freezeRequestNo = floatval(strim($_REQUEST['freezeRequestNo']));
     $deal_id = intval(strim($_REQUEST['deal_id']));
     $pTrdBnkCode = strim($_REQUEST['pTrdBnkCode']);
     $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
     if (empty($data)) {
         showErr('用户不存在', 0);
     } else {
         if (!empty($data['ips_acct_no'])) {
             $class_name = getCollName();
             require_once APP_ROOT_PATH . "system/collocation/" . $class_name . "_collocation.php";
             $collocation_class = $class_name . "_collocation";
             $collocation_object = new $collocation_class();
             $collocation_object->set_mobile_sys();
             $collocation_code = $collocation_object->SincerityGoldUnfreeze($user_id, $user_type, $freezeRequestNo, $deal_id, $pTrdBnkCode);
             print_r($collocation_code);
         } else {
             showErr('该用户还未申请过资金托管帐户', 0);
         }
     }
 }
Example #4
0
 public function bank()
 {
     $bank_list = $GLOBALS['db']->getAll("SELECT ub.*,b.icon FROM " . DB_PREFIX . "user_bank ub left join " . DB_PREFIX . "bank b on ub.bank_id=b.id  where user_id=" . intval($GLOBALS['user_info']['id']) . " ORDER BY id ASC");
     foreach ($bank_list as $k => $v) {
         $bank_list[$k]['bankcode'] = str_replace(" ", "", $v['bankcard']);
     }
     $GLOBALS['tmpl']->assign("bank_list", $bank_list);
     make_delivery_region_js();
     if (app_conf("OPEN_IPS") > 0) {
         if (strtolower(getCollName()) == "yeepay") {
             $yee_bank = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "yeepay_bind_bank_card where is_callback =1 and code =1 and platformUserNo = " . intval($GLOBALS['user_info']['id']));
             $GLOBALS['tmpl']->assign("yee_bank", $yee_bank);
             $GLOBALS['tmpl']->assign("is_yee", 1);
         }
         //手续费
         $fee_config = load_auto_cache("user_carry_config");
         $json_fee = array();
         foreach ($fee_config as $k => $v) {
             $json_fee[] = $v;
             if ($v['fee_type'] == 1) {
                 $fee_config[$k]['fee_format'] = $v['fee'] . "%";
             } else {
                 $fee_config[$k]['fee_format'] = format_price($v['fee']);
             }
         }
         $GLOBALS['tmpl']->assign("fee_config", $fee_config);
         $GLOBALS['tmpl']->assign("json_fee", json_encode($json_fee));
     }
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_CARRY']);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_money_carry_bank.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
Example #5
0
 public function transfer_export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     $start_time = strim($_REQUEST['start_time']);
     $end_time = strim($_REQUEST['end_time']);
     $d = explode('-', $start_time);
     if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
         exit;
     }
     $d = explode('-', $end_time);
     if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
         exit;
     }
     if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
         $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
         exit;
     }
     if ($limit) {
         $limit = " limit " . $limit;
     }
     $className = getCollName();
     //环迅
     if (strtolower($className) == "ips") {
         $where = " where pErrCode ='MG00000F' ";
         if (isset($_REQUEST['user_name']) && intval(strim($_REQUEST['user_name'])) >= 0) {
             $where .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $where .= " and UNIX_TIMESTAMP(pDwDate) >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $where .= " and UNIX_TIMESTAMP(pDwDate) <=" . to_timespan(strim($end_time));
         }
         $list = $GLOBALS['db']->getAll("select a.*,u.user_name from " . DB_PREFIX . "ips_do_dw_trade a left join " . DB_PREFIX . "user u on a.user_id = u.id " . $where . $limit);
         $list_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "ips_do_dw_trade " . $where);
         foreach ($list as $k => $v) {
             $list[$k]["user_type"] = l('P_USER_TYPE_' . $v["user_type"]);
             $list[$k]["pAcctType"] = l('P_ACCT_TYPE_' . $v["pAcctType"]);
             $list[$k]["pOutType"] = l('P_OUT_TYPE_' . $v["pOutType"]);
             $list[$k]["pIpsFeeType"] = l('P_IPS_FEE_TYPE_' . $v["pIpsFeeType"]);
         }
     } elseif (strtolower($className) == "yeepay") {
         $where = " where yw.code ='1' and yw.is_callback = 1 ";
         if (isset($_REQUEST['user_name']) && intval(strim($_REQUEST['user_name'])) >= 0) {
             $where .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $where .= " and yw.create_time >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $where .= " and yw.create_time <=" . to_timespan(strim($end_time));
         }
         $y_sql = "select yw.id, requestNo  as pIpsBillNo,u.real_name as pRealName,u.user_name,u.user_type,1 as pOutType,\r\n\t\t\tFROM_UNIXTIME(yw.create_time ,'%Y-%m-%d')as pDwDate,amount as pTrdAmt,fee as pMerFee , \r\n\t\t\tu.idno as pIdentNo,\r\n\t\t\tcase when feeMode ='PLATFORM' then 1 else 2 end as pIpsFeeType\r\n\t\t\t from " . DB_PREFIX . "yeepay_withdraw yw left join " . DB_PREFIX . "user u on yw.platformUserNo = u.id " . $where . $limit;
         $list = $GLOBALS['db']->getAll($y_sql);
         $list_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "yeepay_withdraw yw left join " . DB_PREFIX . "user u on yw.platformUserNo = u.id " . $where);
         foreach ($list as $k => $v) {
             $list[$k]["user_type"] = l('P_USER_TYPE_' . $v["user_type"]);
             $list[$k]["pAcctType"] = l('P_ACCT_TYPE_' . $v["pAcctType"]);
             $list[$k]["pOutType"] = l('P_OUT_TYPE_' . $v["pOutType"]);
             $list[$k]["pIpsFeeType"] = l('P_IPS_FEE_TYPE_' . $v["pIpsFeeType"]);
         }
     } elseif (strtolower($className) == "baofoo") {
         $where = " where yw.code ='CSD000' and yw.is_callback = 1 ";
         if (isset($_REQUEST['user_name']) && intval(strim($_REQUEST['user_name'])) >= 0) {
             $where .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $where .= " and yw.create_time >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $where .= " and yw.create_time <=" . to_timespan(strim($end_time));
         }
         $y_sql = "select yw.id, order_id as pIpsBillNo,u.real_name as pRealName,u.user_name,u.user_type,1 as pOutType,\r\n\t\t\tFROM_UNIXTIME(yw.create_time ,'%Y-%m-%d')as pDwDate,amount as pTrdAmt,fee as pMerFee , \r\n\t\t\tu.idno as pIdentNo,\r\n\t\t\tfee_taken_on as pIpsFeeType\r\n\t\t\t from " . DB_PREFIX . "baofoo_fo_charge yw left join " . DB_PREFIX . "user u on yw.user_id = u.id " . $where . $limit;
         $list = $GLOBALS['db']->getAll($y_sql);
         $list_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "baofoo_fo_charge yw left join " . DB_PREFIX . "user u on yw.user_id = u.id " . $where);
         foreach ($list as $k => $v) {
             $list[$k]["user_type"] = l('P_USER_TYPE_' . $v["user_type"]);
             $list[$k]["pAcctType"] = l('P_ACCT_TYPE_' . $v["pAcctType"]);
             $list[$k]["pOutType"] = l('P_OUT_TYPE_' . $v["pOutType"]);
             $list[$k]["pIpsFeeType"] = l('P_IPS_FEE_TYPE_' . $v["pIpsFeeType"]);
         }
     }
     if ($list) {
         register_shutdown_function(array(&$this, 'transfer_export_csv'), $page + 1);
         $list_value_old = array('id' => '""', 'user_name' => '""', 'user_type' => '""', 'pOutType' => '""', 'pIdentNo' => '""', 'pRealName' => '""', 'pDwDate' => '""', 'pTrdAmt' => '""', 'pMerFee' => '""', 'pIpsFeeType' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,用户名,用户类型,提现模式,证件号码,姓名,提现日期,交易金额,平台手续费,手续费支付方");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $list_value = $list_value_old;
             $list_value["user_name"] = '"' . iconv('utf-8', 'gbk', $v["user_name"]) . '"';
             $list_value["id"] = '"' . iconv('utf-8', 'gbk', $v["id"]) . '"';
             $list_value["user_type"] = '"' . iconv('utf-8', 'gbk', $v["user_type"]) . '"';
             $list_value["pOutType"] = '"' . iconv('utf-8', 'gbk', $v["pOutType"]) . '"';
             $list_value["pIdentNo"] = '"' . iconv('utf-8', 'gbk', $v["pIdentNo"]) . '"';
             $list_value["pRealName"] = '"' . iconv('utf-8', 'gbk', $v["pRealName"]) . '"';
             $list_value["pDwDate"] = '"' . iconv('utf-8', 'gbk', $v["pDwDate"]) . '"';
             $list_value["pMerFee"] = '"' . iconv('utf-8', 'gbk', $v["pMerFee"]) . '"';
             $list_value["pTrdAmt"] = '"' . iconv('utf-8', 'gbk', $v["pTrdAmt"]) . '"';
             $list_value["pIpsFeeType"] = '"' . iconv('utf-8', 'gbk', $v["pIpsFeeType"]) . '"';
             $content .= implode(",", $list_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=order_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
 public function back_export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     $start_time = strim($_REQUEST['start_time']);
     $end_time = strim($_REQUEST['end_time']);
     $d = explode('-', $start_time);
     if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
         exit;
     }
     $d = explode('-', $end_time);
     if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
         exit;
     }
     if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
         $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
         exit;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     if ($limit) {
         $limit = " limit " . $limit;
     }
     $className = getCollName();
     //环迅
     if (strtolower($className) == "ips") {
         $condition = " where pStatus = 'Y'";
         if (strim($_REQUEST['pBidNo']) != '') {
             $condition .= " and dl.id like '%" . strim($_REQUEST['pBidNo']) . "%'";
         }
         if (strim($_REQUEST['deal_name']) != '') {
             $condition .= " and dl.name like '%" . strim($_REQUEST['deal_name']) . "%'";
         }
         if (strim($_REQUEST['user_name']) != '') {
             $condition .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $condition .= " and r.repay_time >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $condition .= " and r.repay_time <=" . to_timespan(strim($end_time));
         }
         $sql = "select d.*,r.*,deal_t.pBidNo,d.id as mid ,u.user_name,dl.name as deal_name from " . DB_PREFIX . "ips_repayment_new_trade_detail as d\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal_load_repay r on r.id = d.deal_load_repay_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal dl on dl.id = r.deal_id\r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = dl.user_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "ips_repayment_new_trade deal_t on deal_t.id = d.pid";
         $count_sql = "select count(*) from " . DB_PREFIX . "ips_repayment_new_trade_detail as d\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal_load_repay r on r.id = d.deal_load_repay_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal dl on dl.id = r.deal_id\r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = dl.user_id";
         $list = $GLOBALS['db']->getAll($sql . $condition . " order by d.id desc" . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     } elseif (strtolower($className) == "yeepay") {
         $condition = " where deal_t.bizType = 'REPAYMENT' and deal_t.is_complete_transaction = 1 and deal_t.code ='1' and deal_t.is_callback = 1 ";
         if (strim($_REQUEST['pBidNo']) != '') {
             $condition .= " and dl.id like '%" . strim($_REQUEST['pBidNo']) . "%'";
         }
         if (strim($_REQUEST['deal_name']) != '') {
             $condition .= " and dl.name like '%" . strim($_REQUEST['deal_name']) . "%'";
         }
         if (strim($_REQUEST['user_name']) != '') {
             $condition .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $condition .= " and r.repay_time >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $condition .= " and r.repay_time <=" . to_timespan(strim($end_time));
         }
         $sql = "select d.*,r.*,deal_t.tenderOrderNo as pBidNo,d.id as mid ,u.user_name,dl.name as deal_name \r\n\t\t\tfrom " . DB_PREFIX . "yeepay_cp_transaction_detail as d\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal_load_repay r on r.id = d.deal_load_repay_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal dl on dl.id = r.deal_id\r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = dl.user_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "yeepay_cp_transaction deal_t on deal_t.id = d.pid";
         $count_sql = "select count(*) \r\n\t\t\tfrom " . DB_PREFIX . "yeepay_cp_transaction_detail as d\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal_load_repay r on r.id = d.deal_load_repay_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal dl on dl.id = r.deal_id\r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = dl.user_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "yeepay_cp_transaction deal_t on deal_t.id = d.pid";
         $list = $GLOBALS['db']->getAll($sql . $condition . " order by d.id desc" . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     } elseif (strtolower($className) == "baofoo") {
         $condition = " where 1=1 ";
         if (strim($_REQUEST['pBidNo']) != '') {
             $condition .= " and dl.id like '%" . strim($_REQUEST['pBidNo']) . "%'";
         }
         if (strim($_REQUEST['deal_name']) != '') {
             $condition .= " and dl.name like '%" . strim($_REQUEST['deal_name']) . "%'";
         }
         if (strim($_REQUEST['user_name']) != '') {
             $condition .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $condition .= " and r.repay_time >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $condition .= " and r.repay_time <=" . to_timespan(strim($end_time));
         }
         $sql = "select d.*,r.*,deal_t.cus_id as pBidNo,d.id as mid ,u.user_name,dl.name as deal_name \r\n\t\t\tfrom " . DB_PREFIX . "baofoo_business_detail as d\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal_load_repay r on r.id = d.deal_load_repay_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal dl on dl.id = r.deal_id\r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = dl.user_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "baofoo_business deal_t on deal_t.id = d.pid";
         $count_sql = "select count(*) \r\n\t\t\tfrom " . DB_PREFIX . "baofoo_business_detail as d\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal_load_repay r on r.id = d.deal_load_repay_id\r\n\t\t\tleft JOIN " . DB_PREFIX . "deal dl on dl.id = r.deal_id\r\n\t\t\tleft join " . DB_PREFIX . "user u on u.id = dl.user_id";
         $list = $GLOBALS['db']->getAll($sql . $condition . " order by d.id desc" . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     }
     foreach ($list as $k => $v) {
         if ($v["status"] == 0) {
             $v["status"] = "提前";
         }
         if ($v["status"] == 1) {
             $v["status"] = "准时";
         }
         if ($v["status"] == 2) {
             $v["status"] = "逾期";
         }
         if ($v["status"] == 3) {
             $v["status"] = "严重逾期";
         }
         $list[$k]["status"] = $v["status"];
     }
     if ($list) {
         register_shutdown_function(array(&$this, 'deal_export_csv'), $page + 1);
         $list_value = array('mid' => '""', 'pBidNo' => '""', 'deal_name' => '""', 'user_name' => '""', 'repay_time' => '""', 'true_repay_time' => '""', 'repay_money' => '""', 'true_manage_money' => '""', 'true_manage_interest_money' => '""', 'impose_money' => '""', 'status' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,标号,贷款名称,投标人,还款日,实际还款日,已收本息,管理费,利息管理费,罚息/违约金,状态");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $list_value["mid"] = '"' . iconv('utf-8', 'gbk', $v["mid"]) . '"';
             $list_value["pBidNo"] = '"' . iconv('utf-8', 'gbk', $v["pBidNo"]) . '"';
             $list_value["deal_name"] = '"' . iconv('utf-8', 'gbk', $v["deal_name"]) . '"';
             $list_value["user_name"] = '"' . iconv('utf-8', 'gbk', $v["user_name"]) . '"';
             $list_value["repay_time"] = '"' . iconv('utf-8', 'gbk', to_date($v["repay_time"], "Y-m-d")) . '"';
             $list_value["true_repay_time"] = '"' . iconv('utf-8', 'gbk', to_date($v["true_repay_time"], "Y-m-d")) . '"';
             $list_value["repay_money"] = '"' . iconv('utf-8', 'gbk', $v["repay_money"]) . '"';
             $list_value["true_manage_money"] = '"' . iconv('utf-8', 'gbk', $v["true_manage_money"]) . '"';
             $list_value["impose_money"] = '"' . iconv('utf-8', 'gbk', $v["impose_money"]) . '"';
             $list_value["true_manage_interest_money"] = '"' . iconv('utf-8', 'gbk', $v["true_manage_interest_money"]) . '"';
             $list_value["impose_money"] = '"' . iconv('utf-8', 'gbk', $v["impose_money"]) . '"';
             $list_value["status"] = '"' . iconv('utf-8', 'gbk', $v["status"]) . '"';
             $content .= implode(",", $list_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=order_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
 /**
  * 解冻保证金
  * @param int $deal_id 标的号
  * @param int $pUnfreezenType 解冻类型 否 1#解冻借款方;2#解冻担保方
  * @param float $money 解冻金额;默认为0时,则解冻所有未解冻的金额
  * @return string
  */
 function GuaranteeUnfreeze()
 {
     $pTransferType = intval(strim($_REQUEST['pTransferType']));
     $deal_id = intval(strim($_REQUEST['deal_id']));
     $money = floatval($_REQUEST['money']);
     require_once APP_ROOT_PATH . "app/Lib/deal_func.php";
     $deal = get_deal($deal_id);
     // $GLOBALS['db']->getRow("select * from ".DB_PREFIX."deal where id = ".$deal_id);
     if (!empty($deal)) {
         if (!empty($deal['ips_bill_no'])) {
             $class_name = getCollName();
             require_once APP_ROOT_PATH . "system/collocation/" . $class_name . "_collocation.php";
             $collocation_class = $class_name . "_collocation";
             $collocation_object = new $collocation_class();
             $collocation_code = $collocation_object->GuaranteeUnfreeze($deal_id, $pTransferType, $money);
             print_r($collocation_code);
         } else {
             showErr('该标未发布登记:' . $deal['ips_bill_no'], 0);
         }
     } else {
         showErr('标的ID不存在:' . $deal_id, 0);
     }
 }
Example #8
0
 public function ips_transfer_view()
 {
     $GLOBALS['tmpl']->assign("page_title", "债权转让明细");
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     if ($limit) {
         $limit = " limit " . $limit;
     }
     if (isset($_REQUEST['id']) && intval(strim($_REQUEST['id'])) > 0) {
         //$condition .= " and t.pid = ".intval(strim($_REQUEST['id']));
         $GLOBALS['tmpl']->assign('id', intval(strim($_REQUEST['id'])));
     } else {
         return;
         //$this->error (l("INVALID_OPERATION"),$ajax);
     }
     $className = getCollName();
     //环迅
     if (strtolower($className) == "ips") {
         $p_sql = "select dlt.* from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_data\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.pTransferType = 4 and t.id = " . intval($_REQUEST['id']);
         $load_info = $GLOBALS['db']->getRow($p_sql);
         if (!$load_info) {
             $this->error(l("INVALID_OPERATION"), $ajax);
         }
         $condition = " and ((dlr.user_id = " . $GLOBALS["user_info"]["id"] . " and dlr.t_user_id = 0 ) or dlr.t_user_id =" . $GLOBALS["user_info"]["id"] . ")";
         $sql = "select dlr.*,d.name as deal_name,u.user_name,tu.user_name as t_user_name from " . DB_PREFIX . "deal_load_repay as dlr LEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id left join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id left join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id where dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " and dlr.deal_id = " . $load_info["deal_id"];
         $count_sql = "select count(*) from " . DB_PREFIX . "deal_load_repay as dlr LEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id where dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " and dlr.deal_id = " . $load_info["deal_id"];
         $list = $GLOBALS['db']->getAll($sql . $condition . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     } elseif (strtolower($className) == "yeepay") {
         $p_sql = "select dlt.* from " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.transfer_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.bizType = 'CREDIT_ASSIGNMENT'  and t.id = " . intval($_REQUEST['id']);
         $load_info = $GLOBALS['db']->getRow($p_sql);
         if (!$load_info) {
             $this->error(l("INVALID_OPERATION"), $ajax);
         }
         $condition = " and ((dlr.user_id = " . $GLOBALS["user_info"]["id"] . " and dlr.t_user_id = 0 ) or dlr.t_user_id =" . $GLOBALS["user_info"]["id"] . ")";
         $sql = "select dlr.*,d.name as deal_name,u.user_name,tu.user_name as t_user_name \r\n\t\t\tfrom " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         //print_r($sql);die;
         $count_sql = "select count(*) from " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         $list = $GLOBALS['db']->getAll($sql . $condition . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     } elseif (strtolower($className) == "baofoo") {
         $p_sql = "select dlt.* from " . DB_PREFIX . "baofoo_acct_trans as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = dlt.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.code = 'CSD000'  and t.ref_type = 1 and t.id = " . intval($_REQUEST['id']);
         $load_info = $GLOBALS['db']->getRow($p_sql);
         if (!$load_info) {
             $this->error(l("INVALID_OPERATION"), $ajax);
         }
         $condition = " and ((dlr.user_id = " . $GLOBALS["user_info"]["id"] . " and dlr.t_user_id = 0 ) or dlr.t_user_id =" . $GLOBALS["user_info"]["id"] . ")";
         $sql = "select dlr.*,d.name as deal_name,u.user_name,tu.user_name as t_user_name \r\n\t\t\tfrom " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         //print_r($sql);die;
         $count_sql = "select count(*) from " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         $list = $GLOBALS['db']->getAll($sql . $condition . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     }
     foreach ($list as $k => $v) {
         $list[$k]["ll_key"] = $v["l_key"] + 1;
     }
     $page = new Page($list_count, app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('list', $list);
     $GLOBALS['tmpl']->assign("start_time", $start_time);
     $GLOBALS['tmpl']->assign("end_time", $end_time);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_ips_ips_transfer_view.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
 public function relation_export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     if ($limit) {
         $limit = " limit " . $limit;
     }
     if (isset($_REQUEST['id']) && intval(strim($_REQUEST['id'])) > 0) {
         //$condition .= " and t.pid = ".intval(strim($_REQUEST['id']));
         $GLOBALS['tmpl']->assign('id', intval(strim($_REQUEST['id'])));
     } else {
         return;
         //$this->error (l("INVALID_OPERATION"),$ajax);
     }
     $className = getCollName();
     //环迅
     if (strtolower($className) == "ips") {
         $p_sql = "select dlt.* from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_data\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.pTransferType = 4 and t.id = " . intval($_REQUEST['id']);
         $load_info = $GLOBALS['db']->getRow($p_sql);
         if (!$load_info) {
             $this->error(l("INVALID_OPERATION"), $ajax);
         }
         $sql = "select dlr.*,d.name as deal_name,u.user_name,tu.user_name as t_user_name from " . DB_PREFIX . "deal_load_repay as dlr LEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id left join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id left join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id where dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " and dlr.deal_id = " . $load_info["deal_id"];
         $count_sql = "select count(*) from " . DB_PREFIX . "deal_load_repay as dlr LEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id where dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " and dlr.deal_id = " . $load_info["deal_id"];
         $list = $GLOBALS['db']->getAll($sql . $condition . " order by dlr.id desc " . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     } elseif (strtolower($className) == "yeepay") {
         $p_sql = "select dlt.* from " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.transfer_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.bizType = 'CREDIT_ASSIGNMENT'  and t.id = " . intval($_REQUEST['id']);
         $load_info = $GLOBALS['db']->getRow($p_sql);
         if (!$load_info) {
             $this->error(l("INVALID_OPERATION"), $ajax);
         }
         $sql = "select dlr.*,d.name as deal_name,u.user_name,tu.user_name as t_user_name \r\n\t\t\tfrom " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         //print_r($sql);die;
         $count_sql = "select count(*) from " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         $list = $GLOBALS['db']->getAll($sql . $condition . " order by dlr.id desc " . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     } elseif (strtolower($className) == "baofoo") {
         $p_sql = "select dlt.* from " . DB_PREFIX . "baofoo_acct_trans as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = dlt.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.code = 'CSD000'  and t.ref_type = 1 and t.id = " . intval($_REQUEST['id']);
         $load_info = $GLOBALS['db']->getRow($p_sql);
         if (!$load_info) {
             $this->error(l("INVALID_OPERATION"), $ajax);
         }
         $sql = "select dlr.*,d.name as deal_name,u.user_name,tu.user_name as t_user_name \r\n\t\t\tfrom " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         //print_r($sql);die;
         $count_sql = "select count(*) from " . DB_PREFIX . "deal_load_repay as dlr \r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlr.user_id \r\n\t\t\tleft join " . DB_PREFIX . "user as tu on tu.id = dlr.t_user_id \r\n\t\t\tleft join " . DB_PREFIX . "deal as d on dlr.deal_id = d.id \r\n\t\t\twhere dlr.load_id =" . intval($load_info['load_id']) . " and dlr.user_id =" . intval($load_info['user_id']) . " \r\n\t\t\tand dlr.deal_id = " . $load_info["deal_id"];
         $list = $GLOBALS['db']->getAll($sql . $condition . " order by dlr.id desc " . $limit);
         //取得满足条件的记录数
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     }
     foreach ($list as $k => $v) {
         $list[$k]["ll_key"] = $list[$k]["l_key"] + 1;
         $list[$k]["uu_key"] = $list[$k]["u_key"] + 1;
     }
     if ($list) {
         register_shutdown_function(array(&$this, 'relation_export_csv'), $page + 1);
         $list_value = array('id' => '""', 'deal_name' => '""', 'self_money' => '""', 'repay_money' => '""', 'manage_money' => '""', 'manage_interest_money' => '""', 'impose_money' => '""', 'repay_time' => '""', 'true_repay_time' => '""', 'status' => '""', 'is_site_repay' => '""', 'l_key' => '""', 'u_key' => '""', 'has_repay' => '""', 'repay_manage_money' => '""', 'repay_manage_impose_money' => '""', 'user_name' => '""', 't_user_name' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,借款名称,本金,还款金额,管理费,利息管理费,罚息,还款日,实际还款时间,还款状态,付款方式,还款期号,还款顺序,订单状态,从借款者均摊下来的管理费,接入者均摊下来的逾期管理费,投标人,承接人");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $list_value["id"] = '"' . iconv('utf-8', 'gbk', $v["id"]) . '"';
             $list_value["deal_name"] = '"' . iconv('utf-8', 'gbk', M("deal")->where(" id=" . strim($v['deal_id']))->getField("name")) . '"';
             $list_value["self_money"] = '"' . iconv('utf-8', 'gbk', $v["self_money"]) . '"';
             $list_value["repay_money"] = '"' . iconv('utf-8', 'gbk', $v["repay_money"]) . '"';
             $list_value["manage_money"] = '"' . iconv('utf-8', 'gbk', $v["manage_money"]) . '"';
             $list_value["impose_money"] = '"' . iconv('utf-8', 'gbk', $v["impose_money"]) . '"';
             $list_value["repay_time"] = '"' . iconv('utf-8', 'gbk', $v["repay_time"]) . '"';
             $list_value["true_repay_time"] = '"' . iconv('utf-8', 'gbk', $v["true_repay_time"]) . '"';
             if ($v['status'] != '') {
                 $list_value["status"] = '"' . iconv('utf-8', 'gbk', l("REPAY_STATUS_" . strim($v['status']))) . '"';
             } else {
                 $list_value["status"] = "";
             }
             if ($v['is_site_repay'] != '') {
                 $list_value["is_site_repay"] = '"' . iconv('utf-8', 'gbk', l("IS_SITE_REPAY_" . strim($v['is_site_repay']))) . '"';
             } else {
                 $list_value["is_site_repay"] = "";
             }
             $list_value["l_key"] = '"' . iconv('utf-8', 'gbk', $v["l_key"]) . '"';
             $list_value["u_key"] = '"' . iconv('utf-8', 'gbk', $v["u_key"]) . '"';
             if ($v['has_repay'] != '') {
                 $list_value["has_repay"] = '"' . iconv('utf-8', 'gbk', l("HAS_REPAY_" . strim($v['has_repay']))) . '"';
             } else {
                 $list_value["has_repay"] = "";
             }
             $list_value["repay_manage_money"] = '"' . iconv('utf-8', 'gbk', $v["repay_manage_money"]) . '"';
             $list_value["repay_manage_impose_money"] = '"' . iconv('utf-8', 'gbk', $v["repay_manage_impose_money"]) . '"';
             $list_value["user_name"] = '"' . iconv('utf-8', 'gbk', $v["user_name"]) . '"';
             $list_value["t_user_name"] = '"' . iconv('utf-8', 'gbk', $v["t_user_name"]) . '"';
             $list_value["msg"] = '"' . iconv('utf-8', 'gbk', $v["msg"]) . '"';
             $content .= implode(",", $list_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=order_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }