Authored by 李奇

修改接口508

@@ -2,28 +2,13 @@ @@ -2,28 +2,13 @@
2 import wx from './utils/wx'; 2 import wx from './utils/wx';
3 import udid from './common/udid'; 3 import udid from './common/udid';
4 import event from './common/event'; 4 import event from './common/event';
5 -import promisify from './common/promisify';  
6 import objectAssign from './vendors/object-assign'; 5 import objectAssign from './vendors/object-assign';
7 import {WeToast} from './vendors/toast/wetoast'; 6 import {WeToast} from './vendors/toast/wetoast';
8 import config from './common/config'; 7 import config from './common/config';
9 import {GET, POST} from './common/request'; 8 import {GET, POST} from './common/request';
10 -import {Encrypt,Decrypt} from './common/aes.js';  
11 -let crypto = require('./common/cryptojs/cryptojs.js').Crypto  
12 import md5 from './vendors/md5'; 9 import md5 from './vendors/md5';
13 -var mta = require('./vendors/mta_analysis.js')  
14 -import { wechatLoginAction } from './utils/login';  
15 -import { isStringEmpty } from './utils/util';  
16 -  
17 -import { logEvent,  
18 - YB_LAUNCH_APP,  
19 - YB_EXIT_APP,  
20 - YB_ENTER_FOREGROUND,  
21 - YB_ENTER_BACKGROUND,  
22 - YB_PAGE_OPEN_L,  
23 - YB_AWAKE_MP  
24 - } from './common/analytics.js';  
25 -  
26 -import { appReport } from './common/appReport.js'; 10 +import {wechatLoginAction} from './utils/login';
  11 +import {isStringEmpty} from './utils/util';
