From 842428a678da6f57ae41d9cdb9f2320062eef300 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Sun, 29 Sep 2019 18:15:56 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E6=A6=82=E5=86=B5?=
=?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Home/View/default/Query/dailySummary.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Application/Home/View/default/Query/dailySummary.html b/Application/Home/View/default/Query/dailySummary.html
index 5a5227cca..96197f933 100644
--- a/Application/Home/View/default/Query/dailySummary.html
+++ b/Application/Home/View/default/Query/dailySummary.html
@@ -55,6 +55,8 @@
width: auto;
padding-left: 15px;
padding-right: 15px;
+ position: relative;
+ z-index: 1;
}
From bb7738864d3d9365b9029e2c9c5394cb468d2346 Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Mon, 30 Sep 2019 10:20:54 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=9B=9E=E9=80=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/BaseController.class.php | 210 ------------------
1 file changed, 210 deletions(-)
diff --git a/Application/Callback/Controller/BaseController.class.php b/Application/Callback/Controller/BaseController.class.php
index 6aa04e2cf..65b29bbda 100644
--- a/Application/Callback/Controller/BaseController.class.php
+++ b/Application/Callback/Controller/BaseController.class.php
@@ -4,7 +4,6 @@ namespace Callback\Controller;
use Think\Controller;
use Common\Api\GameApi;
use Org\UcenterSDK\Ucservice;
-use Think\Log;
/**
* 支付回调控制器
* @author 小纯洁
@@ -55,7 +54,6 @@ class BaseController extends Controller {
$spend = M('Spend',"tab_");
$map['pay_order_number'] = $data['out_trade_no'];
$d = $spend->where($map)->find();
-
if(empty($d)){$this->record_logs("数据异常");return false;}
// 支付金额判断 by zgc
if ($d['pay_amount'] != $data['money']) {
@@ -63,63 +61,6 @@ class BaseController extends Controller {
}
if($d['pay_status'] == 0){
- // 处理绑币平台币优先处理
- if ($d['deduction_amount'] > 0) {
- $out_trade_no = "PF_" . date('Ymd') . date('His') . sp_random_string(4);
-
- $bind_balance = M('user_play', 'tab_')->where(array(
- 'user_id' => $d['user_id'],
- 'game_id' => $d['game_id']
- ))->getField('bind_balance');
- $request = $d;
- $request['pay_order_number'] = $out_trade_no;
- $request['price'] = $bind_balance;
- $request['deduction_amount'] = 0;
- $request['pay_way'] = -1;
- $request['pay_status'] = 1;
-
- if ($d['deduction_amount'] > $bind_balance)
- $bb = 0;
- else
- $bb = $bind_balance - $d['deduction_amount'];
-
- if ($bind_balance > 0) {
- M('user_play', 'tab_')->where(array(
- 'user_id' => $d['user_id'],
- 'game_id' => $d['game_id']
- ))->save(array(
- 'bind_balance' => $bb
- ));
-
- $result = $this->add_spend($request);
- $this->set_ratio($request['pay_order_number'], 2); // 游戏返利
- }
-
- if ($bb == 0) {
- $mbalance = $d['deduction_amount'] - $bind_balance;
- if ($mbalance > 0) {
- $request['pay_way'] = 0;
- $request['pay_order_number'] = $request['pay_order_number']."_1";
- $request['price'] = $mbalance;
- $balance = M('user', 'tab_')->where(array(
- 'id' => $d['user_id'],
- ))->getField('balance');
-
- if ($balance < $mbalance) { // 异常
- $this->record_logs($mbalance."平台币余额不足".$balance);return false;
- }
- M('user', 'tab_')->where(array(
- 'id' => $d['user_id']
- ))->save(array(
- 'balance' => $balance - $mbalance,
- ));
- $result = $this->add_spend($request);
- $this->set_ratio($request['pay_order_number'], 2); // 游戏返利
- }
- }
-
- }
-
$data_save['pay_status'] = 1;
$data_save['order_number'] = $data['trade_no'];
$map_s['pay_order_number'] = $data['out_trade_no'];
@@ -523,155 +464,4 @@ class BaseController extends Controller {
fwrite($myfile, $txt);
fclose($myfile);
}
-
- /**
- *消费表添加数据
- */
- public function add_spend($data,$type=0){
- $spend = M("spend","tab_");
- $spend_data = $this->spend_param($data);
- $ordercheck = $spend->where(array('pay_order_number'=>$spend_data["pay_order_number"]))->find();
- if($ordercheck)
- {
- if($type==1){
- redirect(U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!')));exit;
- }else{
- $this->set_message(0,'fail',"订单已经存在,请刷新充值页面重新下单!");
- }
- }
- // if(!is_check_apply_promote($spend_data['game_id'],$spend_data['promote_id'])){
- // $spend_data['promote_id']=0;
- // $spend_data['promote_account']="自然注册";
- // }
- $result = $spend->add($spend_data);
- return $result;
- }
-
- /**
- *消费记录表 参数
- */
- private function spend_param($param=array()){
- $user_entity = get_user_entity($param['user_id']);
- $data_spned['user_id'] = $param["user_id"];
- $data_spned['user_account'] = $user_entity["account"];
- $data_spned['user_nickname'] = $user_entity["nickname"];
- $data_spned['game_id'] = $param["game_id"];
- $data_spned['game_appid'] = $param["game_appid"];
- $data_spned['game_name'] = get_game_name($param["game_id"]);
- $data_spned['selle_ratio'] = get_game_selle_ratio($param["game_id"]);
- $data_spned['server_id'] = $param["server_id"];
- $data_spned['server_name'] = $param["server_name"];
- $data_spned['game_player_name'] = $param["game_player_name"];
- $data_spned['promote_id'] = $user_entity["promote_id"];
- $data_spned['promote_account'] = $user_entity["promote_account"];
- $data_spned['order_number'] = $param["order_number"];
- $data_spned['pay_order_number'] = $param["pay_order_number"];
- $data_spned['props_name'] = $param["title"];
- $data_spned['cost'] = $param["price"];//原价
- $data_spned['deduction_amount'] = $param["deduction_amount"];// 抵扣价格
- $data_spned['discount_amount'] = $param["discount_amount"];// 折扣价格
- $data_spned['pay_time'] = NOW_TIME;
- $data_spned['pay_status'] = $param["pay_status"];
- $data_spned['pay_game_status'] = 0;
- $data_spned['extend'] = $param['extend'];
- $data_spned['pay_way'] = $param["pay_way"];
- if($data_spned['pay_way'] != 7){
- $discount = $this->get_discount($param['game_id'],$user_entity['promote_id'],$param['user_id']);
- $data_spned['pay_amount'] = $param["price"] * $discount['discount']/10;//实付金额
- $data_spned['discount_type'] = $discount['discount_type'];
- }else{//苹果支付不计入折扣
- $data_spned['pay_amount'] = $param["price"];
- $data_spned['discount_type'] = 0;
- }
- if (isset($param['actual_amount']) && $param['actual_amount'])
- $data_spned['pay_amount'] = $param['actual_amount']; // 实际支付价格
- $data_spned['spend_ip'] = $param["spend_ip"];
- $data_spned['sdk_version'] = $param["sdk_version"];
- if($param['small_user_id'] != $param['user_id']) {
- $data_spned['small_id'] = $param["small_user_id"];
- $data_spned['small_account'] = get_user_account_by_id($param['small_user_id']);
- }
- return $data_spned;
- }
-
- /**
- * 获取用户折扣
- * @param $game_id 游戏ID
- * @param $promote_id 渠道ID
- * @param $user_id 用户ID
- * @return mixed
- */
- protected function get_discount($game_id,$promote_id,$user_id){
- //获取折扣
- $map['game_id'] = $game_id;
- $map['promote_id'] =-1;
- $map['status'] = 2;
- $discount = M('Promote_welfare','tab_')->where($map)->find();
- if(null==$discount){
- $map['game_id'] = $game_id;
- $map['promote_id'] = $promote_id == 0 ? 0 : -2;
- $map['status'] = 2;
- $discount = M('Promote_welfare','tab_')->where($map)->find();
- }
- $discount = discount_data($discount);
- if(empty($discount)){
- $res['discount'] = 10;
- $res['discount_type'] = 0;//无折扣
- return $res;
- }
-
- //判断用户是否为首冲
- $where['game_id'] = $game_id;
- $where['user_id'] = $user_id;
- $where['pay_status'] = 1;
- $data = M('bind_spend','tab_')->where($where)->find();
- if(!empty($data) || !empty(M('spend','tab_')->where($where)->find())){
- $res['discount'] = $discount['continue_discount'];//续冲
- $res['discount_type'] = 2;
- }else{
- $res['discount'] = $discount['first_discount'];//首冲
- $res['discount_type'] = 1;
- }
- return $res;
- }
-
- /**
- *游戏返利
- *$type 类型 1 非绑定平台币 2绑定平台币
- */
- /* public function set_ratio($data,$type = 1){
- $map['pay_order_number']=$data;
- $map['pay_way'] = ($type==2) ? -1 : 0; // 判断支付类型
- $spend=M("Spend","tab_")->where($map)->find();
- $reb_map['game_id']=$spend['game_id'];
- $time = time();
- $reb_map['starttime'] = ['lt',$time];
- $reb_map_str = "endtime > {$time} or endtime = 0";
- switch ($spend['promote_id']) {
- case 0:
- $reb_map['promote_id'] = array('in','0,-1');
- break;
- default:
- $reb_map['promote_id'] = array('in','1,-1');
- break;
- }
-
-
- //如果是绑币则判断是否开启绑币返利
- if($type == 2){$reb_map['bind_status'] = 1;}
- $rebate=M("Rebate","tab_")->where($reb_map)->where($reb_map_str)->find();//
- if (!empty($rebate)) {
- if($rebate['money']>0 && $rebate['status']==1){
- if($spend['pay_amount']>=$rebate['money']){
- $this->compute($spend,$rebate);
- }else{
- return false;
- }
- }else{
- $this->compute($spend,$rebate);
- }
- }else{
- return false;
- }
- } */
}
\ No newline at end of file
From a4114aadc2c76839d6d53e269bf9fdda71e61d29 Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Mon, 30 Sep 2019 10:23:01 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=81=A2=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/BaseController.class.php | 210 ++++++++++++++++++
1 file changed, 210 insertions(+)
diff --git a/Application/Callback/Controller/BaseController.class.php b/Application/Callback/Controller/BaseController.class.php
index 65b29bbda..6aa04e2cf 100644
--- a/Application/Callback/Controller/BaseController.class.php
+++ b/Application/Callback/Controller/BaseController.class.php
@@ -4,6 +4,7 @@ namespace Callback\Controller;
use Think\Controller;
use Common\Api\GameApi;
use Org\UcenterSDK\Ucservice;
+use Think\Log;
/**
* 支付回调控制器
* @author 小纯洁
@@ -54,6 +55,7 @@ class BaseController extends Controller {
$spend = M('Spend',"tab_");
$map['pay_order_number'] = $data['out_trade_no'];
$d = $spend->where($map)->find();
+
if(empty($d)){$this->record_logs("数据异常");return false;}
// 支付金额判断 by zgc
if ($d['pay_amount'] != $data['money']) {
@@ -61,6 +63,63 @@ class BaseController extends Controller {
}
if($d['pay_status'] == 0){
+ // 处理绑币平台币优先处理
+ if ($d['deduction_amount'] > 0) {
+ $out_trade_no = "PF_" . date('Ymd') . date('His') . sp_random_string(4);
+
+ $bind_balance = M('user_play', 'tab_')->where(array(
+ 'user_id' => $d['user_id'],
+ 'game_id' => $d['game_id']
+ ))->getField('bind_balance');
+ $request = $d;
+ $request['pay_order_number'] = $out_trade_no;
+ $request['price'] = $bind_balance;
+ $request['deduction_amount'] = 0;
+ $request['pay_way'] = -1;
+ $request['pay_status'] = 1;
+
+ if ($d['deduction_amount'] > $bind_balance)
+ $bb = 0;
+ else
+ $bb = $bind_balance - $d['deduction_amount'];
+
+ if ($bind_balance > 0) {
+ M('user_play', 'tab_')->where(array(
+ 'user_id' => $d['user_id'],
+ 'game_id' => $d['game_id']
+ ))->save(array(
+ 'bind_balance' => $bb
+ ));
+
+ $result = $this->add_spend($request);
+ $this->set_ratio($request['pay_order_number'], 2); // 游戏返利
+ }
+
+ if ($bb == 0) {
+ $mbalance = $d['deduction_amount'] - $bind_balance;
+ if ($mbalance > 0) {
+ $request['pay_way'] = 0;
+ $request['pay_order_number'] = $request['pay_order_number']."_1";
+ $request['price'] = $mbalance;
+ $balance = M('user', 'tab_')->where(array(
+ 'id' => $d['user_id'],
+ ))->getField('balance');
+
+ if ($balance < $mbalance) { // 异常
+ $this->record_logs($mbalance."平台币余额不足".$balance);return false;
+ }
+ M('user', 'tab_')->where(array(
+ 'id' => $d['user_id']
+ ))->save(array(
+ 'balance' => $balance - $mbalance,
+ ));
+ $result = $this->add_spend($request);
+ $this->set_ratio($request['pay_order_number'], 2); // 游戏返利
+ }
+ }
+
+ }
+
$data_save['pay_status'] = 1;
$data_save['order_number'] = $data['trade_no'];
$map_s['pay_order_number'] = $data['out_trade_no'];
@@ -464,4 +523,155 @@ class BaseController extends Controller {
fwrite($myfile, $txt);
fclose($myfile);
}
+
+ /**
+ *消费表添加数据
+ */
+ public function add_spend($data,$type=0){
+ $spend = M("spend","tab_");
+ $spend_data = $this->spend_param($data);
+ $ordercheck = $spend->where(array('pay_order_number'=>$spend_data["pay_order_number"]))->find();
+ if($ordercheck)
+ {
+ if($type==1){
+ redirect(U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!')));exit;
+ }else{
+ $this->set_message(0,'fail',"订单已经存在,请刷新充值页面重新下单!");
+ }
+ }
+ // if(!is_check_apply_promote($spend_data['game_id'],$spend_data['promote_id'])){
+ // $spend_data['promote_id']=0;
+ // $spend_data['promote_account']="自然注册";
+ // }
+ $result = $spend->add($spend_data);
+ return $result;
+ }
+
+ /**
+ *消费记录表 参数
+ */
+ private function spend_param($param=array()){
+ $user_entity = get_user_entity($param['user_id']);
+ $data_spned['user_id'] = $param["user_id"];
+ $data_spned['user_account'] = $user_entity["account"];
+ $data_spned['user_nickname'] = $user_entity["nickname"];
+ $data_spned['game_id'] = $param["game_id"];
+ $data_spned['game_appid'] = $param["game_appid"];
+ $data_spned['game_name'] = get_game_name($param["game_id"]);
+ $data_spned['selle_ratio'] = get_game_selle_ratio($param["game_id"]);
+ $data_spned['server_id'] = $param["server_id"];
+ $data_spned['server_name'] = $param["server_name"];
+ $data_spned['game_player_name'] = $param["game_player_name"];
+ $data_spned['promote_id'] = $user_entity["promote_id"];
+ $data_spned['promote_account'] = $user_entity["promote_account"];
+ $data_spned['order_number'] = $param["order_number"];
+ $data_spned['pay_order_number'] = $param["pay_order_number"];
+ $data_spned['props_name'] = $param["title"];
+ $data_spned['cost'] = $param["price"];//原价
+ $data_spned['deduction_amount'] = $param["deduction_amount"];// 抵扣价格
+ $data_spned['discount_amount'] = $param["discount_amount"];// 折扣价格
+ $data_spned['pay_time'] = NOW_TIME;
+ $data_spned['pay_status'] = $param["pay_status"];
+ $data_spned['pay_game_status'] = 0;
+ $data_spned['extend'] = $param['extend'];
+ $data_spned['pay_way'] = $param["pay_way"];
+ if($data_spned['pay_way'] != 7){
+ $discount = $this->get_discount($param['game_id'],$user_entity['promote_id'],$param['user_id']);
+ $data_spned['pay_amount'] = $param["price"] * $discount['discount']/10;//实付金额
+ $data_spned['discount_type'] = $discount['discount_type'];
+ }else{//苹果支付不计入折扣
+ $data_spned['pay_amount'] = $param["price"];
+ $data_spned['discount_type'] = 0;
+ }
+ if (isset($param['actual_amount']) && $param['actual_amount'])
+ $data_spned['pay_amount'] = $param['actual_amount']; // 实际支付价格
+ $data_spned['spend_ip'] = $param["spend_ip"];
+ $data_spned['sdk_version'] = $param["sdk_version"];
+ if($param['small_user_id'] != $param['user_id']) {
+ $data_spned['small_id'] = $param["small_user_id"];
+ $data_spned['small_account'] = get_user_account_by_id($param['small_user_id']);
+ }
+ return $data_spned;
+ }
+
+ /**
+ * 获取用户折扣
+ * @param $game_id 游戏ID
+ * @param $promote_id 渠道ID
+ * @param $user_id 用户ID
+ * @return mixed
+ */
+ protected function get_discount($game_id,$promote_id,$user_id){
+ //获取折扣
+ $map['game_id'] = $game_id;
+ $map['promote_id'] =-1;
+ $map['status'] = 2;
+ $discount = M('Promote_welfare','tab_')->where($map)->find();
+ if(null==$discount){
+ $map['game_id'] = $game_id;
+ $map['promote_id'] = $promote_id == 0 ? 0 : -2;
+ $map['status'] = 2;
+ $discount = M('Promote_welfare','tab_')->where($map)->find();
+ }
+ $discount = discount_data($discount);
+ if(empty($discount)){
+ $res['discount'] = 10;
+ $res['discount_type'] = 0;//无折扣
+ return $res;
+ }
+
+ //判断用户是否为首冲
+ $where['game_id'] = $game_id;
+ $where['user_id'] = $user_id;
+ $where['pay_status'] = 1;
+ $data = M('bind_spend','tab_')->where($where)->find();
+ if(!empty($data) || !empty(M('spend','tab_')->where($where)->find())){
+ $res['discount'] = $discount['continue_discount'];//续冲
+ $res['discount_type'] = 2;
+ }else{
+ $res['discount'] = $discount['first_discount'];//首冲
+ $res['discount_type'] = 1;
+ }
+ return $res;
+ }
+
+ /**
+ *游戏返利
+ *$type 类型 1 非绑定平台币 2绑定平台币
+ */
+ /* public function set_ratio($data,$type = 1){
+ $map['pay_order_number']=$data;
+ $map['pay_way'] = ($type==2) ? -1 : 0; // 判断支付类型
+ $spend=M("Spend","tab_")->where($map)->find();
+ $reb_map['game_id']=$spend['game_id'];
+ $time = time();
+ $reb_map['starttime'] = ['lt',$time];
+ $reb_map_str = "endtime > {$time} or endtime = 0";
+ switch ($spend['promote_id']) {
+ case 0:
+ $reb_map['promote_id'] = array('in','0,-1');
+ break;
+ default:
+ $reb_map['promote_id'] = array('in','1,-1');
+ break;
+ }
+
+
+ //如果是绑币则判断是否开启绑币返利
+ if($type == 2){$reb_map['bind_status'] = 1;}
+ $rebate=M("Rebate","tab_")->where($reb_map)->where($reb_map_str)->find();//
+ if (!empty($rebate)) {
+ if($rebate['money']>0 && $rebate['status']==1){
+ if($spend['pay_amount']>=$rebate['money']){
+ $this->compute($spend,$rebate);
+ }else{
+ return false;
+ }
+ }else{
+ $this->compute($spend,$rebate);
+ }
+ }else{
+ return false;
+ }
+ } */
}
\ No newline at end of file
From 7351c3a6fa3bc618ae38c917b35cdd22474213df Mon Sep 17 00:00:00 2001
From: tpingzhang <635929049@qq.com>
Date: Mon, 30 Sep 2019 10:28:26 +0800
Subject: [PATCH 4/4] =?UTF-8?q?1015=E7=89=88=E6=9C=AC=E5=9B=9E=E9=80=80?=
=?UTF-8?q?=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Sdk/Controller/BaseController.class.php | 1 +
.../Sdk/View/default/Spend/pay_way.html | 481 +++++++++---------
2 files changed, 229 insertions(+), 253 deletions(-)
diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php
index f24813a52..2b61c31ac 100644
--- a/Application/Sdk/Controller/BaseController.class.php
+++ b/Application/Sdk/Controller/BaseController.class.php
@@ -687,6 +687,7 @@ class BaseController extends RestController{
* $request $discountAmount 折扣价格
*/
public function other_price(&$request, $discountAmount=0) {
+ return $request;
// 优先扣除绑定币平台币
if ($request['code'] == '0') return $request; // 平台币充值 不做判断
$deductionAmount = 0;
diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html
index a810aed6f..6295fe855 100644
--- a/Application/Sdk/View/default/Spend/pay_way.html
+++ b/Application/Sdk/View/default/Spend/pay_way.html
@@ -1,270 +1,245 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
支付中心
-
-
+ return false;
+ });
+
+ $('#alipaybtn').on('click',function() {
+ var that = $(this),url = $.trim(that.attr('data-url'));
+ if(that.hasClass('disabledbtn')){return false;}
+ that.addClass('disabled');
+ $.ajax({
+ type:'post',
+ dataType:'json',
+ data:{},
+ url:url,
+ success:function(result) {
+ if(result.code==200) {
+ var data = result.data;
+ if(data.wap==1) {
+
+ location.href = data.url;
+
+ } else if (data.wap==1) {
+ window.webkit.messageHandlers.noticeAppResult.postMessage(data.url);
+ }
+ else {
-
-
-
-
-
-
-
{$balance+$bind_balance}平台币
-
-
-
-
-
-
-¥{$balance+$bind_balance}
-
-
-
-
-
+ window.webkit.messageHandlers.noticeAppResult.postMessage(data.url);
-
-
- 确认支付
-
-
-
+
\ No newline at end of file