|
|
|
@ -529,5 +529,37 @@ class MarketPerformanceSetController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 设置每周一自动重算
|
|
|
|
|
*/
|
|
|
|
|
public function setThisMonthFirstMondayScript()
|
|
|
|
|
{
|
|
|
|
|
$year = date('Y',time());
|
|
|
|
|
$m = date('m',time());
|
|
|
|
|
$d = date('d',time());
|
|
|
|
|
if($d != 1){
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
// 先取得这个月的 1 号
|
|
|
|
|
$iThisMonthFirst = strtotime("{$year}-{$m}-01 4:00:00");
|
|
|
|
|
$dThisDay = date("w", $iThisMonthFirst);
|
|
|
|
|
if ($dThisDay == '1') {
|
|
|
|
|
$dFirstMonday = $iThisMonthFirst;
|
|
|
|
|
} else {
|
|
|
|
|
//不是星期一先回到星期日
|
|
|
|
|
$iDays = 86400 * ($dThisDay * 1);
|
|
|
|
|
//找出星期日的日期
|
|
|
|
|
$iSunday = $iThisMonthFirst - $iDays;
|
|
|
|
|
//星期日 + 8 天就是星期一
|
|
|
|
|
$iThisMonthFirstMonday = $iSunday + (86400 * 8);
|
|
|
|
|
$dFirstMonday = $iThisMonthFirstMonday;
|
|
|
|
|
}
|
|
|
|
|
$tmdRes = M("cmd_tasks","tab_")->where(['type'=>'MarketPerformanceSet','schedule_time'=>$dFirstMonday])->find();
|
|
|
|
|
if(!$tmdRes){
|
|
|
|
|
$pay_time = date( 'Y-m', strtotime( 'last day of -1 months' ) );
|
|
|
|
|
$params = "php ".SUBSITE_INDEX." Timing/caculateMarketStream/time/{$pay_time}";
|
|
|
|
|
D("CmdTasks")->addScheduleTask("MarketPerformanceSet",$params,$dFirstMonday);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|