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
b11affbb
Commit
b11affbb
authored
Jul 23, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
b10dd13c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
center-manage/app/base/service/impl/product/productpriceSve.js
+15
-15
No files found.
center-manage/app/base/service/impl/product/productpriceSve.js
View file @
b11affbb
...
@@ -8,19 +8,19 @@ class ProductpriceService extends ServiceBase {
...
@@ -8,19 +8,19 @@ class ProductpriceService extends ServiceBase {
* @param {*} pname 产品名称
* @param {*} pname 产品名称
* @param {*} spname 服务商名称
* @param {*} spname 服务商名称
*/
*/
async
findRegionsByProductName
(
productname
,
spname
)
{
async
findRegionsByProductName
(
productname
,
spname
)
{
let
ps
=
await
this
.
dao
.
model
.
findAll
({
let
ps
=
await
this
.
dao
.
model
.
findAll
({
where
:
{
where
:
{
sptags
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
spname
+
"%"
},
sptags
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
spname
+
"%"
},
pname
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
productname
+
"%"
},
pname
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
productname
+
"%"
},
isEnabled
:
true
isEnabled
:
true
},
attributes
:
[
'pname'
,
'strategyitems'
],
raw
:
true
},
attributes
:
[
'pname'
,
'strategyitems'
],
raw
:
true
})
})
//查询出地区
//查询出地区
let
rs
=
await
this
.
db
.
models
.
region
.
findAll
({
attributes
:
[
'code'
,
'name'
],
raw
:
true
})
let
rs
=
await
this
.
db
.
models
.
region
.
findAll
({
attributes
:
[
'code'
,
'name'
],
raw
:
true
})
//获取地区JSON 对象
//获取地区JSON 对象
let
psrtn
=
[]
let
psrtn
=
[]
let
cacheregions
=
{}
let
cacheregions
=
{}
ps
.
forEach
(
r
=>
{
ps
.
forEach
(
r
=>
{
let
rpathstr
=
r
.
pname
.
split
(
"~"
)[
1
]
let
rpathstr
=
r
.
pname
.
split
(
"~"
)[
1
]
let
rpatharray
=
rpathstr
.
split
(
"/"
)
let
rpatharray
=
rpathstr
.
split
(
"/"
)
...
@@ -28,32 +28,32 @@ class ProductpriceService extends ServiceBase {
...
@@ -28,32 +28,32 @@ class ProductpriceService extends ServiceBase {
let
regionName
=
rpatharray
[
lstindex
]
let
regionName
=
rpatharray
[
lstindex
]
let
regioninfo
=
{}
let
regioninfo
=
{}
regioninfo
[
"label"
]
=
regionName
regioninfo
[
"label"
]
=
regionName
let
exAttrTmp
=
r
.
strategyitems
let
exAttrTmp
=
r
.
strategyitems
//按照名字去取地区编码
//按照名字去取地区编码
let
areainfos
=
rs
.
filter
(
f
=>
{
let
areainfos
=
rs
.
filter
(
f
=>
{
if
(
f
.
name
.
indexOf
(
regionName
)
>=
0
)
{
if
(
f
.
name
.
indexOf
(
regionName
)
>=
0
)
{
return
true
return
true
}
else
{
}
else
{
return
false
return
false
}
}
})
})
let
codeval
=
String
(
areainfos
[
0
].
code
).
padEnd
(
6
,
'0'
)
let
codeval
=
String
(
areainfos
[
0
].
code
).
padEnd
(
6
,
'0'
)
if
(
areainfos
[
0
].
name
.
indexOf
(
"天津"
)
>=
0
||
areainfos
[
0
].
name
.
indexOf
(
"北京"
)
>=
0
||
areainfos
[
0
].
name
.
indexOf
(
"上海"
)
>=
0
||
areainfos
[
0
].
name
.
indexOf
(
"重庆"
)
>=
0
)
{
if
(
productname
.
indexOf
(
"icp"
)
<
0
&&
productname
.
indexOf
(
"edi"
)
<
0
&&
areainfos
[
0
].
name
.
indexOf
(
"天津"
)
>=
0
||
areainfos
[
0
].
name
.
indexOf
(
"北京"
)
>=
0
||
areainfos
[
0
].
name
.
indexOf
(
"上海"
)
>=
0
||
areainfos
[
0
].
name
.
indexOf
(
"重庆"
)
>=
0
)
{
codeval
=
String
(
areainfos
[
0
].
code
+
"01"
).
padEnd
(
6
,
'0'
)
codeval
=
String
(
areainfos
[
0
].
code
+
"01"
).
padEnd
(
6
,
'0'
)
}
}
if
(
!
cacheregions
[
codeval
])
{
if
(
!
cacheregions
[
codeval
])
{
cacheregions
[
codeval
]
=
regioninfo
cacheregions
[
codeval
]
=
regioninfo
regioninfo
[
"code"
]
=
codeval
regioninfo
[
"code"
]
=
codeval
regioninfo
[
"exAttr"
]
=
[
exAttrTmp
]
regioninfo
[
"exAttr"
]
=
[
exAttrTmp
]
psrtn
.
push
(
regioninfo
)
psrtn
.
push
(
regioninfo
)
}
else
{
}
else
{
let
cacheObj
=
cacheregions
[
codeval
]
let
cacheObj
=
cacheregions
[
codeval
]
cacheObj
[
"exAttr"
].
push
(
exAttrTmp
)
cacheObj
[
"exAttr"
].
push
(
exAttrTmp
)
}
}
})
})
return
psrtn
return
psrtn
}
}
async
updownProduct
(
uid
)
{
async
updownProduct
(
uid
)
{
let
p
=
await
this
.
dao
.
findById
(
uid
)
let
p
=
await
this
.
dao
.
findById
(
uid
)
p
.
isEnabled
=
!
p
.
isEnabled
p
.
isEnabled
=
!
p
.
isEnabled
await
p
.
save
()
await
p
.
save
()
...
...
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