修改会员为1时情况下处理金额为支付金额减去冻结金额逻辑
This commit is contained in:
parent
17239d39e8
commit
b23cafcb64
@ -304,14 +304,10 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$financeLogic = new StoreFinanceFlowLogic();
|
$financeLogic = new StoreFinanceFlowLogic();
|
||||||
$user_sing = new UserSign();
|
$user_sing = new UserSign();
|
||||||
|
|
||||||
$financeLogic->order = $order;
|
|
||||||
$financeLogic->user = ['uid' => $order['uid']];
|
|
||||||
// if ($order->pay_type != 9 || $order->pay_type != 10) {
|
|
||||||
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付
|
|
||||||
$count_frees = 0;
|
|
||||||
//商户应该获得的钱 每个商品的price-ot_price 利润
|
|
||||||
// if (isset($order->profit) && $order->profit > 0) {
|
|
||||||
if ($order['uid'] > 0) {
|
if ($order['uid'] > 0) {
|
||||||
|
// 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去
|
||||||
|
$vipFrozenAmount = self::dealFrozenPrice($order['id']);
|
||||||
|
$order['pay_price'] = bcsub($order['pay_price'],$vipFrozenAmount,2);
|
||||||
//用户下单该用户等级为1得时候才处理冻结金额
|
//用户下单该用户等级为1得时候才处理冻结金额
|
||||||
$user = User::where('id', $order['uid'])->find();
|
$user = User::where('id', $order['uid'])->find();
|
||||||
if ($user['user_ship'] == 1) {
|
if ($user['user_ship'] == 1) {
|
||||||
@ -329,6 +325,12 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
User::where('id', $order['uid'])->inc('integral', $user_number)->update();
|
User::where('id', $order['uid'])->inc('integral', $user_number)->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$financeLogic->order = $order;
|
||||||
|
$financeLogic->user = ['uid' => $order['uid']];
|
||||||
|
// if ($order->pay_type != 9 || $order->pay_type != 10) {
|
||||||
|
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付
|
||||||
|
$count_frees = 0;
|
||||||
|
|
||||||
//平台手续费
|
//平台手续费
|
||||||
$fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
|
$fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
|
||||||
$count_frees = bcadd($count_frees, $fees, 2);
|
$count_frees = bcadd($count_frees, $fees, 2);
|
||||||
@ -467,6 +469,25 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
PayNotify::create($data);
|
PayNotify::create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冻结金额
|
||||||
|
* @param $oid
|
||||||
|
* @return int|mixed
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static function dealFrozenPrice($oid)
|
||||||
|
{
|
||||||
|
$detail = StoreOrderCartInfo::where('oid',$oid)->select()->toArray();
|
||||||
|
$total_vip = 0;
|
||||||
|
foreach ($detail as $value){
|
||||||
|
$total_vip +=$value['cart_info']['vip_frozen_price'];
|
||||||
|
}
|
||||||
|
return $total_vip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理用户为vip1时得冻结资金
|
* 处理用户为vip1时得冻结资金
|
||||||
@ -478,13 +499,9 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public static function dealVipAmount($order,$pay_type =1, $transaction_id = 0)
|
public static function dealVipAmount($order,$pay_type =1,$transaction_id = 0)
|
||||||
{
|
{
|
||||||
$detail = StoreOrderCartInfo::where('oid',$order['id'])->select()->toArray();
|
$total_vip = self::dealFrozenPrice($order['id']);
|
||||||
$total_vip = 0;
|
|
||||||
foreach ($detail as $value){
|
|
||||||
$total_vip +=$value['cart_info']['vip_frozen_price'];
|
|
||||||
}
|
|
||||||
$data=[
|
$data=[
|
||||||
'order_id' => $order['id'],
|
'order_id' => $order['id'],
|
||||||
'transaction_id' => $transaction_id??0,
|
'transaction_id' => $transaction_id??0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user