Quellcode durchsuchen

Merge branch 'master' of https://gogs.tjp.com.cn/maoming/python-fastapi-mm-zhcs-yj-api

libushang vor 1 Woche
Ursprung
Commit
5ddc7ab2aa
2 geänderte Dateien mit 14 neuen und 13 gelöschten Zeilen
  1. 13 12
      routers/api/pattern/classification.py
  2. 1 1
      routers/api/pattern/template.py

+ 13 - 12
routers/api/pattern/classification.py

@@ -55,7 +55,7 @@ def read_save_excel_img(file_path):
         w, h = img.size  # 像素宽高
         # print(f'第1张图片:宽={w}px, 高={h}px')
         name = new_guid()
-        img.save(f'{name}.png')
+        img.save(f'/data/upload/mergefile/uploads/{name}.png')
 
         data[f'{col0}-{row0}']={"size":[h, w],"image":f'{name}.png'}
     return data
@@ -116,16 +116,17 @@ async def create_contact(
                 import_status  = False
                 msg =  f'\n行<{row + 1}>分类名称不能为空<{name}>'
                 code = 500
-            value = sheet.cell(row, 1).value
-            if value == '':
-                import_status  = False
-                msg =  f'\n行<{row + 1}>分类值不能为空<{value}>'
-                code = 500
+            value = 'marker'
+            # value = sheet.cell(row, 1).value
+            # if value == '':
+            #     import_status  = False
+            #     msg =  f'\n行<{row + 1}>分类值不能为空<{value}>'
+            #     code = 500
             try:
-                img_data=img_list[f'2-{row}']
+                img_data=img_list[f'1-{row}']
             except:
                 import_status = False
-                msg = f'\n行<{row + 1}>图片不能为空<{value}>'
+                msg = f'\n行<{row + 1}>图片不能为空<{name}>'
                 code = 500
                 return JSONResponse(status_code=code, content={
                     "code": code,
@@ -135,12 +136,12 @@ async def create_contact(
             new_classification = TpPatternClassification(
                 classification_id=new_guid(),
                 template_id=template_id,
-                name=body['name'],
-                value=body['value'],
-                order_num=0,
+                name=name,
+                value=value,
+                order_num=999,
                 visible='1',
                 image=img_data['image'],
-                icon=body['value'],
+                icon=value,
                 size=img_data['size'],
                 create_by=user_id
             )

+ 1 - 1
routers/api/pattern/template.py

@@ -84,7 +84,7 @@ async def create_contact(
             template_id=new_guid(),
             name=name,
             value=value,
-            order_num=0,
+            order_num=999,
             visible='1',
             create_by = user_id
         )