合并余额绑币明细

master
tping 5 years ago
parent ae07e2e182
commit 41ca8e8121

@ -247,7 +247,7 @@ class BaseController extends Controller {
$before = $userInfo['balance']; $before = $userInfo['balance'];
$after = $before + $d['pay_amount']; $after = $before + $d['pay_amount'];
$valueDetailLogModel = new \Sdk\Model\ValueDetailLogModel(); $valueDetailLogModel = new \Sdk\Model\ValueDetailLogModel();
$valueDetailLogModel->add($d['user_id'], $before, $d['pay_amount'], $after, $valueDetailLogModel::BALANCE, "平台币抵扣".$d['pay_amount']); $valueDetailLogModel->addLog($d['user_id'], $data['trade_no'], $before, $d['pay_amount'], $after, $valueDetailLogModel::BALANCE, "平台币抵扣".$d['pay_amount']);
$user->where("id=".$d['user_id'])->setInc("balance",$d['pay_amount']); $user->where("id=".$d['user_id'])->setInc("balance",$d['pay_amount']);
$user->where("id=".$d['user_id'])->setInc("cumulative",$d['pay_amount']); $user->where("id=".$d['user_id'])->setInc("cumulative",$d['pay_amount']);

@ -1080,14 +1080,14 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
$user_play->where($user_play_map)->save(array('bind_balance' => 0)); // 扣绑定币 $user_play->where($user_play_map)->save(array('bind_balance' => 0)); // 扣绑定币
$request['price'] = $user_play_data['bind_balance']; $request['price'] = $user_play_data['bind_balance'];
$result = $this->add_spend($request); $result = $this->add_spend($request);
$valueDetailLogModel->add($request['user_id'], $user_play_data['bind_balance'], -$user_play_data['bind_balance'], 0, $valueDetailLogModel::BANDBI, "绑定币消费:".$user_play_data['pay_amount']); $valueDetailLogModel->addLog($request['user_id'], $request['pay_order_number'], $user_play_data['bind_balance'], -$user_play_data['bind_balance'], 0, $valueDetailLogModel::BANDBI, "绑定币消费:".$user_play_data['pay_amount']);
$this->set_ratio($request['pay_order_number'], 2); // 游戏返利 $this->set_ratio($request['pay_order_number'], 2); // 游戏返利
$notice_order[] = $request['pay_order_number']; $notice_order[] = $request['pay_order_number'];
} }
$request['pay_order_number'] = $pay_order_number; $request['pay_order_number'] = $pay_order_number;
$request['pay_way'] = 0; // 扣平台币 $request['pay_way'] = 0; // 扣平台币
$real_price = $price - $user_play_data['bind_balance']; $real_price = $price - $user_play_data['bind_balance'];
$valueDetailLogModel->add($request['user_id'], $balance, -$real_price, 0, $valueDetailLogModel::BALANCE, "平台币消费:".$real_price); $valueDetailLogModel->addLog($request['user_id'], $request['pay_order_number'], $balance, -$real_price, 0, $valueDetailLogModel::BALANCE, "平台币消费:".$real_price);
$user->where(array('id' => $request["user_id"]))->setDec("balance", $real_price); $user->where(array('id' => $request["user_id"]))->setDec("balance", $real_price);
//$this->set_message(0,"fail", $request['pay_order_number']); //$this->set_message(0,"fail", $request['pay_order_number']);
@ -1096,7 +1096,7 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
$this->set_ratio($request['pay_order_number'], 1); // 游戏返利 $this->set_ratio($request['pay_order_number'], 1); // 游戏返利
$notice_order[] = $request['pay_order_number']; $notice_order[] = $request['pay_order_number'];
} else { // 绑定币足够扣 } else { // 绑定币足够扣
$valueDetailLogModel->add($request['user_id'], $user_play_data['bind_balance'], -$request['price'], $user_play_data['bind_balance'] - $request['price'], $valueDetailLogModel::BANDBI, "绑定币消费.".$request['price']); $valueDetailLogModel->addLog($request['user_id'], $request['pay_order_number'], $user_play_data['bind_balance'], -$request['price'], $user_play_data['bind_balance'] - $request['price'], $valueDetailLogModel::BANDBI, "绑定币消费.".$request['price']);
$user_play->where($user_play_map)->setDec('bind_balance', $request['price']); // 扣绑定币 $user_play->where($user_play_map)->setDec('bind_balance', $request['price']); // 扣绑定币
$result = $this->add_spend($request); $result = $this->add_spend($request);

@ -30,8 +30,9 @@ class ValueDetailLogModel extends Model {
} }
// 新增数值变动记录 // 新增数值变动记录
public function add($uid, $before, $value, $after, $type, $remark='', $payType=1) { public function addLog($uid, $orderNumber, $before, $value, $after, $type, $remark='', $payType=1) {
$this->add(array( $this->add(array(
'order_number' => $orderNumber,
'user_id' => $uid, 'user_id' => $uid,
'before_value' => $before, 'before_value' => $before,
'value' => $value, 'value' => $value,

Loading…
Cancel
Save