Exemplo n.º 1
0
 function checkBirthday()
 {
     $birthdays = $this->birthday_model->select();
     $count = count($birthdays);
     $lunar = new Lunar();
     $mainRemind = '';
     for ($i = 0; $i < $count; $i++) {
         $name = $birthdays[$i]['user_name'];
         $birthday = $birthdays[$i]['user_birthday'];
         $email = $birthdays[$i]['user_email'];
         $solar = $birthdays[$i]['user_solar'];
         $remind = $birthdays[$i]['user_remind'];
         $wish = $birthdays[$i]['user_wish'];
         $d = 0;
         if ($solar == 0) {
             $l = $lunar->convertSolarToLunar(date('Y'), date('m'), date('d'));
             $lmounth = $l[4];
             $lday = $l[5];
             $lnow = date('Y') . '-' . $lmounth . '-' . $lday;
             $d = date_difference_days($birthday, date($lnow));
         } else {
             $d = date_difference_days($birthday, date('Y-m-d'));
         }
         if ($d > 0 && $d < 4) {
             //提醒好友
             if ($remind == 1) {
                 sp_send_email($email, 'KCMS系统生日提醒', '亲爱的' . $name . ':您的生日快到了,还有' . $d . '天就到了哦!' . $wish);
             }
             $mainRemind .= '您的好友' . $name . '的生日快到了,还有' . $d . '天\\n\\n\\n';
         } elseif ($d == 0) {
             //提醒好友
             if ($remind == 1) {
                 sp_send_email($email, 'KCMS系统生日提醒', '亲爱的' . $name . ':' . $wish);
             }
             $mainRemind .= '今天是您的好友' . $name . '的生日,提醒的祝福语' . $wish . '\\n\\n\\n';
         }
     }
     //提醒管理员
     if ($mainRemind) {
         sp_send_email('*****@*****.**', '所有好友生日提醒功能', $mainRemind);
     }
     $this->success('检查成功!');
 }
Exemplo n.º 2
0
 private function birthdayRemind()
 {
     $this->birthday_model = D("Common/Birthday");
     $birthdays = $this->birthday_model->order("create_time DESC")->select();
     $count = count($birthdays);
     $str = '';
     $lunar = new Lunar();
     for ($i = 0; $i < $count; $i++) {
         $name = $birthdays[$i]['user_name'];
         $birthday = $birthdays[$i]['user_birthday'];
         $solar = $birthdays[$i]['user_solar'];
         $d = 0;
         if ($solar == 0) {
             $l = $lunar->convertSolarToLunar(date('Y'), date('m'), date('d'));
             $lmounth = $l[4];
             $lday = $l[5];
             $lnow = date('Y') . '-' . $lmounth . '-' . $lday;
             $d = date_difference_days($birthday, date($lnow));
         } else {
             $d = date_difference_days($birthday, date('Y-m-d'));
         }
         if ($d >= 0) {
             $str .= $name . "/:cake" . $birthday . "还差" . $d . "天/:gift\n\n";
         }
     }
     return $str;
 }