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
3d37542f
Commit
3d37542f
authored
Jun 12, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of t-git.51gjj.com:fangbin/51business
parents
b93f9b76
beb64607
Pipeline
#8796
passed with stage
in 12 seconds
Changes
5
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
7 deletions
+39
-7
product.js
app/controller/gjj/product.js
+5
-3
context.js
app/extend/context.js
+30
-0
product.js
app/router/product.js
+1
-1
product.js
app/service/gjj/product.js
+0
-0
config.local.js
config/config.local.js
+3
-3
No files found.
app/controller/gjj/product.js
View file @
3d37542f
...
...
@@ -9,13 +9,14 @@ class ProductController extends Controller {
const
{
ctx
}
=
this
;
const
type
=
ctx
.
params
.
type
||
'credit'
;
const
keys
=
ctx
.
query
.
keys
?
eval
(
ctx
.
query
.
keys
)
:
[];
const
keys
=
ctx
.
query
.
keys
?
ctx
.
query
.
keys
.
split
(
','
)
:
[];
const
results
=
await
ctx
.
service
.
gjj
.
product
.
getRecommendOptions
(
type
,
keys
);
let
suit_options
;
let
credit_loans
=
[];
let
common_loans
=
[];
let
common_credits
=
[];
if
(
type
==
'loan'
)
{
let
credit_cards
=
[];
if
(
type
===
'loan'
)
{
suit_options
=
await
ctx
.
service
.
gjj
.
product
.
getLoanChannelSuitOptions
();
if
(
suit_options
)
{
results
.
unshift
(
suit_options
);
...
...
@@ -23,10 +24,11 @@ class ProductController extends Controller {
credit_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
1
);
common_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
4
);
}
else
{
credit_cards
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
2
);
common_credits
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
3
);
}
ctx
.
success
({
results
:
results
,
credit_loans
:
credit_loans
,
common_loans
:
common_loans
,
common_credits
:
common_credit
s
});
ctx
.
success
({
results
,
credit_loans
,
common_loans
,
common_credits
,
credit_card
s
});
}
}
module
.
exports
=
ProductController
;
app/extend/context.js
View file @
3d37542f
...
...
@@ -39,6 +39,36 @@ module.exports = {
}
},
isEmpty
(
data
)
{
const
type
=
typeof
(
data
);
let
ret
=
false
;
switch
(
type
)
{
case
'undefined'
:
ret
=
true
;
break
;
case
'string'
:
ret
=
!
(
data
.
length
>
0
);
break
;
case
'number'
:
ret
=
!
(
data
>
0
);
break
;
case
'boolean'
:
ret
=
false
;
break
;
case
'object'
:
// 判断是否为数组
if
(
data
instanceof
Array
)
{
ret
=
!
(
data
.
length
>
0
);
}
else
{
ret
=
JSON
.
stringify
(
data
)
===
'{}'
||
!
data
;
}
break
;
default
:
break
;
}
return
ret
;
},
login
(
params
)
{
const
{
cookies
,
session
}
=
this
;
const
moment
=
require
(
'moment'
);
...
...
app/router/product.js
View file @
3d37542f
...
...
@@ -4,6 +4,6 @@ module.exports = app => {
const
router
=
app
.
router
.
namespace
(
app
.
config
.
projectRootPath
+
'/product'
);
router
.
get
(
'/recommend/channel/options/:type'
,
'gjj.product.getOptionProducts'
);
//
router
.
get
(
'
third_options'
,
'
/recommend/channel/options/:type'
,
'gjj.product.getOptionProducts'
);
//
};
app/service/gjj/product.js
View file @
3d37542f
This diff is collapsed.
Click to expand it.
config/config.local.js
View file @
3d37542f
...
...
@@ -90,13 +90,13 @@ module.exports = appInfo => {
};
config
.
PHP_URL
=
'https://kaifa.jianbing.com'
;
config
.
NODE_URL
=
'https://
dev
-nginx.jianbing.com/user_api/v1'
;
config
.
NODE_BASE_URL
=
'https://
dev
-nginx.jianbing.com'
;
config
.
NODE_URL
=
'https://
uat
-nginx.jianbing.com/user_api/v1'
;
config
.
NODE_BASE_URL
=
'https://
uat
-nginx.jianbing.com'
;
config
.
HOUSE_SERVICE_API
=
'https://uat-nginx.jianbing.com/house-service'
;
config
.
CDN_BASE_URL
=
'https://r.51gjj.com/image/'
;
config
.
USER_CENTER_API_URI
=
'https://
dev
-nginx.jianbing.com/usercenter-service'
;
config
.
USER_CENTER_API_URI
=
'https://
uat
-nginx.jianbing.com/usercenter-service'
;
return
config
;
...
...
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