p-honggang.li
2025-08-29 57c6a02c135c1224e9de2766e412eedd4cd18d58
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import createAxios from '@/utils/axios'
 
let url = '/admin/api/points/'
 
const pointsApi = {
  // 积分规则设置相关接口
  // 获取积分规则配置
  getPointsRules(data: object): ApiPromise {
    return createAxios({
      url: `${url}main/page`,
      data: data,
    }) as ApiPromise
  },
 
  // 根据ID获取积分规则
  getPointsRuleById(data: URLSearchParams): ApiPromise {
    return createAxios({
      url: `${url}rule/list`,
      method: 'post',
      data: data,
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    }) as ApiPromise
  },
 
  // 保存积分规则配置
  savePointsRules(data: object): ApiPromise {
    return createAxios({
      url: `${url}rules/update`,
      data: data,
    }) as ApiPromise
  },
 
  // 个人积分相关接口
  // 获取个人积分统计
  getPersonalPointsStats(userId: number): ApiPromise {
    return createAxios({
      url: `${url}/total/user/` + userId,
      method: 'get',
    }) as ApiPromise
  },
 
  // 获取个人积分流水
  getPersonalPointsFlow(data: object): ApiPromise {
    return createAxios({
      url: `${url}flow/personal/page`,
      data: data,
    }) as ApiPromise
  },
 
  // 新增:按规则名记账(个人)
  addPersonalFlowByRule(data: { ruleName: string; count?: number; name?: string }): ApiPromise {
    return createAxios({
      url: `${url}personal/flow/addByRule`,
      data,
    }) as ApiPromise
  },
 
  // 单位积分相关接口
  // 获取单位积分统计
  getUnitPointsStats(data: object): ApiPromise {
    return createAxios({
      url: `${url}unit/stats`,
      data: data,
    }) as ApiPromise
  },
 
  // 获取单位积分流水
  getUnitPointsFlow(data: object): ApiPromise {
    return createAxios({
      url: `${url}unit/flow`,
      data: data,
    }) as ApiPromise
  },
 
  // 新增:按规则名记账(单位)
  addUnitFlowByRule(data: { ruleName: string; count?: number; name?: string }): ApiPromise {
    return createAxios({
      url: `${url}unit/flow/addByRule`,
      data,
    }) as ApiPromise
  },
 
  // 获取积分流水数据类目列表
  getPointsFlowCategories(): ApiPromise {
    return createAxios({
      url: `${url}flow/categories`,
      method: 'get',
    }) as ApiPromise
  },
}
 
export default pointsApi