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
33ba76bc
Commit
33ba76bc
authored
Sep 09, 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
faa7f91b
f98437a9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
151 additions
and
16 deletions
+151
-16
gsb-marketplat-mag/app/base/controller/impl/aggregation/producttypeCtl.js
+5
-0
gsb-marketplat-mag/app/base/db/models/aggregation/product.js
+9
-0
gsb-marketplat-mag/app/base/service/impl/aggregation/needinfoSve.js
+88
-2
gsb-marketplat-mag/app/base/service/impl/aggregation/producttypeSve.js
+49
-14
No files found.
gsb-marketplat-mag/app/base/controller/impl/aggregation/producttypeCtl.js
View file @
33ba76bc
...
...
@@ -20,5 +20,10 @@ class ProductTypeCtl extends CtlBase {
const
up
=
await
this
.
service
.
update
(
pobj
);
return
up
;
}
async
getProductTypeInfo
(
pobj
){
const
res
=
await
this
.
service
.
getProductTypeInfo
(
pobj
);
return
res
;
}
}
module
.
exports
=
ProductTypeCtl
;
gsb-marketplat-mag/app/base/db/models/aggregation/product.js
View file @
33ba76bc
...
...
@@ -24,12 +24,21 @@ module.exports = (db, DataTypes) => {
product_type_id
:
{
type
:
DataTypes
.
INTEGER
},
p_product_type_code
:
{
type
:
DataTypes
.
STRING
},
p_product_type_id
:
{
type
:
DataTypes
.
INTEGER
},
sales_volume
:
{
type
:
DataTypes
.
INTEGER
},
product_type_name
:
{
type
:
DataTypes
.
STRING
},
p_product_type_name
:
{
type
:
DataTypes
.
STRING
},
selling_point
:
{
type
:
DataTypes
.
STRING
},
...
...
gsb-marketplat-mag/app/base/service/impl/aggregation/needinfoSve.js
View file @
33ba76bc
...
...
@@ -6,6 +6,7 @@ class NeedinfoService extends ServiceBase {
constructor
()
{
super
(
"aggregation"
,
ServiceBase
.
getDaoName
(
NeedinfoService
));
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
// this.launchchannelDao = system.getObject("dao.configmag.launchchannelDao");
}
//推送聚合页需求至蜂擎
async
pushAggregationNeedInfo2fq
(
ab
){
...
...
@@ -43,7 +44,92 @@ class NeedinfoService extends ServiceBase {
await
this
.
dao
.
update
({
id
:
needinfo
.
id
,
push_status
:
2
});
}
}
async
getChannelDataStatistic
(
pobj
){
// var channelList = await this.launchchannelDao.model.findAll
}
async
getbrowsingrecordlist
(
obj
){
try
{
var
queryObj
=
{
"query"
:
{
"bool"
:
{
"must"
:
[],
"must_not"
:
[],
"should"
:
[]
}
},
"from"
:
0
,
"size"
:
20
,
"sort"
:
[{
"created_date"
:
{
"order"
:
"desc"
}
}],
"aggs"
:
{}
};
if
(
obj
.
channel_code
){
queryObj
.
query
.
bool
.
must
.
push
({
"term"
:
{
"channel_code"
:
obj
.
channel_code
}
});
}
if
(
obj
.
start_date
){
var
st
=
new
Date
(
obj
.
start_date
);
if
(
st
){
st
=
st
.
getTime
();
queryObj
.
query
.
bool
.
must
.
push
({
"range"
:
{
"created_date"
:
{
"gte"
:
st
}
}
})
}
}
if
(
obj
.
end_date
){
var
et
=
new
Date
(
obj
.
end_date
);
if
(
et
){
et
=
et
.
getTime
();
queryObj
.
query
.
bool
.
must
.
push
({
"range"
:
{
"created_date"
:
{
"lte"
:
et
}
}
})
}
}
if
(
obj
.
from
){
queryObj
.
from
=
obj
.
from
}
if
(
obj
.
size
){
queryObj
.
size
=
obj
.
size
}
var
res
=
await
this
.
execClient
.
execPostEs
(
queryObj
,
"http://43.247.184.94:7200/marketmedia_browsingrecords_log/_search"
);
if
(
res
&&
res
.
stdout
){
res
=
JSON
.
parse
(
res
.
stdout
);
return
res
;
}
return
null
;
}
catch
(
e
)
{
console
.
log
(
e
)
return
null
;
}
}
}
module
.
exports
=
NeedinfoService
;
\ No newline at end of file
module
.
exports
=
NeedinfoService
;
// var task = new NeedinfoService();
// var obj={
// channel_code:"iqiyi",
// start_date:"2020-09-07 08:03:08",
// end_date:"2020-09-07 08:03:08",
// from:0,
// size:100
// };
// task.getbrowsingrecordlist(obj).then(d=>{
// console.log(JSON.stringify(d),"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
// });
\ No newline at end of file
gsb-marketplat-mag/app/base/service/impl/aggregation/producttypeSve.js
View file @
33ba76bc
...
...
@@ -12,6 +12,7 @@ class ProducttypeService extends ServiceBase {
async
create
(
pobj
)
{
let
code
=
await
this
.
getBusUid
(
"mmc"
);
pobj
.
code
=
code
;
delete
pobj
.
id
;
if
(
!
pobj
.
code
)
{
return
system
.
getResultFail
(
-
101
,
"编码不能为空"
);
}
...
...
@@ -21,19 +22,27 @@ class ProducttypeService extends ServiceBase {
if
(
!
pobj
.
sequence
)
{
return
system
.
getResultFail
(
-
103
,
"排序不能为空"
);
}
if
(
!
pobj
.
jump_link_type
&&
!
pobj
.
jump_link
)
{
return
system
.
getResultFail
(
-
104
,
"连接不能为空"
);
}
if
(
pobj
.
name
)
{
if
(
!
pobj
.
name
)
{
return
system
.
getResultFail
(
-
105
,
"名称不能为空"
);
}
if
(
pobj
.
name
&&
pobj
.
name
.
length
>
3
)
{
if
(
pobj
.
name
&&
pobj
.
name
.
length
>
4
)
{
return
system
.
getResultFail
(
-
106
,
"名称最多4位字符"
);
}
if
(
pobj
.
p_code
){
var
p_type
=
await
this
.
dao
.
model
.
findOne
({
where
:{
code
:
pobj
.
p_code
,
p_id
:
0
},
raw
:
true
});
if
(
!
p_type
){
return
system
.
getResultFail
(
-
300
,
"产品一类不存在"
);
}
pobj
.
p_id
=
p_type
.
id
;
pobj
.
p_name
=
p_type
.
name
;
}
else
if
(
!
pobj
.
jump_link_type
||
!
pobj
.
jump_link
)
{
return
system
.
getResultFail
(
-
104
,
"连接不能为空"
);
}
return
system
.
getResultSuccess
(
this
.
dao
.
create
(
pobj
));
}
async
update
(
pobj
)
{
if
(
!
pobj
.
pic_url
)
{
return
system
.
getResultFail
(
-
101
,
"图标不能为空"
);
...
...
@@ -41,16 +50,42 @@ class ProducttypeService extends ServiceBase {
if
(
!
pobj
.
sequence
)
{
return
system
.
getResultFail
(
-
102
,
"排序不能为空"
);
}
if
(
!
pobj
.
jump_link_type
&&
!
pobj
.
jump_link
)
{
return
system
.
getResultFail
(
-
104
,
"连接不能为空"
);
}
if
(
pobj
.
name
)
{
// if (!pobj.jump_link_type ||
!pobj.jump_link) {
//
return system.getResultFail(-104, "连接不能为空");
//
}
if
(
!
pobj
.
name
)
{
return
system
.
getResultFail
(
-
105
,
"名称不能为空"
);
}
if
(
pobj
.
name
&&
pobj
.
name
.
length
>
3
)
{
if
(
pobj
.
name
&&
pobj
.
name
.
length
>
4
)
{
return
system
.
getResultFail
(
-
106
,
"名称最多4位字符"
);
}
return
system
.
getResultSuccess
(
this
.
dao
.
update
(
pobj
));
}
//获取产品类型信息-用于后台管理页面
async
getProductTypeInfo
(
obj
){
// if(!obj || !obj.company_id){
// return system.getResultFail();
// }
var
typeones
=
await
this
.
dao
.
model
.
findAll
({
attributes
:[
"id"
,
"code"
,
"name"
,
"pic_url"
,
"jump_link_type"
,
"jump_link"
],
where
:{
p_id
:
0
},
raw
:
true
,
order
:[[
"sequence"
,
"desc"
]]
});
for
(
var
i
=
0
;
i
<
typeones
.
length
;
i
++
){
if
(
typeones
[
i
]
&&
typeones
[
i
].
id
)
var
typetwos
=
await
this
.
dao
.
model
.
findAll
({
attributes
:[
"id"
,
"code"
,
"name"
,
"pic_url"
],
where
:{
p_id
:
typeones
[
i
].
id
},
raw
:
true
,
order
:[[
"sequence"
,
"desc"
]]
});
typeones
[
i
][
"children"
]
=
typetwos
}
return
system
.
getResultSuccess
(
typeones
);
}
}
module
.
exports
=
ProducttypeService
;
\ No newline at end of file
module
.
exports
=
ProducttypeService
;
// var task = new ProducttypeService();
// task.getProductTypeInfo(null).then(d=>{
// console.log(JSON.stringify(d));
// })
\ 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