修改余额支付报错

This commit is contained in:
liu 2024-06-28 13:55:09 +08:00
parent 0138c13069
commit c24b0f7900
2 changed files with 12 additions and 4 deletions

View File

@ -66,11 +66,12 @@ class PayNotifyLogic extends BaseLogic
public static function balancePay($orderSn, $extra = [])
{
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
$user = User::where('id', $order['uid'])->find();
if ($user['now_money'] < $order['pay_price']) {
throw new \Exception('余额不足');
}
$order->money = $order['pay_price'];
// $order->money = $order['pay_price'];
$order->paid = 1;
$order->pay_time = time();
if (!$order->save()) {
@ -107,6 +108,7 @@ class PayNotifyLogic extends BaseLogic
];
OrderLogic::writeOff($params);
}
return true;
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
}
@ -494,6 +496,11 @@ class PayNotifyLogic extends BaseLogic
'number' => $user_number,
];
$user_sing->save($sing);
//删除之前获得的兑换券
UserSign::where([
'order_id'=>$order['order_id'],
'financial_pm'=>1,
])->update(['delete_time'=>time()]);
$now_int = User::where('id',$order['uid'])->find();
if($now_int){
if($now_int['integral'] > $user_number){

View File

@ -6,6 +6,7 @@ use app\common\logic\BaseLogic;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\user_product_storage\UserProductStorage;
use app\common\model\user_product_storage_log\UserProductStorageLog;
use think\Exception;
/**
* 用户商品储存逻辑
@ -13,7 +14,7 @@ use app\common\model\user_product_storage_log\UserProductStorageLog;
class UserProductStorageLogic extends BaseLogic
{
public static function add($order){
$arr=StoreOrderCartInfo::where('oid',$order['id'])->field('product_id,cart_num nums')->select();
$arr=StoreOrderCartInfo::where('oid',$order['id'])->field('product_id,cart_num nums')->select()->toArray();
if($arr){
$data=$arr;
$data_log=$arr;
@ -26,8 +27,8 @@ class UserProductStorageLogic extends BaseLogic
$data_log[$k]['oid']=$order['id'];
$data_log[$k]['financial_pm']=1;
}
UserProductStorage::insertAll($data);
UserProductStorageLog::insertAll($data_log);
(new UserProductStorage())->saveAll($data);
(new UserProductStorageLog())->saveAll($data_log);
}
}