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
3071545a
Commit
3071545a
authored
Sep 09, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据产品类型获取产品
parent
f98437a9
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 @
3071545a
...
@@ -16,5 +16,16 @@ class ProductCtl extends CtlBase {
...
@@ -16,5 +16,16 @@ class ProductCtl extends CtlBase {
const
up
=
await
this
.
service
.
update
(
pobj
);
const
up
=
await
this
.
service
.
update
(
pobj
);
return
up
;
return
up
;
}
}
/**
* 获取某一类下的产品
* @create rxs
* @param pobj
* @returns {Promise<void>}
*/
async
getProductsByType
(
pobj
){
const
result
=
await
this
.
service
.
getProductsByType
(
pobj
);
return
result
;
}
}
}
module
.
exports
=
ProductCtl
;
module
.
exports
=
ProductCtl
;
gsb-marketplat-mag/app/base/service/impl/aggregation/productSve.js
View file @
3071545a
...
@@ -4,6 +4,7 @@ const settings = require("../../../../config/settings");
...
@@ -4,6 +4,7 @@ const settings = require("../../../../config/settings");
class
ProductService
extends
ServiceBase
{
class
ProductService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"aggregation"
,
ServiceBase
.
getDaoName
(
ProductService
));
super
(
"aggregation"
,
ServiceBase
.
getDaoName
(
ProductService
));
this
.
producttypeDao
=
system
.
getObject
(
'db.aggregation.producttypeDao'
)
}
}
async
getImgList
(
pobj
)
{
async
getImgList
(
pobj
)
{
let
res
=
await
this
.
dao
.
findAndCountAll
(
pobj
);
let
res
=
await
this
.
dao
.
findAndCountAll
(
pobj
);
...
@@ -48,5 +49,28 @@ class ProductService extends ServiceBase {
...
@@ -48,5 +49,28 @@ class ProductService extends ServiceBase {
}
}
return
system
.
getResultSuccess
(
this
.
dao
.
update
(
pobj
));
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
;
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