|
@@ -12,29 +12,48 @@ class TasksService extends CrudService {
|
|
|
}
|
|
|
|
|
|
async create(requestBody) {
|
|
|
- console.log(requestBody);
|
|
|
|
|
|
const mqid = uuid();
|
|
|
+ const pathStu = this.ctx.app.config.baseUrl + '/enrollments/dataimp?type=' + requestBody.type + '&content=' + requestBody.content;
|
|
|
+ const res = await this.ctx.curl(pathStu, {
|
|
|
+ method: 'GET',
|
|
|
+ dataType: 'json',
|
|
|
+ });
|
|
|
const newdata = { ...requestBody, mqid };
|
|
|
- const result = await this.ctx.model.Tasks.create(newdata);
|
|
|
- console.log(result);
|
|
|
- if (result) {
|
|
|
- const { mq } = this.ctx;
|
|
|
- if (mq) {
|
|
|
- const msg = requestBody.name + '上传文件' + requestBody.content;
|
|
|
- const parm = {
|
|
|
- durable: true,
|
|
|
- headers: {
|
|
|
- userid: requestBody.userid,
|
|
|
- mqid,
|
|
|
- } };
|
|
|
- console.log(parm);
|
|
|
- console.log(msg);
|
|
|
- await mq.topic('stu_import', requestBody.userid, msg, parm);
|
|
|
+ if (res) {
|
|
|
+ if (res.data.data.errcount === 0) {
|
|
|
+ newdata.status = '1';
|
|
|
} else {
|
|
|
- this.ctx.logger.error('!!!!!!没有配置MQ插件!!!!!!');
|
|
|
+ newdata.status = '2';
|
|
|
+ newdata.errmsg = res.data.data.errmsg;
|
|
|
}
|
|
|
}
|
|
|
+ const result = await this.ctx.model.Tasks.create(newdata);
|
|
|
+ if (result) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|