|
|
@@ -11,6 +11,7 @@ use bizHd\member\classes\MemberLevelClass;
|
|
|
use bizHd\message\classes\SmsClass;
|
|
|
use bizHd\shop\classes\ShopClass;
|
|
|
use bizHd\shop\classes\ShopExtClass;
|
|
|
+use common\components\dateUtil;
|
|
|
use common\components\noticeUtil;
|
|
|
use common\components\printUtil;
|
|
|
use common\components\ChuanglanSmsApi;
|
|
|
@@ -187,6 +188,15 @@ class BirthdayGiftClass extends BaseClass
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断客户生日是否落在所选时间范围内。
|
|
|
+ * 兼容看板原 period(today/tomorrow/week/all/custom),以及订单页 DateSelect 的 searchTime。
|
|
|
+ *
|
|
|
+ * @param object $custom 客户
|
|
|
+ * @param string $period 时间类型
|
|
|
+ * @param array $params custom/byMonth 时带 startDate、endDate 或 startTime、endTime
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
public static function matchesPeriod($custom, $period, $params = [])
|
|
|
{
|
|
|
$period = $period ?: 'week';
|
|
|
@@ -202,10 +212,15 @@ class BirthdayGiftClass extends BaseClass
|
|
|
if ($period == 'all') {
|
|
|
return true;
|
|
|
}
|
|
|
- if ($period == 'custom') {
|
|
|
- return self::matchesCustomPeriod($custom, $params['startDate'] ?? '', $params['endDate'] ?? '');
|
|
|
+ $startDate = $params['startDate'] ?? $params['startTime'] ?? '';
|
|
|
+ $endDate = $params['endDate'] ?? $params['endTime'] ?? '';
|
|
|
+ // 昨天/本月/近30天等快捷项先转成日期区间,再按生日月日匹配
|
|
|
+ if ($period != 'custom') {
|
|
|
+ $range = dateUtil::formatTime($period, $startDate, $endDate);
|
|
|
+ $startDate = $range['startTime'];
|
|
|
+ $endDate = $range['endTime'];
|
|
|
}
|
|
|
- return false;
|
|
|
+ return self::matchesCustomPeriod($custom, $startDate, $endDate);
|
|
|
}
|
|
|
|
|
|
public static function matchesCustomPeriod($custom, $startDate, $endDate)
|