27 12
28 App({ 13 App({
29 onLaunch: function (options) { 14 onLaunch: function (options) {
@@ -39,14 +24,14 @@ App({ @@ -39,14 +24,14 @@ App({
39 this.globalData.systemInfo = res; 24 this.globalData.systemInfo = res;
40 this.checkUDID(); 25 this.checkUDID();
41 26
42 - that.getSimplePise()  
43 - this.checkNetworkType() 27 + that.getSimplePise();
  28 + this.checkNetworkType();
44 29
45 - if (options && options.scene){ 30 + if (options && options.scene) {
46 this.globalData.ch = options.scene 31 this.globalData.ch = options.scene
47 } 32 }
48 33
49 - if (options && options.query && options.query.union_type){ 34 + if (options && options.query && options.query.union_type) {
50 this.globalData.union_type = options.query.union_type 35 this.globalData.union_type = options.query.union_type
51 } 36 }
52 37
@@ -73,60 +58,27 @@ App({ @@ -73,60 +58,27 @@ App({
73 data: "" 58 data: ""
74 }); 59 });
75 } 60 }
76 - }) 61 + });
  62 +
77 this.getSessionkey(); 63 this.getSessionkey();
78 - let timestamp = new Date().getTime() + '' 64 + let timestamp = new Date().getTime() + '';
79 this.globalData.sid = md5(timestamp); 65 this.globalData.sid = md5(timestamp);
80 66
81 - if (options){ 67 + if (options) {
82 let channel = options.query.channel; 68 let channel = options.query.channel;
83 let channelType = options.query.type; 69 let channelType = options.query.type;
84 - let params = { 'CHANNEL': channel, 'TYPE': channelType };  
85 - logEvent(YB_LAUNCH_APP, params, this); 70 + let params = {'CHANNEL': channel, 'TYPE': channelType};
86 } 71 }
87 setTimeout(function () { 72 setTimeout(function () {
88 - wechatLoginAction(function (response) {});}, 1000); 73 + wechatLoginAction(() => '');
  74 + }, 1000);
89 75
90 this.mtainit(options); 76 this.mtainit(options);
91 }, 77 },
92 78
93 - //当应用程序进入前台显示状态时触发  
94 - onShow(options) {  
95 - let that = this  
96 - let params = {};  
97 - logEvent(YB_ENTER_FOREGROUND, params, this)  
98 - if (that.globalData.hasReportAwakeAction==='false'){  
99 - let pathParam = ""  
100 - if(options && options.query) {  
101 - for (var Key in options.query) {  
102 - if (pathParam.length == 0) {  
103 - pathParam = Key + '=' + options.query[Key] + '';  
104 - } else {  
105 - pathParam = pathParam + '&' + '' + Key + '=' + options.query[Key] + '';  
106 - }  
107 - }  
108 - }  
109 - let path  
110 - if(pathParam!==""){  
111 - path = options.path + "?" + pathParam  
112 - }else{  
113 - path = options.path  
114 - }  
115 - params = {  
116 - PAGE_PATH: path  
117 - };  
118 - logEvent(YB_AWAKE_MP, params, this);  
119 - that.globalData.hasReportAwakeAction = 'true'  
120 - }  
121 - appReport('start', "LIFECYCLE", "RESUME", {},this)  
122 - }, 79 + onShow() {},
123 80
124 - //当应用程序进入后台状态时触发  
125 - onHide () {  
126 - let params = {};  
127 - logEvent(YB_ENTER_BACKGROUND,params)  
128 - appReport('start', "LIFECYCLE", "STOP", {},this)  
129 - }, 81 + onHide () {},
130 82
131 getUserInfo: function () { 83 getUserInfo: function () {
132 try { 84 try {
@@ -156,7 +108,7 @@ App({ @@ -156,7 +108,7 @@ App({
156 var value = this.globalData.WXThird_session 108 var value = this.globalData.WXThird_session
157 if (!isStringEmpty(value)) { 109 if (!isStringEmpty(value)) {
158 that.globalData.WXThird_session = value; 110 that.globalData.WXThird_session = value;
159 - }else{ 111 + } else {
160 value = wx.getStorageSync('WXThird_session') 112 value = wx.getStorageSync('WXThird_session')
161 } 113 }
162 return value 114 return value
@@ -197,9 +149,9 @@ App({ @@ -197,9 +149,9 @@ App({
197 }) 149 })
198 }, 150 },
199 151
200 - setOpenID:function(openID){ 152 + setOpenID: function (openID) {
201 153
202 - if(openID=='') return 154 + if (openID == '') return
203 this.globalData.openID = openID; 155 this.globalData.openID = openID;
204 wx.setStorage({ 156 wx.setStorage({
205 key: "openID", 157 key: "openID",
@@ -209,9 +161,9 @@ App({ @@ -209,9 +161,9 @@ App({
209 161
210 getOpenID: function () { 162 getOpenID: function () {
211 let openid = '' 163 let openid = ''
212 - if (!isStringEmpty(this.globalData.openID)){ 164 + if (!isStringEmpty(this.globalData.openID)) {
213 openid = this.globalData.openID 165 openid = this.globalData.openID
214 - }else{ 166 + } else {
215 openid = wx.getStorageSync('openID') 167 openid = wx.getStorageSync('openID')
216 this.globalData.openID = openid 168 this.globalData.openID = openid
217 } 169 }
@@ -233,27 +185,24 @@ App({ @@ -233,27 +185,24 @@ App({
233 systemInfo: null, 185 systemInfo: null,
234 WXThird_session: '', 186 WXThird_session: '',
235 WXUnion_ID: '', 187 WXUnion_ID: '',
236 - openID:'', 188 + openID: '',
237 p2SecretKey: '', 189 p2SecretKey: '',
238 sessionkey: '', 190 sessionkey: '',
239 sid: '', 191 sid: '',
240 - udid:'',  
241 - cid:'1',  
242 - mobileRegisterState:'', 192 + udid: '',
  193 + cid: '1',
  194 + mobileRegisterState: '',
243 hasReportAwakeAction: 'false', 195 hasReportAwakeAction: 'false',
244 - defraudurl:'https://activity.yoho.cn/feature/45.html?title=防诈骗提醒', 196 + defraudurl: 'https://activity.yoho.cn/feature/45.html?title=防诈骗提醒',
245 miniapp_type: config.constants.MINI_APP_TYPE, 197 miniapp_type: config.constants.MINI_APP_TYPE,
246 - union_type:'',  
247 - ch:'',  
248 - networkType:'0',  
249 - deviceInfo:{}, 198 + union_type: '',
  199 + ch: '',
  200 + networkType: '0',
  201 + deviceInfo: {}
250 }, 202 },
251 203
252 isLogin: function () { 204 isLogin: function () {
253 return this.globalData.userInfo != null && 205 return this.globalData.userInfo != null &&
254 - // this.globalData.userInfo.uid != undefined &&  
255 - // this.globalData.userInfo.uid != null &&  
256 - // this.globalData.userInfo.uid != '' &&  
257 this.globalData.WXThird_session != '' && 206 this.globalData.WXThird_session != '' &&
258 this.globalData.WXThird_session != null && 207 this.globalData.WXThird_session != null &&
259 this.globalData.WXThird_session != undefined; 208 this.globalData.WXThird_session != undefined;
@@ -261,14 +210,14 @@ App({ @@ -261,14 +210,14 @@ App({
261 210
262 getUid: function () { 211 getUid: function () {
263 let uid = this.globalData.userInfo.uid 212 let uid = this.globalData.userInfo.uid
264 - if(!uid||uid===0){ 213 + if (!uid || uid === 0) {
265 this.getUserInfo(); 214 this.getUserInfo();
266 uid = this.globalData.userInfo.uid 215 uid = this.globalData.userInfo.uid
267 } 216 }
268 return uid; 217 return uid;
269 }, 218 },
270 219
271 - getMiniappType:function(){ 220 + getMiniappType: function () {
272 return config.constants.MINI_APP_TYPE 221 return config.constants.MINI_APP_TYPE
273 }, 222 },
274 223
@@ -277,20 +226,20 @@ App({ @@ -277,20 +226,20 @@ App({
277 let that = this 226 let that = this
278 let data = { 227 let data = {
279 "udid": that.globalData.udid, 228 "udid": that.globalData.udid,
280 - "method": 'resources.simple.pice'} 229 + "method": 'resources.simple.pice'
  230 + }
281 let method = "GET" 231 let method = "GET"
282 let header = { 232 let header = {
283 'Content-Type': 'application/x-www-form-urlencoded' 233 'Content-Type': 'application/x-www-form-urlencoded'
284 } 234 }
285 235
286 wx.request({ 236 wx.request({
287 - url:config.constants.API_HOST, 237 + url: config.constants.API_HOST,
288 data, 238 data,
289 method, 239 method,
290 header: header, 240 header: header,
291 success: function (res) { 241 success: function (res) {
292 - // console.log("res:", res)  
293 - if (res && res.data && res.data.data && res.data.data.sk){ 242 + if (res && res.data && res.data.data && res.data.data.sk) {
294 that.globalData.p2SecretKey = res.data.data.sk; 243 that.globalData.p2SecretKey = res.data.data.sk;
295 wx.setStorage({ 244 wx.setStorage({
296 key: "p2SecretKey", 245 key: "p2SecretKey",
@@ -299,7 +248,6 @@ App({ @@ -299,7 +248,6 @@ App({
299 } 248 }
300 }, 249 },
301 fail: function (err) { 250 fail: function (err) {
302 - // console.log("err:",err)  
303 } 251 }
304 }); 252 });
305 }, 253 },
@@ -307,34 +255,23 @@ App({ @@ -307,34 +255,23 @@ App({
307 fastloginSwitch: function () { 255 fastloginSwitch: function () {
308 let that = this 256 let that = this
309 let param = { 257 let param = {
310 - method: 'app.passport.fastloginSwitch', 258 + method: 'app.passport.fastloginSwitch'
311 }; 259 };
312 GET(config.constants.API_HOST, param) 260 GET(config.constants.API_HOST, param)
313 .then(json => { 261 .then(json => {
314 - // if (!json || !json.code || json.code != 200 || !json.data) return;  
315 - // if (!json.data || !json.data.sk) return;  
316 -  
317 - // let p2SecretKey = json.data.sk;  
318 - // if (!p2SecretKey) return;  
319 - // that.globalData.p2SecretKey = p2SecretKey;  
320 -  
321 - // wx.setStorage({  
322 - // key: "p2SecretKey",  
323 - // data: p2SecretKey  
324 - // });  
325 }) 262 })
326 263
327 .catch(error => { 264 .catch(error => {
328 }); 265 });
329 }, 266 },
330 267
331 - checkUDID:function(){ 268 + checkUDID: function () {
332 let that = this 269 let that = this
333 try { 270 try {
334 var value = wx.getStorageSync('udid') 271 var value = wx.getStorageSync('udid')
335 if (value) { 272 if (value) {
336 that.globalData.udid = value; 273 that.globalData.udid = value;
337 - }else{ 274 + } else {
338 let udidValue = md5(that.getUUID()); 275 let udidValue = md5(that.getUUID());
339 that.globalData.udid = udidValue; 276 that.globalData.udid = udidValue;
340 try { 277 try {
@@ -344,12 +281,10 @@ App({ @@ -344,12 +281,10 @@ App({
344 } 281 }
345 //获取签名秘钥 282 //获取签名秘钥
346 } catch (e) { 283 } catch (e) {
347 - // Do something when catch error  
348 - // console.log("checkUDID error: " + e)  
349 } 284 }
350 }, 285 },
351 286
352 - checkNetworkType:function(){ 287 + checkNetworkType: function () {
353 let that = this; 288 let that = this;
354 let net = ''; 289 let net = '';
355 290
@@ -371,8 +306,7 @@ App({ @@ -371,8 +306,7 @@ App({
371 } 306 }
372 // console.log("network:",net) 307 // console.log("network:",net)
373 }, 308 },
374 - complete:function(res){  
375 - appReport('start', "LIFECYCLE", "START", {}, that) 309 + complete: function (res) {
376 } 310 }
377 }) 311 })
378 that.globalData.networkType = net; 312 that.globalData.networkType = net;
@@ -384,10 +318,6 @@ App({ @@ -384,10 +318,6 @@ App({
384 }, 318 },
385 319
386 loginCallBack: function (response) { 320 loginCallBack: function (response) {
387 - // console.log(response)  
388 - // if (response.code === 10001) {  
389 - // this.showRelaunchModal();  
390 - // }  
391 }, 321 },
392 322
393 showRelaunchModal: function () { 323 showRelaunchModal: function () {
@@ -411,23 +341,15 @@ App({ @@ -411,23 +341,15 @@ App({
411 try { 341 try {
412 var value = wx.getStorageSync('sessionkey') 342 var value = wx.getStorageSync('sessionkey')
413 if (value) { 343 if (value) {
414 - // console.log(value)  
415 this.globalData.sessionkey = value; 344 this.globalData.sessionkey = value;
416 } 345 }
417 } catch (e) { 346 } catch (e) {
418 - // console.log(e)  
419 } 347 }
420 } 348 }
421 return undefined; 349 return undefined;
422 }, 350 },
423 351
424 - mtainit(e) {  
425 - mta.App.init({  
426 - "appID": "500570715",  
427 - "eventID": "500570797",  
428 - });  
429 - // console.log("init mta");  
430 - }, 352 + mtainit(e) {},
431 WeToast 353 WeToast
432 }) 354 })
433 355
@@ -11,12 +11,14 @@ const config = { @@ -11,12 +11,14 @@ const config = {
11 constants: { 11 constants: {
12 LOG_EVENT_HOST: 'https://analysis.yohobuy.com/yas_mobile', 12 LOG_EVENT_HOST: 'https://analysis.yohobuy.com/yas_mobile',
13 APP_REPORT_HOST: 'https://app.yoho.cn/collect/v3', 13 APP_REPORT_HOST: 'https://app.yoho.cn/collect/v3',
14 - API_HOST: 'http://api-test1.yohops.com:9999', 14 + // API_HOST: 'https://api.yoho.cn',
  15 + // SERVICE_HOST: 'https://api.yoho.cn',
  16 + API_HOST: 'http://api-test1.yohops.com:9999/',
15 SERVICE_HOST: 'http://api-test1.yohops.com:9999/', 17 SERVICE_HOST: 'http://api-test1.yohops.com:9999/',
16 MINI_APP_TYPE: '0', 18 MINI_APP_TYPE: '0',
17 PAYMENT_CODE: '45', 19 PAYMENT_CODE: '45',
18 OS_VERSION: 'yohobuy:h5', 20 OS_VERSION: 'yohobuy:h5',
19 - APP_VERSION: '2.2.1', 21 + APP_VERSION: '6.4.0',
20 APP_BUILD: '1003', 22 APP_BUILD: '1003',
21 PRIVATE_KEY: 'b43890b0a296ff3c7b8c260ca763980b', 23 PRIVATE_KEY: 'b43890b0a296ff3c7b8c260ca763980b',
22 CLIENT_TYPE: 'miniapp', 24 CLIENT_TYPE: 'miniapp',
@@ -9,8 +9,58 @@ let p1SecretKey = "yoho9646yoho9646" @@ -9,8 +9,58 @@ let p1SecretKey = "yoho9646yoho9646"
9 let ClientInitConfigMehtod = "resources.simple.pice" 9 let ClientInitConfigMehtod = "resources.simple.pice"
10 let ClientConfigHasRequested = 0 10 let ClientConfigHasRequested = 0
11 11
  12 +function getPrivateKey(){
  13 + return new Promise(function(resolve,reject){
  14 + let app = getApp()
  15 + let p2SecretKey = app && app.globalData && app.globalData.p2SecretKey;
  16 + if (!p2SecretKey){
  17 + p2SecretKey = wx.getStorageSync("p2SecretKey")
  18 + }
  19 +
  20 + if (p2SecretKey){
  21 + resolve(p2SecretKey)
  22 + }else{
  23 +
  24 + let data = {
  25 + "udid": app.globalData.udid,
  26 + "method": 'resources.simple.pice'
  27 + }
  28 + let method = "GET"
  29 + let header = {
  30 + 'Content-Type': 'application/x-www-form-urlencoded'
  31 + }
  32 +
  33 + wx.request({
  34 + url: config.constants.API_HOST,
  35 + data,
  36 + method,
  37 + header: header,
  38 + success: function (res) {
  39 + // console.log("res:", res)
  40 + if (res && res.data && res.data.data && res.data.data.sk) {
  41 + app.globalData.p2SecretKey = res.data.data.sk;
  42 + wx.setStorage({
  43 + key: "p2SecretKey",
  44 + data: res.data.data.sk
  45 + });
  46 +
  47 + resolve(app.globalData.p2SecretKey)
  48 + }
  49 + },
  50 + fail: function (err) {
  51 + reject(err)
  52 + // console.log("err:",err)
  53 + }
  54 + });
  55 +
  56 + }
  57 + })
  58 +}
  59 +
12 function request(method = 'GET') { 60 function request(method = 'GET') {
13 return function(url, params = {}) { 61 return function(url, params = {}) {
  62 + return getPrivateKey()
  63 + .then(key => {
14 return new Promise(function(resolve, reject) { 64 return new Promise(function(resolve, reject) {
15 let app = getApp(); 65 let app = getApp();
16 if (params && !params.hasOwnProperty('uid')) { 66 if (params && !params.hasOwnProperty('uid')) {
@@ -90,6 +140,7 @@ function request(method = 'GET') { @@ -90,6 +140,7 @@ function request(method = 'GET') {
90 } 140 }
91 }); 141 });
92 }) 142 })
  143 + });
93 } 144 }
94 } 145 }
95 146
@@ -149,23 +200,12 @@ function _publicParams() { @@ -149,23 +200,12 @@ function _publicParams() {
149 // Do something when catch error 200 // Do something when catch error
150 } 201 }
151 202
152 - // app_version = '5.6.0';  
153 - // os_version = '10.3';  
154 - // screen_size = '320x568';  
155 - // let uid = '0';  
156 - // let udid = 'acea1c6170ecca417c67979a406156950bcf4fe5';  
157 - // let physical_channel = 1;  
158 -  
159 -  
160 return { 203 return {
161 app_version, 204 app_version,
162 os_version, 205 os_version,
163 client_type, 206 client_type,
164 screen_size, 207 screen_size,
165 - // physical_channel,  
166 - // udid,  
167 - v,  
168 - // uid, 208 + v
169 }; 209 };
170 } 210 }
171 211
  1 +import api from '../../common/api';
  2 +
  3 +export default {
  4 + /**
  5 + * 解析用户信息
  6 + * @param thirdSession
  7 + * @param encryptedData
  8 + * @param iv
  9 + * @returns {*}
  10 + */
  11 + decodeUserInfo(thirdSession, encryptedData, iv) {
  12 + return api.post({
  13 + url: '/wechat/',
  14 + data: {
  15 + iv,
  16 + encryptedData,
  17 + srdSession: thirdSession,
  18 + method: 'wechat.smallProgram.decodeUserInfo'
  19 + }
  20 + });
  21 + },
  22 +
  23 + /**
  24 + * 判断有货微信账户是否绑定手机号
  25 + * @param unionID
  26 + * @param nickName
  27 + * @returns {*}
  28 + */
  29 + wechatUserIsBind(unionID, nickName) {
  30 + return api.get({
  31 + url: '',
  32 + data: {
  33 + method: 'app.passport.signinByOpenID',
  34 + openId: unionID,
  35 + source_type: 'wechat',
  36 + nickname: nickName,
  37 + }
  38 + });
  39 + },
  40 +
  41 + /**
  42 + * 微信登录小程序
  43 + * @param code
  44 + * @returns {*}
  45 + */
  46 + wechatMiniAppLogin(code) {
  47 + return api.get({
  48 + url: '/wechat/',
  49 + data: {
  50 + method: 'wechat.smallProgram.onLogin',
  51 + jsCode: code,
  52 + miniapp_type: '2'
  53 + }
  54 + });
  55 + },
  56 +
  57 + /**
  58 + * 绑定小程序
  59 + * @param unionId
  60 + * @param mobile
  61 + * @param code
  62 + * @param area
  63 + * @returns {*}
  64 + */
  65 + bindMiniapp(unionId, mobile, code, area = 86) {
  66 + return api.get({
  67 + url: '',
  68 + data: {
  69 + code,
  70 + mobile,
  71 + area,
  72 + open_id: unionId,
  73 + source_type: 'wechat',
  74 + method: 'app.passport.bindMiniapp'
  75 + }
  76 + });
  77 + },
  78 +
  79 + /**
  80 + * 自动绑定小程序
  81 + * @param unionId
  82 + * @param mobile
  83 + * @param area
  84 + * @returns {*}
  85 + */
  86 + bindMiniAppByAuto(unionId, mobile, area = 86) {
  87 + return api.get({
  88 + url: '',
  89 + data: {
  90 + mobile,
  91 + area,
  92 + open_id: unionId,
  93 + source_type: 'wechat',
  94 + method: 'app.passport.miniAppBindByAuto'
  95 + }
  96 + });
  97 + },
  98 +
  99 + /**
  100 + * 自动登录
  101 + * @param mobile
  102 + * @param code
  103 + * @param area
  104 + * @returns {*}
  105 + */
  106 + autoSignIn(mobile, code, area = 86) {
  107 + return api.get({
  108 + url: '',
  109 + data: {
  110 + code,
  111 + area,
  112 + profile: mobile,
  113 + source_type: 'wechat',
  114 + method: 'app.passport.autoSignin'
  115 + }
  116 + });
  117 + },
  118 +
  119 + /**
  120 + * sessionKey是否失效验证
  121 + * @returns {*}
  122 + */
  123 + verify() {
  124 + return api.get({
  125 + url: '',
  126 + data: {
  127 + method: 'app.passport.verify'
  128 + }
  129 + });
  130 + },
  131 +
  132 + /**
  133 + * 获取用户信息
  134 + * @param uid 用户UID
  135 + * @returns {*}
  136 + */
  137 + getProfile() {
  138 + return api.get({
  139 + url: '',
  140 + data: {
  141 + method: 'app.passport.profile'
  142 + }
  143 + });
  144 + },
  145 +
  146 + /**
  147 + * 获取优惠券总数
  148 + * @returns {*}
  149 + */
  150 + getCouponTotal() {
  151 + return api.get({
  152 + url: '/coupon/total.do',
  153 + data: {},
  154 + api: 'store'
  155 + });
  156 + },
  157 +
  158 + /**
  159 + * 获取有货币总数
  160 + * @returns {*}
  161 + */
  162 + getCoinTotal() {
  163 + return api.get({
  164 + url: '',
  165 + data: {
  166 + method: 'app.yohocoin.total'
  167 + }
  168 + });
  169 + },
  170 +
  171 + /**
  172 + * 获取国家和地区
  173 + * @returns {*}
  174 + */
  175 + getArea() {
  176 + return api.get({
  177 + url: '',
  178 + data: {
  179 + source_type: 'wechat',
  180 + method: 'app.passport.getArea'
  181 + }
  182 + });
  183 + },
  184 +
  185 + /**
  186 + * 用户未授权-发送验证码
  187 + * @param area 国家码
  188 + * @param mobile 手机号
  189 + * @returns {*}
  190 + */
  191 + sendSms(area, mobile) {
  192 + return api.get({
  193 + url: '',
  194 + data: {
  195 + area,
  196 + mobile,
  197 + source_type: 'wechat',
  198 + method: 'app.message.sendSms'
  199 + }
  200 + });
  201 + },
  202 +
  203 + /**
  204 + * 用户已授权-发送验证码
  205 + * @param mobile 手机号
  206 + * @param area 国家码
  207 + * @returns {*}
  208 + */
  209 + sendCodeByMiniApp(area, mobile, openId) {
  210 + return api.get({
  211 + url: '',
  212 + data: {
  213 + area,
  214 + mobile,
  215 + open_id: openId,
  216 + source_type: 'wechat',
  217 + method: 'app.bind.sendCodeByMiniApp'
  218 + }
  219 + });
  220 + }
  221 +};

1.11 KB | W: | H:

259 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.09 KB | W: | H:

214 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -129,12 +129,13 @@ function getUnionID(srd_session, callbackFunc) { @@ -129,12 +129,13 @@ function getUnionID(srd_session, callbackFunc) {
129 判断该微信用户是否已经绑定了有货账号,如果已绑定则返回uid等用户信息 129 判断该微信用户是否已经绑定了有货账号,如果已绑定则返回uid等用户信息
130 */ 130 */
131 function wechatUserIsBind(unionID, nickName, callbackFunc) { 131 function wechatUserIsBind(unionID, nickName, callbackFunc) {
132 - let app = getApp() 132 + let app = getApp();
133 let param = { 133 let param = {
134 method: 'app.passport.signinByOpenID', 134 method: 'app.passport.signinByOpenID',
135 openId: unionID, 135 openId: unionID,
136 nickname: nickName, 136 nickname: nickName,
137 - } 137 + };
  138 +
138 POST(config.constants.API_HOST, param) 139 POST(config.constants.API_HOST, param)
139 .then(data => { 140 .then(data => {
140 let responseData = data.data 141 let responseData = data.data
@@ -146,7 +147,6 @@ function wechatUserIsBind(unionID, nickName, callbackFunc) { @@ -146,7 +147,6 @@ function wechatUserIsBind(unionID, nickName, callbackFunc) {
146 userInfo.ssouid = responseData.ssouid; 147 userInfo.ssouid = responseData.ssouid;
147 userInfo.uid = responseData.uid; 148 userInfo.uid = responseData.uid;
148 app.setUserInfo(userInfo); 149 app.setUserInfo(userInfo);
149 -  
150 app.setSessionkey(responseData.session_key); 150 app.setSessionkey(responseData.session_key);
151 trigger(true) 151 trigger(true)
152 152