/** * 修改下次提醒时间 */ function setLastdate() { global $adb, $log; $log->debug("Entering setLastdate() method ..."); $query = "select memdaysid,memday940,memday1004,memday946 from ec_memdays \n\t\t\t\t\twhere deleted = 0 and memday946 < '{$nowdate}' "; $result = $adb->getList($query); $nowyear = date("Y"); $nowmonth = date("m"); $nowday = date("d"); $nowdate = date("Y-m-d"); foreach ($result as $row) { $memdaysid = $row["memdaysid"]; $dateval = $row["memday940"]; $calendar = $row["memday1004"]; $lastval = $row["memday946"]; if ($calendar == '公历') { $datearr = explode("-", $lastval); $year = $datearr[0] + 0; $month = $datearr[1] + 0; $days = $datearr[2] + 0; $lastdate = sprintf("%d-%02d-%02d", $year + 1, $month, $days); } else { $montharr = array("正月" => "1", "二月" => "2", "三月" => "3", "四月" => "4", "五月" => "5", "六月" => "6", "七月" => "7", "八月" => "8", "九月" => "9", "十月" => "10", "十一月" => "11", "腊月" => "12"); $daysarr = array("初一" => "1", "初二" => "2", "初三" => "3", "初四" => "4", "初五" => "5", "初六" => "6", "初七" => "7", "初八" => "8", "初九" => "9", "初十" => "10", "十一" => "11", "十二" => "12", "十三" => "13", "十四" => "14", "十五" => "15", "十六" => "16", "十七" => "17", "十八" => "18", "十九" => "19", "二十" => "20", "二十一" => "21", "二十二" => "22", "二十三" => "23", "二十四" => "24", "二十五" => "25", "二十六" => "26", "二十七" => "27", "二十八" => "28", "二十九" => "29", "三十" => "30"); $lastdatearr = explode(" ", $lastval); $year = $lastdatearr[0] + 0; $datearr = explode(" ", $dateval); $monthval = $montharr[$datearr[1]]; $daysval = $daysarr[$datearr[2]]; require_once 'modules/Memdays/Lunar.php'; $lunar = new Lunar(); //今年 $yeardate = sprintf("%d-%02d-%02d", $year, $monthval, $daysval); $gl = $lunar->L2S($yeardate); $lastdate = date("Y-m-d", $gl); if ($lastdate < $nowdate) { $yeardate = sprintf("%d-%02d-%02d", $year + 1, $monthval, $daysval); $gl = $lunar->L2S($yeardate); $lastdate = date("Y-m-d", $gl); } } $upquery = "update ec_memdays set memday946 = '{$lastdate}' where memdaysid = {$memdaysid} "; $adb->query($upquery); } $log->debug("Exiting setLastdate method ..."); }
$Sday = $days - $this->_SMDay[1]; } else { $Smonth = 1; $Sday = $days; } } else { $Syear = $year; for ($i = 1; $i <= 12; $i++) { if ($days > $this->GetSMon($Syear, $i)) { $days -= $this->GetSMon($Syear, $i); } else { $Smonth = $i; $Sday = $days; break; } } } return mktime(0, 0, 0, $Smonth, $Sday, $Syear); //$Sdate = $Syear."-".$Smonth."-".$Sday; //return $Sdate; } } $today = date("Y-m-d"); $lunar = new Lunar(); //公历转农历 $nl = date("Y-m-d", $lunar->S2L($today)); //农历转公历 $gl = date("Y-m-d", $lunar->L2S($nl)); echo "今天公历是:{$today}<br/>"; echo "转为农历是:{$nl}<br/>"; echo "转回公历是:{$gl}<br/>";
exit; } else { echo $json->encode(array('code' => 0, 'msg' => '出错啦,请稍后再试')); exit; } } elseif ($_REQUEST['act'] == 'calendar') { require '..\\includes\\cls_json.php'; require 'includes\\lunar.php'; $json = new JSON(); $lunar = new Lunar(); if ($_REQUEST['type'] == 2) { $nl = date("Y-m-d", $lunar->S2L($_REQUEST['birthday'])); echo $temp = $json->encode(array('type' => '农历:', 'date' => $nl)); } else { //$date = $lunar->convertLunarToSolar($date[0], $date[1], $date[2]); $gl = date("Y-m-d", $lunar->L2S($_REQUEST['birthday'])); die($json->encode(array('type' => '公历:', 'date' => $gl))); } } elseif ($_REQUEST['act'] == 'find_referrer') { $keyword = intval($_REQUEST['keywords']); $sql = 'SELECT user_id,user_name FROM ' . $GLOBALS['ecs']->table('users') . " WHERE home_phone LIKE '%{$keyword}%' OR mobile_phone='{$keyword}'"; if ($_SESSION['role_id'] > 0) { $sql .= " AND role_id={$_SESSION['role_id']} "; } $res = $GLOBALS['db']->getAll($sql); if (!$res) { $sql = 'SELECT u.user_id,user_name FROM ' . $GLOBALS['ecs']->table('users') . ' u LEFT JOIN ' . $GLOBALS['ecs']->table('user_contact') . ' c ON u.user_id=c.user_id ' . " WHERE contact_value LIKE '%{$keyword}%'"; $res = $GLOBALS['db']->getAll($sql); } die($json->encode($res)); } elseif ($_REQUEST['act'] == 'forecast') {