微信充值退款逻辑和订单数据处理

This commit is contained in:
liu 2024-06-24 17:32:55 +08:00
parent 97641a18ce
commit ba9bc4a8aa
3 changed files with 12 additions and 3 deletions

View File

@ -114,7 +114,7 @@ class UserRechargeController extends BaseAdminController
}
//支付宝
return $this->success();
}

View File

@ -28,8 +28,6 @@ class PayController extends BaseApiController
{
$app = new PayService(1);
$result = $app->wechat->callback(Request()->post());
Cache::set('6log'.time(),$result);
Cache::set('6logJ'.time(),json_encode($result));
if ($result && $result->event_type == 'TRANSACTION.SUCCESS') {
$ciphertext = $result->resource['ciphertext'];
if ($ciphertext['trade_state'] === 'SUCCESS') {

View File

@ -259,6 +259,17 @@ class PayNotifyLogic extends BaseLogic
//更新状态
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
if ($order->isEmpty() || $order->status == OrderEnum::REFUND_PAY) {
//充值
$orderRe = UserRecharge::where('order_id',$orderSn)->findOrEmpty();
if($orderRe->isEmpty() || $orderRe->status == -1){
return true;
}
$orderRe->status = -1;
$orderRe->refund_price = $orderRe->price;
$orderRe->refund_time = time();
$orderRe->remarks = '';
$orderRe->save();
return true;
}
$order->status = OrderEnum::REFUND_PAY;