| 1234567891011121314151617181920212223242526272829303132333435 |
- import FetchRequest from '@/api/FetchRequest'
- import type Immunity from '@/mode/Immunity'
- // @ts-ignore
- import type AjaxResult from '@/mode/AjaxResult'
- class ImmunityApi {
- static url = '/api/sys/immunity'
- /**
- * 获取用户免打扰
- */
- static list(userId: string): Promise<AjaxResult<Immunity[]>> {
- return FetchRequest.get(`${this.url}/${userId}`, true)
- }
- /**
- * 保存用户免打扰
- */
- static save(userId: string, chatId: string): Promise<AjaxResult<Immunity[]>> {
- const immunity: Immunity = {
- userId: userId,
- chatId: chatId
- }
- return FetchRequest.post(this.url, JSON.stringify(immunity), true)
- }
- /**
- * 删除用户免打扰
- */
- static delete(userId: string, chatId: string): Promise<AjaxResult<Immunity[]>> {
- return FetchRequest.del(`${this.url}/${userId}-${chatId}`, '', true)
- }
- }
- export default ImmunityApi
|