perf(前端): wai 发消息
parent
2d2eee7704
commit
b802532c50
@ -1,26 +1,24 @@
|
||||
import { fetchJSON, postForm, postJSON } from '@/utils/request';
|
||||
import { API_HOST, WAI_HOST } from '@/config';
|
||||
import { usingStorage } from '@/utils/usingStorage';
|
||||
import { fetchJSON, postForm, postJSON } from '@/utils/request'
|
||||
import { API_HOST, WAI_HOST } from '@/config'
|
||||
import { usingStorage } from '@/utils/usingStorage'
|
||||
|
||||
const WAI_SERVER_KEY = 'G-STR:WAI_SERVER'
|
||||
|
||||
export const postSendMsg = async (body) => {
|
||||
const { waiServer } = usingStorage(WAI_SERVER_KEY)
|
||||
const { attaList=[], atta, content, ...bodyData } = body;
|
||||
const formData = new FormData();
|
||||
const { attaList = [], atta, content, ...bodyData } = body
|
||||
const formData = new FormData()
|
||||
Object.keys(bodyData).forEach(function (key) {
|
||||
formData.append(key, bodyData[key]);
|
||||
});
|
||||
formData.append(key, bodyData[key])
|
||||
})
|
||||
attaList.forEach(function (item) {
|
||||
formData.append('attachment', item);
|
||||
});
|
||||
const { result } = await postJSON(`${waiServer}/messages/text`, body);
|
||||
return result;
|
||||
};
|
||||
formData.append('attachment', item)
|
||||
})
|
||||
const { result } = await postJSON(`${waiServer}/messages/send`, body)
|
||||
return result
|
||||
}
|
||||
|
||||
export const fetchQRCode = (phone) => {
|
||||
const { waiServer } = usingStorage(WAI_SERVER_KEY)
|
||||
return fetchJSON(
|
||||
`${waiServer}/channels/qrcode`,
|
||||
{ phone })
|
||||
return fetchJSON(`${waiServer}/channels/qrcode`, { phone })
|
||||
}
|
||||
|
Loading…
Reference in New Issue