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
4b8b5575
Commit
4b8b5575
authored
Aug 21, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
0b0841ad
Pipeline
#12651
passed with stage
in 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
device_init.js
app/middleware/device_init.js
+10
-11
product.js
app/service/gjj/product.js
+11
-2
No files found.
app/middleware/device_init.js
View file @
4b8b5575
...
...
@@ -167,22 +167,22 @@ module.exports = () => {
if
(
!
jianbing_customer_id
||
!
auth_token
)
{
return
{};
}
const
phone_info
=
await
ctx
.
service
.
user
.
get_phone_by_user_sid
({
user_sid
:
jianbing_customer_id
,
token
:
auth_token
});
//获取用户手机号码
const
phone_info
=
await
ctx
.
service
.
user
.
get_phone_by_user_sid
({
user_sid
:
jianbing_customer_id
,
token
:
auth_token
});
//
获取用户手机号码
const
phone
=
phone_info
.
phone
;
const
channel_alias
=
ctx
.
cookies
.
get
(
'channel_alias'
,
{
signed
:
false
});
let
app_channel_info
=
await
ctx
.
blockModel
.
AppChannel
.
one
({
where
:
{
alias
:
channel_alias
}
});
//
if
(
!
app_channel_info
||
!
app_channel_info
.
app_id
||
!
app_channel_info
.
channel_id
)
{
app_channel_info
=
await
ctx
.
blockModel
.
AppChannel
.
one
({
where
:
{
alias
:
'n_1_18100_appstore'
}
});
//如果配置的渠道未渠道信息,使用默认的渠道,以防出错
app_channel_info
=
await
ctx
.
blockModel
.
AppChannel
.
one
({
where
:
{
alias
:
'n_1_18100_appstore'
}
});
//
如果配置的渠道未渠道信息,使用默认的渠道,以防出错
}
const
app_id
=
app_channel_info
.
app_id
;
const
channel_id
=
app_channel_info
.
channel_id
;
const
go_register_params
=
{
phone
:
phone
,
app_id
:
app_id
,
channel_id
:
channel_id
,
}
const
result_go_register
=
await
ctx
.
helper
.
send_request
(
ctx
.
app
.
config
.
NODE_URL
+
'/login/go_register'
,
go_register_params
,
{
method
:
'POST'
});
//通过手机号直接注册新用户中心
phone
,
app_id
,
channel_id
,
}
;
const
result_go_register
=
await
ctx
.
helper
.
send_request
(
ctx
.
app
.
config
.
NODE_URL
+
'/login/go_register'
,
go_register_params
,
{
method
:
'POST'
});
//
通过手机号直接注册新用户中心
const
node_user_center_login_ret
=
result_go_register
.
data
;
ctx
.
logger
.
info
(
JSON
.
stringify
({
url
:
ctx
.
app
.
config
.
NODE_URL
+
'/login/go_register'
,
middleware_go_register_params
:
go_register_params
,
middleware_result_go_register
:
result_go_register
}));
if
(
!
node_user_center_login_ret
.
token
||
!
node_user_center_login_ret
.
uid
||
!
node_user_center_login_ret
.
app_user_id
)
{
...
...
@@ -194,10 +194,10 @@ module.exports = () => {
token
:
node_user_center_login_ret
.
token
,
device_id
:
node_user_center_login_ret
.
device_id
,
device_login_id
:
node_user_center_login_ret
.
device_login_logs_id
,
}
}
;
const
expire
=
7200
*
1000
;
const
date
=
new
Date
();
for
(
le
t
key
in
user_login_info
)
{
for
(
cons
t
key
in
user_login_info
)
{
const
value
=
user_login_info
[
key
];
const
exist_value
=
ctx
.
cookies
.
get
(
key
,
{
signed
:
false
});
if
(
!
exist_value
)
{
...
...
@@ -207,4 +207,4 @@ module.exports = () => {
return
user_login_info
;
}
};
\ No newline at end of file
};
app/service/gjj/product.js
View file @
4b8b5575
...
...
@@ -172,6 +172,8 @@ class ProductService extends Service {
const
url
=
ctx
.
app
.
config
.
NODE_BASE_URL
+
'/cassandra-server/loan_list/bu_class/list'
;
const
param
=
{
uid
:
userId
,
app_uid
:
appUserId
,
app_id
:
ctx
.
appId
};
const
resp
=
await
ctx
.
helper
.
send_request
(
url
,
param
,
{
method
:
'GET'
});
console
.
log
(
param
);
console
.
log
(
resp
);
if
(
resp
.
status
!==
200
)
{
ctx
.
failed
(
'[bu_class]内部接口错误'
);
}
...
...
@@ -221,12 +223,19 @@ class ProductService extends Service {
return
Number
(
a
.
recommend_sorter
)
-
Number
(
b
.
recommend_sorter
);
};
let
ret
=
[];
// 如果未登录,则推荐授信贷
// 如果未登录
或者没有导入公积金
,则推荐授信贷
if
(
ctx
.
isEmpty
(
userId
))
{
// const commonLoanList = await this.getCommonBusinessList();
const
loanList
=
await
this
.
getAllProductsByType
(
1
);
ret
=
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
loanList
));
}
else
{
const
userGjj
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
NODE_BASE_URL
+
'/cassandra-server/gjj/list/'
+
userId
,
{},
{
method
:
'GET'
});
if
(
userGjj
.
status
!==
200
||
ctx
.
isEmpty
(
userGjj
.
data
.
ret
))
{
const
loanList
=
await
this
.
getAllProductsByType
(
1
);
ret
=
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
loanList
));
return
ret
;
}
// 日志
const
log
=
{
user_sid
:
ctx
.
oldUserId
,
...
...
@@ -441,7 +450,7 @@ class ProductService extends Service {
location
=
'credit_channel'
;
}
const
channels
=
ctx
.
isEmpty
(
v
.
channel_rate_id
)
?
[]
:
v
.
channel_rate_id
.
split
(
','
);
const
rate
=
channels
.
includes
(
channel
)
?
(
v
.
channel_rate
.
includes
(
'元'
)
?
v
.
channel_rate
:
v
.
channel_rate
+
'%'
)
:
(
!
ctx
.
isEmpty
(
v
.
rate
)
?
(
v
.
rate
.
includes
(
'元
'
)
?
v
.
rate
:
v
.
rate
+
'%'
)
:
''
);
const
rate
=
channels
.
includes
(
channel
)
?
(
v
.
channel_rate
.
includes
(
'元'
)
||
v
.
channel_rate
.
includes
(
'%'
)
?
v
.
channel_rate
:
v
.
channel_rate
+
'%'
)
:
(
!
ctx
.
isEmpty
(
v
.
rate
)
?
(
v
.
rate
.
includes
(
'元'
)
||
v
.
rate
.
includes
(
'%
'
)
?
v
.
rate
:
v
.
rate
+
'%'
)
:
''
);
const
rateTitle
=
channels
.
includes
(
channel
)
?
v
.
channel_rate_title
:
v
.
rate_title
;
let
url
=
v
.
url
;
if
(
Number
(
v
.
type
)
===
4
)
{
...
...
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