feat: 修改了CapitalFlowLogic, PayNotifyLogic, StoreFinanceFlowLogic, WeChatMnpService等文件,添加了新的参数$key,修改了storeIncome和storeExpense方法,并调整了部分变量名称。

This commit is contained in:
mkm 2024-09-01 10:35:40 +08:00
parent 594efabae1
commit 4344e46544
4 changed files with 17 additions and 17 deletions

View File

@ -100,7 +100,7 @@ class CapitalFlowLogic extends BaseLogic
* @param $mark
* @return mixed
*/
public function storeIncome($category, $linkType, $linkId, $amount, $mark = '')
public function storeIncome($category, $linkType, $linkId, $amount, $mark = '',$key='')
{
$model = new CapitalFlow();
$model->store_id = $this->store['id'];
@ -108,8 +108,8 @@ class CapitalFlowLogic extends BaseLogic
$model->link_type = $linkType;
$model->link_id = $linkId;
$model->amount = $amount;
$model->before_balance = $this->store['balance'];
$model->balance = bcadd($this->store['balance'], $amount, 2);
$model->before_balance = $this->store[$key]??0;
$model->balance = bcadd($this->store[$key]??0, $amount, 2);
$model->create_time = date('Y-m-d H:i:s');
$model->type = 'in';
$model->title = $this->getTitle($category, $amount);
@ -129,7 +129,7 @@ class CapitalFlowLogic extends BaseLogic
* @param $mark
* @return mixed
*/
public function storeExpense($category, $linkType, $linkId, $amount, $mark = '')
public function storeExpense($category, $linkType, $linkId, $amount, $mark = '',$key='')
{
$model = new CapitalFlow();
$model->store_id = $this->store['store_id'];
@ -138,8 +138,8 @@ class CapitalFlowLogic extends BaseLogic
$model->link_type = $linkType;
$model->link_id = $linkId;
$model->amount = $amount;
$model->before_balance = $this->store['balance'];
$model->balance = bcsub($this->store['balance'], $amount, 2);
$model->before_balance = $this->store[$key]??0;
$model->balance = bcsub($this->store[$key], $amount, 2);
$model->create_time = date('Y-m-d H:i:s');
$model->type = 'out';
$model->title = $this->getTitle($category, $amount);

View File

@ -97,7 +97,7 @@ class PayNotifyLogic extends BaseLogic
// self::addUserSing($order);
$capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 3, $order['store_id']);
self::dealProductLog($order);
// self::dealProductLog($order);
self::afterPay($order);
if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) {
@ -163,7 +163,7 @@ class PayNotifyLogic extends BaseLogic
];
UserSign::create($sing);
self::dealProductLog($order);
// self::dealProductLog($order);
}
@ -211,7 +211,7 @@ class PayNotifyLogic extends BaseLogic
];
OrderLogic::writeOff($params);
}
self::dealProductLog($order);
// self::dealProductLog($order);
if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) {
$checkArr = [
'cart_id' => $order['cart_id'],
@ -269,7 +269,7 @@ class PayNotifyLogic extends BaseLogic
}
self::afterPay($order, $extra['transaction_id']);
// self::addUserSing($order);
self::dealProductLog($order);
// self::dealProductLog($order);
if (!empty($extra['payer']['openid']) && $order->pay_type == 7) {
Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 4]);
@ -517,7 +517,7 @@ class PayNotifyLogic extends BaseLogic
}
$cashFlowLogic = new CashFlowLogic();
$cashFlowLogic->insert($order['store_id'], $order['pay_price']);
self::dealProductLog($order);
// self::dealProductLog($order);
if ($order && $order['store_id'] && $order['reservation'] != 1) {
$params = [
@ -561,7 +561,7 @@ class PayNotifyLogic extends BaseLogic
}
$order->save();
self::afterPay($order);
self::dealProductLog($order);
// self::dealProductLog($order);
// if ($order->pay_type == 9) {
// $extra['create_time'] = $order['create_time'];

View File

@ -151,18 +151,18 @@ class StoreFinanceFlowLogic extends BaseLogic
$store = SystemStore::where('id', $store_id)->find();
$capitalFlowDao = new CapitalFlowLogic($store, 'store');
if ($money > 0) {
$capitalFlowDao->storeIncome('store_money_add', 'order', $order_id, $money);
$capitalFlowDao->storeIncome('store_money_add', 'order', $order_id, $money,'','store_money');
SystemStore::where('id', $store_id)->inc('store_money', $money)->update();
}
if ($deposit > 0) {
$capitalFlowDao->storeIncome('store_paid_deposit_add', 'order', $order_id, $deposit);
$capitalFlowDao->storeIncome('store_paid_deposit_add', 'order', $order_id, $deposit,'','paid_deposit');
SystemStore::where('id', $store_id)->inc('paid_deposit', $deposit)->update();
}
$find = StoreFinanceFlow::where(['order_id' => $order_id, 'financial_pm' => 1, 'financial_type' => 16, 'status' => 0])->find();
StoreFinanceFlow::where(['order_id' => $order_id, 'financial_type' => 16])->update(['status' => 1]);
if ($find) {
if ($find['number'] > 0) {
$capitalFlowDao->storeIncome('store_attrition_add', 'order', $order_id, $find['number']);
$capitalFlowDao->storeIncome('store_attrition_add', 'order', $order_id, $find['number'],'','attrition');
SystemStore::where('id', $store_id)->inc('attrition', $find['number'])->update();
}
}

View File

@ -109,9 +109,9 @@ class WeChatMnpService
$dateTime = new DateTime(date('Y-m-d H:i:s'));
$formattedDateTime = $dateTime->format('Y-m-d\TH:i:s.uP');
if(in_array($logistics_type,[1,2,4])){
$item_desc='商品';
$item_desc='门店商品';
}else{
$item_desc='充值';
$item_desc='采购礼包';
}
return $this->app->getClient()->postJson("wxa/sec/order/upload_shipping_info?access_token=$token", [
'order_key' =>[