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
95
96
97
98
| const $f = require('./baserequest');
| const util = require('../utils/util');
| const app = getApp();
|
| module.exports = {
| //获取所有环保日程
| getAllSchedules: function (userId, fun) {
| let cb = {
| url: `schedules.json`,
| method: 'GET',
| params: {
| userId: userId,
| },
| };
| Object.assign(cb, fun);
|
| wx.request(cb);
| },
|
| // 获取日程
| getSchedules: function ({ startTime, endTime, type }, fun) {
| let cb = {
| url: `/schedule/get`,
| data: {
| userId: app.globalData.accessToken.userId,
| startTime: startTime,
| endTime: endTime,
| type: type,
| },
| };
| Object.assign(cb, fun);
|
| $f.post(cb);
| },
|
| // 签收完成日程
| completeSchedule: function ({ id }, fun) {
| let cb = {
| url: `/schedule/complete`,
| params: {
| userId: app.globalData.accessToken.userId,
| id,
| },
| };
| Object.assign(cb, fun);
|
| $f.post(cb);
| },
|
| // 撤销完成日程
| revokeSchedule: function ({recordId}, fun) {
| let cb = {
| url: `/schedule/revoke`,
| params: {
| userId: app.globalData.accessToken.userId,
| recordId,
| },
| };
| Object.assign(cb, fun);
|
| $f.post(cb);
| },
|
| // 获取当前用户的实操事务
| getOperations(fun) {
| let cb = {
| url: `/operation/get?userId=${app.globalData.accessToken.userId}`,
| };
| Object.assign(cb, fun);
|
| $f.get(cb);
| },
|
| // 获取当前用户的实操事务和操作记录
| getOperationRecords(fun) {
| let cb = {
| url: `/operation/get/record?userId=${app.globalData.accessToken.userId}`,
| };
| Object.assign(cb, fun);
|
| $f.get(cb);
| },
|
| // 执行实操事务
| doOperations({operationId, stateId}, fun) {
| let cb = {
| url: `/operation/execute`,
| params: {
| userId: app.globalData.accessToken.userId,
| operationId,
| stateId
| },
| };
| Object.assign(cb, fun);
|
| $f.post(cb);
| }
| };
|
|