@cpzxrobot/sdk 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/user_gateway.js +49 -0
- package/package.json +1 -1
- package/readme.md +4 -0
- package/user_gateway.ts +52 -1
package/dist/user_gateway.js
CHANGED
|
@@ -119,5 +119,54 @@ class UserGateway extends Object {
|
|
|
119
119
|
var axios = await this.context.ready;
|
|
120
120
|
return axios.post(`/api/v2/user/${id}/avatar/add`, avatar);
|
|
121
121
|
}
|
|
122
|
+
get approval() {
|
|
123
|
+
return {
|
|
124
|
+
count: (id, status) => {
|
|
125
|
+
return this.context.ready.then((axios) => {
|
|
126
|
+
return axios.post(`/api/v2/coremde-sale/approval/count`, {
|
|
127
|
+
status,
|
|
128
|
+
userId: id
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
list: (id, status) => {
|
|
133
|
+
return this.context.ready.then((axios) => {
|
|
134
|
+
return axios.post(`/api/v2/coremde-sale/approval/list`, {
|
|
135
|
+
status,
|
|
136
|
+
userId: id
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
get checkin() {
|
|
143
|
+
return {
|
|
144
|
+
add: (userId, address) => {
|
|
145
|
+
return this.context.ready.then((axios) => {
|
|
146
|
+
return axios.post(`/api/v2/coremde-sale/checkin/add`, {
|
|
147
|
+
userId,
|
|
148
|
+
address
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
//date 传入格式为2019-8或者Date类型对象
|
|
153
|
+
list: (userId, date) => {
|
|
154
|
+
//if date is string
|
|
155
|
+
var yearMonth;
|
|
156
|
+
if (typeof date === 'string') {
|
|
157
|
+
yearMonth = date;
|
|
158
|
+
}
|
|
159
|
+
else if (typeof date === 'object') {
|
|
160
|
+
yearMonth = date.getFullYear() + '-' + (date.getMonth() + 1);
|
|
161
|
+
}
|
|
162
|
+
return this.context.ready.then((axios) => {
|
|
163
|
+
return axios.post(`/api/v2/coremde-sale/checkin/list`, {
|
|
164
|
+
userId,
|
|
165
|
+
yearMonth
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
122
171
|
}
|
|
123
172
|
exports.UserGateway = UserGateway;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -139,6 +139,10 @@ baseURL: "/"
|
|
|
139
139
|
| cpzxrobot().user.add | 添加用户 |
|
|
140
140
|
| cpzxrobot().user.update | 更新用户 |
|
|
141
141
|
| cpzxrobot().user.list | 列出用户(传入工厂) |
|
|
142
|
+
| cpzxrobot().user.approval.list | 获取用户审批列表,传入userId和status参数 |
|
|
143
|
+
| cpzxrobot().user.approval.count | 获取用户审批列表的数量,传入userId和status参数 |
|
|
144
|
+
| cpzxrobot().user.checkin.add | 添加用户签到记录,传入userId和address参数 |
|
|
145
|
+
| cpzxrobot().user.checkin.list | 列出用户签到记录,传入userId和date参数 |
|
|
142
146
|
|
|
143
147
|
### 工厂信息接口
|
|
144
148
|
|
package/user_gateway.ts
CHANGED
|
@@ -113,7 +113,7 @@ export class UserGateway extends Object {
|
|
|
113
113
|
|
|
114
114
|
async list(factory: Factory) {
|
|
115
115
|
var axios = await this.context.ready;
|
|
116
|
-
return axios.get("/api/v2/" + factory.id+"/users");
|
|
116
|
+
return axios.get("/api/v2/" + factory.id + "/users");
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
async mypermission() {
|
|
@@ -130,4 +130,55 @@ export class UserGateway extends Object {
|
|
|
130
130
|
var axios = await this.context.ready;
|
|
131
131
|
return axios.post(`/api/v2/user/${id}/avatar/add`, avatar);
|
|
132
132
|
}
|
|
133
|
+
|
|
134
|
+
get approval() {
|
|
135
|
+
return {
|
|
136
|
+
count: (id: number, status: any) => {
|
|
137
|
+
return this.context.ready.then((axios) => {
|
|
138
|
+
return axios.post(`/api/v2/coremde-sale/approval/count`, {
|
|
139
|
+
status,
|
|
140
|
+
userId: id
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
list: (id: number, status: any) => {
|
|
145
|
+
return this.context.ready.then((axios) => {
|
|
146
|
+
return axios.post(`/api/v2/coremde-sale/approval/list`, {
|
|
147
|
+
status,
|
|
148
|
+
userId: id
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
get checkin() {
|
|
156
|
+
return {
|
|
157
|
+
add: (userId: number,address: String) => {
|
|
158
|
+
return this.context.ready.then((axios) => {
|
|
159
|
+
return axios.post(`/api/v2/coremde-sale/checkin/add`, {
|
|
160
|
+
userId,
|
|
161
|
+
address
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
//date 传入格式为2019-8或者Date类型对象
|
|
166
|
+
list: (userId: number,date:any) => {
|
|
167
|
+
//if date is string
|
|
168
|
+
var yearMonth:string;
|
|
169
|
+
if(typeof date === 'string'){
|
|
170
|
+
yearMonth = date;
|
|
171
|
+
}else if (typeof date === 'object'){
|
|
172
|
+
yearMonth = date.getFullYear()+'-'+(date.getMonth()+1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return this.context.ready.then((axios) => {
|
|
176
|
+
return axios.post(`/api/v2/coremde-sale/checkin/list`, {
|
|
177
|
+
userId,
|
|
178
|
+
yearMonth
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
133
184
|
}
|