展厅登记支持在线填写值班人并记录编辑日志
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import asyncio
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import uuid
|
||||
@@ -261,12 +262,25 @@ def convert_package(raw):
|
||||
|
||||
def install(app, get_db, current_user, photo_root, visible_clause):
|
||||
from .hall_log import snapshot as hall_log_snapshot
|
||||
from .hall_log import write_cell as hall_log_write
|
||||
|
||||
@app.get('/api/center/hall-log')
|
||||
async def hall_log(refresh: bool = False, viewer=Depends(current_user)):
|
||||
"""赋能中心展厅使用登记(实时读取金山文档在线表格)。"""
|
||||
return await hall_log_snapshot(force=refresh)
|
||||
|
||||
class HallLogDutyIn(BaseModel):
|
||||
row: int = Field(ge=2, le=502)
|
||||
value: str = Field(default='', max_length=200)
|
||||
|
||||
@app.post('/api/center/hall-log/duty')
|
||||
async def hall_log_duty(payload: HallLogDutyIn, viewer=Depends(current_user)):
|
||||
"""填写展厅登记的"值班人"列,写回金山文档并留编辑日志。"""
|
||||
editor = viewer.get('display_name') or viewer.get('username') or viewer['id']
|
||||
await asyncio.to_thread(hall_log_write, os.getenv('WORKLOG_HALL_LOG_LINK_ID') or 'cnC7HwRAxKf9', payload.row, 8, payload.value.strip(), editor)
|
||||
await hall_log_snapshot(force=True)
|
||||
return {'ok': True, 'row': payload.row, 'value': payload.value.strip(), 'editor': editor}
|
||||
|
||||
@app.post('/api/center/materials')
|
||||
async def upload_material(request:Request,db=Depends(get_db),viewer=Depends(current_user)):
|
||||
raw=bytearray()
|
||||
|
||||
Reference in New Issue
Block a user