|
@@ -0,0 +1,65 @@
|
|
|
+// 云函数入口文件
|
|
|
+const cloud = require('wx-server-sdk')
|
|
|
+const request = require('request');
|
|
|
+
|
|
|
+cloud.init()
|
|
|
+
|
|
|
+// 云函数入口函数
|
|
|
+exports.main = async (event, context) => {
|
|
|
+ const wxContext = cloud.getWXContext()
|
|
|
+
|
|
|
+ var data=event.message;
|
|
|
+
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ try {
|
|
|
+ request({
|
|
|
+ method: 'POST',
|
|
|
+ headers: {
|
|
|
+ Authorization: event.message.token || '',
|
|
|
+ "content-type": "application/json",
|
|
|
+ },
|
|
|
+ body: JSON.stringify(data),
|
|
|
+ url: 'https://wash.nanodreamtech.com/api/user/getPhoneNumber',
|
|
|
+ }, function (error, response, body) {
|
|
|
+ if (error) {
|
|
|
+ return reject(error);
|
|
|
+ }
|
|
|
+ return resolve(JSON.parse(body));
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ return reject(e)
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // request({
|
|
|
+ // url: 'https://wash.nanodreamtech.com/api/user/getPhoneNumber', // 云端正式服
|
|
|
+ // body:data,
|
|
|
+ // method:'POST',
|
|
|
+ // headers: {
|
|
|
+ // Authorization: event.message.token || '',
|
|
|
+ // 'content-type': 'application/json',
|
|
|
+ // },
|
|
|
+ // json: true, // 添加这个配置
|
|
|
+ // },function (error,response,body){
|
|
|
+ // if(!error&&response.statusCode==200){
|
|
|
+ // return body
|
|
|
+ // }
|
|
|
+
|
|
|
+ // })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|