|
|
1
|
+const request = require('request-promise');
|
1
|
const _ = require('lodash');
|
2
|
const _ = require('lodash');
|
2
|
const url = require('url');
|
3
|
const url = require('url');
|
3
|
const helpers = global.yoho.helpers;
|
4
|
const helpers = global.yoho.helpers;
|
|
@@ -9,6 +10,34 @@ const cookie = global.yoho.cookie; |
|
@@ -9,6 +10,34 @@ const cookie = global.yoho.cookie; |
9
|
const AuthHelperModel = require('../models/auth-helper');
|
10
|
const AuthHelperModel = require('../models/auth-helper');
|
10
|
const config = global.yoho.config;
|
11
|
const config = global.yoho.config;
|
11
|
|
12
|
|
|
|
13
|
+class BaiduSDK {
|
|
|
14
|
+ /*
|
|
|
15
|
+ * @ description: 广告主回传转化数据接口, 上报百度
|
|
|
16
|
+ * @ author: huzhiming
|
|
|
17
|
+ * @ date: 2019-11-19 17:21:29
|
|
|
18
|
+ * @ version: v1.0.0
|
|
|
19
|
+ * 详情见文档:[http://ocpc.baidu.com/developer/d/guide/?iurl=api%2Fapi-doc%2Fapi-interface%2F]
|
|
|
20
|
+ */
|
|
|
21
|
+ static reportOcpcApi({
|
|
|
22
|
+ token = '7GULUkX90QLZU6cHO9OEqUsRKttGNqpN@O62eFfb91OUVhmkakV1bQHIxF8xURBvP',
|
|
|
23
|
+ conversionTypes = [{ logidUrl: '', newType: null }]
|
|
|
24
|
+ }) {
|
|
|
25
|
+ request({
|
|
|
26
|
+ method: 'POST',
|
|
|
27
|
+ uri: 'http://ocpc.baidu.com/ocpcapi/api/uploadConvertData',
|
|
|
28
|
+ body: {
|
|
|
29
|
+ token,
|
|
|
30
|
+ conversionTypes
|
|
|
31
|
+ },
|
|
|
32
|
+ json: true
|
|
|
33
|
+ }).then((result) => {
|
|
|
34
|
+ console.log(`[账号注册成功后上报 百度ocpc返回信息:${JSON.stringify(result)}`);
|
|
|
35
|
+ }).catch((error) => {
|
|
|
36
|
+ console.log(`[账号注册成功后上报 百度ocpc失败 错误信息:${error}`);
|
|
|
37
|
+ });
|
|
|
38
|
+ }
|
|
|
39
|
+}
|
|
|
40
|
+
|
12
|
class Reg {
|
41
|
class Reg {
|
13
|
/**
|
42
|
/**
|
14
|
* 注册页面
|
43
|
* 注册页面
|
|
@@ -224,6 +253,24 @@ class Reg { |
|
@@ -224,6 +253,24 @@ class Reg { |
224
|
|
253
|
|
225
|
delete req.session.phoneNum;
|
254
|
delete req.session.phoneNum;
|
226
|
|
255
|
|
|
|
256
|
+ /*
|
|
|
257
|
+ * @ description: feat(oCPC搜索推广): 推广链接转化数据发送给百度服务器,埋点:OCPC推广链接打开并完成注册进行数据上报
|
|
|
258
|
+ * @ author: huzhiming
|
|
|
259
|
+ * @ date: 2019-11-19 19:09:39
|
|
|
260
|
+ * @ version: v1.0.0
|
|
|
261
|
+ * bd_vid_path存值见:public/js/common.js 文件
|
|
|
262
|
+ */
|
|
|
263
|
+ const logidUrl = req.cookies.bd_vid_path;
|
|
|
264
|
+
|
|
|
265
|
+ if (logidUrl) {
|
|
|
266
|
+ BaiduSDK.reportOcpcApi({
|
|
|
267
|
+ conversionTypes: {
|
|
|
268
|
+ logidUrl,
|
|
|
269
|
+ newType: 25
|
|
|
270
|
+ }
|
|
|
271
|
+ });
|
|
|
272
|
+ }
|
|
|
273
|
+
|
227
|
return res.json({
|
274
|
return res.json({
|
228
|
code: 200,
|
275
|
code: 200,
|
229
|
message: '注册成功',
|
276
|
message: '注册成功',
|