1. 累计充值 日月限额

2,支付页面调整
master
tping 5 years ago
parent 551cd83678
commit b6a3a7e136

@ -105,7 +105,8 @@ class BaseController extends Controller {
$this->inviteFriendAward($d['user_id'], $d['pay_amount'], 'PF_'.$data['out_trade_no']);
//充值奖励积分
$this->rechargeAwardPoint($d['user_id'],$d['pay_amount']);
// 当天累计充值
$this->payTodayTotal($d['pay_amount'], $d['pay_way']);
return false;
}
@ -170,7 +171,9 @@ class BaseController extends Controller {
$this->rechargeAwardPoint($d['user_id'],$d['pay_amount']);
//累计消费
$this->changeCumulative('Spend',$d['pay_order_number']);
// 当天累计充值
$this->payTodayTotal($d['pay_amount']-$d['deduction_amount'], $d['pay_way']);
if($r!== false){
// 通知后台 TASK_URLhttp://47.111.118.107:9501/game-event/recharge
$url = C('TASK_URL')."/game-event/recharge";
@ -244,7 +247,8 @@ class BaseController extends Controller {
$this->inviteFriendAward($d['user_id'],$d['pay_amount'],$data['out_trade_no']);
//充值奖励积分
$this->rechargeAwardPoint($d['user_id'],$d['pay_amount']);
// 当天累计充值
$this->payTodayTotal($d['pay_amount'], $d['pay_way']);
}else{
$this->record_logs("修改数据失败");
}
@ -587,6 +591,31 @@ class BaseController extends Controller {
return false;
}
}
/*
* 当日累计充值
*/
public function payTodayTotal($price, $pay_way) {
$table = M('pay_today_total', 'tab_');
$date = date('Ymd');
$data = $table->where(array(
'pay_date' => $date,
'pay_way' => $pay_way,
))->find();
if($data){
$table->where(array(
'pay_date' => $date,
'pay_way' => $pay_way,
))->setInc("price_cnt", $price);
}else{
$table->add(array(
'pay_way' => $pay_way,
'price_cnt' => $price,
'pay_date' => date('Ymd'),
));
}
}
/**
*日志记录

@ -1,4 +1,6 @@
<?php
use Sdk\Controller\BaseController;
// +----------------------------------------------------------------------
// | 徐州梦创信息科技有限公司—专业的游戏运营,推广解决方案.
// +----------------------------------------------------------------------
@ -56,6 +58,49 @@ function pay_check($user_id) {
}
// 支付限额 wx alipay
function pay_limit($type='wx') {
C(BaseController::get_tool());
$configType = $type;
if ($configType== 'wx') {
$configType = 'wei_xin';
}
$date = date('Ymd');
if ($configType== 'wei_xin') {
$dwhere = "pay_date={$date} and (pay_way=2 or pay_way=3)";
} else if ($configType== 'alipay') {
$dwhere = "pay_date={$date} and pay_way=1";
} else { // 找不到的不限额
return false;
}
if (C($configType.".day_pay_limit") > 0) {
$todayTotal = M("pay_today_total", "tab_")->where($dwhere)->getField("price_cnt");
if ($todayTotal >= C($configType.".day_pay_limit")) { // 日限额
return true;
}
}
$start = date('Ym01');
$end = date('Ymd');
if ($configType== 'wei_xin') {
$mwhere = "pay_date={$date} and (pay_way=2 or pay_way=3) and pay_date>={$start} and pay_date<={$end}";
} else if ($configType== 'alipay') {
$mwhere = "pay_date={$date} and pay_way=1 and pay_date>={$start} and pay_date<={$end}";
} else { // 找不到的不限额
return false;
}
if (C($configType.".month_pay_limit") > 0) {
$todayTotal = M("pay_today_total", "tab_")->where($mwhere)->sum("price_cnt");
if ($todayTotal >= C($configType.".month_pay_limit")) { // 月限额
return true;
}
}
return false;
}
/* //获取支付方式 */
function get_pay_way($id=null)
{
@ -262,3 +307,23 @@ function jsonOutput($status=0, $msg='', $data=[]) {
exit();
}
/**
* 使用淘宝接口 判断ip,,,确定是否属于该地区
* @param $ip
* @return bool
*/
function ip_is_country($ip, $country_id=['US'])
{
$url = "http://ip.taobao.com/service/getIpInfo.php?ip=".$ip;
$res = file_get_contents($url);
if (!empty($res)) {
$ipData = json_decode($res,true);
if ($ipData['code']==0 && in_array($ipData['data']['country_id'],$country_id)) {
return true;
}
}
return false;
}

@ -393,6 +393,10 @@ class AppleController extends BaseController{
// $this->set_message(0,"fail","充值金额有误");
redirect(U('Spend/notice_v1',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'充值金额有误')));exit;
}
// 微信支付日月限额
if (pay_limit('wx')) {
redirect(U('Spend/notice_v1',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付限额,暂不支持')));exit;
}
$extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'game_id'=>$request['game_id']/* ,'pay_status'=>1 */))->find();
if($extend_data){
//$this->set_message(1089,"fail","订单号重复,请关闭支付页面重新支付");

@ -1267,6 +1267,10 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER
//$this->set_message(1089,"fail","订单号重复,请关闭支付页面重新支付");
//redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'订单号重复,请关闭支付页面重新支付', 'user_token' => $this->userToken)));exit;
}
// 微信支付日月限额
if (pay_limit('wx')) {
echo json_encode(['code'=>0,'msg'=> '支付限额,暂不支持']);exit;
}
$table = $request['code'] == 1 ? "spend" : "deposit";
$prefix = $request['code'] == 1 ? "SP_" : "PF_";
//折扣

@ -737,6 +737,10 @@ class WapPayController extends BaseController{
if($request['price']*1<=0 || $request['price'] >= C('WX_PAY_LIMIT')){
$this->set_message(1011,"fail","充值金额有误");
}
// 微信支付日月限额
if (pay_limit('wx')) {
$this->set_message(1011,"fail","支付限额,暂不支持");
}
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
if($game['pay_status'] == 0){
$this->set_message(0,"fail","该游戏暂时无法充值,请联系客服!");

@ -62,7 +62,7 @@
<img src="__IMG__/pay_way/dagou2.png" alt="">
</div>
</if>
<if condition="$money elt C('WX_PAY_LIMIT')">
<if condition="!pay_limit('wx') and $money elt C('WX_PAY_LIMIT')">
<if condition="C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.wx_small') eq 1)">
<div class="payment_rest_way way_btn" data-type="wxpay" data-url="{:U('PayH5/weixin_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}">
<div>
@ -153,7 +153,8 @@
<img src="__IMG__/pay_way/dagou2.png" alt="">
</div>
</if>
<if condition="$money elt C('WX_PAY_LIMIT')">
<if condition="!pay_limit('wx') and $money elt C('WX_PAY_LIMIT')">
<if condition="C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.wx_small') eq 1)">
<div class="payment_rest_way way_btn" data-type="wxpay" data-url="{:U('PayH5/weixin_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}">
<div>

@ -57,7 +57,7 @@
</div>
</if>
<if condition="$money elt C('WX_PAY_LIMIT')">
<if condition="C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.wx_small') eq 1)">
<if condition="!pay_limit('wx') and C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.wx_small') eq 1)">
<div class="payment_rest_way way_btn" data-type="wxpay" data-url="{:U('PayH5/platform_weixin_pay',array('price' => $money,'user_token'=>I('user_token'),'api_ver' => 2, 'game_id' => $game_id))}">
<div>
<img src="__IMG__/pay_way/weixin.png" alt="">
@ -141,7 +141,7 @@
<img src="__IMG__/pay_way/dagou2.png" alt="">
</div>
</if>
<if condition="$money elt C('WX_PAY_LIMIT')">
<if condition="!pay_limit('wx') and $money elt C('WX_PAY_LIMIT')">
<if condition="C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.wx_small') eq 1)">
<div class="payment_rest_way way_btn" data-type="wxpay" data-url="{:U('PayH5/platform_weixin_pay',array('price' => $money,'user_token'=>I('user_token'),'api_ver' => 2, 'game_id' => $game_id))}">
<div>

Binary file not shown.

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save