|
@@ -936,18 +936,63 @@ class OrderController extends Controller {
|
936
|
936
|
//$v['receiverMobile'] = substr($v['receiverMobile'], 0, 3).'****'.substr($v['receiverMobile'], 7);
|
937
|
937
|
$order->status_name = $status_arr[$order->status];
|
938
|
938
|
|
939
|
|
- //是否是会员
|
|
939
|
+ // 代金券
|
|
940
|
+ if($order->use_coupon == 1){
|
|
941
|
+ $order->coupon_id = DB::table('customer_coupons')->where('order_id', $id)->where('is_use', 1)->pluck('id');
|
|
942
|
+ }
|
|
943
|
+
|
|
944
|
+ #查询用户会员信息
|
|
945
|
+ $cust_info = array();
|
|
946
|
+ $cust_info['if_coupons'] = 0;
|
|
947
|
+ $cust_info['if_m_gift'] = 0;
|
|
948
|
+ $cust_info['if_b_gift'] = 0;
|
940
|
949
|
$order->is_vip = 0;
|
|
950
|
+
|
|
951
|
+ $phone = $order->buyer_phone;
|
941
|
952
|
$time = date('Y-m-d H:i:s');
|
942
|
|
- $customer_info = DB::table('customer_vip')->where('phone', $order->buyer_phone)->where('is_del', 0)->first();
|
943
|
|
- if(!empty($customer_info) && $customer_info->vip_end_time > $time){
|
944
|
|
- $order->is_vip = 1;
|
|
953
|
+ $mtime = date('Y-m-01');
|
|
954
|
+ $customer_info = DB::table('customer_vip')->where('phone', $phone)->where('is_del', 0)->first();
|
|
955
|
+ if( !empty($customer_info) ){
|
|
956
|
+ //判断是否过期
|
|
957
|
+ if($customer_info->vip_end_time > $time){
|
|
958
|
+ $order->is_vip = 1;
|
|
959
|
+ $coupons = DB::table('customer_coupons')->where('phone', $phone)->where('is_use', 0)->where('end_time', '>', $time)->first();
|
|
960
|
+ $cust_info['if_coupons'] = !empty($coupons) ? 1:0;
|
|
961
|
+
|
|
962
|
+ if($order['createTime'] >= $mtime){
|
|
963
|
+ //未过期,1.获取优惠券,获取当月礼,获取生日礼,判断领取
|
|
964
|
+ //判断是否领取当月礼
|
|
965
|
+ $if_m_gift = DB::table('customer_gift_receives')->where('phone', $phone)->where('is_del',0)->where('gift_type', 0)->where('dtime', '>=', $mtime)->first();
|
|
966
|
+ if(empty($if_m_gift)){
|
|
967
|
+ $cust_info['if_m_gift'] = 1;
|
|
968
|
+ }
|
|
969
|
+
|
|
970
|
+ //判断生日礼
|
|
971
|
+ $birth_time = date('m', strtotime($customer_info->birthday));
|
|
972
|
+ $tom = date('m');
|
|
973
|
+ if($tom==$birth_time){
|
|
974
|
+ //生日期内,判断是否已领
|
|
975
|
+ $if_b_gift = DB::table('customer_gift_receives')->where('phone', $phone)->where('is_del',0)->where('gift_type', 1)->where('dtime', '>=', $mtime)->first();
|
|
976
|
+ if(empty($if_b_gift)){
|
|
977
|
+ $cust_info['if_b_gift'] = 1;
|
|
978
|
+ }
|
|
979
|
+ }
|
|
980
|
+ }
|
|
981
|
+ }
|
|
982
|
+
|
945
|
983
|
}
|
946
|
|
- // 代金券
|
|
984
|
+ //额外+判断 ,若已领,则可领
|
947
|
985
|
if($order->use_coupon == 1){
|
948
|
|
- $order->coupon_id = DB::table('customer_coupons')->where('order_id', $id)->where('is_use', 1)->pluck('id');
|
|
986
|
+ $cust_info['if_coupons'] = 1;
|
|
987
|
+ }
|
|
988
|
+ if($order->use_m_gift == 1){
|
|
989
|
+ $cust_info['if_m_gift'] = 1;
|
|
990
|
+ }
|
|
991
|
+ if($order->use_b_gift == 1){
|
|
992
|
+ $cust_info['if_b_gift'] = 1;
|
949
|
993
|
}
|
950
|
994
|
|
|
995
|
+ $order->cust_info = $cust_info;
|
951
|
996
|
return self::returnValue(['data'=>$order]);
|
952
|
997
|
}
|
953
|
998
|
}
|