作者 耿培杰

修改购物车接口

@@ -203,10 +203,7 @@ function wpjam_array_push($array, $data=null, $key=false){ @@ -203,10 +203,7 @@ function wpjam_array_push($array, $data=null, $key=false){
203 } 203 }
204 } 204 }
205 205
206 -if (!function_exists('cal_days_in_month'))  
207 -{  
208 - function cal_days_in_month($calendar, $month, $year)  
209 - {  
210 - return date('t', mktime(0, 0, 0, $month, 1, $year));  
211 - } 206 +function days_in_month($month, $year) {
  207 + // calculate number of days in a month
  208 + return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
212 } 209 }
@@ -212,7 +212,7 @@ class Member extends Api @@ -212,7 +212,7 @@ class Member extends Api
212 $betweenTime = ['1970-1-1', date('Y-m-d')]; 212 $betweenTime = ['1970-1-1', date('Y-m-d')];
213 if ($date) { 213 if ($date) {
214 $dateArr = explode('-', $date); 214 $dateArr = explode('-', $date);
215 - $lastDay = cal_days_in_month(CAL_GREGORIAN, $dateArr[1], $dateArr[0]); 215 + $lastDay = days_in_month( $dateArr[1], $dateArr[0]);
216 $lastDate = $dateArr[0] . '-' . $dateArr[1] . '-' . $lastDay; 216 $lastDate = $dateArr[0] . '-' . $dateArr[1] . '-' . $lastDay;
217 $betweenTime = [$date, $lastDate]; 217 $betweenTime = [$date, $lastDate];
218 } 218 }