Browse Source

feat: 补充提交

zhangweicheng 1 năm trước cách đây
mục cha
commit
35a00b537c
1 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 5 3
      modules/users/models/compilation_model.js

+ 5 - 3
modules/users/models/compilation_model.js

@@ -238,9 +238,11 @@ class CompilationModel extends BaseModel {
    * */
   async setExample(compilationId, example) {
     let data = [];
-    if (example) {
-      for (let projId of example) {
-        if (projId && projId.trim() !== "") data.push(projId.trim());
+    for (let projId of example) {
+      if (/^[0-9]+$/.test(projId)) {
+        data.push(parseInt(projId));
+      } else if (projId) {
+        data.push(projId);
       }
     }
     return await this.updateById(compilationId, { example: data });