退款微信进资金流水
This commit is contained in:
parent
883847e49d
commit
1cca6ee0ec
app/common/logic
@ -19,6 +19,7 @@ class CapitalFlowLogic extends BaseLogic
|
||||
$this->store = $obj;
|
||||
}
|
||||
}
|
||||
//微信退款记录
|
||||
|
||||
/**
|
||||
* 用户收入
|
||||
@ -29,7 +30,7 @@ class CapitalFlowLogic extends BaseLogic
|
||||
* @param $mark
|
||||
* @return mixed
|
||||
*/
|
||||
public function userIncome($category, $linkType, $linkId, $amount, $mark = '')
|
||||
public function userIncome($category, $linkType, $linkId, $amount, $mark = '',$type=0)
|
||||
{
|
||||
$model = new CapitalFlow();
|
||||
$model->uid = $this->user['id'];
|
||||
@ -37,8 +38,13 @@ class CapitalFlowLogic extends BaseLogic
|
||||
$model->link_type = $linkType;
|
||||
$model->link_id = $linkId;
|
||||
$model->amount = $amount;
|
||||
$model->before_balance = $this->user['now_money'];
|
||||
$model->balance = bcadd($this->user['now_money'], $amount, 2);
|
||||
if($type){
|
||||
$model->before_balance = $this->user['now_money'];
|
||||
$model->balance = $this->user['now_money'];
|
||||
}else{
|
||||
$model->before_balance = $this->user['now_money'];
|
||||
$model->balance = bcadd($this->user['now_money'], $amount, 2);
|
||||
}
|
||||
$model->create_time = date('Y-m-d H:i:s');
|
||||
$model->type = 'in';
|
||||
$model->title = $this->getTitle($category, $amount);
|
||||
|
@ -8,6 +8,7 @@ use app\common\enum\PayEnum;
|
||||
use app\common\enum\user\UserShipEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\dict\DictType;
|
||||
use app\common\model\finance\CapitalFlow;
|
||||
use app\common\model\finance\PayNotifyLog;
|
||||
use app\common\model\pay\PayNotify;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
@ -268,10 +269,10 @@ class PayNotifyLogic extends BaseLogic
|
||||
$order->save();
|
||||
//日志记录
|
||||
//加用户余额,采购款, 日志记录 加数量
|
||||
$user = User::where('id', $order['uid'])->findOrEmpty();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$deal_money = bcdiv($extra['amount']['refund'], 100, 2);
|
||||
if (in_array($order['pay_type'],[PayEnum::BALANCE_PAY,PayEnum::PURCHASE_FUNDS])){
|
||||
$deal_money = bcdiv($extra['amount']['refund'], 100, 2);
|
||||
$user = User::where('id', $order['uid'])->findOrEmpty();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
if($order['pay_type'] == PayEnum::BALANCE_PAY){//用户余额
|
||||
$user->now_money = bcadd($user->now_money, $deal_money, 2);
|
||||
$user->save();
|
||||
@ -290,9 +291,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
}
|
||||
|
||||
}
|
||||
//微信日志
|
||||
|
||||
|
||||
//微信日志 user_order_refund
|
||||
$capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money,'',1);
|
||||
self::addStock($order['id']);//微信
|
||||
|
||||
// self::afterPay($order,$extra['transaction_id']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user