31 lines
868 B
PHP
31 lines
868 B
PHP
<?php
|
|
|
|
namespace app\adminapi\controller;
|
|
|
|
use app\common\model\works\rcbg\OaPlan;
|
|
use think\facade\Db;
|
|
|
|
class IndexController extends BaseAdminController
|
|
{
|
|
public function index(){
|
|
$oa_plan = OaPlan::where('is_remind',0)->where('remind_type','>',0)->select()->toArray();
|
|
foreach ($oa_plan as $v){
|
|
$date = match($v['remind_type']){
|
|
1=>'5分钟',2=>'15分钟',3=>'30分钟',4=>'1小时',5=>'2小时',6=>'1天'
|
|
};
|
|
if(time() > strtotime($v['remind_time'])){
|
|
Db::name('oa_message')->insert([
|
|
'title' => '您有一条新的日程安排提醒',
|
|
'template' => 0,
|
|
'content' => '您的日程安排还有'.$date.'开始,请合理安排时间',
|
|
'from_uid' => 0,
|
|
'to_uid' => $v['admin_id'],
|
|
'type' => 1,
|
|
'send_time' => time(),
|
|
'status' => 1,
|
|
'is_draft' => 1,
|
|
]);
|
|
}
|
|
}
|
|
}
|
|
} |