From 3382c56a915fe21753cc06bcee55b6fb76151262 Mon Sep 17 00:00:00 2001 From: tping Date: Mon, 16 Mar 2020 16:14:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=B8=81=E3=80=81=E7=BB=91?= =?UTF-8?q?=E5=B8=81=E4=BD=99=E9=A2=9D=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Callback/Controller/BaseController.class.php | 11 +++++++++++ Application/Sdk/Model/ValueDetailLogModel.class.php | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Application/Callback/Controller/BaseController.class.php b/Application/Callback/Controller/BaseController.class.php index 44246c2c..4ae2c08c 100644 --- a/Application/Callback/Controller/BaseController.class.php +++ b/Application/Callback/Controller/BaseController.class.php @@ -64,6 +64,7 @@ class BaseController extends Controller { $this->record_logs("支付金额不一致".$data['out_trade_no'].":".$data['money']);return false; } + $valueDetailLogModel = new \Sdk\Model\ValueDetailLogModel(); if($d['pay_status'] == 0){ // 处理绑币平台币优先处理 if ($d['deduction_amount'] > 0) { @@ -95,9 +96,12 @@ class BaseController extends Controller { 'pay_source' => 2, // 0官网 1推广后台 2移动端 'pay_ip' => $d['spend_ip'], 'create_time' => $createTime, + 'payed_time' => time(), 'sdk_version' => $d['sdk_version'], 'check_sign' => get_check_sign($d['user_id'],$data['trade_no'],$d['pay_amount'],$createTime), ]); + $valueDetailLogModel->addLog($d['user_id'], 'PF_'.$data['out_trade_no'], + $balance, $d['pay_amount'], $balance+$d['pay_amount'], $valueDetailLogModel::BALANCE, "游戏支付时候抵扣金额不足,增加到平台币", 2); $user = M("user","tab_"); $user->where("id=".$d['user_id'])->setInc("balance", $d['pay_amount']); $user->where("id=".$d['user_id'])->setInc("cumulative", $d['pay_amount']); @@ -138,6 +142,10 @@ class BaseController extends Controller { $result = $this->add_spend($request); $this->set_ratio($request['pay_order_number'], 2); // 游戏返利 $notice_order[] = $request['pay_order_number']; + + $valueDetailLogModel->addLog($d['user_id'], $request['pay_order_number'], + $bind_balance, -($bind_balance-$bb), $bb, $valueDetailLogModel::BANDBI, "绑币抵扣", 1); + } if ($bb == 0) { @@ -155,6 +163,9 @@ class BaseController extends Controller { $result = $this->add_spend($request); $this->set_ratio($request['pay_order_number'], 2); // 游戏返利 $notice_order[] = $request['pay_order_number']; + $valueDetailLogModel->addLog($d['user_id'], $request['pay_order_number'], + $balance, -($mbalance), $balance - $mbalance, $valueDetailLogModel::BALANCE, "平台币抵扣", 1); + } } diff --git a/Application/Sdk/Model/ValueDetailLogModel.class.php b/Application/Sdk/Model/ValueDetailLogModel.class.php index d1cc056d..7c43d9aa 100644 --- a/Application/Sdk/Model/ValueDetailLogModel.class.php +++ b/Application/Sdk/Model/ValueDetailLogModel.class.php @@ -31,6 +31,11 @@ class ValueDetailLogModel extends Model { // 新增数值变动记录 public function addLog($uid, $orderNumber, $before, $value, $after, $type, $remark='', $payType=1) { + // 判断 pay_type = 0 是否存在 存在就删除掉 + $this->delete(array( + 'user_id' => $uid, + 'pay_type' => 0 + )); $this->add(array( 'order_number' => $orderNumber, 'user_id' => $uid, @@ -40,7 +45,7 @@ class ValueDetailLogModel extends Model { 'create_time' => time(), 'type' => $type, 'remark' => $remark, - 'pay_type' => $payType + 'pay_type' => $payType // 1为spend(消费),2为deposit(充值),3为转账 0为初始 )); } }