no message
This commit is contained in:
parent
3ebfc0b97a
commit
953246022b
@ -801,62 +801,6 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function buyConfirm_福云(e) {
|
|
||||||
if ($("#autorenew").is(":checked"))
|
|
||||||
var t = 1;
|
|
||||||
else
|
|
||||||
t = 0;
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "buy",
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
coupon: $("#coupon").val(),
|
|
||||||
shop: e,
|
|
||||||
autorenew: t
|
|
||||||
},
|
|
||||||
success: function (e) {
|
|
||||||
if (e.ret) {
|
|
||||||
var t = {
|
|
||||||
type: "success"
|
|
||||||
};
|
|
||||||
t.title = e.msg,
|
|
||||||
Swal.fire(t),
|
|
||||||
window.setTimeout("location.href='/user'", 1500)
|
|
||||||
} else {
|
|
||||||
var o = {
|
|
||||||
type: "warning",
|
|
||||||
title: "购买失败"
|
|
||||||
};
|
|
||||||
o.html = e.msg,
|
|
||||||
Swal.fire(o)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (e) {
|
|
||||||
var t = {
|
|
||||||
type: "error"
|
|
||||||
};
|
|
||||||
t.title = data.msg,
|
|
||||||
Swal.fire(t)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
function _autorenewValue()
|
|
||||||
{
|
|
||||||
let autorenew = 0;
|
|
||||||
|
|
||||||
if ($("#autorenew").is(":checked")) {
|
|
||||||
autorenew = 1;
|
|
||||||
} else {
|
|
||||||
autorenew = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return autorenew;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// 本地钱包购买按钮
|
// 本地钱包购买按钮
|
||||||
function buyConfirm(e) {
|
function buyConfirm(e) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -878,12 +822,7 @@
|
|||||||
Swal.fire(t),
|
Swal.fire(t),
|
||||||
window.setTimeout("location.href='/user'", 1500)
|
window.setTimeout("location.href='/user'", 1500)
|
||||||
} else {
|
} else {
|
||||||
var o = {
|
showAlert("error", e.msg);
|
||||||
type: "warning",
|
|
||||||
title: "购买失败"
|
|
||||||
};
|
|
||||||
o.html = e.msg,
|
|
||||||
Swal.fire(o)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (e) {
|
error: function (e) {
|
||||||
@ -922,8 +861,10 @@
|
|||||||
"code" == r ? window.location.href = a : ($("#coolpay-modal").modal("show"),
|
"code" == r ? window.location.href = a : ($("#coolpay-modal").modal("show"),
|
||||||
$("#to-coolpay").attr("href", a))
|
$("#to-coolpay").attr("href", a))
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
Swal.fire("发生错误", o.msg, "error")
|
//Swal.fire("发生错误", o.msg, "error")
|
||||||
|
showAlert("error", o.msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ final class CouponController extends BaseController
|
|||||||
if ($coupon === null || ($coupon->expire_time !== 0 && $coupon->expire_time < time())) {
|
if ($coupon === null || ($coupon->expire_time !== 0 && $coupon->expire_time < time())) {
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
'msg' => $invalid_coupon_msg,
|
'msg' => '优惠码不存在或已过期',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ final class CouponController extends BaseController
|
|||||||
if ($product === null) {
|
if ($product === null) {
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
'msg' => $invalid_coupon_msg,
|
'msg' => "该商品无效",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,14 +56,14 @@ final class CouponController extends BaseController
|
|||||||
if ($limit->disabled) {
|
if ($limit->disabled) {
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
'msg' => $invalid_coupon_msg,
|
'msg' => "优惠码已被禁用",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($limit->product_id !== '' && ! in_array($product_id, explode(',', $limit->product_id))) {
|
if ($limit->product_id !== '' && ! in_array($product_id, explode(',', $limit->product_id))) {
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
'msg' => $invalid_coupon_msg,
|
'msg' => '优惠码不适用于此商品',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,12 +71,13 @@ final class CouponController extends BaseController
|
|||||||
$use_limit = $limit->use_time;
|
$use_limit = $limit->use_time;
|
||||||
|
|
||||||
if ($use_limit > 0) {
|
if ($use_limit > 0) {
|
||||||
$user_use_count = (new Order())->where('user_id', $user->id)->where('user_coupon', $coupon->code)->count();
|
$aPayOrderStatus = ["activated", "pending", "expired"];
|
||||||
|
$user_use_count = (new Order())->where('user_id', $user->id)->where('user_coupon', $coupon->code)->whereIn("status", $aPayOrderStatus)->count();
|
||||||
if ($user_use_count >= $use_limit) {
|
if ($user_use_count >= $use_limit) {
|
||||||
return $response->withJson([
|
// return $response->withJson([
|
||||||
'ret' => 0,
|
// 'ret' => 0,
|
||||||
'msg' => $invalid_coupon_msg,
|
// 'msg' => '优惠码使用次数已达上限',
|
||||||
]);
|
// ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,55 +86,17 @@ final class CouponController extends BaseController
|
|||||||
if ($total_use_limit > 0 && $coupon->use_count >= $total_use_limit) {
|
if ($total_use_limit > 0 && $coupon->use_count >= $total_use_limit) {
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
'msg' => $invalid_coupon_msg,
|
'msg' => '优惠码使用次数已达上限',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = json_decode($coupon->content);
|
$content = json_decode($coupon->content);
|
||||||
$invalid_coupon_msg = "优惠码有效";
|
$invalid_coupon_msg = "优惠码有效";
|
||||||
// $iRet = 1;
|
|
||||||
// $sMsg = "优惠码可用";
|
|
||||||
//
|
|
||||||
// $sDateNow = date("Y-m-d");
|
|
||||||
//// $sDateNow = "2025-05-02";
|
|
||||||
// $oHuodong = Huodong::where("start_date", "<=", $sDateNow)->where("end_date", ">=", $sDateNow)->first();
|
|
||||||
//
|
|
||||||
// if ($oHuodong) {
|
|
||||||
// if ($oHuodong->class == "A") {
|
|
||||||
// if ($content->type === 'percentage') {
|
|
||||||
//
|
|
||||||
// $content->value = $oHuodong->coupon_global;
|
|
||||||
// $iRet = 2;
|
|
||||||
// $sMsg = '该优惠码可用,在【'.$oHuodong->title.'】期间视为-'.$oHuodong->coupon_global.'%优惠。';
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ($content->type === 'percentage') {
|
|
||||||
// $discount = $product->price * $content->value / 100;
|
|
||||||
// } else {
|
|
||||||
// $discount = $content->value;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $buy_price = $product->price - $discount;
|
|
||||||
|
|
||||||
// return $response->withJson([
|
|
||||||
// 'ret' => $iRet,
|
|
||||||
// 'msg' => $sMsg,
|
|
||||||
// 'discount' => $discount,
|
|
||||||
// 'buy_price' => $buy_price,
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 1,
|
'ret' => 1,
|
||||||
'msg' => $invalid_coupon_msg,
|
'msg' => $invalid_coupon_msg,
|
||||||
'coupon_value' => $content->value,
|
'coupon_value' => $content->value,
|
||||||
// 'name' => 8888,
|
|
||||||
// 'code' => 111,
|
|
||||||
// 'shop' => 222,
|
|
||||||
// 'credit' => $discount,
|
|
||||||
// 'total' => $buy_price,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -265,6 +265,9 @@ final class Payment
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($coupon_raw !== '') {
|
if ($coupon_raw !== '') {
|
||||||
|
|
||||||
|
$aPayOrderStatus = ["activated", "pending", "expired"];
|
||||||
|
|
||||||
$coupon = (new UserCoupon())->where('code', $coupon_raw)->first();
|
$coupon = (new UserCoupon())->where('code', $coupon_raw)->first();
|
||||||
|
|
||||||
if ($coupon === null || ($coupon->expire_time !== 0 && $coupon->expire_time < time())) {
|
if ($coupon === null || ($coupon->expire_time !== 0 && $coupon->expire_time < time())) {
|
||||||
@ -301,7 +304,7 @@ final class Payment
|
|||||||
$coupon_use_limit = $coupon_limit->use_time;
|
$coupon_use_limit = $coupon_limit->use_time;
|
||||||
|
|
||||||
if ($coupon_use_limit > 0) {
|
if ($coupon_use_limit > 0) {
|
||||||
$user_use_count = (new Order())->where('user_id', $user->id)->where('user_coupon', $coupon->code)->count();
|
$user_use_count = (new Order())->where('user_id', $user->id)->where('user_coupon', $coupon->code)->whereIn("status", $aPayOrderStatus)->count();
|
||||||
if ($user_use_count >= $coupon_use_limit) {
|
if ($user_use_count >= $coupon_use_limit) {
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
@ -352,7 +355,7 @@ final class Payment
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($product_limit->new_user_required !== 0) {
|
if ($product_limit->new_user_required !== 0) {
|
||||||
$order_count = (new Order())->where('user_id', $user->id)->count();
|
$order_count = (new Order())->where('user_id', $user->id)->whereIn("status", $aPayOrderStatus)->count();
|
||||||
if ($order_count > 0) {
|
if ($order_count > 0) {
|
||||||
return $response->withJson([
|
return $response->withJson([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user