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
d60d6dd4
Commit
d60d6dd4
authored
Sep 10, 2020
by
兰国旗
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gsb-marketplat-mag' of gitlab.gongsibao.com:jiangyong/zhichan into gsb-marketplat-mag
parents
33ba76bc
3071545a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
gsb-marketplat-mag/app/base/controller/impl/aggregation/productCtl.js
+11
-0
gsb-marketplat-mag/app/base/service/impl/aggregation/productSve.js
+25
-0
No files found.
gsb-marketplat-mag/app/base/controller/impl/aggregation/productCtl.js
View file @
d60d6dd4
...
...
@@ -16,5 +16,16 @@ class ProductCtl extends CtlBase {
const
up
=
await
this
.
service
.
update
(
pobj
);
return
up
;
}
/**
* 获取某一类下的产品
* @create rxs
* @param pobj
* @returns {Promise<void>}
*/
async
getProductsByType
(
pobj
){
const
result
=
await
this
.
service
.
getProductsByType
(
pobj
);
return
result
;
}
}
module
.
exports
=
ProductCtl
;
gsb-marketplat-mag/app/base/service/impl/aggregation/productSve.js
View file @
d60d6dd4
...
...
@@ -4,6 +4,7 @@ const settings = require("../../../../config/settings");
class
ProductService
extends
ServiceBase
{
constructor
()
{
super
(
"aggregation"
,
ServiceBase
.
getDaoName
(
ProductService
));
this
.
producttypeDao
=
system
.
getObject
(
'db.aggregation.producttypeDao'
)
}
async
getImgList
(
pobj
)
{
let
res
=
await
this
.
dao
.
findAndCountAll
(
pobj
);
...
...
@@ -48,5 +49,28 @@ class ProductService extends ServiceBase {
}
return
system
.
getResultSuccess
(
this
.
dao
.
update
(
pobj
));
}
/**
* 获取某一类下的产品
* @create rxs
* @param pobj
* @returns {Promise<void>}
*/
async
getProductsByType
(
pobj
){
const
type
=
await
this
.
producttypeDao
.
findOne
({
name
:
pobj
.
typeName
},[]);
if
(
!
type
){
return
system
.
getResultFail
(
-
1
,
'获取产品类型数据失败'
);
}
let
products
=
await
this
.
dao
.
model
.
findAll
({
attributes
:[
"name"
],
where
:{
product_type_id
:
type
.
id
},
raw
:
true
});
let
names
=
''
;
products
.
forEach
(
item
=>
{
names
+=
item
.
name
+
','
})
names
=
names
.
substring
(
0
,
names
.
length
-
1
);
return
system
.
getResult
(
names
)
}
}
module
.
exports
=
ProductService
;
\ 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