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
29b8d137
Commit
29b8d137
authored
Jun 21, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
0ec526e9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
41 deletions
+75
-41
center-manage/app/base/api/impl/auth/accessAuth.js
+2
-2
center-manage/app/base/db/models/auth/user.js
+4
-0
center-manage/app/base/db/models/product/xproduct.js
+9
-0
center-manage/app/base/service/impl/auth/userSve.js
+29
-10
center-manage/app/base/service/impl/product/xproductSve.js
+31
-29
No files found.
center-manage/app/base/api/impl/auth/accessAuth.js
View file @
29b8d137
...
...
@@ -26,11 +26,11 @@ class AccessAuthAPI extends APIBase {
}
async
getBizUserForBizChance
(
p
,
q
,
req
){
let
s
=
await
this
.
userSve
.
getBizUserForBizChance
(
p
.
clientMobile
,
p
.
spName
,
p
.
productCatName
)
let
s
=
await
this
.
userSve
.
getBizUserForBizChance
(
p
.
clientMobile
,
p
.
spName
,
p
.
productCatName
,
p
.
regionName
)
return
system
.
getResult
(
s
)
}
async
getBizUserForDelivery
(
p
,
q
,
req
){
let
s
=
await
this
.
userSve
.
getBizUserForDelivery
(
p
.
clientMobile
,
p
.
spName
,
p
.
productCatName
,
p
.
skucode
)
let
s
=
await
this
.
userSve
.
getBizUserForDelivery
(
p
.
clientMobile
,
p
.
spName
,
p
.
productCatName
,
p
.
skucode
,,
p
.
regionName
)
return
system
.
getResult
(
s
)
}
classDesc
()
{
...
...
center-manage/app/base/db/models/auth/user.js
View file @
29b8d137
...
...
@@ -52,6 +52,10 @@ module.exports = (db, DataTypes) => {
opath
:
DataTypes
.
STRING
,
//作业务时,需要在业务表冗余当前处理人的opath
ptags
:
DataTypes
.
STRING
,
//权限标签,逗号分隔,可以按照标签查看opath中含有标签的数据
skilltags
:
DataTypes
.
STRING
,
// 技能标签
regiontags
:{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
}
// 区域标签
},{
paranoid
:
true
,
//假的删除
underscored
:
true
,
...
...
center-manage/app/base/db/models/product/xproduct.js
View file @
29b8d137
...
...
@@ -20,6 +20,10 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
//和user的from相同,在注册user时,去创建
servicer_name
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
}
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
...
...
@@ -28,6 +32,11 @@ module.exports = (db, DataTypes) => {
//freezeTableName: true,
// define the table's name
tableName
:
'x_product'
,
getterMethods
:
{
spName
()
{
return
servicer_name
}
},
validate
:
{
},
...
...
center-manage/app/base/service/impl/auth/userSve.js
View file @
29b8d137
...
...
@@ -369,8 +369,9 @@ class UserService extends ServiceBase {
* @param {*} clientMobile 客户电话
* @param {*} spName 服务商名称
* @param {*} productCatName 产品类型名称
* @param {*} regionName 区域
*/
async
getBizUserForBizChance
(
clientMobile
,
spName
,
productCatName
)
{
async
getBizUserForBizChance
(
clientMobile
,
spName
,
productCatName
,
regionName
)
{
var
self
=
this
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
return
this
.
db
.
transaction
(
async
function
(
t
)
{
...
...
@@ -398,11 +399,20 @@ class UserService extends ServiceBase {
console
.
log
(
companyFind
)
let
users
=
companyFind
.
us
let
cansels
=
users
.
filter
(
u
=>
{
if
(
u
.
isAllocated
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
return
true
}
else
{
return
false
if
(
regionName
&&
regionName
!=
""
){
if
(
u
.
isAllocated
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
&&
u
.
regiontags
.
indexOf
(
regionName
)
>=
0
)
{
return
true
}
else
{
return
false
}
}
else
{
if
(
u
.
isAllocated
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
return
true
}
else
{
return
false
}
}
})
let
lngth
=
cansels
.
length
if
(
lngth
>
0
)
{
...
...
@@ -437,8 +447,9 @@ class UserService extends ServiceBase {
* @param {*} spName 服务商名称
* @param {*} productCatName 产品类型名称
* @param {*} skucode 最小销售货品编码,来自渠道上架的码
* @param {*} regionName 区域
*/
async
getBizUserForDelivery
(
xclientMobile
,
spName
,
productCatName
,
skucode
)
{
async
getBizUserForDelivery
(
xclientMobile
,
spName
,
productCatName
,
skucode
,
regionName
)
{
let
clientMobile
=
'fordeliver'
+
xclientMobile
var
self
=
this
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
...
...
@@ -486,10 +497,18 @@ class UserService extends ServiceBase {
});
let
users
=
companyFind
.
us
let
cansels
=
users
.
filter
(
u
=>
{
if
(
u
.
isAllocated
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
return
true
}
else
{
return
false
if
(
regionName
&&
regionName
!=
""
){
if
(
u
.
isAllocated
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
&&
u
.
regiontags
.
indexOf
(
regionName
)
>=
0
)
{
return
true
}
else
{
return
false
}
}
else
{
if
(
u
.
isAllocated
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
return
true
}
else
{
return
false
}
}
})
let
lngth
=
cansels
.
length
...
...
center-manage/app/base/service/impl/product/xproductSve.js
View file @
29b8d137
...
...
@@ -10,35 +10,37 @@ class XProductService extends ServiceBase {
}
}
module
.
exports
=
XProductService
;
// function findTitlePath(items,findstr,results){
// items.forEach(item=>{
// if(item.title.indexOf(findstr)<0){
// if(item.children && item.children.length>0){
// return findTitlePath(item.children,findstr,results)
// }
// }else{
// results.push(item.titlepath)
// return
// }
// })
// }
// let ps = new XProductService()
// let ts=system.getObject("service.common.treearchSve")
// let products=[]
// ps.buildProductCat().then(res => {
// ts.getRegions().then(rs=>{
// res.forEach(xp=>{
// let product={}
// product.code=xp.path_code+xp.id
// results=[]
// findTitlePath(rs,xp.region_name,results)
// product.regionpath=results[0]
// product.productcatpath="产品分类"+xp.path_name
// product.name= product.productcatpath+"~"+ product.regionpath
// products.push(product)
// })
// console.log(JSON.stringify(products))
// })
function
findTitlePath
(
items
,
findstr
,
results
){
items
.
forEach
(
item
=>
{
if
(
item
.
title
.
indexOf
(
findstr
)
<
0
){
if
(
item
.
children
&&
item
.
children
.
length
>
0
){
return
findTitlePath
(
item
.
children
,
findstr
,
results
)
}
}
else
{
results
.
push
(
item
.
titlepath
)
return
}
})
}
let
ps
=
new
XProductService
()
let
ts
=
system
.
getObject
(
"service.common.treearchSve"
)
let
products
=
[]
ps
.
buildProductCat
().
then
(
res
=>
{
// console.log(JSON.stringify(res))
ts
.
getRegions
().
then
(
rs
=>
{
res
.
forEach
(
xp
=>
{
let
product
=
{}
product
.
code
=
xp
.
path_code
+
xp
.
id
results
=
[]
findTitlePath
(
rs
,
xp
.
region_name
,
results
)
product
.
regionpath
=
results
[
0
]
product
.
productcatpath
=
"产品分类"
+
xp
.
path_name
product
.
name
=
product
.
productcatpath
+
"~"
+
product
.
regionpath
product
.
sptags
=
xp
.
servicer_name
products
.
push
(
product
)
})
console
.
log
(
JSON
.
stringify
(
products
))
})
// { id: 128,
// path_code: '/ic/gsreg/'+id,----->code
...
...
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