function dobid() { $ajax = intval($_REQUEST["ajax"]); $id = intval($_REQUEST["id"]); $bid_money = floatval($_REQUEST["bid_money"]); $bid_paypassword = strim(FW_DESPWD($_REQUEST['bid_paypassword'])); $status = dobid2($id, $bid_money, $bid_paypassword, 1); if ($status['status'] == 0) { showErr($status['show_err'], $ajax); } elseif ($status['status'] == 2) { do_loans($id, date('Y-m-d')); // 满标自动放款 ajax_return($status); } elseif ($status['status'] == 3) { showSuccess("余额不足,请先去充值", $ajax, url("index", "uc_money#incharge")); } else { //showSuccess($GLOBALS['lang']['DEAL_BID_SUCCESS'],$ajax,url("index","deal",array("id"=>$id))); showSuccess($GLOBALS['lang']['DEAL_BID_SUCCESS'], $ajax, url("index", "uc_invest")); } }
/** * 放款 */ function do_loans() { $id = intval($_REQUEST['id']); $repay_start_time = strim($_REQUEST['repay_start_time']); require_once APP_ROOT_PATH . 'system/libs/user.php'; require_once APP_ROOT_PATH . 'system/common.php'; require_once APP_ROOT_PATH . "app/Lib/common.php"; $result = do_loans($id, $repay_start_time); //更新凭证 $loan_data = array(); $loan_data['loans_pic'] = strim($_REQUEST["loans_pic"]); $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $loan_data, "UPDATE", "id=" . $id); //投标 收益奖励 $list = array(); if ($result['status'] == 2) { ajax_return($result); } elseif ($result['status'] == 1) { $sql_list = "select * from " . DB_PREFIX . "deal_load where deal_id='{$id}' "; $list = $GLOBALS['db']->getAll($sql_list); foreach ($list as $k => $v) { //投标人 VIP升级 $tuser_id = $v['user_id']; $ttype = 1; $ttype_info = 2; $tresultdate = syn_user_vip($tuser_id, $ttype, $ttype_info); } $this->get_manage($id); //VIP升级 -借款 $user_id = M("Deal")->where("id='{$id}'")->getField("user_id"); $type = 1; $type_info = 1; $resultdate = syn_user_vip($user_id, $type, $type_info); $this->success($result['info']); } else { $this->error($result['info']); } }
function DoLoansCallBack($str3Req) { //print_r($str3XmlParaInfo); $order_id = $str3Req["order_id"]; $where = " order_id = '" . $order_id . "'"; $sql = "update " . DB_PREFIX . "baofoo_business set is_callback = 1 where is_callback = 0 and " . $where; $GLOBALS['db']->query($sql); if ($GLOBALS['db']->affected_rows()) { //操作成功 $data = array(); $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_business", $str3Req, 'UPDATE', $where); if ($str3Req['code'] == 'CSD000') { $ipsdata = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "baofoo_business where " . $where); $deal_id = (int) $ipsdata['cus_id']; $deal_load = array(); $deal_load['is_has_loans'] = 1; //1#转账成功 $where = " deal_id = " . $deal_id; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load", $deal_load, 'UPDATE', $where); $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_load where is_has_loans = 0 and deal_id = " . $deal_id); if ($count == 0) { //已经全部放款完成,生成:还款计划以及回款计划; $repay_start_time = intval($ipsdata['repay_start_time']); require_once APP_ROOT_PATH . "app/Lib/common.php"; return do_loans($deal_id, $repay_start_time, 1); } } } else { return 1; } }
/** * 放款 */ function do_loans() { $id = intval($_REQUEST['id']); $repay_start_time = strim($_REQUEST['repay_start_time']); require_once APP_ROOT_PATH . "app/Lib/common.php"; $result = do_loans($id, $repay_start_time); if ($result['status'] == 2) { ajax_return($result); } elseif ($result['status'] == 1) { $this->success($result['info']); } else { $this->error($result['info']); } }
function DoLoansCallBack($str3Req) { $requestNo = $str3Req["requestNo"]; $platformNo = $str3Req["platformNo"]; $GLOBALS['db']->query("update " . DB_PREFIX . "yeepay_cp_transaction set is_callback = 1 where is_callback = 0 and requestNo = " . $requestNo); $result['pErrCode'] = $str3Req["code"]; $result['pErrMsg'] = $str3Req["message"]; $result['pIpsAcctNo'] = $str3Req["requestNo"]; if ($str3Req["code"] == 1) { $sql = "update " . DB_PREFIX . "yeepay_cp_transaction set is_complete_transaction = 1,update_time = " . TIME_UTC . " where is_callback = 1 and requestNo = " . $requestNo; $GLOBALS['db']->query($sql); $deal_load = array(); $deal_load['is_has_loans'] = 1; //1#转账成功 $where = " pP2PBillNo = " . $requestNo; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load", $deal_load, 'UPDATE', $where); } $ipsdata = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "yeepay_cp_transaction where is_callback = 1 and requestNo =" . $requestNo); $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_load where is_has_loans = 0 and deal_id = " . $ipsdata["tenderOrderNo"]); if ($count == 0) { //已经全部放款完成,生成:还款计划以及回款计划; $repay_start_time = intval($ipsdata['repay_start_time']); require_once APP_ROOT_PATH . "app/Lib/common.php"; $result = do_loans($ipsdata["tenderOrderNo"], $repay_start_time, 1); showIpsInfo($result["info"], SITE_DOMAIN . APP_ROOT . "/m.php?m=Deal&a=full"); } else { return 1; } }
function TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req) { //print_r($str3Req); //require_once(APP_ROOT_PATH.'system/collocation/ips/xml.php'); //print_r(@XML_unserialize($str3XmlParaInfo)); exit; $pTransferType = $str3Req["pTransferType"]; $pMerBillNo = $str3Req["pMerBillNo"]; $id = intval($str3Req["pMemo1"]); $where = " id = '" . $id . "'"; $data = array(); $data['pErrCode'] = $pErrCode; //一、转账类型为“代偿”,“投 资”时同步返回 MG00008F IPS 受理中;异步再返回 MG00000F 操作成功; 二、其他转账类型 MG00000F 操作成功 $data['pErrMsg'] = $pErrMsg; $data['pIpsBillNo'] = $str3Req["pIpsBillNo"]; //IPS还款订单号 否 由 IPS 系统生成的唯一流水号, 此次还款的批次号 $data['pIpsTime'] = $str3Req["pIpsTime"]; //IPS处理时间 否 格式为:yyyyMMddHHmmss $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_transfer", $data, 'UPDATE', $where); /*if ($data['pErrCode'] == 'MG00008F'){ $GLOBALS['db']->autoExecute(DB_PREFIX."deal",array("ips_do_transfer"=>1),'UPDATE',"id in (SELECT pBidNo FROM ".DB_PREFIX."ips_transfer WHERE id = '".$id."')"); }*/ //MG00000F操作成功 if ($data['pErrCode'] == 'MG00000F') { $sql = "update " . DB_PREFIX . "ips_transfer set is_callback = 1 where is_callback = 0 and " . $where; $GLOBALS['db']->query($sql); if ($GLOBALS['db']->affected_rows()) { $ipsdata = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ips_transfer where " . $where); $deal_id = intval($ipsdata['deal_id']); //require_once(APP_ROOT_PATH.'system/collocation/ips/xml.php'); //$pDetails = getXmlNodeValue($str3XmlParaInfo, "pDetails"); //print_r($pDetails); //$pDetails = @XML_unserialize($pDetails); //print_r($pDetails); //$pDetails = getXmlNodeValue($str3XmlParaInfo, "pDetails"); $attr = array(); if (isset($str3Req["pDetails"]["pRow"][0])) { $attr = $str3Req["pDetails"]["pRow"]; } else { $attr[] = $str3Req["pDetails"]["pRow"]; } foreach ($attr as $k => $v) { //$pDetail = ''; $pOriMerBillNo = $v["pOriMerBillNo"]; $where = " pid = " . $ipsdata['id'] . " and pOriMerBillNo = '" . $pOriMerBillNo . "'"; $detail = array(); $detail['pIpsDetailBillNo'] = $v["pIpsDetailBillNo"]; //IPS明细订单号 否 IPS明细订单号 $detail['pIpsDetailTime'] = $v["pIpsDetailTime"]; //IPS明细处理时间 否 格式为:yyyyMMddHHmmss $detail['pIpsFee'] = $v["pIpsFee"]; //IPS手续费 否 IPS手续费 $detail['pStatus'] = $v["pStatus"]; //Y#转账成功;N#转账失败 $detail['pMessage'] = $v["pMessage"]; //转账备注 否 转账失败的原因 $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_transfer_detail", $detail, 'UPDATE', $where); if ($pTransferType == 1) { $deal_load = array(); if ($detail['pStatus'] == 'Y') { $deal_load['is_has_loans'] = 1; } else { $deal_load['is_has_loans'] = 0; } //1#转账成功;0#转账失败 $deal_load['msg'] = $detail['pMessage']; //转账备注 否 转账失败的原因 $where = " deal_id = " . $deal_id . " and pMerBillNo = '" . $pOriMerBillNo . "'"; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load", $deal_load, 'UPDATE', $where); } } //转账类型 1:投资(报文提交关系,转出方:转入方=N:1), 2:代偿(报文提交关系,转出方:转入方=1:N), 3:代偿还款(报文提交关系,转出方:转入方=1:1), 4:债权转让(报文提交关系,转出方:转入方=1:1), 5:结算担保收益(报文提交关系,转出方:转入方=1: 1) if ($pTransferType == 1) { $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_load where is_has_loans = 0 and deal_id = " . $deal_id); if ($count == 0) { //已经全部放款完成; //$sql = "update ".DB_PREFIX."deal set is_has_loans = 1 where is_has_loans = 0 and id = ".$deal_id; //$GLOBALS['db']->query($sql); $repay_start_time = intval($ipsdata['ref_data']); require_once APP_ROOT_PATH . "app/Lib/common.php"; $result = do_loans($deal_id, $repay_start_time, 1); } else { //还有未放款完成的 //$sql = "update ".DB_PREFIX."deal set is_has_loans = 0 where id = ".$deal_id; //$GLOBALS['db']->query($sql); } } else { if ($pTransferType == 4) { $sql = "update " . DB_PREFIX . "deal_load_transfer set t_user_id = lock_user_id, transfer_time = '" . get_gmtime() . "', ips_status = 2, ips_bill_no = '" . $data['pIpsBillNo'] . "' where ips_status = 1 and id =" . intval($ipsdata['ref_data']); //echo $sql; $GLOBALS['db']->query($sql); $sql = "select * from " . DB_PREFIX . "deal_load_transfer where ips_status = 2 and id =" . intval($ipsdata['ref_data']); $transfer = $GLOBALS['db']->getRow($sql); //将用户投资回款计划,收款人更改为:承接者 $sql = "update " . DB_PREFIX . "deal_load_repay set t_pMerBillNo = '" . $ipsdata["pMerBillNo"] . "', t_user_id = '" . $transfer['t_user_id'] . "' where has_repay = 0 and load_id =" . intval($transfer['load_id']) . " and user_id =" . intval($transfer['user_id']) . " and deal_id = " . $deal_id; //echo $sql; $GLOBALS['db']->query($sql); return $transfer; } else { if ($pTransferType == 5) { $sql = "update " . DB_PREFIX . "deal set guarantor_real_fit_amt = guarantor_real_fit_amt +" . intval($ipsdata['ref_data']) . " where id =" . $deal_id; //echo $sql; $GLOBALS['db']->query($sql); } } } } } //print_r($str3Req);exit; }