zhangwencui
6 天以前 7619c19a67c2ac824f803090bab753fc5ea14408
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import type { PageParam, PageResult } from '@vben/request';
 
import { requestClient } from '#/api/request';
 
export namespace SystemSocialUserApi {
  /** 社交用户信息 */
  export interface SocialUser {
    id?: number;
    type: number;
    openid: string;
    token: string;
    rawTokenInfo: string;
    nickname: string;
    avatar: string;
    rawUserInfo: string;
    code: string;
    state: string;
    createTime?: Date;
    updateTime?: Date;
  }
 
  /** 社交绑定请求 */
  export interface SocialUserBindReqVO {
    type: number;
    code: string;
    state: string;
  }
 
  /** 取消社交绑定请求 */
  export interface SocialUserUnbindReqVO {
    type: number;
    openid: string;
  }
}
 
/** 查询社交用户列表 */
export function getSocialUserPage(params: PageParam) {
  return requestClient.get<PageResult<SystemSocialUserApi.SocialUser>>(
    '/system/social-user/page',
    { params },
  );
}
 
/** 查询社交用户详情 */
export function getSocialUser(id: number) {
  return requestClient.get<SystemSocialUserApi.SocialUser>(
    `/system/social-user/get?id=${id}`,
  );
}
 
/** 社交绑定,使用 code 授权码 */
export function socialBind(data: SystemSocialUserApi.SocialUserBindReqVO) {
  return requestClient.post<boolean>('/system/social-user/bind', data);
}
 
/** 取消社交绑定 */
export function socialUnbind(data: SystemSocialUserApi.SocialUserUnbindReqVO) {
  return requestClient.delete<boolean>('/system/social-user/unbind', { data });
}
 
/** 获得绑定社交用户列表 */
export function getBindSocialUserList() {
  return requestClient.get<SystemSocialUserApi.SocialUser[]>(
    '/system/social-user/get-bind-list',
  );
}