我必须在数据库中添加一些条目才能向用户发送通知,但条件看起来像这样,
这是我的结束日期06-05-2019,现在的当前日期是03-05-2019或01-05-2019,我想在结束日期的3天之前发送通知到实际的结束日期。就像,我的结束日期是06-05-2019某些事件的话,我想在日期发送的通知04-05-2019,05-05-2019,06-05-2019。
我的cakePHP查询代码在这里:
$offer_notify_second = $this->NotificationStore->find('all', array(
'contain' => array(),
'fields' => array('NotificationStore.id','NotificationStore.role_id','NotificationStore.user_id','NotificationStore.notification_type','NotificationStore.notification_app_display_type','NotificationStore.link','NotificationStore.offer_id','NotificationStore.offer_type'),
'conditions' => array('DATE_SUB(NotificationStore.end_date, INTERVAL 3 DAY)' => date('Y-m-d'), 'NotificationStore.user_id' => $this->request->data['user_id'], 'NotificationStore.notification_type' => OFFER_NOTIFICATION),
));
```
阿波罗的战车