|
@@ -737,7 +737,7 @@ class CustomerDepositController extends Controller
|
737
|
737
|
$phone = $request->input('phone');
|
738
|
738
|
|
739
|
739
|
#查询会员领取情况以及基本信息
|
740
|
|
- $monthGiftLog = CustomerGiftReceives::getCustomerReceivesLog($phone,0);
|
|
740
|
+// $monthGiftLog = CustomerGiftReceives::getCustomerReceivesLog($phone,0);
|
741
|
741
|
$customerInformation = CustomerVip::getCustomerInformation($phone);
|
742
|
742
|
$data = array();
|
743
|
743
|
|
|
@@ -760,21 +760,21 @@ class CustomerDepositController extends Controller
|
760
|
760
|
$list = array();
|
761
|
761
|
#将数据对应填写
|
762
|
762
|
foreach ($data as $value) {
|
763
|
|
- foreach ($monthGiftLog as $v) {
|
764
|
|
- if(($value['start_time'] <= $v['dtime']) && ($v['dtime'] <= $value['end_time'])){
|
765
|
|
- $value['order_id'] = $v['order_id'];
|
766
|
|
- $value['dtime'] = $v['dtime'];
|
767
|
|
- $value['status'] = '已使用';
|
768
|
|
- $giftInfo = CustomerMonthGift::find($v['gift_id']);
|
769
|
|
- $goodsId = $giftInfo->goods_id;
|
770
|
|
- $goodsInfo = Goods::find($goodsId);
|
771
|
|
- $value['goods_id'] = $goodsId;
|
772
|
|
- $value['goods_name'] = $goodsInfo->name;
|
773
|
|
- } else if($value['end_time'] < date('Y-m-d')){
|
774
|
|
- $value['status'] = '已过期';
|
775
|
|
- } else {
|
776
|
|
- $value['status'] = '未使用';
|
777
|
|
- }
|
|
763
|
+ $monthGiftLog = CustomerGiftReceives::where('phone',$phone)->where('gift_type',0)
|
|
764
|
+ ->where('dtime','>=',$value['start_time'])->where('dtime','<=',$value['end_time'])->first();
|
|
765
|
+ if($monthGiftLog){
|
|
766
|
+ $value['order_id'] = $monthGiftLog['order_id'];
|
|
767
|
+ $value['dtime'] = $monthGiftLog['dtime'];
|
|
768
|
+ $value['status'] = '已使用';
|
|
769
|
+ $giftInfo = CustomerMonthGift::find($monthGiftLog['gift_id']);
|
|
770
|
+ $goodsId = $giftInfo->goods_id;
|
|
771
|
+ $goodsInfo = Goods::find($goodsId);
|
|
772
|
+ $value['goods_id'] = $goodsId;
|
|
773
|
+ $value['goods_name'] = $goodsInfo->name;
|
|
774
|
+ } else if($value['end_time'] < date('Y-m-d')){
|
|
775
|
+ $value['status'] = '已过期';
|
|
776
|
+ } else {
|
|
777
|
+ $value['status'] = '未使用';
|
778
|
778
|
}
|
779
|
779
|
$list[] = $value;
|
780
|
780
|
}
|