public function index() { $root = array(); $email = strim($GLOBALS['request']['biz_email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['biz_pwd']); //密码 //检查用户,用户密码 $biz_user = biz_check($email, $pwd); $supplier_id = intval($biz_user['supplier_id']); $deal_id = intval($GLOBALS['request']['deal_id']); //团购商品id if ($supplier_id > 0) { $page = intval($GLOBALS['request']['page']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE; $list = $GLOBALS['db']->getAll("select d.sn,d.password,d.confirm_time from " . DB_PREFIX . "deal_coupon as d where d.confirm_account > 0 and d.is_valid = 1 and d.is_delete = 0 and d.deal_id = " . $deal_id . " and d.supplier_id = " . $supplier_id . " order by d.confirm_time desc limit " . $limit); foreach ($list as $k => $v) { $list[$k]['confirm_time_format'] = to_date($v['confirm_time'], 'Y-m-d H:i'); } $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_coupon as d where d.confirm_account > 0 and d.is_valid = 1 and d.is_delete = 0 and d.deal_id = " . $deal_id . " and d.supplier_id = " . $supplier_id); $root['page'] = array("page" => $page, "page_total" => ceil($count / PAGE_SIZE), "page_size" => PAGE_SIZE); $root['item'] = $list; $root['return'] = 1; } output($root); }
public function export_csv($page = 1) { set_time_limit(0); $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE")); $map['ecv_type_id'] = intval($_REQUEST['ecv_type_id']); $list = M(MODULE_NAME)->where($map)->limit($limit)->findAll(); if ($list) { register_shutdown_function(array(&$this, 'export_csv'), $page + 1); $ecv_value = array('sn' => '""', 'password' => '""', 'money' => '""', 'use_limit' => '""', 'begin_time' => '""', 'end_time' => '""'); if ($page == 1) { $content = iconv("utf-8", "gbk", "序列号,密码,面额,使用数量,生效时间,过期时间"); $content = $content . "\n"; } foreach ($list as $k => $v) { $ecv_value['sn'] = '"' . iconv('utf-8', 'gbk', $v['sn']) . '"'; $ecv_value['password'] = '******' . iconv('utf-8', 'gbk', $v['password']) . '"'; $ecv_value['money'] = '"' . iconv('utf-8', 'gbk', format_price($v['money'])) . '"'; $ecv_value['use_limit'] = '"' . iconv('utf-8', 'gbk', $v['use_limit']) . '"'; $ecv_value['begin_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['begin_time'])) . '"'; $ecv_value['end_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['end_time'])) . '"'; $content .= implode(",", $ecv_value) . "\n"; } header("Content-Disposition: attachment; filename=voucher_list.csv"); echo $content; } else { if ($page == 1) { $this->error(L("NO_RESULT")); } } }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); //$order_sn = $GLOBALS['db']->getOne("select order_sn from ".DB_PREFIX."deal_order where id = ".$payment_notice['order_id']); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); /* 银行类型 */ //$bank_id = $GLOBALS['db']->getOne("select bank_id from ".DB_PREFIX."deal_order where id = ".$payment_notice['order_id']); $bank_id = $payment_notice['bank_id']; $payChannel = $this->config['sdo_paychannel']; $defaultChannel = $this->config['sdo_defaultchannel']; if ($bank_id == '0' || trim($bank_id) == 'SDO1' || trim($bank_id) == 'SDO') { $bank_id = ''; } $postBackURL = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=Sdo'; //付款完成后的跳转页面 $notifyURL = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Sdo'; //通知发货页面 $shengpay = new shengpay(); $array = array('Name' => 'B2CPayment', 'Version' => 'V4.1.1.1.1', 'Charset' => 'UTF-8', 'MsgSender' => $payment_info['config']['sdo_account'], 'SendTime' => to_date(get_gmtime(), 'YmdHis'), 'OrderTime' => to_date(get_gmtime(), 'YmdHis'), 'PayType' => 'PT001', 'PayChannel' => '14,18,19,20', 'InstCode' => $bank_id, 'PageUrl' => $postBackURL, 'NotifyUrl' => $notifyURL, 'ProductName' => $payment_notice_id, 'BuyerContact' => '', 'BuyerIp' => '', 'Ext1' => '', 'Ext2' => '', 'SignType' => 'MD5'); $shengpay->init($array); $shengpay->setKey($payment_info['config']['sdo_key']); /* /* 商家自行检测传入的价格与数据库订单需支付金额是否相同 */ $code = $shengpay->takeOrder($payment_notice_id, $money, $payment_info); $code .= "<br /><span class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</span>"; return $code; }
/** * 付款单的支付 * @param unknown_type $payment_notice_id * 当超额付款时在此进行退款处理 */ function payment_paid($payment_notice_id, $outer_notice_sn = '') { $payment_notice_id = intval($payment_notice_id); $now = TIME_UTC; $GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set pay_time = " . $now . ", pay_date = '" . to_date($now, 'Y-m-d') . "',outer_notice_sn = '" . $outer_notice_sn . "',is_paid = 1 where id = " . $payment_notice_id . " and is_paid = 0"); $rs = $GLOBALS['db']->affected_rows(); if ($rs) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']); $GLOBALS['db']->query("update " . DB_PREFIX . "payment set total_amount = total_amount + " . $payment_notice['money'] . " where class_name = '" . $payment_info['class_name'] . "'"); if (intval($payment_notice['order_id']) == 0) { //充值 require_once APP_ROOT_PATH . "system/libs/user.php"; if ($payment_info['online_pay'] == 0) { $msg = '线下充值'; // sprintf($GLOBALS['lang']['PAYMENT_INCHARGE'],$payment_notice['notice_sn']); } else { $msg = '在线充值'; // sprintf($GLOBALS['lang']['PAYMENT_INCHARGE'],$payment_notice['notice_sn']); } $fee_amount = $payment_notice['fee_amount']; $money = $payment_notice['money']; modify_account(array('money' => $money - $fee_amount, 'fee_amount' => $fee_amount, 'score' => 0), $payment_notice['user_id'], $msg, 1); //在此处开始生成付款的短信及邮件 send_payment_sms($payment_notice_id); send_payment_mail($payment_notice_id); } } return $rs; }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['user_login_status'] = 1; $root['response_code'] = 1; $page_size = $GLOBALS['m_config']['page_size']; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $record_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "payment_notice where user_id = " . intval($GLOBALS['user_info']['id']) . " and order_id=0 AND deal_id=0 AND deal_item_id=0 AND deal_name='' order by create_time desc limit " . $limit); foreach ($record_list as $k => $v) { $record_list[$k]['create_time'] = to_date($v['create_time'], 'Y-m-d'); } $record_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "payment_notice where user_id = " . intval($GLOBALS['user_info']['id']) . " and order_id=0 AND deal_id=0 AND deal_item_id=0 AND deal_name=''"); $root['record_list'] = $record_list; $root['page'] = array("page" => $page, "page_total" => ceil($record_count / $page_size), "page_size" => intval($page_size), 'total' => intval($record_count)); } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
/** * 付款单的支付 * @param unknown_type $payment_notice_id * 当超额付款时在此进行退款处理 */ function payment_paid($payment_notice_id, $outer_notice_sn = '') { $payment_notice_id = intval($payment_notice_id); $now = TIME_UTC; $GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set pay_time = " . $now . ", pay_date = " . to_date($now, 'Y-m-d') . ",outer_notice_sn = '" . $outer_notice_sn . "',is_paid = 1 where id = " . $payment_notice_id . " and is_paid = 0"); $rs = $GLOBALS['db']->affected_rows(); if ($rs) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']); $GLOBALS['db']->query("update " . DB_PREFIX . "payment set total_amount = total_amount + " . $payment_notice['money'] . " where class_name = '" . $payment_info['class_name'] . "'"); //if (intval($payment_notice['order_id']) == 0){ //充值 require_once APP_ROOT_PATH . "system/libs/user.php"; $msg = sprintf($GLOBALS['lang']['PAYMENT_INCHARGE'], $payment_notice['notice_sn']); modify_account(array('money' => $payment_notice['money'], 'score' => 0), $payment_notice['user_id'], $msg, 1); // 充值奖励 if ($payment_notice['money'] > intval(app_conf("USER_RECHARGE_LIMIT_MONEY"))) { $award = $payment_notice['money'] * floatval(app_conf("USER_RECHARGE_PERCENT")) * 0.01; modify_account(array('money' => $award, 'score' => 0), $payment_notice['user_id'], "充值奖励", 1); } //在此处开始生成付款的短信及邮件 send_payment_sms($payment_notice_id); send_payment_mail($payment_notice_id); //} } return $rs; }
public function index() { $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $user_id = $GLOBALS['user_info']['id']; $status = isset($_REQUEST['stauts']) ? intval($_REQUEST['stauts']) : 3; $time = isset($_REQUEST['time']) ? to_timespan($_REQUEST['time'], "Ymd") : ""; $deal_name = strim($_REQUEST['deal_name']); $condition = ""; if ($deal_name != "") { $condition .= " and d.name = '" . $deal_name . "' "; $GLOBALS['tmpl']->assign('deal_name', $deal_name); } if ($time != "") { $condition .= " and dlr.repay_time = " . $time . " "; $GLOBALS['tmpl']->assign('time', to_date($time, "Y-m-d")); } $result = getUcRepayPlan($user_id, $status, $limit, $condition); if ($result['rs_count'] > 0) { $page = new Page($result['rs_count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('list', $result['list']); } $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_REPAY_PLAN']); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_repay_plan.html"); $GLOBALS['tmpl']->assign("status", $status); $GLOBALS['tmpl']->display("page/uc.html"); }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order = $GLOBALS['db']->getRow("select order_sn,bank_id from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']); $_TransID = $order['order_sn']; $_OrderMoney = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $_Merchant_url = SITE_DOMAIN . APP_ROOT . '/baofoo_callback.php?act=response'; $_Return_url = SITE_DOMAIN . APP_ROOT . '/baofoo_callback.php?act=notify'; /* 交易日期 */ $_TradeDate = to_date($payment_notice['create_time'], 'YmdHis'); $_MerchantID = $payment_info['config']['baofoo_account']; $_PayID = $order['bank_id']; if (intval($_PayID) == 1000 || intval($_PayID) == 0) { $_PayID = ""; } $_NoticeType = 1; $_Md5Key = $payment_info['config']['baofoo_key']; $_TerminalID = $payment_info['config']['baofoo_terminal']; $_AdditionalInfo = $payment_notice_id; $_Md5_OrderMoney = $_OrderMoney * 100; $MARK = "|"; $_Signature = md5($_MerchantID . $MARK . $_PayID . $MARK . $_TradeDate . $MARK . $_TransID . $MARK . $_Md5_OrderMoney . $MARK . $_Merchant_url . $MARK . $_Return_url . $MARK . $_NoticeType . $MARK . $_Md5Key); /*交易参数*/ $parameter = array('MemberID' => $_MerchantID, 'TransID' => $_TransID, 'PayID' => $_PayID, 'TradeDate' => $_TradeDate, 'OrderMoney' => $_OrderMoney * 100, 'ProductName' => $_TransID, 'Amount' => 1, 'ProductLogo' => '', 'Username' => '', 'AdditionalInfo' => $_AdditionalInfo, 'PageUrl' => $_Merchant_url, 'ReturnUrl' => $_Return_url, 'NoticeType' => $_NoticeType, 'Signature' => $_Signature, 'TerminalID' => $_TerminalID, 'InterfaceVersion' => "4.0", 'KeyType' => "1"); $def_url = '<form style="text-align:center;" action="http://gw.baofoo.com/payindex" target="_blank" style="margin:0px;padding:0px" method="POST" >'; foreach ($parameter as $key => $val) { $def_url .= "<input type='hidden' name='{$key}' value='{$val}' />"; } $def_url .= "<input type='submit' class='paybutton' value='前往" . $this->payment_lang['baofoo_gateway_' . intval($_PayID)] . "' />"; $def_url .= "</form>"; $def_url .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($_OrderMoney) . "</div>"; return $def_url; }
public function index() { $page = intval($GLOBALS['request']['page']); $city_name = strim($GLOBALS['request']['city_name']); //城市名称 if ($page == 0) { $page = 1; } $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $event_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_event order by sort desc limit " . $limit); $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_event"); foreach ($event_list as $k => $v) { $now = get_gmtime(); $event_list[$k]['end_time'] = $v['event_end_time']; $event_list[$k]['url'] = url("shop", "deal_event#show", array("id" => $v['id'])); $event_list[$k]['event_end_time'] = to_date($v['event_end_time'], 'Y-m-d'); $event_list[$k]['icon'] = get_abs_img_root(make_img($v['icon'], 592, 215, 1)); $event_list[$k]['sheng_time_format'] = to_date($v['event_end_time'] - $now, "d天h小时i分"); } $page_total = ceil($count / $page_size); $root = array(); $root['return'] = 1; $root['item'] = $event_list; $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size); $root['page_title'] = "活动专题"; $root['city_name'] = $city_name; output($root); }
public function index() { $order_sn = strim($_REQUEST['order_sn']); $time = isset($_REQUEST['time']) ? to_date(to_timespan($_REQUEST['time'], "Y-m-d"), "Y-m-d") : ""; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $condition = " 1=1 "; if ($order_sn != "") { $condition .= " and go.order_sn = '" . $order_sn . "' "; } if ($time != "") { $condition .= " and go.ex_date = '" . $time . "' "; $GLOBALS['tmpl']->assign('time', $time); } $user_id = $GLOBALS['user_info']['id']; $result = get_order($limit, $user_id, $condition); $page = new Page($result['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("order_sn", $order_sn); $GLOBALS['tmpl']->assign("order_info", $result['list']); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_goods_order.html"); $GLOBALS['tmpl']->display("page/uc.html"); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $page = intval($GLOBALS['request']['page']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/uc_func.php'; $root['user_login_status'] = 1; $root['response_code'] = 1; if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $result = get_user_log($limit, $GLOBALS['user_info']['id'], 'money'); $list = $result['list']; foreach ($list as $k => $v) { $list[$k]['log_time_format'] = to_date($v['log_time'], "Y-m-d H:i:s"); $list[$k]['money_format'] = format_price($v['money']); $list[$k]['lock_money_format'] = format_price($v['lock_money']); } $root['item'] = $list; $root['page'] = array("page" => $page, "page_total" => ceil($result['count'] / app_conf("PAGE_SIZE"))); } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); //$order = $GLOBALS['db']->getRow("select order_sn,bank_id from ".DB_PREFIX."deal_order where id = ".$payment_notice['order_id']); $order_sn = $payment_notice['notice_sn']; $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); /*$data_front_url = SITE_DOMAIN.APP_ROOT.'/index.php?ctl=payment&act=notify&class_name=Guofubao'; $data_front_url=""; $data_return_url = SITE_DOMAIN.APP_ROOT.'/index.php?ctl=payment&act=response&class_name=Guofubao'; */ //新 $data_front_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/guofubao_callback.php?act=notify'; //$data_front_url=""; $data_return_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/guofubao_callback.php?act=response'; $tranCode = '8888'; //$spbill_create_ip = $_SERVER['REMOTE_ADDR']; $spbill_create_ip = CLIENT_IP; /* 交易日期 */ $today = to_date($payment_notice['create_time'], 'YmdHis'); $bank_id = $payment_notice['bank_id']; if ($bank_id == '0') { $bank_id = ''; } $desc = $order_sn; include_once APP_ROOT_PATH . "system/libs/iconv.php"; $chinese = new Chinese(); $desc = $chinese->Convert("UTF-8", "GBK", $desc); /* 货币类型 */ $currencyType = '156'; /* 数字签名 */ $version = '2.1'; $tranCode = $tranCode; $merchant_id = $payment_info['config']['merchant_id']; $merOrderNum = $order_sn; $tranAmt = $money; // 总金额 $feeAmt = ''; $tranDateTime = $today; $frontMerUrl = $data_front_url; $backgroundMerUrl = $data_return_url; //返回的路径 $tranIP = $spbill_create_ip != "" ? $spbill_create_ip : ''; //商户识别码 $verficationCode = $payment_info['config']['VerficationCode']; $gopayServerTime = trim(file_get_contents("https://www.gopay.com.cn/PGServer/time")); $signValue = 'version=[' . $version . ']tranCode=[' . $tranCode . ']merchantID=[' . $merchant_id . ']merOrderNum=[' . $merOrderNum . ']tranAmt=[' . $tranAmt . ']feeAmt=[' . $feeAmt . ']tranDateTime=[' . $tranDateTime . ']frontMerUrl=[' . $frontMerUrl . ']backgroundMerUrl=[' . $backgroundMerUrl . ']orderId=[]gopayOutOrderId=[]tranIP=[' . $tranIP . ']respCode=[]gopayServerTime=[' . $gopayServerTime . ']VerficationCode=[' . $verficationCode . ']'; $signValue = md5($signValue); /*交易参数*/ $parameter = array('version' => '2.1', 'charset' => '2', 'language' => '1', 'signType' => '1', 'tranCode' => '8888', 'merchantID' => $merchant_id, 'virCardNoIn' => $payment_info['config']['virCardNoIn'], 'merOrderNum' => $merOrderNum, 'tranAmt' => $tranAmt, 'currencyType' => $currencyType, 'tranDateTime' => $tranDateTime, 'tranIP' => $spbill_create_ip, 'goodsName' => $desc, 'goodsDetail' => '', 'buyerName' => '', 'buyerContact' => '', 'frontMerUrl' => $frontMerUrl, 'backgroundMerUrl' => $backgroundMerUrl, 'signValue' => $signValue, 'gopayServerTime' => $gopayServerTime, 'bankCode' => $bank_id, 'userType' => 1, 'feeAmt' => '', 'isRepeatSubmit' => '', 'merRemark1' => $payment_notice_id, 'merRemark2' => ''); $def_url = '<form style="text-align:center;" action="https://gateway.gopay.com.cn/Trans/WebClientAction.do" target="_blank" style="margin:0px;padding:0px" method="get" >'; foreach ($parameter as $key => $val) { $def_url .= "<input type='hidden' name='{$key}' value='{$val}' />"; } $def_url .= "<input type='submit' class='paybutton' value='前往国付宝在线支付' />"; $def_url .= "</form>"; $def_url .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>"; return $def_url; }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { // require APP_ROOT_PATH.'app/Lib/uc_func.php'; $root['user_login_status'] = 1; $root['response_code'] = 1; $page_size = $GLOBALS['m_config']['page_size']; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_log where user_id = " . intval($GLOBALS['user_info']['id']) . " order by log_time desc limit " . $limit); foreach ($log_list as $k => $v) { $log_list[$k]['log_time'] = to_date($v['log_time'], 'Y-m-d'); } $log_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_log where user_id = " . intval($GLOBALS['user_info']['id'])); $root['page'] = array("page" => $page, "page_total" => ceil($log_count / $page_size), "page_size" => intval($page_size), 'total' => intval($log_count)); $root['log_list'] = $log_list; } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $id = intval($GLOBALS['request']['id']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/deal.php'; $root['user_login_status'] = 1; $deal = get_deal($id); $root['deal'] = $deal; //还款列表 $loan_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "deal_repay where deal_id={$id} ORDER BY repay_time ASC"); $manage_fee = 0; $impose_money = 0; $repay_money = 0; foreach ($loan_list as $k => $v) { $manage_fee += $v['manage_money']; $impose_money += $v['impose_money']; $repay_money += $v['repay_money']; //还款日 $loan_list[$k]['repay_time_format'] = to_date($v['repay_time'], 'Y-m-d'); $loan_list[$k]['true_repay_time_format'] = to_date($v['true_repay_time'], 'Y-m-d'); //待还本息 $loan_list[$k]['repay_money_format'] = format_price($v['repay_money']); //借款管理费 $loan_list[$k]['manage_money_format'] = format_price($v['manage_money']); //逾期费用 $loan_list[$k]['impose_money_format'] = format_price($v['impose_money']); //状态 if ($v['status'] == 0) { $loan_list[$k]['status_format'] = '提前还款'; } elseif ($v['status'] == 1) { $loan_list[$k]['status_format'] = '准时还款'; } elseif ($v['status'] == 2) { $loan_list[$k]['status_format'] = '逾期还款'; } elseif ($v['status'] == 3) { $loan_list[$k]['status_format'] = '严重逾期'; } } $root['manage_fee'] = $manage_fee; $root['impose_money'] = $impose_money; $root['repay_money'] = $repay_money; $root['loan_list'] = $loan_list; $inrepay_info = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "deal_inrepay_repay WHERE deal_id={$id}"); $root['inrepay_info'] = $inrepay_info; } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } $root['program_title'] = "提前还款"; output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['biz_email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['biz_pwd']); //密码 //检查用户,用户密码 $biz_user = biz_check($email, $pwd); $supplier_id = intval($biz_user['supplier_id']); $type = strim($GLOBALS['request']['type']); //0:全部评价;1:差评;2:未读 $deal_id = strim($GLOBALS['request']['deal_id']); //团购商品id if ($supplier_id > 0) { $root['user_login_status'] = 1; //用户登陆状态:1:成功登陆;0:未成功登陆 $page = intval($GLOBALS['request']['page']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE; $sql = "select m.id,m.content,m.create_time,m.update_time, m.point,m.admin_reply,m.admin_id,u.user_name from " . DB_PREFIX . "message m left join fanwe_user u on u.id = m.user_id where m.rel_id = " . $deal_id . " and m.rel_table = 'deal' and m.pid = 0 and m.is_buy = 1"; $count_sql = "select count(*) from " . DB_PREFIX . "message m left join fanwe_user u on u.id = m.user_id where m.rel_id = " . $deal_id . " and m.rel_table = 'deal' and m.pid = 0 and m.is_buy = 1"; //0:全部评价;1:差评;2:未读 if ($type == 1) { $sql .= " and m.point <= 2 "; $count_sql .= " and m.point <= 2 "; } else { if ($type == 2) { $sql .= " and m.is_read = 0 "; $count_sql .= " and m.is_read = 0 "; } } $count = $GLOBALS['db']->getOne($count_sql); $sql .= " order by m.create_time desc limit " . $limit; $deal_list = $GLOBALS['db']->getAll($sql); //$root['sql'] = $sql; //echo $sql; exit; foreach ($deal_list as $k => $v) { $deal_list[$k]['create_time_format'] = to_date($v['create_time'], 'Y-m-d H:i'); $deal_list[$k]['update_time_format'] = to_date($v['update_time'], 'Y-m-d H:i'); } $root['page'] = array("page" => $page, "page_total" => ceil($count / PAGE_SIZE), "page_size" => PAGE_SIZE); if ($deal_list == false || $deal_list == null) { $deal_list = array(); } //$root['count'] = count($deal_list); //$root['22'] = print_r($deal_list,1); $root['item'] = $deal_list; $root['return'] = 1; } else { $root['return'] = 0; $root['user_login_status'] = 0; //用户登陆状态:1:成功登陆;0:未成功登陆 $root['info'] = "商户不存在或密码错误"; } output($root); }
public function index() { $payment_id = intval($GLOBALS['request']['payment']); $money = floatval($GLOBALS['request']['money']); if ($money <= 0) { $root['status'] = 2; $root['info'] = $GLOBALS['lang']['PLEASE_INPUT_CORRECT_INCHARGE']; output($root); } $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_id); if (!$payment_info) { $root['status'] = 2; $root['info'] = $GLOBALS['lang']['PLEASE_SELECT_PAYMENT']; output($root); } if ($payment_info['fee_type'] == 0) { //定额 $payment_fee = $payment_info['fee_amount']; } else { //比率 $payment_fee = $money * $payment_info['fee_amount']; } //开始生成订单 $now = NOW_TIME; $order['type'] = 1; //充值单 $order['user_id'] = $GLOBALS['user_info']['id']; $order['create_time'] = $now; $order['total_price'] = $money + $payment_fee; $order['deal_total_price'] = $money; $order['pay_amount'] = 0; $order['pay_status'] = 0; $order['delivery_status'] = 5; $order['order_status'] = 0; $order['payment_id'] = $payment_id; $order['payment_fee'] = $payment_fee; // $order['bank_id'] = strim($_REQUEST['bank_id']); do { $order['order_sn'] = to_date(get_gmtime(), "Ymdhis") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order, 'INSERT', '', 'SILENT'); $order_id = intval($GLOBALS['db']->insert_id()); } while ($order_id == 0); require_once APP_ROOT_PATH . "system/model/cart.php"; $payment_notice_id = make_payment_notice($order['total_price'], $order_id, $payment_info['id']); //创建支付接口的付款单 if ($payment_notice_id) { $root['order_id'] = $order_id; $root['info'] = 1; } // print_r($root);exit; output($root); // $rs = order_paid($order_id); // if ($rs) { // app_redirect(url("index", "payment#incharge_done", array("id" => $order_id))); //充值支付成功 // } else { // app_redirect(url("index", "payment#pay", array("id" => $payment_notice_id))); // } }
public function get_payment_code($payment_notice_id) { $upop_evn = $this->upop_evn; $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); // 商户名称 quickpay_conf::$pay_params['merAbbr'] = $payment_info['config']['upop_merAbbr']; foreach (Upop_payment::$api_url[$upop_evn] as $key => $value) { quickpay_conf::${$key} = $value; } if ($upop_evn == '2') { quickpay_conf::$security_key = $payment_info['config']['upop_security_key']; quickpay_conf::$pay_params['merId'] = $payment_info['config']['upop_account']; } else { if ($upop_evn == '1') { quickpay_conf::$security_key = $payment_info['config']['upop_security_key_pm']; quickpay_conf::$pay_params['merId'] = $payment_info['config']['upop_account_pm']; } else { if ($upop_evn == '0') { quickpay_conf::$security_key = $payment_info['config']['upop_security_key']; quickpay_conf::$pay_params['merId'] = $payment_info['config']['upop_account']; } } } $frontEndUrl = SITE_DOMAIN . APP_ROOT . '/callback/payment/upop_response.php'; $backEndUrl = SITE_DOMAIN . APP_ROOT . '/callback/payment/upop_notify.php'; mt_srand(quickpay_service::make_seed()); $param = array(); $param['transType'] = quickpay_conf::CONSUME; // 交易类型,CONSUME or PRE_AUTH $param['orderAmount'] = $money * 100; // 交易金额 转化为分 $param['orderNumber'] = $payment_notice['notice_sn']; // 订单号,必须唯一 $param['orderTime'] = to_date(NOW_TIME, 'YmdHis'); // 交易时间, YYYYmmhhddHHMMSS $param['orderCurrency'] = quickpay_conf::CURRENCY_CNY; //交易币种,CURRENCY_CNY=>人民币 $param['customerIp'] = $_SERVER['REMOTE_ADDR']; // 用户IP $param['frontEndUrl'] = $frontEndUrl; // 前台回调URL $param['backEndUrl'] = $frontEndUrl; // 后台回调URL /* 可填空字段 $param['commodityUrl'] = "http://www.example.com/product?name=商品"; //商品URL $param['commodityName'] = '商品名称'; //商品名称 $param['commodityUnitPrice'] = 11000; //商品单价 $param['commodityQuantity'] = 1; //商品数量 */ $button = "<button class='ui-button paybutton' rel='blue' type='submit'>去网银在线支付</button>"; $pay_service = new quickpay_service($param, quickpay_conf::FRONT_PAY); $html = $pay_service->create_html($button); return $html; }
function DoDpTrade($cfg, $user_id, $pTrdAmt, $post_url) { $merchant_id = $cfg['merchant_id']; $terminal_id = $cfg['terminal_id']; $key = $cfg['key']; $iv = $cfg['iv']; $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Baofoo&class_act=DoDpTrade&from=" . $_REQUEST['from']; //web方式返回 $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Baofoo&class_act=DoDpTrade&from=" . $_REQUEST['from']; //s2s方式返回 $user = array(); $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); $data = array(); $data['merchant_id'] = $merchant_id; //商户号 $data['terminal_id'] = $terminal_id; //终端号 $data['order_id'] = 0; //订单号 (唯一不可重复) $data['user_id'] = $user_id; $data['amount'] = $pTrdAmt; //充值金额,单位:元 $data['mer_fee'] = 0; //商户收取的手续费 $data['fee_taken_on'] = '1'; //费用承担方(宝付收取的费用),1平台2用户自担 $data['additional_info'] = ''; //其它信息 $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_recharge", $data, 'INSERT'); $id = $GLOBALS['db']->insert_id(); $data_update = array(); $data_update['order_id'] = $id; $data['order_id'] = $id; $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_recharge", $data_update, 'UPDATE', 'id=' . $id); $strxml = DoDpTradeXml($data, $pWebUrl, $pS2SUrl); $pSign = md5($strxml . "~|~" . $key); //$aes=new MyAES(); //$requestParams=$aes->encrypt($strxml,$key,$iv); //加密 $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body> <form name="form1" id="form1" method="post" action="' . $post_url . 'custody/recharge.do" target="_self"> merchant_id:<input type="hidden" name="merchant_id" value="' . $merchant_id . '" /><br> terminal_id:<input type="hidden" name="terminal_id" value="' . $terminal_id . '" /><br> sign:<input type="hidden" name="sign" value="' . $pSign . '" /><br> requestParams:<textarea name="requestParams" cols="100" rows="5">' . $strxml . '</textarea> <br> <input type="submit" value="提交"></input> </form> </body></html> <script language="javascript">document.form1.submit();</script>'; //echo $html; exit; $baofoo_log = array(); $baofoo_log['code'] = 'recharge'; $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s'); $baofoo_log['strxml'] = $strxml; $baofoo_log['html'] = $html; $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log); return $html; }
public function edit() { $id = intval($_REQUEST['id']); $condition['id'] = $id; $vo = M(MODULE_NAME)->where($condition)->find(); $vo['end_time'] = $vo['end_time'] != 0 ? to_date($vo['end_time']) : ''; $this->assign('vo', $vo); $this->display(); }
public function edit() { $id = intval($_REQUEST['id']); $condition['id'] = $id; $vo = M("PlanCate")->where($condition)->find(); $_REQUEST['repay_time'] = to_date($vo['repay_time'], "Y-m-d H:i:s"); $this->assign('vo', $vo); $this->display(); }
public function index() { init_app_page(); $s_account_info = $GLOBALS["account_info"]; $supplier_id = intval($s_account_info['supplier_id']); $name = strim($_REQUEST['name']); $begin_time = strim($_REQUEST['begin_time']); $end_time = strim($_REQUEST['end_time']); $begin_time_s = to_timespan($begin_time, "Y-m-d H:i"); $end_time_s = to_timespan($end_time, "Y-m-d H:i"); $condition = ""; if ($name != "") { $youhui_ids = $GLOBALS['db']->getRow("select group_concat(id SEPARATOR ',') as ids from " . DB_PREFIX . "youhui where name like '%" . $name . "%'"); $condition .= " and log.youhui_id in (" . $youhui_ids['ids'] . ") "; } if ($begin_time_s) { $condition .= " and log.create_time > " . $begin_time_s . " "; } if ($end_time_s) { $condition .= " and log.create_time < " . $end_time_s . " "; } $GLOBALS['tmpl']->assign("name", $name); $GLOBALS['tmpl']->assign("begin_time", $begin_time); $GLOBALS['tmpl']->assign("end_time", $end_time); //分页 $page_size = 15; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $list = $GLOBALS['db']->getAll("select distinct(log.id),log.* from " . DB_PREFIX . "youhui_log as log left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition . " order by log.create_time desc limit " . $limit); foreach ($list as $k => $v) { $list[$k]['user_name'] = load_user($v['user_id']); $list[$k]['user_name'] = $list[$k]['user_name']['user_name']; $youhui_info = load_auto_cache("youhui", array('id' => $v['youhui_id'])); $list[$k]['youhui_name'] = $youhui_info['name']; $location_info = load_auto_cache("store", array('id' => $v['location_id'])); $list[$k]['location_name'] = $location_info['name']; if ($list[$k]['expire_time'] != 0 && $list[$k]['expire_time'] < NOW_TIME) { $list[$k]['expire_time'] = "已过期"; } elseif ($list[$k]['expire_time'] == 0) { $list[$k]['expire_time'] = "永久有效"; } else { $list[$k]['expire_time'] = to_date($list[$k]['expire_time']); } $list[$k]['url'] = url('index', 'youhui#' . $v['youhui_id']); } $total = $GLOBALS['db']->getOne("select count(distinct(log.id)) from " . DB_PREFIX . "youhui_log as log left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition); $page = new Page($total, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("list", $list); $GLOBALS['tmpl']->assign("head_title", "优惠券下载记录"); $GLOBALS['tmpl']->display("pages/youhuio/index.html"); }
public function index() { $GLOBALS['tmpl']->assign("page_title", "VIP等级特权"); $list = load_auto_cache("level"); $GLOBALS['tmpl']->assign("list", $list['list']); $userinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user WHERE id='" . $GLOBALS['user_info']['id'] . "' and vip_state='1' "); $GLOBALS['tmpl']->assign('userinfo', $userinfo); $gradeinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "vip_type WHERE id='" . $userinfo['vip_id'] . "' and is_delete='0' "); $GLOBALS['tmpl']->assign('gradeinfo', $gradeinfo); $vip_type = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "vip_type WHERE is_effect='1' and is_delete='0' "); $GLOBALS['tmpl']->assign('vip_type', $vip_type); $vip_setting = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "vip_setting v LEFT JOIN " . DB_PREFIX . "vip_type vt ON v.vip_id=vt.id WHERE v.is_effect='1' and v.is_delete='0' "); $GLOBALS['tmpl']->assign('vip_setting', $vip_setting); $customerinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "customer WHERE id='" . $userinfo['customer_id'] . "' and is_effect='1' "); $GLOBALS['tmpl']->assign('customerinfo', $customerinfo); $today = to_date(TIME_UTC, "Y-m-d"); $start_time = to_date(next_replay_month(TIME_UTC, -24), "Y-m-d"); $begin_date = to_date(next_replay_month(TIME_UTC, -3), "Y-m-d"); $user_id = $GLOBALS['user_info']['id']; $borrow_total = $GLOBALS['db']->getOne("select sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE start_date>'{$start_time}' and user_id='{$user_id}' and deal_status > 3 "); $load_total = $GLOBALS['db']->getOne("select sum(dl.money) FROM " . DB_PREFIX . "deal_load dl LEFT JOIN " . DB_PREFIX . "deal d ON dl.deal_id=d.id WHERE dl.create_date>'{$start_time}' and dl.user_id='{$user_id}' and d.deal_status > 3 "); $t_u_load = $GLOBALS['db']->getRow("SELECT sum(dlr.repay_money) as load_money FROM " . DB_PREFIX . "deal_load_repay dlr LEFT JOIN " . DB_PREFIX . "deal d ON d.id=dlr.deal_id LEFT JOIN " . DB_PREFIX . "deal_load dl ON dl.id=dlr.load_id WHERE d.is_effect=1 and dl.is_repay= 0 and dlr.t_user_id = " . $user_id); $load_total = floatval($load_total) + floatval($t_u_load['load_money']); // $load_total = $GLOBALS['db']->getOne("select sum(money) FROM ".DB_PREFIX."deal_load WHERE create_date>'$start_time' and user_id='$user_id' "); $overdue_total = $GLOBALS['db']->getOne("select sum(repay_money) FROM " . DB_PREFIX . "deal_repay WHERE ((has_repay=1 and repay_date<true_repay_date) or (has_repay=0 and repay_date <'{$today}')) and user_id='{$user_id}' "); $bl_total = (int) $borrow_total + (int) $load_total; $yx_total = $bl_total - $overdue_total; $vipgradeinfo = $GLOBALS['db']->getRow("select * FROM " . DB_PREFIX . "vip_type WHERE lower_limit<='{$yx_total}' and upper_limit>='{$yx_total}' and is_effect='1' and is_delete='0' "); $grade_cz = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "vip_type where is_effect='1' and is_delete='0' order by lower_limit asc limit 1 "); if ($grade_cz['lower_limit'] > $yx_total || $userinfo['vip_id'] == 0) { $chazhi = (int) $grade_cz['lower_limit'] - $yx_total; if ($chazhi > 0) { $chazhi = $chazhi; } else { $chazhi = 0; } $nextgrade = $grade_cz['vip_grade']; } else { $chazhi = $vipgradeinfo['upper_limit'] - $yx_total + 1; $nextgradeinfo = $GLOBALS['db']->getRow("select * FROM " . DB_PREFIX . "vip_type WHERE lower_limit >'" . $vipgradeinfo['upper_limit'] . "' and is_effect='1' and is_delete='0' order by lower_limit asc limit 1 "); $nextgrade = $nextgradeinfo['vip_grade']; } $chazhi = number_format($chazhi); $bl_total = number_format($bl_total); $vipgradeinfo = number_format($vipgradeinfo); $yx_total = number_format($yx_total); $overdue_total = number_format($overdue_total); $GLOBALS['tmpl']->assign('bl_total', $bl_total); $GLOBALS['tmpl']->assign('chazhi', $chazhi); $GLOBALS['tmpl']->assign('nextgrade', $nextgrade); $GLOBALS['tmpl']->assign('overdue_total', $overdue_total); $GLOBALS['tmpl']->assign('yx_total', $yx_total); $GLOBALS['tmpl']->assign('vipgradeinfo', $vipgradeinfo); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_vip_setting_index.html"); $GLOBALS['tmpl']->display("page/uc.html"); }
public function index() { $email = addslashes($GLOBALS['request']['email']); //用户名或邮箱 $pwd = addslashes($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user_info = user_check($email, $pwd); $user_id = intval($user_info['id']); if (!$user_info) { $root['status'] = 0; $root['message'] = "用户已失效,无法上传"; output($root); } else { //上传 $content = addslashes(htmlspecialchars(trim($GLOBALS['request']['content']))); if ($content == '') { $root['status'] = 0; $root['message'] = "发布内容不能为空"; output($root); } $dir = "u_" . to_date(get_gmtime(), "Ym"); if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) { @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir); @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777); } $img_result = save_image_upload($_FILES, 'image_1', 'attachment/' . $dir, array('origin' => array(0, 0, 0, 0)), 0, 1); if (intval($img_result['error']) != 0) { $root['status'] = 0; $root['message'] = "图片上传失败:" . $img_result['message']; output($root); } $image_1 = $img_result['image_1']['url']; $youhui['user_id'] = $user_id; $youhui['icon'] = $image_1; $youhui['image'] = $image_1; $youhui['is_effect'] = 0; $youhui['name'] = $content; $youhui['content'] = $content; $youhui['create_time'] = get_gmtime(); $youhui['pub_by'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui", $youhui, 'INSERT'); $id = $GLOBALS['db']->insert_id(); if ($id) { $root['status'] = 1; $root['message'] = "发布信息成功"; output($root); } else { $root['status'] = 0; $root['message'] = "发布信息失败,请稍候再发"; output($root); } //上传 } }
/** * 创建新帐户 * @param int $user_id * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id * @param unknown_type $MerCode * @param unknown_type $cert_md5 * @param unknown_type $post_url * @return string */ function RegisterCat($user_id, $platformNo, $post_url, $sys = 'pc') { $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=RegisterCat&from=" . $_REQUEST['from']; //web方式返回 $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=RegisterCat&from=" . $_REQUEST['from']; //s2s方式返回 $user = array(); $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); $yeepay_log = array(); $yeepay_log['code'] = 'toRegister'; $yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s'); $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log); $requestNo = $GLOBALS['db']->insert_id(); $data = array(); $data['requestNo'] = $requestNo; //请求流水号 $data['platformUserNo'] = $user_id; // $data['platformNo'] = $platformNo; // 商户编号 $data['nickName'] = $user['user_name']; $data['realName'] = $user['identify_name']; $data['idCardNo'] = $user['identify_number']; // $data['idCardType'] = 'G2_IDCARD'; $data['mobile'] = $user['mobile']; // $data['email'] = $user['email']; // $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_register", $data, 'INSERT'); $id = $GLOBALS['db']->insert_id(); $strxml = CreateNewAcctXml($data, $pWebUrl, $pS2SUrl); $pSign = cfca($strxml); if ($sys == 'pc') { $act = 'bha'; } elseif ($sys == 'mobile') { $act = 'bhawireless'; } $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body> <form name="form1" id="form1" method="post" action="' . $post_url . '/' . $act . '/identityVerification" target="_self"> <input type="hidden" name="sign" value="' . $pSign . '" /> <textarea name="req" cols="100" rows="5" style="display:none">' . $strxml . '</textarea> <input type="hidden" value="提交"></input> <div style="width:100%;text-align:center;padding:50px 0;"><img src="' . APP_ROOT . '/app/Tpl/' . app_conf("TEMPLATE") . '/images/loading.gif" />页面正在跳转,请稍后...</div> </form> </body></html> <script language="javascript">document.form1.submit();</script>'; //echo $html; exit; $yeepay_log = array(); $yeepay_log['strxml'] = $strxml; $yeepay_log['html'] = $html; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log, 'UPDATE', 'id=' . $requestNo); return $html; }
function DoDwTrade($user_id, $platformNo, $pTrdAmt, $post_url, $sys = 'pc') { $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=DoDwTrade&from=" . $_REQUEST['from']; //web方式返回 $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=DoDwTrade&from=" . $_REQUEST['from']; //s2s方式返回 $user = array(); $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); $yeepay_log = array(); $yeepay_log['code'] = 'toWithdraw'; $yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s'); $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log); $requestNo = $GLOBALS['db']->insert_id(); $fee = 0; //getCarryFee($pTrdAmt,$user); $data = array(); $data['requestNo'] = $requestNo; //请求流水号 $data['platformUserNo'] = $user_id; // $data['platformNo'] = $platformNo; // 商户编号 $data['amount'] = $pTrdAmt - $fee; $collocation_item = $GLOBALS['db']->getRow("select config from " . DB_PREFIX . "collocation where class_name='Yeepay'"); $collocation_cfg = unserialize($collocation_item['config']); $data['feeMode'] = $collocation_cfg['TXfeeMode'] ? $collocation_cfg['TXfeeMode'] : 'USER'; //费率模式PLATFORM PLATFORM 收取商户手续费 USER 收取用户手续费 $data['fee'] = $fee; $data['create_time'] = NOW_TIME; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_withdraw", $data, 'INSERT'); $id = $GLOBALS['db']->insert_id(); $strxml = DoDwTradeXml($data, $pWebUrl, $pS2SUrl); $pSign = cfca($strxml); if ($sys == 'pc') { $act = 'bha'; } elseif ($sys == 'mobile') { $act = 'bhawireless'; } $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body> <form name="form1" id="form1" method="post" action="' . $post_url . '/' . $act . '/toWithdraw" target="_self"> <input type="hidden" name="sign" value="' . $pSign . '" /> <textarea name="req" cols="100" rows="5" style="display:none">' . $strxml . '</textarea> <input type="hidden" value="提交"></input> <div style="width:100%;text-align:center;padding:50px 0;"><img src="' . APP_ROOT . '/app/Tpl/' . app_conf("TEMPLATE") . '/images/loading.gif" />页面正在跳转,请稍后...</div> </form> </body></html> <script language="javascript">document.form1.submit();</script>'; //echo $html; exit; $yeepay_log = array(); $yeepay_log['strxml'] = $strxml; $yeepay_log['html'] = $html; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log, 'UPDATE', 'id=' . $requestNo); return $html; }
/** * 标的登记 及 流标 * @param int $deal_id * @param int $pOperationType 标的操作类型,1:新增,2:结束 “新增”代表新增标的,“结束”代表标的正常还清、丌 需要再还款戒者标的流标等情况。标的“结束”后,投资 人投标冻结金额、担保方保证金、借款人保证金均自劢解 冻 * @param int $status; 0:新增; 2:流标结束 * @param string $status_msg 主要是status_msg=2时记录的,流标原因 * @param unknown_type $platformNo * @param unknown_type $post_url * @return string */ function DoBids($deal_id, $pOperationType, $status, $status_msg, $platformNo, $post_url) { $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=yeepay&class_act=DoBids"; //web方式返回 $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=yeepay&class_act=DoBids"; //s2s方式返回 //$requestNo = $GLOBALS['db']->getOne("select * from ".DB_PREFIX."yeepay_cp_transaction where is_callback = 1 and code = 1 and tenderOrderNo = '".$deal_id."'"); $t_arr = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "yeepay_cp_transaction where is_callback = 1 and tenderOrderNo = " . $deal_id . " and bizType = 'TENDER'"); $deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id); $err_count = 0; foreach ($t_arr as $k => $v) { $data = array(); $data['requestNo'] = $v["requestNo"]; //请求流水号 $data['platformNo'] = $platformNo; // 商户编号 $data['mode'] = "CANCEL"; /* 请求参数 */ $req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo=\"" . $platformNo . "\">" . "<requestNo>" . $data['requestNo'] . "</requestNo>" . "<mode>" . $data['mode'] . "</mode>" . "<notifyUrl><![CDATA[" . $pS2SUrl . "]]></notifyUrl>" . "</request>"; /* 签名数据 */ $sign = "xxxx"; $yeepay_log = array(); $yeepay_log['code'] = 'COMPLETE_TRANSACTION'; $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s'); $yeepay_log['strxml'] = $req; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log); //$id = $GLOBALS['db']->insert_id(); /* 调用账户查询服务 */ $service = "COMPLETE_TRANSACTION"; $ch = curl_init($post_url . "/bhaexter/bhaController"); curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign))); $resultStr = curl_exec($ch); if (empty($resultStr)) { $err_count++; } else { require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($resultStr); //print_r($str3ParaInfo);exit; $str3Req = $str3ParaInfo['response']; $result['pErrCode'] = $str3Req["code"]; $result['pErrMsg'] = $str3Req["description"]; //$result['pIpsAcctNo'] = $user_id; if ($str3Req["code"] == 1) { $requestNo = $str3Req['requestNo']; $t_data = array(); $t_data["is_complete_transaction"] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_cp_transaction", $t_data, 'UPDATE', " requestNo = '" . $requestNo . "'"); return array("info" => '操作成功'); } } } //showIpsInfo('同步成功',""); }
/** * 创建新帐户 * @param int $user_id * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id * @param unknown_type $MerCode * @param unknown_type $cert_md5 * @param unknown_type $post_url * @return string */ function CreateNewAcct($cfg, $user_id, $post_url) { $merchant_id = $cfg['merchant_id']; $terminal_id = $cfg['terminal_id']; $key = $cfg['key']; $iv = $cfg['iv']; $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php"; //web方式返回 $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Baofoo&class_act=CreateNewAcct&from=" . $_REQUEST['from']; //s2s方式返回 //$pWebUrl = 'http://www.test.com/ser_url'; //$pS2SUrl = 'http://www.test.com/ser_url'; $user = array(); $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); $data = array(); $data['merchant_id'] = $merchant_id; $data['terminal_id'] = $terminal_id; $data['bf_account'] = $user['mobile']; $data['name'] = $user['real_name']; $data['id_card'] = $user['idno']; $data['user_id'] = $user_id; $data['create_time'] = TIME_UTC; $sql = "select id from " . DB_PREFIX . "baofoo_bind_state where user_id = " . $user_id; $id = intval($GLOBALS['db']->getOne($sql)); if ($id == 0) { $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_bind_state", $data, 'INSERT'); $id = $GLOBALS['db']->insert_id(); } else { $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_bind_state", $data, 'UPDATE', 'id=' . $id); } $strxml = CreateNewAcctXml($data, $pWebUrl, $pS2SUrl); $pSign = md5($strxml . "~|~" . $key); $aes = new MyAES(); $requestParams = $aes->encrypt($strxml, $key, $iv); //加密 $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body> <form name="form1" id="form1" method="post" action="' . $post_url . 'custody/bindState.do" target="_self"> <input type="hidden" name="sign" value="' . $requestParams . '" /> <input type="hidden" name="merchant_id" value="' . $merchant_id . '" /> <input type="hidden" name="terminal_id" value="' . $terminal_id . '" /> <input type="submit" value="提交"></input> </form> </body></html> <script language="javascript">document.form1.submit();</script>'; //echo $html; exit; $baofoo_log = array(); $baofoo_log['code'] = 'bindState'; $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s'); $baofoo_log['strxml'] = $strxml; $baofoo_log['html'] = $html; $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log); return $html; }
/** * 创建新帐户 * @param int $user_id * @param int $user_type 0:普通用户xd_user.id;1:担保用户xd_deal_agency.id * @param unknown_type $MerCode * @param unknown_type $cert_md5 * @param unknown_type $post_url * @return string */ function CreateNewAcct($user_id, $user_type, $MerCode, $cert_md5, $post_url) { $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Ips&class_act=CreateNewAcct&from=" . $_REQUEST['from']; //web方式返回 $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Ips&class_act=CreateNewAcct&from=" . $_REQUEST['from']; //s2s方式返回 $user = array(); if ($user_type == 0) { $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); } else { $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_agency where id = " . $user_id); } $data = array(); $data['user_type'] = $user_type; $data['user_id'] = $user_id; $data['argMerCode'] = $MerCode; // '“平台”账号 否 由IPS颁发的商户号 ', $data['pMerBillNo'] = $user_id . 'U' . get_gmtime(); //$user_id;//'pMerBillNo商户开户流水号 否 商户系统唯一丌重复 针对用户在开户中途中断(开户未完成,但关闭了IPS开 户界面)时,必须重新以相同的商户订单号发起再次开户 ', $data['pIdentType'] = 1; //'证件类型 否 1#身份证,默认:1', $data['pIdentNo'] = $user['idno']; //'证件号码 否 真实身份证 ', $data['pRealName'] = $user['real_name']; //'姓名 否 真实姓名(中文) ' $data['pMobileNo'] = $user['mobile']; //'手机号 否 用户发送短信 ' $data['pEmail'] = $user['email']; //'注册邮箱 否 用于登录账号,IPS系统内唯一丌能重复', $data['pSmDate'] = to_date(get_gmtime(), 'Ymd'); //'提交日期 否 时间格式“yyyyMMdd”,商户提交日期,。如:20140323 ', $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_create_new_acct", $data, 'INSERT'); $id = $GLOBALS['db']->insert_id(); $strxml = CreateNewAcctXml($data, $pWebUrl, $pS2SUrl); //echo $strxml;exit; $Crypt3Des = new Crypt3Des(); //new 3des class $p3DesXmlPara = $Crypt3Des->DESEncrypt($strxml); //3des 加密 $str = $MerCode . $p3DesXmlPara . $cert_md5; //print_r($cert_md5); exit; $pSign = md5($str); $html = ' <form name="form1" id="form1" method="post" action="' . $post_url . 'CreateNewIpsAcct.aspx" target="_self"> <input type="hidden" name="argMerCode" value="' . $MerCode . '" /> <input type="hidden" name="arg3DesXmlPara" value="' . $p3DesXmlPara . '" /> <input type="hidden" name="argSign" value="' . $pSign . '" /> </form> <script language="javascript">document.form1.submit();</script>'; //echo $html; exit; return $html; }
public function edit() { $id = intval($_REQUEST['id']); $condition['id'] = $id; $vo = M(MODULE_NAME)->where($condition)->find(); $vo['begin_time'] = $vo['begin_time'] != 0 ? to_date($vo['begin_time']) : ''; $vo['end_time'] = $vo['end_time'] != 0 ? to_date($vo['end_time']) : ''; $this->assign('vo', $vo); $cate_tree = M("ShopCate")->where('is_delete = 0')->findAll(); $cate_tree = D("ShopCate")->toFormatTree($cate_tree, 'name'); $this->assign("cate_tree", $cate_tree); $this->display(); }
/** * 创建新帐户 * @param int $user_id * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id * @param unknown_type $MerCode * @param unknown_type $cert_md5 * @param unknown_type $post_url * @return string */ function CreateNewAcct($user_id, $platformNo, $post_url) { $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=CreateNewAcct&from=" . $_REQUEST['from']; //web方式返回 $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=CreateNewAcct&from=" . $_REQUEST['from']; //s2s方式返回 $user = array(); $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); $yeepay_log = array(); $yeepay_log['code'] = 'toRegister'; $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s'); $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log); $requestNo = $GLOBALS['db']->insert_id(); $data = array(); $data['requestNo'] = $requestNo; //请求流水号 $data['platformUserNo'] = $user_id; // $data['platformNo'] = $platformNo; // 商户编号 $data['nickName'] = $user['user_name']; $data['realName'] = $user['real_name']; $data['idCardNo'] = $user['idno']; // $data['idCardType'] = 'G2_IDCARD'; $data['mobile'] = $user['mobile']; // $data['email'] = $user['email']; // $data['create_time'] = TIME_UTC; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_register", $data, 'INSERT'); $id = $GLOBALS['db']->insert_id(); $strxml = CreateNewAcctXml($data, $pWebUrl, $pS2SUrl); $pSign = "signdata"; $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body> <form name="form1" id="form1" method="post" action="' . $post_url . '/bha/toRegister" target="_self"> <input type="text" name="sign" value="' . $pSign . '" /> <textarea name="req" cols="100" rows="5">' . $strxml . '</textarea> <input type="submit" value="提交"></input> </form> </body></html> <script language="javascript">document.form1.submit();</script>'; //echo $html; exit; $yeepay_log = array(); $yeepay_log['strxml'] = $strxml; $yeepay_log['html'] = $html; $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log, 'UPDATE', 'id=' . $requestNo); return $html; }