Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
74314a32
Commit
74314a32
authored
Dec 15, 2019
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
7f931ff4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
546 deletions
+165
-546
laowubao/app/base/api/impl/operator/laoActionApi.js
+19
-1
laowubao/app/base/db/impl/operator/userlabourDao.js
+28
-30
laowubao/app/base/db/models/operator/userlabour.js
+41
-54
laowubao/app/base/service/impl/operator/labourSve.js
+74
-63
laowubao/app/base/service/impl/operator/userlabourSve.js
+3
-398
No files found.
laowubao/app/base/api/impl/operator/laoActionApi.js
View file @
74314a32
...
...
@@ -432,7 +432,6 @@ class LaoActionApi extends APIBase {
}
catch
{
return
system
.
getResult
(
null
,
"获取数据失败"
);
}
}
async
FindUserInfoByWhere
(
obj
)
{
//根据条件获取用户或者企业信息
...
...
@@ -475,6 +474,25 @@ class LaoActionApi extends APIBase {
return
await
this
.
labourSve
.
findlabourByWhere
(
parm
);
}
async
notifyInterview
(
obj
)
{
if
(
!
obj
.
userId
)
{
return
system
.
getResult
(
null
,
"用户id不存在"
);
}
if
(
!
obj
.
id
)
{
return
system
.
getResult
(
null
,
"人才id不存在"
);
}
try
{
let
rs
=
await
this
.
labourSve
.
notifyInterview
(
obj
);
return
system
.
getResultSuccess
(
rs
);
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getErrResult2
(
"您的网络不稳, 请稍后重试"
)
}
}
async
FindRecruitByWhere
(
obj
)
{
//根据条件获取招聘信息
var
parm
=
obj
;
if
(
obj
.
page_size
)
{
...
...
laowubao/app/base/db/impl/operator/userlabourDao.js
View file @
74314a32
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
UsersDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
UsersDao
));
}
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
async
nameList
()
{
var
sql
=
"SELECT * FROM user_info"
;
return
await
this
.
customQuery
(
sql
);
class
UserlabourDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
UserlabourDao
)
);
}
async
findUserInfoByPhone
(
phone_no
){
var
sql
=
"select * from user_info where phone_no = :phone"
;
return
await
this
.
customQuery
(
sql
,
{
phone
:
phone_no
});
}
async
findLabourIdsByUserId
(
userId
)
{
var
sql
=
"select labour_id from user_labour where user_id = :userId"
;
var
list
=
await
this
.
customQuery
(
sql
,
{
userId
:
userId
});
async
findUserInfoByid
(
user_id
){
return
this
.
model
.
findOne
(
{
where
:{
id
:
user_id
},
raw
:
true
var
result
=
[];
if
(
list
)
{
for
(
var
item
of
list
)
{
result
.
push
(
item
.
labour_id
);
}
);
}
return
result
;
}
async
find
UserInfoByids
(
ids
,
attrs
)
{
async
find
MapByUserIds
(
userIds
)
{
var
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
if
(
!
userIds
||
userIds
.
length
==
0
)
{
return
result
;
}
attrs
=
attrs
||
"*"
;
var
sql
=
"select "
+
attrs
+
"from user_info where id in (:ids)"
;
var
list
=
await
this
.
customQuery
(
sql
,{
ids
:
ids
});
if
(
!
list
||
list
.
length
==
0
){
var
sql
=
"select user_id, labour_id from user_labour where id user_id (:userIds)"
;
var
list
=
await
this
.
customQuery
(
sql
,
{
userIds
:
userIds
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
){
result
[
item
.
id
]
=
item
;
for
(
var
item
of
list
)
{
var
lst
=
result
[
item
.
id
];
if
(
!
lst
)
{
lst
=
[];
}
lst
.
push
(
item
.
labour_id
);
result
[
item
.
id
]
=
lst
;
}
return
result
;
}
}
module
.
exports
=
UsersDao
;
module
.
exports
=
UserlabourDao
;
// var tesk = new UsersDao();
// var res = tesk.nameList();
...
...
laowubao/app/base/db/models/operator/userlabour.js
View file @
74314a32
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"labour"
,
{
labour_type
:
DataTypes
.
STRING
(
50
),
labour_count
:
DataTypes
.
INTEGER
,
age_range
:
DataTypes
.
STRING
(
50
),
sex_ratio
:
DataTypes
.
STRING
(
10
),
labour_address
:
DataTypes
.
STRING
(
1000
),
report_date
:
DataTypes
.
DATE
,
work_address
:
DataTypes
.
STRING
(
1000
),
situation_memo
:
DataTypes
.
STRING
,
phone_no
:
DataTypes
.
STRING
(
20
),
user_id
:
DataTypes
.
INTEGER
,
cur_type
:
DataTypes
.
INTEGER
,
cur_status
:
DataTypes
.
STRING
(
16
),
publish_date
:
DataTypes
.
DATE
,
},{
return
db
.
define
(
"userlabour"
,
{
user_id
:
DataTypes
.
STRING
(
50
),
labour_id
:
DataTypes
.
INTEGER
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
false
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'labour_info'
,
validate
:
{
},
indexes
:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
// define the table's name
tableName
:
'user_labour'
,
validate
:
{},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
laowubao/app/base/service/impl/operator/labourSve.js
View file @
74314a32
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
/**
* 供人信息
*/
...
...
@@ -8,12 +9,13 @@ class LabourService extends ServiceBase {
constructor
()
{
super
(
"operator"
,
ServiceBase
.
getDaoName
(
LabourService
));
this
.
usersDao
=
system
.
getObject
(
"db.operator.usersDao"
);
this
.
userlabourDao
=
system
.
getObject
(
"db.operator.userlabourDao"
);
}
async
SaveLabourInfo
(
params
){
//添加或更新招聘信息
async
SaveLabourInfo
(
params
)
{
//添加或更新招聘信息
var
id
=
params
.
id
;
var
labour
;
if
(
id
){
if
(
id
)
{
labour
=
await
this
.
dao
.
findById
(
id
);
labour
.
labour_type
=
params
.
labour_type
;
labour
.
labour_count
=
params
.
labour_count
;
...
...
@@ -25,142 +27,150 @@ class LabourService extends ServiceBase {
labour
.
situation_memo
=
params
.
situation_memo
;
labour
.
phone_no
=
params
.
phone_no
;
labour
.
user_id
=
params
.
user_id
;
labour
.
publish_date
=
params
.
publish_date
;
labour
.
publish_date
=
params
.
publish_date
;
labour
=
await
labour
.
save
();
labour
=
await
this
.
dao
.
findById
(
id
);
}
else
{
}
else
{
labour
=
await
this
.
dao
.
create
(
params
);
}
return
system
.
getResultSuccess
(
labour
);
}
async
findAllList
(
obj
){
//获取全部供人信息,返回符合条件的列表
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
async
findAllList
(
obj
)
{
//获取全部供人信息,返回符合条件的列表
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
try
{
var
sqlwhere
=
{
order
:
[[
"publish_date"
,
'desc'
]],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
order
:
[[
"publish_date"
,
'desc'
]],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
};
var
list
=
await
this
.
dao
.
model
.
findAndCountAll
(
sqlwhere
)
||
[];
return
system
.
getResult
(
list
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
"操作失败"
);
return
system
.
getResult
(
null
,
"操作失败"
);
}
}
async
findListByUserid
(
obj
){
//获取userid供人信息,返回符合条件的列表
if
(
!
obj
.
user_id
){
return
system
.
getResult
(
null
,
"参数错误!"
);
async
findListByUserid
(
obj
)
{
//获取userid供人信息,返回符合条件的列表
if
(
!
obj
.
user_id
)
{
return
system
.
getResult
(
null
,
"参数错误!"
);
}
var
user_id
=
obj
.
user_id
;
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
try
{
var
sqlwhere
=
{
where
:
{
user_id
:
user_id
},
order
:
[[
"publish_date"
,
'desc'
]],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
where
:
{
user_id
:
user_id
},
order
:
[[
"publish_date"
,
'desc'
]],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
};
var
list
=
await
this
.
dao
.
model
.
findAndCountAll
(
sqlwhere
)
||
[];
return
system
.
getResult
(
list
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
"操作失败"
);
return
system
.
getResult
(
null
,
"操作失败"
);
}
}
async
findlabourByWhere
(
obj
){
//根据条件获取招工信息
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
async
findlabourByWhere
(
obj
)
{
//根据条件获取招工信息
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
var
user_id
=
Number
(
obj
.
userId
);
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
.
phone_no
){
if
(
obj
.
phone_no
)
{
where
.
phone_no
=
obj
.
phone_no
;
}
if
(
obj
.
labour_type
&&
obj
.
labour_type
!=
"全部"
){
if
(
obj
.
labour_type
&&
obj
.
labour_type
!=
"全部"
)
{
where
.
labour_type
=
obj
.
labour_type
;
}
if
(
obj
.
work_address
&&
obj
.
work_address
!=
"全部"
){
if
(
obj
.
work_address
&&
obj
.
work_address
!=
"全部"
)
{
where
.
work_address
=
obj
.
work_address
;
}
if
(
obj
.
cur_status
&&
obj
.
cur_status
!=
"全部"
){
if
(
obj
.
cur_status
&&
obj
.
cur_status
!=
"全部"
)
{
where
.
cur_status
=
obj
.
cur_status
;
}
try
{
var
sqlwhere
=
{
where
:
where
,
order
:
[[
"publish_date"
,
'desc'
]],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
where
:
where
,
order
:
[[
"publish_date"
,
'desc'
]],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
};
var
list
=
await
this
.
dao
.
model
.
findAndCountAll
(
sqlwhere
)
||
[];
if
(
list
)
{
if
(
list
)
{
await
this
.
setUserInfo
(
list
.
rows
);
let
labourIds
=
await
this
.
userlabourDao
.
findLabourIdsByUserId
(
user_id
)
||
[];
for
(
var
item
of
list
.
rows
)
{
item
.
showNotify
=
labourIds
.
indexOf
(
item
.
id
)
==
-
1
;
}
}
return
system
.
getResult
(
list
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
"操作失败"
);
return
system
.
getResult
(
null
,
"操作失败"
);
}
}
async
notifyInterview
(
obj
)
{
var
id
=
Number
(
obj
.
id
);
var
user_id
=
Number
(
obj
.
userId
);
let
labour
=
await
this
.
userlabourDao
.
create
({
user_id
:
user_id
,
labour_id
:
id
});
return
labour
;
}
async
updatestatus
(
obj
){
//更新状态信息
try
{
var
whereobj
=
{
where
:{
id
:
obj
.
id
}};
async
updatestatus
(
obj
)
{
//更新状态信息
try
{
var
whereobj
=
{
where
:
{
id
:
obj
.
id
}};
var
setobj
=
{};
setobj
.
cur_status
=
obj
.
cur_status
;
if
(
obj
.
cur_status
==
"展示中"
){
if
(
obj
.
cur_status
==
"展示中"
)
{
setobj
.
cur_type
=
1
;
}
else
if
(
obj
.
cur_status
==
"已下架"
){
}
else
if
(
obj
.
cur_status
==
"已下架"
)
{
setobj
.
cur_type
=
2
;
}
else
if
(
obj
.
cur_status
==
"已过期"
){
}
else
if
(
obj
.
cur_status
==
"已过期"
)
{
setobj
.
cur_type
=
3
;
}
else
if
(
obj
.
cur_status
==
"审核未通过"
){
}
else
if
(
obj
.
cur_status
==
"审核未通过"
)
{
setobj
.
cur_type
=
4
;
}
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
;
}
}
/**
* 删除用户下制定 招聘或这是供招信息记录
* @param {*} params
* @param {*} params
*/
async
RemRecOrLob
(
params
){
async
RemRecOrLob
(
params
)
{
try
{
let
res
=
await
this
.
dao
.
model
.
destroy
({
where
:{
id
:
params
.
id
,
user_id
:
params
.
userId
let
res
=
await
this
.
dao
.
model
.
destroy
({
where
:
{
id
:
params
.
id
,
user_id
:
params
.
userId
}
});
return
system
.
getResult
(
res
);
...
...
@@ -183,6 +193,7 @@ class LabourService extends ServiceBase {
}
}
}
module
.
exports
=
LabourService
;
// var tesk = new LabourService();
...
...
laowubao/app/base/service/impl/operator/userlabourSve.js
View file @
74314a32
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
class
User
s
Service
extends
ServiceBase
{
class
User
labour
Service
extends
ServiceBase
{
constructor
()
{
super
(
"operator"
,
ServiceBase
.
getDaoName
(
User
s
Service
));
super
(
"operator"
,
ServiceBase
.
getDaoName
(
User
labour
Service
));
}
async
findUserInfoByPhone
(
params
){
//根据电话号码获取用户信息
var
phone_no
=
params
.
phone_no
;
var
users
=
await
this
.
dao
.
findUserInfoByPhone
(
phone_no
);
if
(
users
.
length
>
0
){
return
system
.
getResult
(
users
[
0
]);
}
else
{
return
system
.
getResult
(
null
,
"不存在相关信息!"
);
}
}
async
findUserInfo
(
obj
){
//根据条件返回用户信息
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
var
where
=
{};
if
(
obj
.
id
){
where
.
id
=
obj
.
id
;
}
if
(
obj
.
user_name
){
where
.
user_name
=
obj
.
user_name
;
}
if
(
obj
.
user_type
&&
obj
.
user_type
!=
"全部"
){
where
.
user_type
=
obj
.
user_type
;
}
if
(
obj
.
phone_no
){
where
.
phone_no
=
obj
.
phone_no
;
}
if
(
obj
.
com_name
){
where
.
com_name
=
obj
.
com_name
;
}
if
(
obj
.
user_address
&&
obj
.
user_address
!=
"全部"
){
where
.
user_address
=
{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
user_address
+
"%"
};
}
if
(
obj
.
status_name
&&
obj
.
status_name
!=
"全部"
){
where
.
status_name
=
obj
.
status_name
;
}
if
(
obj
.
find_type
==
0
){
if
(
obj
.
real_status
&&
obj
.
real_status
!=
"全部"
){
if
(
obj
.
real_status
==
"未实名"
){
where
.
user_name
=
null
;
}
else
if
(
obj
.
real_status
==
"个人认证中"
){
where
.
is_real
=
0
;
}
else
if
(
obj
.
real_status
==
"个人已认证"
){
where
.
is_real
=
1
;
}
else
if
(
obj
.
real_status
==
"个人未通过"
){
where
.
is_real
=
2
;
}
else
if
(
obj
.
real_status
==
"企业认证中"
){
where
.
is_com
=
0
;
}
else
if
(
obj
.
real_status
==
"企业已认证"
){
where
.
is_com
=
1
;
}
else
if
(
obj
.
real_status
==
"企业未通过"
){
where
.
is_com
=
2
;
}
}
}
else
if
(
obj
.
find_type
==
1
){
where
.
com_type
=
1
;
if
(
obj
.
real_status
&&
obj
.
real_status
!=
"全部"
){
if
(
obj
.
real_status
==
"待审核"
){
where
.
is_real
=
0
;
}
else
if
(
obj
.
real_status
==
"已通过"
){
where
.
is_real
=
1
;
}
else
if
(
obj
.
real_status
==
"已拒绝"
){
where
.
is_real
=
2
;
}
}
}
else
if
(
obj
.
find_type
==
2
){
where
.
com_type
=
2
;
if
(
obj
.
real_status
&&
obj
.
real_status
!=
"全部"
){
if
(
obj
.
real_status
==
"待审核"
){
where
.
is_com
=
0
;
}
else
if
(
obj
.
real_status
==
"已通过"
){
where
.
is_com
=
1
;
}
else
if
(
obj
.
real_status
==
"已拒绝"
){
where
.
is_com
=
2
;
}
}
}
try
{
var
sqlwhere
=
{
where
:
where
,
//order: [["publish_date", 'desc']],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
};
var
list
=
await
this
.
dao
.
model
.
findAndCountAll
(
sqlwhere
)
||
[];
return
system
.
getResult
(
list
);
}
catch
(
e
)
{
//console.log(e);
return
system
.
getResult
(
null
,
"操作失败"
);
}
}
async
findUserInfoByid
(
user_id
){
var
users
=
await
this
.
dao
.
findUserInfoByid
(
user_id
);
// if (users.length > 0){
// return system.getResult(users[0]);
// }
// else{
// return system.getResult(null,"不存在相关信息!");
// }
return
users
;
}
async
findAllList
(
obj
){
//获取全部用户信息,返回符合条件的列表
var
pageSize
=
obj
.
page_size
||
10
;
var
currentPage
=
obj
.
current_page
||
1
;
try
{
var
sqlwhere
=
{
//order: [["publish_date", 'desc']],
limit
:
pageSize
,
offset
:
(
currentPage
-
1
)
*
pageSize
,
raw
:
true
};
var
list
=
await
this
.
dao
.
model
.
findAndCountAll
(
sqlwhere
)
||
[];
return
system
.
getResult
(
list
);
}
catch
(
e
)
{
return
system
.
getResult
(
null
,
"操作失败"
);
}
}
async
SaveUserInfo
(
params
){
//添加和更新数据库里的信息
var
id
=
params
.
id
;
var
users
;
if
(
id
){
users
=
await
this
.
dao
.
findById
(
id
);
users
.
phone_no
=
params
.
phone_no
;
users
.
com_type
=
params
.
com_type
;
users
.
com_name
=
params
.
com_name
;
users
.
user_type
=
params
.
user_type
;
users
.
user_identity
=
params
.
user_identity
;
users
.
user_name
=
params
.
user_name
;
users
.
id_card
=
params
.
id_card
;
users
.
user_photo
=
params
.
user_photo
;
users
.
cert_no
=
params
.
cert_no
;
users
.
user_post
=
params
.
cert_post
;
users
.
status_type
=
params
.
status_type
;
users
.
status_name
=
params
.
status_name
;
users
.
legal_name
=
params
.
legal_name
;
users
.
bus_term
=
params
.
bus_term
;
users
.
user_address
=
params
.
user_address
;
users
.
user_path
=
params
.
user_path
;
users
.
com_path
=
params
.
com_path
;
users
.
card_path
=
params
.
card_path
;
users
.
cert_path
=
params
.
cert_path
;
users
.
reg_time
=
params
.
reg_time
;
users
.
cattes_time
=
params
.
cattes_time
;
users
.
uattes_time
=
params
.
uattes_time
;
users
.
memo1_text
=
params
.
memo1_text
;
users
.
memo2_text
=
params
.
memo2_text
;
users
.
is_real
=
params
.
is_real
;
users
.
is_com
=
params
.
is_com
;
users
=
await
users
.
save
();
users
=
await
this
.
dao
.
findById
(
id
);
}
else
{
users
=
await
this
.
dao
.
create
(
params
);
}
return
system
.
getResult
(
users
.
dataValues
);
}
async
updateUserInfo
(
obj
){
try
{
var
whereobj
=
{
where
:{
id
:
obj
.
id
}};
var
setobj
=
{};
if
(
obj
.
phone_no
){
setobj
.
phone_no
=
obj
.
phone_no
;
}
if
(
obj
.
com_type
){
setobj
.
com_type
=
obj
.
com_type
;
}
if
(
obj
.
com_name
){
setobj
.
com_name
=
obj
.
com_name
;
}
if
(
obj
.
user_type
){
setobj
.
user_type
=
obj
.
user_type
;
}
if
(
obj
.
user_identity
){
setobj
.
user_identity
=
obj
.
user_identity
;
}
if
(
obj
.
user_name
){
setobj
.
user_name
=
obj
.
user_name
;
}
if
(
obj
.
id_card
){
setobj
.
id_card
=
obj
.
id_card
;
}
if
(
obj
.
user_photo
){
setobj
.
user_photo
=
obj
.
user_photo
;
}
if
(
obj
.
cert_no
){
setobj
.
cert_no
=
obj
.
cert_no
;
}
if
(
obj
.
user_post
){
setobj
.
user_post
=
obj
.
user_post
;
}
if
(
obj
.
status_name
){
setobj
.
status_name
=
obj
.
status_name
;
if
(
obj
.
status_name
==
"正常"
){
setobj
.
status_type
=
1
;
}
else
if
(
obj
.
status_name
==
"冻结"
){
setobj
.
status_type
=
2
;
}
else
if
(
obj
.
status_name
==
"解冻"
){
setobj
.
status_type
=
3
;
}
}
if
(
obj
.
legal_name
){
setobj
.
legal_name
=
obj
.
legal_name
;
}
if
(
obj
.
bus_term
){
setobj
.
bus_term
=
obj
.
bus_term
;
}
if
(
obj
.
user_address
){
setobj
.
user_address
=
obj
.
user_address
;
}
if
(
obj
.
user_path
){
setobj
.
user_path
=
setobj
.
user_path
;
}
if
(
obj
.
com_path
){
setobj
.
com_path
=
obj
.
com_path
;
}
if
(
obj
.
card_path
){
setobj
.
card_path
=
obj
.
card_path
;
}
if
(
obj
.
cert_path
){
setobj
.
cert_path
=
obj
.
cert_path
;
}
if
(
obj
.
real_status
){
if
(
obj
.
real_status
==
"未审核"
){
setobj
.
is_real
=
0
;
}
else
if
(
obj
.
real_status
==
"通过"
){
setobj
.
is_real
=
1
;
}
else
if
(
obj
.
real_status
==
"拒绝"
){
setobj
.
is_real
=
2
;
}
if
(
obj
.
real_status
!=
"未审核"
){
setobj
.
uattes_time
=
(
new
Date
()).
Format
(
"yyyy-MM-dd"
);
if
(
obj
.
memo1_text
){
setobj
.
memo1_text
=
obj
.
memo1_text
;
}
}
}
if
(
obj
.
com_status
){
if
(
obj
.
com_status
==
"未审核"
){
setobj
.
is_com
=
0
;
}
else
if
(
obj
.
com_status
==
"通过"
){
setobj
.
is_com
=
1
;
}
else
if
(
obj
.
com_status
==
"拒绝"
){
setobj
.
is_com
=
2
;
}
if
(
obj
.
com_status
!=
"未审核"
){
setobj
.
cattes_time
=
(
new
Date
()).
Format
(
"yyyy-MM-dd"
);
if
(
obj
.
memo2_text
){
setobj
.
memo2_text
=
obj
.
memo2_text
;
}
}
}
var
self
=
this
;
var
v
=
await
this
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
dao
.
updateByWhere
(
setobj
,
whereobj
,
t
);
});
return
1
;
}
catch
(
e
){
console
.
log
(
e
);
return
0
;
}
}
async
updateAccountstatus
(
obj
){
//更新账户状态信息
try
{
var
whereobj
=
{
where
:{
id
:
obj
.
id
}};
var
setobj
=
{};
setobj
.
status_name
=
obj
.
cur_status
;
if
(
obj
.
cur_status
==
"正常"
){
setobj
.
status_type
=
1
;
}
else
if
(
obj
.
cur_status
==
"冻结"
){
setobj
.
status_type
=
2
;
}
else
if
(
obj
.
cur_status
==
"解冻"
){
setobj
.
status_type
=
3
;
}
var
self
=
this
;
var
v
=
await
this
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
dao
.
updateByWhere
(
setobj
,
whereobj
,
t
);
});
return
1
;
}
catch
(
e
){
console
.
log
(
e
);
return
0
;
}
}
async
updateUserstatus
(
obj
){
//更新用户实名认证信息
try
{
var
whereobj
=
{
where
:{
id
:
obj
.
id
}};
var
setobj
=
{};
setobj
.
uattes_time
=
(
new
Date
()).
Format
(
"yyyy-MM-dd"
);
if
(
obj
.
cur_status
==
"未认证"
){
setobj
.
is_real
=
0
;
}
else
if
(
obj
.
cur_status
==
"已认证"
){
setobj
.
is_real
=
1
;
}
else
if
(
obj
.
cur_status
==
"未通过"
){
setobj
.
is_real
=
2
;
}
if
(
obj
.
memo_text
){
setobj
.
memo1_text
=
obj
.
memo_text
;
}
var
self
=
this
;
var
v
=
await
this
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
dao
.
updateByWhere
(
setobj
,
whereobj
,
t
);
});
return
1
;
}
catch
(
e
){
console
.
log
(
e
);
return
0
;
}
}
async
updateCompanystatus
(
obj
){
//更新企业实名认证信息
try
{
var
whereobj
=
{
where
:{
id
:
obj
.
id
}};
var
setobj
=
{};
setobj
.
cattes_time
=
(
new
Date
()).
Format
(
"yyyy-MM-dd"
);
if
(
obj
.
cur_status
==
"未认证"
){
setobj
.
is_com
=
0
;
}
else
if
(
obj
.
cur_status
==
"已认证"
){
setobj
.
is_com
=
1
;
}
else
if
(
obj
.
cur_status
==
"未通过"
){
setobj
.
is_com
=
2
;
}
if
(
obj
.
memo_text
){
setobj
.
memo2_text
=
obj
.
memo_text
;
}
var
self
=
this
;
var
v
=
await
this
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
dao
.
updateByWhere
(
setobj
,
whereobj
,
t
);
});
return
1
;
}
catch
(
e
){
console
.
log
(
e
);
return
0
;
}
}
}
module
.
exports
=
User
s
Service
;
module
.
exports
=
User
labour
Service
;
// var tesk = new UsersService();
// var par = {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment