Commit d21d9a17 by 王昆

gsb

parent 50b3bd98
......@@ -378,6 +378,7 @@ class LaoActionApi extends APIBase {
}
var temp_info = {};
var parm = {};
var isAdmin = obj.isAdmin;
if (obj.page_size) {
parm.page_size = Number(obj.page_size);
} else {
......@@ -424,7 +425,7 @@ class LaoActionApi extends APIBase {
}
}
temp_info = await this.userlabourSve.finduserlabourByWhere(parm);
if (temp_info.status == 0 && temp_info.data.rows.length > 0) {
if (temp_info && temp_info.status == 0 && temp_info.data.rows.length > 0) {
try {
for (var i = 0; i < temp_info.data.rows.length; i++) {
var cominfo = await this.usersSve.findUserInfoByid(temp_info.data.rows[i].user_id);
......@@ -469,9 +470,13 @@ class LaoActionApi extends APIBase {
}
} else {
//console.log(e);
if (isAdmin) {
return system.getResultSuccess({count: 0, rows: []});
} else {
return system.getResult(null, "获取数据为空");
}
}
}
// 我的应聘-邀请面试
async inviteInterview(obj) {
......
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class UserlabourService extends ServiceBase {
constructor() {
super("operator", ServiceBase.getDaoName(UserlabourService));
this.userlabourDao = system.getObject("db.operator.userlabourDao");
}
async SaveUserLabourInfo(params){//添加或更新招聘信息
async SaveUserLabourInfo(params) {//添加或更新招聘信息
var id = params.id;
var userlabour;
if (id){
if (id) {
userlabour = await this.dao.findById(id);
userlabour.user_id = params.user_id;
if (params.labour_id){
if (params.labour_id) {
userlabour.labour_id = params.labour_id;
}
userlabour.recruit_id = params.recruit_id;
userlabour.labour_user_id = params.labour_user_id;
if (params.ecid){
if (params.ecid) {
userlabour.ecid = params.ecid;
}
userlabour.apply_stauts = params.apply_stauts;
if (params.interview_time){
if (params.interview_time) {
userlabour.interview_time = params.interview_time;
}
if (params.sign_at){
if (params.sign_at) {
userlabour.sign_at = params.sign_at;
}
if (params.contract_url){
if (params.contract_url) {
userlabour.contract_url = params.contract_url;
}
userlabour = await userlabour.save();
userlabour = await this.dao.findById(id);
}
else{
} else {
userlabour = await this.dao.create(params);
}
return system.getResultSuccess(userlabour);
}
async finduserlabourByWhere(obj){//根据条件获取应聘信息
var pageSize=obj.page_size || 10;
var currentPage=obj.current_page || 1;
async finduserlabourByWhere(obj) {//根据条件获取应聘信息
var pageSize = obj.page_size || 10;
var currentPage = obj.current_page || 1;
var where = {};
if (obj.id){
if (obj.id) {
where.id = obj.id;
}
if (obj.user_id){
if (obj.user_id) {
where.user_id = obj.user_id;
}
if (obj.labour_id){
if (obj.labour_id) {
where.labour_id = obj.labour_id;
}
if (obj.recruit_id){
if (obj.recruit_id) {
where.recruit_id = obj.recruit_id;
}
if (obj.labour_user_id){
if (obj.labour_user_id) {
where.labour_user_id = obj.labour_user_id;
}
if (obj.ecid){
if (obj.ecid) {
where.ecid = obj.ecid;
}
if (obj.apply_stauts){
if (obj.apply_stauts == "已申请"){
where.apply_stauts = 10;
}
else if (obj.apply_stauts == "邀请面试"){
where.apply_stauts = 20;
}
else if (obj.apply_stauts == "面试成功"){
where.apply_stauts = 30;
}
else if (obj.apply_stauts == "面试失败"){
where.apply_stauts = 40;
}
else if (obj.apply_stauts == "待签约"){
where.apply_stauts = 50;
}
else if (obj.apply_stauts == "签约成功"){
where.apply_stauts = 60;
}
if (obj.apply_stauts) {
where.apply_stauts = obj.apply_stauts;
}
try {
......@@ -93,58 +76,52 @@ class UserlabourService extends ServiceBase {
raw: true
};
var list = await this.dao.model.findAndCountAll(sqlwhere) || [];
if(list) {
if (list) {
return system.getResult(list);
}
else{
return system.getResult(null,"没有应聘信息");
} else {
return system.getResult(null, "没有应聘信息");
}
}catch (e) {
} catch (e) {
console.log(e);
return system.getResult(null,"操作失败");
return system.getResult(null, "操作失败");
}
}
async updateStatus(obj){//更新状态信息
try{
var whereobj = {where:{id: obj.id}};
async updateStatus(obj) {//更新状态信息
try {
var whereobj = {where: {id: obj.id}};
var setobj = {};
if (obj.apply_stauts == "已申请"){
if (obj.apply_stauts == "已申请") {
setobj.apply_stauts = 10;
}
else if (obj.apply_stauts == "邀请面试"){
} else if (obj.apply_stauts == "邀请面试") {
setobj.apply_stauts = 20;
setobj.interview_time = (new Date()).Format("yyyy-MM-dd");
}
else if (obj.apply_stauts == "面试成功"){
} else if (obj.apply_stauts == "面试成功") {
setobj.apply_stauts = 30;
}
else if (obj.apply_stauts == "面试失败"){
} else if (obj.apply_stauts == "面试失败") {
setobj.apply_stauts = 40;
}
else if (obj.apply_stauts == "待签约"){
} else if (obj.apply_stauts == "待签约") {
setobj.apply_stauts = 50;
}
else if (obj.apply_stauts == "签约成功"){
} else if (obj.apply_stauts == "签约成功") {
setobj.apply_stauts = 60;
setobj.sign_at = (new Date()).Format("yyyy-MM-dd");
}
var self = this;
var v = await this.db.transaction(async function (t) {
await self.dao.updateByWhere(setobj,whereobj,t);
await self.dao.updateByWhere(setobj, whereobj, t);
});
return 1;
}
catch (e){
} catch (e) {
console.log(e);
return 0;
}
}
}
module.exports = UserlabourService;
// var tesk = new UsersService();
......
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