1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- // 云函数入口文件
- 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
- // }
-
- // })
-
|