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
69902ddc
Commit
69902ddc
authored
Jun 20, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
589ed731
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
190 additions
and
1 deletions
+190
-1
center-manage/app/base/db/models/product/product.js
+12
-0
center-manage/app/base/db/models/product/xproduct.js
+66
-0
center-manage/app/base/service/impl/product/productSve.js
+1
-1
center-manage/app/base/service/impl/product/xproductSve.js
+111
-0
No files found.
center-manage/app/base/db/models/product/product.js
View file @
69902ddc
...
...
@@ -4,6 +4,18 @@ const appconfig=system.getSysConfig();
module
.
exports
=
(
db
,
DataTypes
)
=>
{
//定价类型
return
db
.
define
(
"product"
,
{
sptags
:{
//交付商标签
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
},
channeltags
:{
//渠道标签
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
},
industrytags
:{
//行业标签
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
},
code
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
...
...
center-manage/app/base/db/models/product/xproduct.js
0 → 100644
View file @
69902ddc
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
module
.
exports
=
(
db
,
DataTypes
)
=>
{
//定价类型
return
db
.
define
(
"xproduct"
,
{
path_code
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
path_name
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
region_id
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
region_name
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
//和user的from相同,在注册user时,去创建
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'x_product'
,
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}]
// }
]
});
}
center-manage/app/base/service/impl/product/productSve.js
View file @
69902ddc
...
...
@@ -16,7 +16,7 @@ class ProductService extends ServiceBase {
}
async
create
(
p
)
{
if
(
!
p
.
name
||
p
.
name
==
""
)
{
p
.
name
=
p
.
regionpath
+
"~"
+
p
.
productcat
path
p
.
name
=
p
.
productcatpath
+
"~"
+
p
.
region
path
}
//策略ids
let
stragetyids
=
p
.
sts
...
...
center-manage/app/base/service/impl/product/xproductSve.js
0 → 100644
View file @
69902ddc
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
class
XProductService
extends
ServiceBase
{
constructor
()
{
super
(
"xproduct"
,
ServiceBase
.
getDaoName
(
XProductService
));
}
async
buildProductCat
()
{
let
ps
=
await
this
.
dao
.
model
.
findAll
({
raw
:
true
})
return
ps
}
}
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))
// })
// { id: 128,
// path_code: '/ic/gsreg/'+id,----->code
// path_name: '/工商服务/公司注册/',+产品分类---->productcatpath
// region_id: '320400',
// region_name: '常州'}--->regionpath
//通过region_name--解析出regionpath
//path_name--添加“产品分类”
//code,regionpath,productcatpath,name
// let treedata={}
// res.forEach(item=>{
// let pathcodes=item.path_code.split("/")
// let pathnames=item.path_name.split("/")
// let pathcoderesults=pathcodes.slice(1,3)
// let pathnameresults=pathnames.slice(1,3)
// let codekey=pathcoderesults[0]
// if(!treedata[codekey]){
// let tmp={}
// tmp["code"]=pathcoderesults[0]
// tmp["title"]=pathnameresults[0]
// tmp["orgpath"]="/"+pathcoderesults[0]
// tmp["titlepath"]="/"+pathnameresults[0]
// tmp.children=[
// {
// code:pathcoderesults[1],
// title:pathnameresults[1],
// orgpath:item.path_code,
// titlepath:item.path_name
// }
// ]
// treedata[codekey]= tmp
// }else{
// let f=treedata[codekey].children.filter(it=>{
// if(it.code==pathcoderesults[1]){
// return true
// }else{
// return false
// }
// })
// if(f.length==0){
// let n={
// code:pathcoderesults[1],
// title:pathnameresults[1],
// orgpath:item.path_code,
// titlepath:item.path_name
// }
// treedata[codekey].children.push(n)
// }
// }
// })
// let root = {
// title: "产品分类",
// code: "root",
// orgpath: "root",
// children: [
// ]
// }
// Object.keys(treedata).forEach(k=>{
// root.children.push(treedata[k])
// })
// console.log(JSON.stringify(root))
})
\ No newline at end of file
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