| xqd
@@ -8,6 +8,7 @@ use App\Models\BusinessServiceModel;
|
|
|
use App\Models\CardInfoModel;
|
|
|
use App\Models\CouponInfoModel;
|
|
|
use App\Models\OrderInfoModel;
|
|
|
+use App\Models\PaidInfoModel;
|
|
|
use App\Models\ProductCategoryModel;
|
|
|
use App\Models\ProductInfoModel;
|
|
|
use App\Models\ProductScheduleModel;
|
| xqd
@@ -794,6 +795,7 @@ class HomeController extends Controller
|
|
|
} else {
|
|
|
$money = $order->deposit;
|
|
|
}
|
|
|
+ session($order->id.'paytype',request('paytype'));
|
|
|
|
|
|
if (request('couponid')) {
|
|
|
$coupon = CouponInfoModel::find(request('couponid'));
|
| xqd
@@ -844,12 +846,18 @@ class HomeController extends Controller
|
|
|
return $app->handlePaidNotify(function ($notify, $successful) {
|
|
|
\Log::info($notify);
|
|
|
if ($notify['result_code'] == 'SUCCESS') {
|
|
|
- $user = UserInfoModel::where('openid', $notify['openid'])->first();
|
|
|
+ $order = OrderInfoModel::where('out_trade_no',$notify['out_trade_no'])->first();
|
|
|
+ $order->status = 1;
|
|
|
+
|
|
|
$data['order_no'] = $notify['out_trade_no'];
|
|
|
- $data['price'] = $notify['total_fee'] / 100;
|
|
|
- $data['user_id'] = $user->id;
|
|
|
- OrderInfoModel::create($data);
|
|
|
- $user->save();
|
|
|
+ $data['order_id'] = $order->id;
|
|
|
+ $data['order_price'] = $order->price;
|
|
|
+ $data['paid_price'] = $notify['total_fee'] / 100;
|
|
|
+ $data['type'] = session($order->id.'paytype');
|
|
|
+
|
|
|
+ PaidInfoModel::create($data);
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
return $successful('通信失败,请稍后再通知我');
|
|
|
}
|
| xqd
@@ -1319,7 +1327,8 @@ class HomeController extends Controller
|
|
|
}
|
|
|
$products = explode(',', $value->coupon->product_id);
|
|
|
|
|
|
- if ((strtotime($value->coupon->end_time) > strtotime(Carbon::now('Asia/Shanghai'))) && in_array($product->category_id, $products)) {
|
|
|
+ $price = $product->current_price?$product->current_price:$product->origin_price;
|
|
|
+ if ((strtotime($value->coupon->end_time) > strtotime(Carbon::now('Asia/Shanghai'))) && in_array($product->category_id, $products) && ($price >= $value->coupon->min_price)) {
|
|
|
$flag = true;
|
|
|
} else {
|
|
|
$flag = false;
|