Browse Source

会员部分修改

shensong 5 years ago
parent
commit
c05a9e22be
1 changed files with 16 additions and 7 deletions
  1. 16 7
      app/CustomerGiftReceives.php

+ 16 - 7
app/CustomerGiftReceives.php

@@ -35,14 +35,23 @@ class CustomerGiftReceives extends Model
35 35
         $info = $self->where('phone',$phone)->where('gift_type',0)->where('dtime','>=',date('Y-m-01',time()))->where('is_del',0)->first();
36 36
         if(!$info){
37 37
             $times++;
38
+            #判断现在距离会员结束还有几个月,最后一个月不算
39
+            $start = new \DateTime(date('Y-m-d',time()));
40
+            $end =  new \DateTime($endTime);
41
+            $diff = $start->diff($end);
42
+            $diff_month = $diff->format('%y')*12+$diff->format('%m');
43
+            $times += $diff_month;
44
+            return $times;
45
+        } else {
46
+            #判断现在距离会员结束还有几个月,最后一个月不算
47
+            $start = new \DateTime(date('Y-m-d',time()));
48
+            $end =  new \DateTime($endTime);
49
+            $diff = $start->diff($end);
50
+            $diff_month = $diff->format('%y')*12+$diff->format('%m');
51
+            $times += $diff_month;
52
+            return $times;
38 53
         }
39
-        #判断现在距离会员结束还有几个月,最后一个月不算
40
-        $start = new \DateTime(date('Y-m-d',time()));
41
-        $end =  new \DateTime($endTime);
42
-        $diff = $start->diff($end);
43
-        $diff_month = $diff->format('%y')*12+$diff->format('%m');
44
-        $times += $diff_month;
45
-        return $times;
54
+
46 55
     }
47 56
 
48 57
     /**