Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
3cf615f3
Commit
3cf615f3
authored
May 17, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add loan channel
parent
9b27f67c
Pipeline
#7776
passed with stage
in 4 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
5 deletions
+46
-5
product.js
app/controller/gjj/product.js
+19
-0
recommend_channel_product.js
app/model/block/recommend_channel_product.js
+1
-1
product.js
app/router/product.js
+9
-0
product.js
app/service/gjj/product.js
+17
-4
No files found.
app/controller/gjj/product.js
0 → 100644
View file @
3cf615f3
'use strict'
;
const
Controller
=
require
(
'egg'
).
Controller
;
class
ProductController
extends
Controller
{
// 筛选项列表
async
getOptionProducts
()
{
const
{
ctx
}
=
this
;
const
type
=
ctx
.
params
.
type
||
'credit'
;
if
(
type
==
'loan'
){
}
const
keys
=
ctx
.
query
.
keys
?
eval
(
ctx
.
query
.
keys
)
:
[];
const
results
=
await
ctx
.
service
.
gjj
.
product
.
getRecommendOptions
(
type
,
keys
);
ctx
.
success
({
results
});
}
}
module
.
exports
=
ProductController
;
app/model/block/recommend_channel_product.js
View file @
3cf615f3
...
@@ -11,7 +11,7 @@ module.exports = app => {
...
@@ -11,7 +11,7 @@ module.exports = app => {
identifier
:
STRING
,
identifier
:
STRING
,
type
:
ENUM
(
'normal'
,
'quality'
),
type
:
ENUM
(
'normal'
,
'quality'
),
order
:
INTEGER
,
order
:
INTEGER
,
status
:
ENUM
(
'offline'
,
'online'
),
//
status: ENUM('offline', 'online'),
valid
:
INTEGER
,
valid
:
INTEGER
,
// 注意,需要转成string
// 注意,需要转成string
created_at
:
{
created_at
:
{
...
...
app/router/product.js
0 → 100644
View file @
3cf615f3
'use strict'
;
module
.
exports
=
app
=>
{
const
router
=
app
.
router
.
namespace
(
app
.
config
.
projectRootPath
+
'/product'
);
router
.
get
(
'/recommend/channel/options/:type'
,
'gjj.product.getOptionProducts'
);
//
};
app/service/gjj/
loan
.js
→
app/service/gjj/
product
.js
View file @
3cf615f3
'use strict'
;
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
Service
=
require
(
'egg'
).
Service
;
const
R
=
require
(
'ramda'
)
const
R
=
require
(
'ramda'
)
class
Loan
Service
extends
Service
{
class
Product
Service
extends
Service
{
//通过 type=loan/credit 频道 option_ids 筛选项数组 all_product_ids
//通过 type=loan/credit 频道 option_ids 筛选项数组 all_product_ids
...
@@ -27,12 +27,14 @@ class LoanService extends Service {
...
@@ -27,12 +27,14 @@ class LoanService extends Service {
//获取筛选项列表 带 product_id
//获取筛选项列表 带 product_id
//return : [{"id":3,"title":"银行分类","description":"信用卡银行分类","_children":[{"id":12,"title":"招商银行","quality":["1"],"normal":["1"]},{"id":16,"title":"广发银行","quality":[],"normal":[]}]},{"id":4,"title":"主题分类","description":"信用卡主题分类","_children":[]},{"id":5,"title":"信用卡筛选项","description":"信用卡筛选项","_children":[]}]
//return : [{"id":3,"title":"银行分类","description":"信用卡银行分类","_children":[{"id":12,"title":"招商银行","quality":["1"],"normal":["1"]},{"id":16,"title":"广发银行","quality":[],"normal":[]}]},{"id":4,"title":"主题分类","description":"信用卡主题分类","_children":[]},{"id":5,"title":"信用卡筛选项","description":"信用卡筛选项","_children":[]}]
async
getRecommendOptions
(
type
=
'credit'
,
keys
=
[
'loan_organization'
,
'loan_filter'
,
'credit_bank'
,
'credit_theme'
,
'credit_filter'
])
{
async
getRecommendOptions
(
type
=
'credit'
,
keys
=
[])
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
// const type = 'credit';
// const type = 'credit';
// const keys = ['loan_organization', 'loan_filter', 'credit_bank', 'credit_theme', 'credit_filter'];
// keys = ['loan_organization', 'loan_filter', 'credit_bank', 'credit_theme', 'credit_filter'];
// console.info(keys);
let
classifies
=
await
ctx
.
blockModel
.
RecommendChannelClassify
.
all
({
where
:
{
type
:
type
,
valid
:
1
,
key
:
{
$in
:
keys
}
}
});
let
classifies
=
await
ctx
.
blockModel
.
RecommendChannelClassify
.
all
({
where
:
{
type
:
type
,
valid
:
1
,
key
:
{
$in
:
keys
}
}
});
// return classifies;
classifies
=
R
.
project
([
'id'
,
'title'
,
'description'
])(
classifies
);
classifies
=
R
.
project
([
'id'
,
'title'
,
'description'
])(
classifies
);
const
classify_ids
=
R
.
pluck
(
'id'
,
classifies
);
const
classify_ids
=
R
.
pluck
(
'id'
,
classifies
);
let
options
=
await
ctx
.
blockModel
.
RecommendChannelOption
.
all
({
where
:
{
classify_id
:
{
$in
:
classify_ids
},
status
:
'online'
,
valid
:
1
},
order
:
[[
'order'
,
'asc'
]]
});
let
options
=
await
ctx
.
blockModel
.
RecommendChannelOption
.
all
({
where
:
{
classify_id
:
{
$in
:
classify_ids
},
status
:
'online'
,
valid
:
1
},
order
:
[[
'order'
,
'asc'
]]
});
...
@@ -64,6 +66,17 @@ class LoanService extends Service {
...
@@ -64,6 +66,17 @@ class LoanService extends Service {
return
ret
;
return
ret
;
}
}
//
async
getLoanChannelSuitOptions
()
{
const
{
ctx
}
=
this
;
const
user_id
=
ctx
.
userId
;
if
(
user_id
)
{
}
}
}
}
module
.
exports
=
Loan
Service
;
module
.
exports
=
Product
Service
;
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