<?php $member_account = get_member_account(); $openid = $member['openid']; $order = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE id=:id limit 1", array(':id' => $orderid)); $getmember = member_get($openid); if ($getmember['gold'] >= $order['price']) { $usegold = member_gold($openid, $order['price'], 'usegold', "消费金额:" . $order['price'] . ",订单编号:" . $order['ordersn']); if ($usegold) { mysqld_update('shop_order', array('status' => '1', 'paytype' => '1'), array('id' => $orderid)); message('订单提交成功,收货后请验货!', WEBSITE_ROOT . mobile_url('myorder'), 'success'); } else { message('付款失败!', WEBSITE_ROOT . mobile_url('myorder'), 'error'); } } else { message('余额不足,无法完成付款!', WEBSITE_ROOT . mobile_url('myorder'), 'error'); }
<?php $op = $_GP['op']; if ($op == 'credit') { $condition = " (`type`='usecredit' or `type`='addcredit')"; } if ($op == 'gold') { $condition = " (`type`='usegold' or `type`='addgold')"; } $member = mysqld_select("SELECT * FROM " . table('member') . " where openid=:openid ", array(':openid' => $_GP['openid'])); $list = mysqld_selectall("SELECT * FROM " . table('member_paylog') . " where openid=:openid and {$condition} order by createtime desc", array(':openid' => $_GP['openid'])); if (checksubmit('submit')) { if (!is_numeric($_GP['fee']) || $_GP['fee'] < 0) { message("输入的数字非法请重新输入"); } if (!empty($member['openid'])) { if ($op == 'credit') { member_credit($_GP['openid'], $_GP['fee'], 'addcredit', $_GP['remark']); message('积分充值成功', 'refresh', 'success'); } if ($op == 'gold') { member_gold($_GP['openid'], $_GP['fee'], 'addgold', $_GP['remark']); message('余额充值成功', 'refresh', 'success'); } } } include page($op);
function integration_session_account($loginid, $oldsessionid) { $member = mysqld_select("SELECT * FROM " . table('member') . " WHERE openid = :openid ", array(':openid' => $loginid)); $sessionmember = mysqld_select("SELECT * FROM " . table('member') . " WHERE openid = :openid", array(':openid' => $oldsessionid)); if (empty($member['openid']) || $sessionmember['istemplate'] != 1) { return; } $cartall = mysqld_selectall("SELECT * FROM " . table('shop_cart') . " WHERE session_id = :session_id ", array(':session_id' => $oldsessionid)); foreach ($cartall as $cartitem) { $row = mysqld_select("SELECT * FROM " . table('shop_cart') . " WHERE session_id = :loginid AND goodsid = :goodsid and optionid=:optionid limit 1", array(':loginid' => $loginid, ':goodsid' => $cartitem['goodsid'], ':optionid' => $cartitem['optionid'])); if (empty($row['id'])) { mysqld_update('shop_cart', array('session_id' => $loginid), array('id' => $cartitem['id'])); } else { $t = $cartitem['total'] + $row['total']; $data = array('marketprice' => $cartitem['marketprice'], 'total' => $t, 'optionid' => $optionid); mysqld_update('shop_cart', $data, array('id' => $row['id'])); mysqld_delete('shop_cart', array('id' => $cartitem['id'])); } } mysqld_update('shop_address', array('openid' => $loginid), array('openid' => $oldsessionid)); mysqld_update('shop_order', array('openid' => $loginid), array('openid' => $oldsessionid)); mysqld_update('shop_address', array('openid' => $loginid), array('openid' => $oldsessionid)); mysqld_update('shop_order_paylog', array('openid' => $loginid), array('openid' => $oldsessionid)); mysqld_update('member_paylog', array('openid' => $loginid), array('openid' => $oldsessionid)); /*可能出现刷分情况,屏蔽 if($sessionmember['credit']>0) { member_credit($loginid,intval($sessionmember['credit']),'addcredit','登陆后账户合并所得积分'); } */ if ($sessionmember['gold'] > 0) { member_gold($loginid, intval($sessionmember['gold']), 'addgold', '登录后与临时账户合并所得余额'); } mysqld_delete('member', array('openid' => $oldsessionid)); $alipaythirdlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='alipay'"); if (!empty($alipaythirdlogin) && !empty($alipaythirdlogin['id'])) { $alipayfans = mysqld_select("SELECT * FROM " . table('alipay_alifans') . " WHERE alipay_openid=:alipay_openid ", array(':alipay_openid' => $oldsessionid)); if (!empty($alipayfans['alipay_openid'])) { mysqld_update('alipay_alifans', array('openid' => $loginid), array('alipay_openid' => $oldsessionid)); } } if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { $weixinthirdlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='weixin'"); if (!empty($weixinthirdlogin) && !empty($weixinthirdlogin['id'])) { $weixinfans = mysqld_select("SELECT * FROM " . table('weixin_wxfans') . " WHERE weixin_openid=:weixin_openid ", array(':weixin_openid' => $oldsessionid)); if (!empty($weixinfans['weixin_openid']) && empty($weixinfans['openid'])) { mysqld_update('weixin_wxfans', array('openid' => $loginid), array('weixin_openid' => $oldsessionid)); } } } if (!empty($_SESSION[MOBILE_QQ_OPENID])) { $qqlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='qq'"); if (!empty($qqlogin) && !empty($qqlogin['id'])) { $qqfans = mysqld_select("SELECT * FROM " . table('qq_qqfans') . " WHERE qq_openid=:qq_openid", array(':qq_openid' => $_SESSION[MOBILE_QQ_OPENID])); if (!empty($qqfans['qq_openid']) && empty($qqfans['openid'])) { mysqld_update('qq_qqfans', array('openid' => $loginid), array('qq_openid' => $_SESSION[MOBILE_QQ_OPENID])); } } } //unset($_SESSION[MOBILE_SESSION_ACCOUNT]); }
<?php $op = $_GP['op'] ? $_GP['op'] : 'display'; $status = intval($_GP['status']); if ($op == 'display') { $list = mysqld_selectall("SELECT teller.*,member.realname,member.mobile,member.outgoldinfo FROM " . table('gold_teller') . " teller left join " . table('member') . " member on teller.openid=member.openid where teller.status=:status order by teller.createtime desc", array('status' => $status)); include page('outchargegold'); exit; } if ($op == 'post') { $id = intval($_GP['id']); if (intval($_GP['tostatus']) == -1) { $gold_teller = mysqld_select("SELECT teller.* FROM " . table('gold_teller') . " teller where teller.status=0 and id=:id", array(':id' => $id)); if (!empty($gold_teller['openid'])) { member_gold($gold_teller['openid'], $gold_teller['fee'], 'addgold', '余额审核拒绝后返回账户' . $gold_teller['fee'] . '元'); } } mysqld_update('gold_teller', array('status' => intval($_GP['tostatus'])), array('id' => $id)); message("审核完成!", 'refresh', 'success'); }
message('支付成功!', WEBSITE_ROOT . mobile_url('myorder', array('status' => 1)), 'success'); } else { message('该订单不是支付状态无法支付', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=myorder', 'error'); } } else { mysqld_insert('paylog', array('typename' => '未找到相关订单', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); message('未找到相关订单', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=myorder', 'error'); } exit; } else { //余额充值 $order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE id = :id and ordersn=:ordersn", array(':id' => $orderid, ':ordersn' => $ordersn)); if (!empty($order['id'])) { if ($order['status'] == 0) { mysqld_update('gold_order', array('status' => 1), array('id' => $order['id'])); mysqld_insert('paylog', array('typename' => '余额充值成功', 'pdate' => $xml, 'ptype' => 'success', 'paytype' => 'weixin')); member_gold($order['openid'], $order['price'], 'addgold', '余额在线充值-微支付'); message('余额充值成功!', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=fansindex', 'success'); } exit; } else { mysqld_insert('paylog', array('typename' => '余额充值未找到订单', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); message('未找余额充值订单', WEBSITE_ROOT . 'index.php?mod=mobile&name=shopwap&do=fansindex', 'error'); exit; } } } mysqld_insert('paylog', array('typename' => '微支付出现错误', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); } else { mysqld_insert('paylog', array('typename' => '签名验证失败', 'pdate' => $xml, 'ptype' => 'error', 'paytype' => 'weixin')); }
mysqld_update('shop_order', array('status' => -1, 'remark' => $_GP['remark']), array('id' => $orderid)); message('订单关闭操作成功!', refresh(), 'success'); } if (checksubmit('finish')) { if (empty($order['isrest'])) { $this->setOrderCredit($order['openid'], $orderid, true, '订单:' . $order['ordersn'] . '完成新增积分'); } mysqld_update('shop_order', array('status' => 3, 'remark' => $_GP['remark'], 'updatetime' => time()), array('id' => $orderid)); require WEB_ROOT . '/system/common/extends/class/shop/class/web/order_1.php'; message('订单操作成功!', refresh(), 'success'); } if (checksubmit('returnpay')) { if ($order['paytype'] == 3) { message('货到付款订单不能进行退款操作!', refresh(), 'error'); } mysqld_update('shop_order', array('status' => -6, 'remark' => $_GP['remark']), array('id' => $orderid)); $this->setOrderStock($orderid, false); member_gold($order['openid'], $order['price'], 'addgold', '订单:' . $order['ordersn'] . '退款返还余额'); message('退款操作成功!', refresh(), 'success'); } if (checksubmit('returngood')) { mysqld_update('shop_order', array('status' => -5, 'remark' => $_GP['remark']), array('id' => $orderid)); $this->setOrderStock($orderid, false); $this->setOrderCredit($order['openid'], $orderid, false, '订单:' . $order['ordersn'] . '退货扣除积分'); member_gold($order['openid'], $order['price'], 'addgold', '订单:' . $order['ordersn'] . '退货返还余额'); message('退货操作成功!', refresh(), 'success'); } $weixin_wxfans = mysqld_selectall("SELECT * FROM " . table('weixin_wxfans') . " WHERE openid = :openid", array(':openid' => $order['openid'])); $alipay_alifans = mysqld_selectall("SELECT * FROM " . table('alipay_alifans') . " WHERE openid = :openid", array(':openid' => $order['openid'])); include page('order'); }
$op = $_GP['op'] ? $_GP['op'] : 'display'; if ($op == 'display') { if (checksubmit('submit')) { if (empty($_GP['charge']) || round($_GP['charge'], 2) <= 0) { message("请输入要充值的金额"); } $fee = round($_GP['charge'], 2); if ($fee > $member['gold']) { message('账户余额不足,最多能提取' . $member['gold'] . '元'); } $ordersn = 'rg' . date('Ymd') . random(6, 1); $gold_order = mysqld_select("SELECT * FROM " . table('gold_teller') . " WHERE ordersn = '{$ordersn}'"); if (!empty($gold_order['ordersn'])) { $ordersn = 'rg' . date('Ymd') . random(6, 1); } member_gold($openid, $fee, 'usegold', '余额提取' . $fee . '元'); mysqld_insert('gold_teller', array('openid' => $openid, 'fee' => $fee, 'status' => 0, 'ordersn' => $ordersn, 'createtime' => time())); message('余额提取申请成功!', 'refresh', 'success'); exit; } $applygold = mysqld_selectcolumn("select sum(fee) from " . table("gold_teller") . " where status=0 and openid=" . $openid); if (empty($applygold)) { $applygold = '0'; } include themePage('outchargegold'); exit; } if ($op == 'history') { $pindex = max(1, intval($_GP['page'])); $psize = 20; $list = mysqld_selectall("select * from " . table("gold_teller") . " where openid=:openid order by createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(":openid" => $openid));
} if ($award_info['amount'] <= 0) { message("该商品已兑换完。"); } $setting = mysqld_select("SELECT * FROM " . table('addon7_config')); $request_info = mysqld_select("SELECT * FROM " . table('addon7_request') . " where openid=:openid order by id desc limit 1", array(":openid" => $openid)); $address = $request_info['address']; $mobile = $request_info['mobile']; $realname = $request_info['realname']; if (empty($realname)) { $realname = $member['realname']; } if (empty($mobile)) { $mobile = $member['mobile']; } if (checksubmit("submit")) { $award_info = mysqld_select("SELECT * FROM " . table('addon7_award') . " where id=:id", array(":id" => intval($_GP['award_id']))); if (!empty($award_info['id'])) { if ($award_info['awardtype'] == 1) { member_credit($openid, $award_info['credit_cost'], 'usecredit', '积分兑换消费积分,兑换id:' . intval($_GP['award_id'])); member_gold($openid, $award_info['gold'], 'addgold', $award_info['credit_cost'] . '积分兑换' . $award_info['gold'] . '余额,兑换id:' . intval($_GP['award_id'])); message('提交成功', mobile_url('index'), 'success'); } else { $insert = array('openid' => $openid, 'realname' => $_GP['realname'], 'mobile' => $_GP['mobile'], 'status' => 0, 'address' => $_GP['address'], 'createtime' => time(), "award_id" => intval($_GP['award_id'])); member_credit($openid, $award_info['credit_cost'], 'usecredit', '积分兑换消费积分,兑换id:' . intval($_GP['award_id'])); mysqld_insert('addon7_request', $insert); message('提交成功', mobile_url('index'), 'success'); } } } include addons_page('useaward');
<?php $request = mysqld_select("select * FROM " . table('addon7_request') . " where id=:id", array(":id" => intval($_GP['id']))); if (!empty($request['award_id']) && empty($request['status'])) { $award = mysqld_select("select * FROM " . table('addon7_award') . " where id=:id", array(":id" => intval($request['award_id']))); if ($award['awardtype'] == 1) { if (!empty($award['gold'])) { member_gold($request['openid'], $award['gold'], 'addgold', '积分兑换商品,兑换id:' . $request['award_id']); mysqld_update('addon7_award', array('amount' => intval($award['amount']) - 1), array("id" => intval($award['id']))); } } else { mysqld_update('addon7_request', array("status" => "1"), array("id" => intval($_GP['id']))); mysqld_update('addon7_award', array('amount' => intval($award['amount']) - 1), array("id" => intval($award['id']))); } } message('兑换成功!', 'refresh', 'success');