Commit 2e19bc8d authored by wildfirecode13's avatar wildfirecode13

1

parent 8a803034
...@@ -7,7 +7,7 @@ cloud.init({ ...@@ -7,7 +7,7 @@ cloud.init({
App({ App({
requestType: 'cloud', // yapi,cloud: 云函数 requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'yapi', // yapi,cloud: 云函数 requestType: 'local', // yapi,cloud: 云函数
cloudName: 'tmallCat', // 主云函数项目名 tmallCat cloudName: 'tmallCat', // 主云函数项目名 tmallCat
// cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat // cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat
cloud, cloud,
......
...@@ -53,8 +53,8 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => { ...@@ -53,8 +53,8 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
const requestMock = () => { const requestMock = () => {
const mockUrlPrefix = { const mockUrlPrefix = {
ams: 'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=', ams: 'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=',
yapi: 'http://localhost:3000/' local: 'http://localhost:3000/',
// yapi: 'https://docs.dui88.com/mock/140/' yapi: 'https://docs.dui88.com/mock/140/'
}; };
const mockUrl = null; const mockUrl = null;
const requestPrefix = mockUrl || mockUrlPrefix[requestType]; const requestPrefix = mockUrl || mockUrlPrefix[requestType];
...@@ -85,7 +85,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => { ...@@ -85,7 +85,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
const requestCloud = () => { const requestCloud = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
cloud.function.invoke(_cloudName, params, handle).then(res => { cloud.function.invoke(_cloudName, params, handle).then(res => {
console.log('request Cloud callback=>', handle, res,JSON.stringify(res)); console.log('request Cloud callback=>', handle, res, JSON.stringify(res));
// console.log('requestCloud', handle, params, res); // console.log('requestCloud', handle, params, res);
hideMyLoading(); hideMyLoading();
if (res && res.success) { if (res && res.success) {
...@@ -104,7 +104,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => { ...@@ -104,7 +104,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
// console.log('requestCloud', _cloudName, handle, params); // console.log('requestCloud', _cloudName, handle, params);
// return requestType === 'ams' ? requestAms() : requestCloud(); // return requestType === 'ams' ? requestAms() : requestCloud();
return (requestType === 'ams' || requestType === 'yapi') ? requestMock() : requestCloud(); return (requestType === 'ams' || requestType === 'yapi'|| requestType === 'local') ? requestMock() : requestCloud();
}; };
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment