|
@@ -43,7 +43,7 @@ class passportModel extends global.yoho.BaseModel { |
|
@@ -43,7 +43,7 @@ class passportModel extends global.yoho.BaseModel { |
43
|
constructor(ctx) {
|
43
|
constructor(ctx) {
|
44
|
super(ctx);
|
44
|
super(ctx);
|
45
|
}
|
45
|
}
|
46
|
- signinByOpenID({ nickname, openId, sourceType, businessLine}) {
|
46
|
+ signinByOpenID({ nickname, openId, sourceType, sourceTypeSecond, businessLine}) {
|
47
|
let param = {
|
47
|
let param = {
|
48
|
nickname: nickname || '',
|
48
|
nickname: nickname || '',
|
49
|
openId: openId,
|
49
|
openId: openId,
|
|
@@ -55,6 +55,10 @@ class passportModel extends global.yoho.BaseModel { |
|
@@ -55,6 +55,10 @@ class passportModel extends global.yoho.BaseModel { |
55
|
param.business_line = businessLine;
|
55
|
param.business_line = businessLine;
|
56
|
}
|
56
|
}
|
57
|
|
57
|
|
|
|
58
|
+ if (sourceTypeSecond) {
|
|
|
59
|
+ param.source_type_second = sourceTypeSecond;
|
|
|
60
|
+ }
|
|
|
61
|
+
|
58
|
return this.get({ data: param });
|
62
|
return this.get({ data: param });
|
59
|
}
|
63
|
}
|
60
|
syncUserSession({uid, sessionKey, req, res}) {
|
64
|
syncUserSession({uid, sessionKey, req, res}) {
|
|
@@ -119,25 +123,33 @@ class passportModel extends global.yoho.BaseModel { |
|
@@ -119,25 +123,33 @@ class passportModel extends global.yoho.BaseModel { |
119
|
log.info(`[sync profile error] uid: ${uid} | err: ${JSON.stringify(e)}`);
|
123
|
log.info(`[sync profile error] uid: ${uid} | err: ${JSON.stringify(e)}`);
|
120
|
});
|
124
|
});
|
121
|
}
|
125
|
}
|
122
|
- sendTaobaoBindCode(mobile) {
|
|
|
123
|
- return this.post({
|
|
|
124
|
- data: {
|
|
|
125
|
- method: 'app.bind.sendCodeByTB',
|
|
|
126
|
- source_type: 'taobao',
|
|
|
127
|
- mobile
|
|
|
128
|
- }
|
|
|
129
|
- });
|
126
|
+ sendTaobaoBindCode(mobile, sourceTypeSecond) {
|
|
|
127
|
+ let data = {
|
|
|
128
|
+ method: 'app.bind.sendCodeByTB',
|
|
|
129
|
+ source_type: 'taobao',
|
|
|
130
|
+ mobile
|
|
|
131
|
+ };
|
|
|
132
|
+
|
|
|
133
|
+ if (sourceTypeSecond) {
|
|
|
134
|
+ data.source_type_second = sourceTypeSecond;
|
|
|
135
|
+ }
|
|
|
136
|
+
|
|
|
137
|
+ return this.post({ data });
|
130
|
}
|
138
|
}
|
131
|
- bindTaobaoAccountByCode({ mobile, code, openId }) {
|
|
|
132
|
- return this.post({
|
|
|
133
|
- data: {
|
|
|
134
|
- method: 'app.bind.bindTBByCode',
|
|
|
135
|
- source_type: 'taobao',
|
|
|
136
|
- mobile,
|
|
|
137
|
- code,
|
|
|
138
|
- open_id: openId
|
|
|
139
|
- }
|
|
|
140
|
- });
|
139
|
+ bindTaobaoAccountByCode({ mobile, code, openId, sourceTypeSecond }) {
|
|
|
140
|
+ let data = {
|
|
|
141
|
+ method: 'app.bind.bindTBByCode',
|
|
|
142
|
+ source_type: 'taobao',
|
|
|
143
|
+ mobile,
|
|
|
144
|
+ code,
|
|
|
145
|
+ open_id: openId
|
|
|
146
|
+ };
|
|
|
147
|
+
|
|
|
148
|
+ if (sourceTypeSecond) {
|
|
|
149
|
+ data.source_type_second = sourceTypeSecond;
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
|
152
|
+ return this.post({ data });
|
141
|
}
|
153
|
}
|
142
|
};
|
154
|
};
|
143
|
|
155
|
|
|
@@ -161,7 +173,8 @@ const login = { |
|
@@ -161,7 +173,8 @@ const login = { |
161
|
|
173
|
|
162
|
return model.signinByOpenID({
|
174
|
return model.signinByOpenID({
|
163
|
openId: user.open_uid,
|
175
|
openId: user.open_uid,
|
164
|
- sourceType: 'taobao'
|
176
|
+ sourceType: 'taobao',
|
|
|
177
|
+ sourceTypeSecond: req.yoho.isAliApp ? 'xianyu' : ''
|
165
|
}).then(result => {
|
178
|
}).then(result => {
|
166
|
let redirectUrl = loginPage;
|
179
|
let redirectUrl = loginPage;
|
167
|
|
180
|
|
|
@@ -218,7 +231,7 @@ const bind = { |
|
@@ -218,7 +231,7 @@ const bind = { |
218
|
let info = bind.getBindThirdInfo(bindCode);
|
231
|
let info = bind.getBindThirdInfo(bindCode);
|
219
|
|
232
|
|
220
|
if (info.type === 'taobao') {
|
233
|
if (info.type === 'taobao') {
|
221
|
- req.ctx(passportModel).sendTaobaoBindCode(mobile).then(res.json).catch(next);
|
234
|
+ req.ctx(passportModel).sendTaobaoBindCode(mobile, req.yoho.isAliApp ? 'xianyu' : '').then(res.json).catch(next);
|
222
|
} else {
|
235
|
} else {
|
223
|
res.json({
|
236
|
res.json({
|
224
|
code: 200,
|
237
|
code: 200,
|
|
@@ -236,7 +249,8 @@ const bind = { |
|
@@ -236,7 +249,8 @@ const bind = { |
236
|
model.bindTaobaoAccountByCode({
|
249
|
model.bindTaobaoAccountByCode({
|
237
|
mobile,
|
250
|
mobile,
|
238
|
code,
|
251
|
code,
|
239
|
- openId: info.openId
|
252
|
+ openId: info.openId,
|
|
|
253
|
+ sourceTypeSecond: req.yoho.isAliApp ? 'xianyu' : ''
|
240
|
}).then(result => {
|
254
|
}).then(result => {
|
241
|
if (_.get(result, 'data.is_bind') === 'Y') {
|
255
|
if (_.get(result, 'data.is_bind') === 'Y') {
|
242
|
model.syncUserSession({
|
256
|
model.syncUserSession({
|