自己写的企业微信消息通知功能,定时会通知所有人,但是每次都会执行2次方法,看了日志发现请求了2次url 如下:
第一次、http://localhost/task.php?m=kaoqin|runt&a=todo&runid=5
第二次、http://localhost/task.php?m=kaoqin|runt&a=todo&runid=5&runtime=1613698207
不清楚问题大概出在哪里。
代码:
public function todoaction()
{
$dt = date('y-m-d', time()-3600*20);//昨天
$sql = "distinct a.uid from `[q]kqanay` a left join `[q]userinfo` b on a.uid=b.id where a.uid=1 and a.dt='$dt' and b.iskq=1 and a.state<>'正常' and a.states is null and a.iswork=1 group by a.uid;";
$rows = $this->db->getall($sql);
$ids = '';
foreach($rows as $k=>$rs){
$ids .=','.$rs['uid'].'';
$wxarr = array(
'title' => "考勤异常提醒",
'description' => "昨天[".$dt."] 你的考勤存在异常,异常明细请查看!",
'url' => ""
);
m('weixinqy:index')->sendxiao($rs['uid'], '考勤', $wxarr);
}
echo 'success';
}
[img,{fileurl}/img/36402.png,700]
原创文章,禁止转载复制,信呼OA官网保留一切知识产权。