Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
shuaiguo
5 years ago
Commit
2b4a0f595521f9937ba310315a5453423b796d8d
1 parent
e651f55a
master
...
develop
feature/home-optimize
feature/payment
feature/reduce
all
fix(百度ocpc): 只注册成功上报回传
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
48 deletions
apps/passport/controllers/reg.js
apps/passport/models/login-service.js
package.json
apps/passport/controllers/reg.js
View file @
2b4a0f5
...
...
@@ -7,12 +7,43 @@ const Promise = require('bluebird');
const
passportHelper
=
require
(
'../models/passport-helper'
);
const
RegService
=
require
(
'../models/reg-service'
);
const
LoginService
=
require
(
'../models/login-service'
);
const
request
=
require
(
'request-promise'
);
const
config
=
require
(
'../../../config/common'
);
const
simpleHeaderModel
=
require
(
'../../../doraemon/models/simple-header'
);
let
helpers
=
global
.
yoho
.
helpers
;
let
cookie
=
global
.
yoho
.
cookie
;
class
BaiduSDK
{
/*
* @ description: 广告主回传转化数据接口, 上报百度
* @ author: huzhiming
* @ date: 2019-11-19 17:21:29
* @ version: v1.0.0
* 详情见文档:[http://ocpc.baidu.com/developer/d/guide/?iurl=api%2Fapi-doc%2Fapi-interface%2F]
*/
static
reportOcpcApi
({
token
=
'7GULUkX90QLZU6cHO9OEqUsRKttGNqpN@O62eFfb91OUVhmkakV1bQHIxF8xURBvP'
,
conversionTypes
=
[{
logidUrl
:
''
,
newType
:
null
}]
})
{
request
({
method
:
'POST'
,
uri
:
'http://ocpc.baidu.com/ocpcapi/api/uploadConvertData'
,
body
:
{
token
,
conversionTypes
},
json
:
true
}).
then
((
result
)
=>
{
console
.
log
(
`
[
账号注册成功后上报
百度
ocpc
返回信息:
$
{
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
error
)
=>
{
console
.
log
(
`
[
账号注册成功后上报
百度
ocpc
失败
错误信息:
$
{
error
}
`
);
});
}
}
/**
* 检查图形验证码
*/
...
...
@@ -186,6 +217,24 @@ let mobileRegister = (req, res, next) => {
return
res
.
json
(
data
);
}
/*
* @ description: feat(oCPC搜索推广): 推广链接转化数据发送给百度服务器,埋点:OCPC推广链接打开并完成注册进行数据上报
* @ author: huzhiming
* @ date: 2019-11-19 19:09:39
* @ version: v1.0.0
* bd_vid_path存值见:public/js/common.js 文件
*/
const
logidUrl
=
req
.
cookies
.
bd_vid_path
;
if
(
logidUrl
)
{
BaiduSDK
.
reportOcpcApi
({
conversionTypes
:
{
logidUrl
,
newType
:
3
}
});
}
// 清除 session type
req
.
session
.
type
=
''
;
...
...
apps/passport/models/login-service.js
View file @
2b4a0f5
'use strict'
;
const
request
=
require
(
'request-promise'
);
const
md5
=
require
(
'md5'
);
const
uuid
=
require
(
'uuid'
);
const
_
=
require
(
'lodash'
);
...
...
@@ -21,34 +20,6 @@ const UserService = require('./user-service');
const
LoginApi
=
require
(
'./login-api'
);
const
logger
=
global
.
yoho
.
logger
;
class
BaiduSDK
{
/*
* @ description: 广告主回传转化数据接口, 上报百度
* @ author: huzhiming
* @ date: 2019-11-19 17:21:29
* @ version: v1.0.0
* 详情见文档:[http://ocpc.baidu.com/developer/d/guide/?iurl=api%2Fapi-doc%2Fapi-interface%2F]
*/
static
reportOcpcApi
({
token
=
'7GULUkX90QLZU6cHO9OEqUsRKttGNqpN@O62eFfb91OUVhmkakV1bQHIxF8xURBvP'
,
conversionTypes
=
[{
logidUrl
:
''
,
newType
:
null
}]
})
{
request
({
method
:
'POST'
,
uri
:
'http://ocpc.baidu.com/ocpcapi/api/uploadConvertData'
,
body
:
{
token
,
conversionTypes
},
json
:
true
}).
then
((
result
)
=>
{
console
.
log
(
`
[
账号注册成功后上报
百度
ocpc
返回信息:
$
{
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
error
)
=>
{
console
.
log
(
`
[
账号注册成功后上报
百度
ocpc
失败
错误信息:
$
{
error
}
`
);
});
}
}
module
.
exports
=
class
extends
global
.
yoho
.
BaseModel
{
constructor
(
ctx
)
{
super
(
ctx
);
...
...
@@ -154,24 +125,6 @@ module.exports = class extends global.yoho.BaseModel {
domain
:
config
.
cookieDomain
});
/*
* @ description: feat(oCPC搜索推广): 推广链接转化数据发送给百度服务器,埋点:OCPC推广链接打开并完成注册进行数据上报
* @ author: huzhiming
* @ date: 2019-11-19 19:09:39
* @ version: v1.0.0
* bd_vid_path存值见:public/js/common.js 文件
*/
const
logidUrl
=
req
.
cookies
.
bd_vid_path
;
if
(
logidUrl
)
{
BaiduSDK
.
reportOcpcApi
({
conversionTypes
:
{
logidUrl
,
newType
:
3
}
});
}
req
.
session
.
TOKEN_
=
publicToken
;
req
.
session
.
LOGIN_UID_
=
uid
;
req
.
session
.
USER_MOBILE
=
data
.
mobile
;
...
...
package.json
View file @
2b4a0f5
{
"name"
:
"yohobuy-node"
,
"version"
:
"6.9.1
8
"
,
"version"
:
"6.9.1
9
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
Please
register
or
login
to post a comment