|
|
|
@ -1,9 +1,10 @@
|
|
|
|
|
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'
|
|
|
|
|
|
|
|
|
|
const WAI_API_VER = '/api/v1'
|
|
|
|
|
|
|
|
|
|
export const postSendMsg = async (body) => {
|
|
|
|
|
const { waiServer } = usingStorage(WAI_SERVER_KEY)
|
|
|
|
|
const { attaList = [], atta, content, ...bodyData } = body
|
|
|
|
@ -14,11 +15,11 @@ export const postSendMsg = async (body) => {
|
|
|
|
|
attaList.forEach(function (item) {
|
|
|
|
|
formData.append('attachment', item)
|
|
|
|
|
})
|
|
|
|
|
const { result } = await postJSON(`${waiServer}/messages/send`, body)
|
|
|
|
|
const { result } = await postJSON(`${waiServer}${WAI_API_VER}/messages/send`, body)
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const fetchQRCode = (phone) => {
|
|
|
|
|
const { waiServer } = usingStorage(WAI_SERVER_KEY)
|
|
|
|
|
return fetchJSON(`${waiServer}/channels/qrcode`, { phone })
|
|
|
|
|
return fetchJSON(`${waiServer}${WAI_API_VER}/channels/qrcode`, { phone })
|
|
|
|
|
}
|
|
|
|
|