修改报错和查询用户余额支付

This commit is contained in:
liu 2024-06-18 12:10:21 +08:00
parent b67259a91e
commit 79e89fa22d
3 changed files with 11 additions and 10 deletions

View File

@ -50,13 +50,14 @@ class CapitalFlowLogic extends BaseLogic
/**
* 用户支出
* @param $category
* @param $store_id
* @param $linkType
* @param $linkId
* @param $amount
* @param $mark
* @return mixed
*/
public function userExpense($store_id=0,$category, $linkType, $linkId, $amount, $mark = '',$payType=0)
public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0,$store_id=0,)
{
$model = new CapitalFlow();
$model->uid = $this->user['id'];

View File

@ -78,7 +78,7 @@ class PayNotifyLogic extends BaseLogic
$user->save();
$capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order['pay_price']);
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price'],'',0,$order['store_id']);
// self::afterPay($order);
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
@ -112,7 +112,7 @@ class PayNotifyLogic extends BaseLogic
$user->save();
$capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense($order['store_id'],'user_order_purchase_pay', 'order', $order['id'], $order['pay_price'],'',1);
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'],'',1,$order['store_id']);
if ($user['user_ship'] == 1) {
VipLogic::dealVipAmount($order, PayEnum::PURCHASE_FUNDS);
}
@ -151,7 +151,7 @@ class PayNotifyLogic extends BaseLogic
} else {
$capitalFlowDao = new CapitalFlowLogic($user);
//微信支付和用户余额无关
$capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order->pay_price, '', 1);
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1,$order['store_id']);
}

View File

@ -21,6 +21,7 @@ use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\logic\store_order\StoreOrderLogic;
use app\common\logic\StoreFinanceFlowLogic;
use app\common\model\finance\CapitalFlow;
use app\common\model\order\Cart;
use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow;
use app\common\model\store_finance_flow\StoreFinanceFlow;
@ -582,7 +583,7 @@ class WorkbenchLogic extends BaseLogic
$cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id'])
->where('status',YesNoEnum::YES)
->sum('receipts');
->sum('receivable');
if(isset($params['month']) && $params['month']){
$all = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']])
->whereMonth('create_time', $params['month'])
@ -599,11 +600,10 @@ class WorkbenchLogic extends BaseLogic
->sum('pay_price');
$profit_all = $all
->sum('profit');
$cost_all = $all
->sum('cost');
//消耗余额 V2.0
$cost_all = CapitalFlow::
where(['category'=>'user_order_balance_pay','store_id'=>$params['store_id']])
->sum('amount');
$time = self::getLastSevenDays();
$newArr = [];