本文整理汇总了PHP中modify_account函数的典型用法代码示例。如果您正苦于以下问题:PHP modify_account函数的具体用法?PHP modify_account怎么用?PHP modify_account使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了modify_account函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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;
$order_id = intval($_REQUEST['id']);
$order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where order_status = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . " and id = " . $order_id);
if (!$order_info) {
$root['info'] = '无效的订单';
} else {
$money = $order_info['credit_pay'];
$GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_order where id = " . $order_id . " and user_id = " . intval($GLOBALS['user_info']['id']) . " and order_status = 0");
if ($GLOBALS['db']->affected_rows() > 0) {
if ($money > 0) {
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => $money), intval($GLOBALS['user_info']['id']), "删除" . $order_info['deal_name'] . "项目支付,退回支付款。");
}
}
$root['response_code'] = 1;
$root['info'] = '删除成功';
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例2: cash_save
public function cash_save()
{
$data['integral'] = intval($_REQUEST['integral']);
$data['user_id'] = $GLOBALS['user_info']['id'];
require APP_ROOT_PATH . 'system/libs/user.php';
$userinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user WHERE id='" . $GLOBALS['user_info']['id'] . "' ");
if ($userinfo['vip_id'] == 0) {
showErr("您还不是VIP会员,不可兑换积分!", 0);
}
if ($data['integral'] == 0 || $data['integral'] == "") {
showErr("请输入正确的兑换积分!", 0);
}
if ($data['integral'] > $userinfo['score']) {
showErr("该积分超过了用户积分", 0);
} else {
if ($data['integral'] % 1000 != 0) {
showErr("该积分不是1000的倍数积分", 0);
} else {
$vininfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "vip_setting WHERE vip_id='" . $userinfo['vip_id'] . "' ");
$excmoney = $data['integral'] * $vininfo['coefficient'] / 100;
modify_account(array('money' => $excmoney, 'nmc_amount' => $excmoney, 'score' => -$data['integral']), $GLOBALS['user_info']['id'], '积分兑现', 22);
}
}
$data['vip_id'] = $userinfo['vip_id'];
$data['exchange_date'] = to_date(TIME_UTC, "Y-m-d");
$data['cash'] = $excmoney;
$GLOBALS['db']->autoExecute(DB_PREFIX . "score_exchange_record", $data, "INSERT");
if ($GLOBALS['db']->affected_rows()) {
showSuccess("兑现成功", 0);
} else {
showErr("兑现失败", 0);
}
}
示例3: payment_paid
/**
* 付款单的支付
* @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;
}
示例4: payment_paid
/**
* 付款单的支付
* @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;
}
示例5: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$page = intval($GLOBALS['request']['page']);
$dltid = intval($GLOBALS['request']['dltid']);
$status = intval($GLOBALS['request']['status']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/uc_func.php';
require APP_ROOT_PATH . 'system/libs/user.php';
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$nmc_amount = $GLOBALS['db']->getOne("SELECT nmc_amount FROM " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id']));
if ($status == 0) {
$GLOBALS['db']->query("UPDATE " . DB_PREFIX . "user_carry SET status=4 where id=" . $dltid . " and status=0 and user_id = " . intval($GLOBALS['user_info']['id']));
if ($GLOBALS['db']->affected_rows()) {
$data = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user_carry where id=" . $dltid . " and status=4 and user_id = " . intval($GLOBALS['user_info']['id']));
modify_account(array('money' => $data['money'], 'lock_money' => -$data['money']), $data['user_id'], "撤销提现,提现金额", 8);
modify_account(array('money' => $data['fee'], 'lock_money' => -$data['fee']), $data['user_id'], "撤销提现,提现手续费", 9);
$root['show_err'] = "撤销操作成功";
} else {
$root['show_err'] = "撤销操作失败";
}
output($root);
} elseif ($status == 4) {
$data = $GLOBALS['db']->getRow("SELECT user_id,money,fee FROM " . DB_PREFIX . "user_carry where id=" . $dltid . " and status=4 and user_id = " . intval($GLOBALS['user_info']['id']));
if ((double) $data['money'] + (double) $data['fee'] + (double) $GLOBALS['user_info']['nmc_amount'] > (double) $GLOBALS['user_info']['money']) {
$root['show_err'] = "继续申请提现失败,金额不足";
}
$sql = "UPDATE " . DB_PREFIX . "user_carry SET status=0 where id=" . $dltid . " and (money + fee + {$nmc_amount}) <= " . (double) $GLOBALS['user_info']['money'] . " and status=4 and user_id = " . intval($GLOBALS['user_info']['id']) . " ";
$root['sql'] = $sql;
$GLOBALS['db']->query($sql);
if ($GLOBALS['db']->affected_rows()) {
modify_account(array('money' => -$data['money'], 'lock_money' => $data['money']), $data['user_id'], "提现申请", 8);
modify_account(array('money' => -$data['fee'], 'lock_money' => $data['fee']), $data['user_id'], "提现手续费", 9);
$root['show_err'] = "继续申请提现成功";
} else {
$root['show_err'] = "继续申请提现失败";
}
output($root);
} else {
$root['show_err'] = "操作失败";
output($root);
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
$root['program_title'] = "提现操作";
output($root);
}
示例6: get_payment_code
public function get_payment_code($payment_notice_id)
{
$rs = payment_paid($payment_notice_id);
if ($rs) {
$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']);
require_once APP_ROOT_PATH . "system/model/user.php";
$msg = sprintf('%s订单付款,付款单号%s', $order_sn, $payment_notice['notice_sn']);
modify_account(array('money' => "-" . $payment_notice['money'], 'score' => 0), $payment_notice['user_id'], $msg);
}
}
示例7: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
//print_r($email);echo"<br />";print_r($pwd);exit;
//检查用户,用户密码
$user_return = $GLOBALS['user_info'];
$user = $user_return;
$user_id = intval($user['id']);
//print_r($user_id);exit;
$uname = strim($GLOBALS['request']['uname']);
if ($user_id == 0) {
$root['status'] = 0;
$root['info'] = "请先登录";
$root['user_login_status'] = 0;
//用户登陆状态:1:成功登陆;0:未成功登陆
output($root);
} else {
$ecvtype_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ecv_type where uname= '" . $uname . "'");
if (!$ecvtype_info) {
$root['status'] = 0;
$root['info'] = "代金券不存在";
output($root);
}
$id = intval($ecvtype_info['id']);
$is_use = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "ecv where ecv_type_id=" . $id . " and user_id=" . $user_id);
if ($is_use > 0) {
$root['status'] = 0;
$root['info'] = "您已经领取过了";
output($root);
}
if ($ecvtype_info['end_time'] > 0 && $ecvtype_info['end_time'] < get_gmtime()) {
$root['status'] = 0;
$root['info'] = "代金券已过期";
output($root);
}
$GLOBALS['db']->query("update " . DB_PREFIX . "ecv set user_id = " . $user_id . " where user_id = 0 and ecv_type_id = " . $id . " limit 1");
if ($GLOBALS['db']->affected_rows() > 0) {
$root['status'] = 1;
$root['info'] = "您已成功领取红包" . round($ecvtype_info['money'], 2) . "元";
$root['id'] = $id;
modify_account(array('money' => round($ecvtype_info['money'], 2)), $user_id, "成功领取红包" . round($ecvtype_info['money'], 2) . "元");
} else {
$root['status'] = 0;
$root['info'] = "剩余数量不足";
output($root);
}
}
output($root);
}
示例8: delete_order
public function delete_order()
{
$id = intval($_REQUEST['id']);
$total_score = intval($_REQUEST['total_score']);
$count_sql = "SELECT count(*) from " . DB_PREFIX . "goods_order where id=" . $id . " and order_status =0 and user_id=" . $GLOBALS['user_info']['id'];
$order_count = $GLOBALS['db']->getOne($count_sql);
if (!$order_count) {
showErr('订单取消失败', 0, url("index", "uc_goods_order"));
}
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array('score' => $total_score), $GLOBALS['user_info']['id'], "用户取消订单积分返还", 22);
$GLOBALS['db']->query("update " . DB_PREFIX . "goods_order set order_status = 3 where id = " . $id);
if ($GLOBALS['db']->affected_rows() == 0) {
showErr('订单取消失败', 0, url("index", "uc_goods_order"));
} else {
showSuccess('订单取消成功', 0, url("index", "uc_goods_order"));
}
}
示例9: edit_dsffreezer
public function edit_dsffreezer()
{
$id = intval($_REQUEST['id']);
$now = get_gmtime();
$dsffreezer = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "money_freeze where id = " . $id);
$deal_name = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $dsffreezer['deal_id']);
$user_xinxi = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $dsffreezer['platformUserNo']);
$log_info = $user_xinxi['name'];
$GLOBALS['db']->query("update " . DB_PREFIX . "money_freeze set status=2,create_time ={$now} where id=" . $id);
require_once APP_ROOT_PATH . "system/libs/user.php";
if ($GLOBALS['db']->affected_rows()) {
modify_account(array('money' => $dsffreezer['amount']), $dsffreezer['platformUserNo'], '冻结资金解冻-冻结号码:' . $id);
}
syn_mortgate($dsffreezer['platformUserNo']);
//$GLOBALS['db']->query("update ".DB_PREFIX."user set money=$money,score=$score,point=$point where id=".$dsffreezer['platformUserNo']);
//save_log($log_info.L("INSERT_SUCCESS"),1);
$this->success(L("INSERT_SUCCESS"));
}
示例10: refund
public function refund()
{
$id = intval($_REQUEST['id']);
$order_info = M("DealOrder")->getById($id);
if ($order_info) {
if ($order_info['is_refund'] == 0) {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set is_refund = 1 where id = " . $id . " and is_refund = 0");
if ($GLOBALS['db']->affected_rows() > 0) {
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => $order_info['total_price']), $order_info['user_id'], $order_info['deal_name'] . "退款");
}
$this->success("成功退款到会员余额");
} else {
$this->error("已经退款");
}
} else {
$this->error("没有该项目的支持");
}
}
示例11: confirm
public function confirm()
{
$id = intval($_REQUEST['id']);
$refund_data = M("UserRefund")->getById($id);
if ($refund_data) {
if ($refund_data['is_pay'] == 1) {
$this->error("已经提现过");
}
$refund_user = M("User")->where("id=" . $refund_data['user_id'] . " and is_effect = 1")->find();
if ($refund_user['money'] < $refund_data['money']) {
$this->error("会员余额不足,不能提现");
}
$reply = strim($_REQUEST['reply']);
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => "-" . $refund_data['money']), $refund_data['user_id'], "管理员确认提现:" . $reply);
$refund_data['reply'] = $reply;
$refund_data['is_pay'] = 1;
$refund_data['pay_time'] = get_gmtime();
M("UserRefund")->save($refund_data);
$this->success("提现确认成功");
} else {
$this->error("没有提现数据");
}
}
示例12: doexchange
public function doexchange()
{
if ($this->allow_exchange) {
$user_pwd = md5(addslashes(trim($_REQUEST['password'])));
$user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id']));
if ($user_info['user_pwd'] == "") {
//判断是否为初次整合
//载入会员整合
$integrate_code = trim(app_conf("INTEGRATE_CODE"));
if ($integrate_code != '') {
$integrate_file = APP_ROOT_PATH . "system/integrate/" . $integrate_code . "_integrate.php";
if (file_exists($integrate_file)) {
require_once $integrate_file;
$integrate_class = $integrate_code . "_integrate";
$integrate_obj = new $integrate_class();
}
}
if ($integrate_obj) {
$result = $integrate_obj->login($user_info['user_name'], $user_pwd);
if ($result['status']) {
$GLOBALS['db']->query("update " . DB_PREFIX . "user set user_pwd = '" . $user_pwd . "' where id = " . $user_info['id']);
$user_info['user_pwd'] = $user_pwd;
}
}
}
if ($user_info['user_pwd'] == $user_pwd) {
$cfg = $this->creditsettings[addslashes(trim($_REQUEST['key']))];
if ($cfg) {
$amount = floor($_REQUEST['amountdesc']);
$use_amount = floor($amount * $cfg['ratio']);
//消耗的本系统积分
$field = $this->credits_CFG[$cfg['creditsrc']]['field'];
if ($user_info[$field] < $use_amount) {
$data = array("status" => false, "message" => $cfg['srctitle'] . "不足,不能兑换");
ajax_return($data);
}
include_once APP_ROOT_PATH . 'uc_client/client.php';
$res = call_user_func_array("uc_credit_exchange_request", array($user_info['integrate_id'], $cfg['creditsrc'], $cfg['creditdesc'], $cfg['appiddesc'], $amount));
if ($res) {
//兑换成功
$use_amount = 0 - $use_amount;
$credit_data = array($field => $use_amount);
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account($credit_data, $user_info['id'], "ucenter兑换支出");
$data = array("status" => true, "message" => "兑换成功");
ajax_return($data);
} else {
$data = array("status" => false, "message" => "兑换失败");
ajax_return($data);
}
} else {
$data = array("status" => false, "message" => "非法的兑换请求");
ajax_return($data);
}
} else {
$data = array("status" => false, "message" => "登录密码不正确");
ajax_return($data);
}
} else {
$data = array("status" => false, "message" => "未开启兑换功能");
ajax_return($data);
}
}
示例13: deal_redempte
function deal_redempte($redempte_id, $status, $earn_money, $fee = 0, $organiser_fee = 0, $pay_type = 0, $web_type = 0)
{
require_once APP_ROOT_PATH . 'system/libs/user.php';
$info = array('status' => 1, 'info' => '');
$licai = array();
if ($web_type == 1 || $web_type == 2) {
$redempte = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "licai_redempte where id={$redempte_id}");
if ($redempte['status'] == 0) {
if ($status == 1) {
//审核通过
if (true) {
//最终的金额
$money = $redempte['money'] + $organiser_fee + $earn_money;
$order = $GLOBALS['db']->getRow("select dorder.money,dorder.site_buy_fee,dorder.redempte_money,dorder.user_id as consumer_id,d.user_id as organiser_id,d.name as licai_name,d.id as licai_id,d.service_fee_rate from " . DB_PREFIX . "licai_order as dorder left join " . DB_PREFIX . "licai as d on dorder.licai_id=d.id where dorder.id=" . $redempte['order_id']);
if ($redempte['money'] > $order['money'] - $order['redempte_money']) {
$info['status'] = 0;
$info['info'] = '您赎回的金额超过了您购买的金额(您的购买金额是' . $order['money'] . ',已赎回' . $order['redempte_money'] . ")";
return $info;
}
/*if($order['service_fee_rate']>0){
$organiser_fee=$redempte['money']*$order['service_fee_rate'];
}else{
$organiser_fee=0;
}*/
//$money=$redempte['money']+$organiser_fee+$earn_money;
$licai['url'] = url("licai#deal", array("id" => $order['licai_id']));
$licai['name'] = $order['licai_name'];
//对发起人进行扣款操作,有冻结金额mortgage_money 先用冻结金额,没有再用余额money,如果余额也不够,就生成垫付单
if ($order['consumer_id'] && $order['organiser_id']) {
//$organiser_user=$GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id=".$order['organiser_id']);
require_once APP_ROOT_PATH . 'system/libs/user.php';
$organiser_user = get_user_info("*", "id = " . $order['organiser_id']);
if ($organiser_user['money'] >= $money) {
//modify_account(array('money'=>'-'.$money,'ben_money'=>'-'.$redempte['money'],'earn_money'=>'-'.$earn_money,'organiser_fee'=>'-'.$organiser_fee),$order['organiser_id'],"发放用户要赎回的理财产品“<a href=\"".$licai['url']."\">".$licai['name']."</a>”",39);
//赎回本金
modify_account(array('money' => '-' . $redempte['money']), $order['organiser_id'], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 39);
//收益
modify_account(array('money' => '-' . $earn_money), $order['organiser_id'], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 40);
//平台手续费
modify_account(array('money' => '-' . $organiser_fee), $order['organiser_id'], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 45);
//if(!$re){
/* $info['status']=0;
$info['info']='资金修改错误';
return $info;
*/
//}
} elseif ($organiser_user['mortgage_money'] >= $money) {
//赎回本金
modify_account(array('money' => '-' . $redempte['money']), $order['organiser_id'], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 39);
//赎回手续费
modify_account(array('money' => '-' . $earn_money), $order['organiser_id'], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 40);
//赎回平台手续费
modify_account(array('money' => '-' . $organiser_fee), $order['organiser_id'], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 45);
//if(!$re){
/* $info['status']=0;
$info['info']='资金修改错误';
return $info;*/
//}
} elseif ($organiser_user['money'] + $organiser_user['mortgage_money'] >= $money) {
$ye_money = $money - $organiser_user['mortgage_money'];
//赎回本金
modify_account(array('money' => '-' . $redempte['money']), $order["organiser_id"], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 39);
//赎回收益
modify_account(array('money' => '-' . $earn_money), $order["organiser_id"], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 40);
//平台手续费
modify_account(array('money' => '-' . $organiser_fee), $order["organiser_id"], "发放用户要赎回的理财产品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 45);
//if(!$re){
/* $info['status']=0;
$info['info']='资金修改错误';
return $info;*/
//}
} else {
if ($pay_type == 1) {
//生成垫付单
$re = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "licai_advance where redempte_id=" . $redempte_id);
if ($re) {
$info['status'] = 0;
$info['info'] = '发起人已经生成垫付单';
return $info;
} else {
$advance['redempte_id'] = $redempte_id;
$advance['user_id'] = $organiser_user['id'];
$advance['user_name'] = $organiser_user['user_name'];
$advance['money'] = $redempte['money'];
$advance['earn_money'] = $earn_money;
$advance['fee'] = $fee;
$advance['organiser_fee'] = $organiser_fee;
$advance['real_money'] = $organiser_user['money'] + $organiser_user['mortgage_money'];
$advance['advance_money'] = $redempte['money'] + $advance['earn_money'] + $advance['organiser_fee'] - $advance['real_money'];
$advance['status'] = 1;
$advance['type'] = $redempte['type'];
$advance['create_date'] = to_date(NOW_TIME);
$advance['update_date'] = to_date(NOW_TIME);
$re = $GLOBALS['db']->autoExecute(DB_PREFIX . "licai_advance", $advance);
if (!$re) {
$info['status'] = 0;
$info['info'] = '发起人生成垫付单错误';
return $info;
} else {
//赎回本金
//.........这里部分代码省略.........
示例14: index
public function index()
{
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$root = array();
if ($user_id > 0) {
$order_id = intval($GLOBALS['request']['order_id']);
$credit = doubleval($_REQUEST['credit']);
$payment_id = intval($_REQUEST['payment']);
$memo = strim($_REQUEST['memo']);
$root['user_login_status'] = 1;
$root['show_pay_btn'] = 0;
//0:不显示,支付按钮; 1:显示支付按钮
$order = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where user_id = {$user_id} and id = " . $order_id);
if (empty($order)) {
// $root['order_status'] = 1;
$root['pay_info'] = '订单不存在.';
$root['show_pay_btn'] = 0;
output($root);
}
if ($order['order_status'] == 2) {
$root['order_status'] = 1;
$root['pay_code'] = '';
$root['order_id'] = $order_id;
$root['order_sn'] = $order['order_sn'];
$root['response_code'] = 1;
$root['pay_info'] = '订单已支付成功.';
$root['show_pay_btn'] = 0;
output($root);
}
if ($payment_id == 0) {
$payment_id = intval($order['payment_id']);
}
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id= " . $order['deal_id']);
if ($credit > 0) {
$sql = $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set credit_pay = credit_pay + " . $credit . " where id = " . $order_id);
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => "-" . $credit), intval($user_id), "支持" . $deal_info['name'] . "项目支付");
}
$result = pay_order($order_id);
if ($order['credit_pay'] = $order['total_price']) {
$root['response_code'] = 1;
$root['info'] = "余额全部支付";
}
if ($order['credit_pay'] < $order['total_price'] && $order['credit_pay'] > 0) {
$root['response_code'] = 2;
$root['info'] = "余额部分支付";
}
if ($order['credit_pay'] = 0) {
$root['response_code'] = 3;
$root['info'] = "余额未支付";
}
if ($result['status'] == 0) {
$payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id=" . $payment_id);
$pay_code = strtolower($payment_info['class_name']);
/*online_pay 支付方式:1:在线支付;0:线下支付;2:手机wap;3:手机sdk */
$online_pay = intval($payment_info['online_pay']);
$root['online_pay'] = $online_pay;
if ($online_pay != 2) {
$root['response_code'] = 0;
$root['pay_info'] = '手机版本不支付,无法在手机上支付.' . $pay_code;
$root['show_pay_btn'] = 0;
output($root);
}
if ($online_pay = 2) {
$money = $result['money'];
$payment_notice['create_time'] = NOW_TIME;
$payment_notice['user_id'] = intval($GLOBALS['user_info']['id']);
$payment_notice['payment_id'] = $payment_id;
$payment_notice['money'] = $money;
// $payment_notice['bank_id'] = strim($_REQUEST['bank_id']);
$payment_notice['order_id'] = $order_id;
$payment_notice['memo'] = $memo;
$payment_notice['deal_id'] = $deal_info['id'];
$payment_notice['deal_item_id'] = $order['deal_item_id'];
$payment_notice['deal_name'] = $deal_info['name'];
do {
$payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999);
$GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT");
$notice_id = $GLOBALS['db']->insert_id();
} while ($notice_id == 0);
}
//创建了支付单号,通过支付接口创建支付数据
require_once APP_ROOT_PATH . "system/payment/" . $payment_info['class_name'] . "_payment.php";
$payment_class = $payment_info['class_name'] . "_payment";
$payment_object = new $payment_class();
$pay = $payment_object->get_payment_code($notice_id);
$root['is_wap'] = intval($pay['is_wap']);
$root['pay_money_format'] = $pay['total_fee_format'];
$root['pay_money'] = $pay['total_fee'];
$root['pay_info'] = $pay['body'];
$root['pay_wap'] = $pay['notify_url'];
if ($root['pay_money'] > 0) {
$root['show_pay_btn'] = 1;
}
//.........这里部分代码省略.........
示例15: do_refund
/**
* 退款执行流:
* 1. 退还金额至会员账户
* 2. 更新商家账户
* 3. 更新订单及订单关联表的相关状态
* 3. 更新平台报表
* 4. 更新订单缓存
* 5. 为订单重新分片
*/
public function do_refund()
{
$order_item_id = intval($_REQUEST['order_item_id']);
$coupon_id = intval($_REQUEST['coupon_id']);
$price = floatval($_REQUEST['price']);
$balance_price = floatval($_REQUEST['balance_price']);
$content = strim($_REQUEST['content']);
if ($price < 0 || $balance_price < 0) {
$this->error("金额出错", 1);
}
if ($order_item_id) {
$oi = $order_item_id;
$data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $order_item_id);
if ($data['refund_status'] == 2) {
$this->error("已退款", 1);
}
if ($data) {
$order_id = $data['order_id'];
$supplier_id = $data['supplier_id'];
}
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set refund_status = 2,is_arrival = 0 where id = " . $order_item_id);
$refund_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item where (refund_status = 1 or is_arrival = 2) and order_id = " . $order_id);
$coupon_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_coupon where refund_status = 1 and order_id = " . $order_id);
if ($refund_item_count == 0 && $coupon_item_count == 0) {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . ",refund_status = 2,after_sale = 1,is_refuse_delivery=0 where id = " . $order_id);
} else {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . ",is_refuse_delivery=0 where id = " . $order_id);
}
} elseif ($coupon_id) {
$data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where id = " . $coupon_id);
if ($data['refund_status'] == 2) {
$this->error("已退款", 1);
}
if ($data) {
$oi = $data['order_deal_id'];
$order_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $data['order_deal_id']);
$data['name'] = $order_item['name'];
$order_id = $data['order_id'];
$supplier_id = $data['supplier_id'];
}
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set refund_status = 2 where id = " . $coupon_id);
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set refund_status = 2 where id = " . $data['order_deal_id']);
$refund_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item where (refund_status = 1 or is_arrival = 2) and order_id = " . $order_id);
$coupon_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_coupon where refund_status = 1 and order_id = " . $order_id);
if ($refund_item_count == 0 && $coupon_item_count == 0) {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . ",refund_status = 2,after_sale = 1 where id = " . $order_id);
} else {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . " where id = " . $order_id);
}
}
$order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $order_id);
if ($price > 0) {
require_once APP_ROOT_PATH . "system/model/user.php";
modify_account(array("money" => $price), $order_info['user_id'], $data['name'] . "退款成功");
modify_statements($price, 6, $data['name'] . "用户退款");
}
if ($balance_price > 0) {
require_once APP_ROOT_PATH . "system/model/supplier.php";
modify_supplier_account("-" . $balance_price, $supplier_id, 1, $data['name'] . "用户退款");
//冻结资金减少
modify_supplier_account($balance_price, $supplier_id, 4, $data['name'] . "用户退款");
//退款增加
modify_statements($balance_price, 7, $data['name'] . "用户退款");
}
require_once APP_ROOT_PATH . "system/model/deal_order.php";
order_log($data['name'] . "退款成功 " . format_price($price) . " " . $content, $order_id);
auto_over_status($order_id);
update_order_cache($order_id);
distribute_order($order_id);
send_msg($order_info['user_id'], $data['name'] . "退款成功 " . format_price($price) . " " . $content, "orderitem", $oi);
$this->success("退款成功", 1);
}