diff --git a/Application/Callback/Controller/BaseController.class.php b/Application/Callback/Controller/BaseController.class.php index 43b9bc87..40e48d0a 100644 --- a/Application/Callback/Controller/BaseController.class.php +++ b/Application/Callback/Controller/BaseController.class.php @@ -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['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'), + )); + } + + } /** *日志记录 diff --git a/Application/Sdk/Common/function.php b/Application/Sdk/Common/function.php index 68298766..f3eaf8c1 100644 --- a/Application/Sdk/Common/function.php +++ b/Application/Sdk/Common/function.php @@ -1,4 +1,6 @@ 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_way=2 or pay_way=3) and pay_date>={$start} and pay_date<={$end}"; + } else if ($configType== 'alipay') { + $mwhere = "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; +} + + diff --git a/Application/Sdk/Controller/AppleController.class.php b/Application/Sdk/Controller/AppleController.class.php index e6d463ad..7cf7a75c 100644 --- a/Application/Sdk/Controller/AppleController.class.php +++ b/Application/Sdk/Controller/AppleController.class.php @@ -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","订单号重复,请关闭支付页面重新支付"); diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index 6a7c8418..ff3b75a9 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -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_"; //折扣 diff --git a/Application/Sdk/Controller/UserHController.class.php b/Application/Sdk/Controller/UserHController.class.php index eba9d4e1..c9a3cec6 100644 --- a/Application/Sdk/Controller/UserHController.class.php +++ b/Application/Sdk/Controller/UserHController.class.php @@ -73,6 +73,7 @@ class UserHController extends Controller */ public function platform_pay() { + C(BaseController::get_tool()); $u = M('user', 'tab_')->where(['id' => $this->userId])->find(); $money = I('money', 0); $api_ver = I('api_ver', 0); diff --git a/Application/Sdk/Controller/WapPayController.class.php b/Application/Sdk/Controller/WapPayController.class.php index b3bd6491..7cc62f6f 100644 --- a/Application/Sdk/Controller/WapPayController.class.php +++ b/Application/Sdk/Controller/WapPayController.class.php @@ -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","该游戏暂时无法充值,请联系客服!"); diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index 1f91a038..789798c9 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -1,283 +1,272 @@ - - +
- - - - - - - - + + + + +