Commit e4be0630 by 孙亚楠

添加定时任务

parent 97970c58
......@@ -283,7 +283,7 @@ class LaoActionApi extends APIBase {
// parm.curStatus=this.trim(obj.curStatus);
// }
if(obj.curType){
parm.curStatus=this.trim(obj.curType);
parm.curType=this.trim(obj.curType);
}
if (find_type == 0) {
temp_info = await this.recruitSve.findAllList(parm);
......@@ -564,6 +564,17 @@ class LaoActionApi extends APIBase {
}
}
/**
* 定时更新招聘信息
*/
async UpdateRecruitExpired(){
try {
await this.recruitSve.UpdateRecruitExpired();
} catch (error) {
console.log(`系统错误 错误信息${error}`);
}
}
async getOssConfig() {
var policyText = {
"expiration": "2119-12-31T16:00:00.000Z",
......
......@@ -112,8 +112,20 @@ class RecruitService extends ServiceBase {
let cur_type = params.curType;
let id = Number(params.id);
let data = {};
//1:展示中、2:已下架、3:已过期、4:审核未通过
if(cur_type){
data.cur_type=cur_type;
if(cur_type==1){
data.cur_status='展示中';
}else if(cur_type==2){
data.cur_status='已下架';
}else if(cur_type==3){
data.cur_status='已过期、4';
}else if(cur_type==4){
data.cur_status='审核未通过';
}else{
return system.getResult("参数错误 状态码不存在");
}
}
let res = await this.dao.model.update(data,{where:{id:id}});
return system.getResult(res);
......@@ -279,6 +291,28 @@ class RecruitService extends ServiceBase {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
/**
* 定时刷新招聘
*/
async UpdateRecruitExpired(){
try {
let nowTime=new Date();
await this.dao.model.update({
cur_type:3,
cur_status:"已过期"
},{
where:{
end_date:{
[this.db.Op.between]: ["1970-01-02",nowTime ],
}
}
});
console.log(`定时更新成功`);
} catch (error) {
console.log(`系统错误 错误信息 ${error}`);
}
}
}
module.exports = RecruitService;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment