bugfix
This commit is contained in:
parent
892f0c5002
commit
dfb0794ee2
@ -97,7 +97,7 @@
|
||||
"url":"{{entire_url('../api/llm_status_update.dspy')}}",
|
||||
"params":{
|
||||
"id":"${id}",
|
||||
"status":"published"
|
||||
"action":"published"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -115,7 +115,7 @@
|
||||
"url":"{{entire_url('../api/llm_status_update.dspy')}}",
|
||||
"params":{
|
||||
"id":"${id}",
|
||||
"status":"unpublished"
|
||||
"action":"unpublished"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
|
||||
result = {'success': False, 'message': ''}
|
||||
|
||||
action = params_kw.action
|
||||
try:
|
||||
dbname = get_module_dbname('llmage')
|
||||
record_id = params_kw.get('id')
|
||||
status = params_kw.get('status')
|
||||
|
||||
action = params_kw.get('status')
|
||||
if not record_id:
|
||||
result['message'] = '缺少id'
|
||||
elif status not in ('published', 'unpublished'):
|
||||
elif action not in ('published', 'unpublished'):
|
||||
result['message'] = '无效的状态值'
|
||||
else:
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
await sor.U('llm', {'id': record_id, 'status': status})
|
||||
await sor.U('llm', {'id': record_id, 'status': action})
|
||||
result['success'] = True
|
||||
result['message'] = '上架成功' if status == 'published' else '下架成功'
|
||||
result['message'] = '上架成功' if action == 'published' else '下架成功'
|
||||
except Exception as e:
|
||||
result['message'] = str(e)
|
||||
|
||||
return json.dumps(result, ensure_ascii=False, default=str)
|
||||
return {
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"otext": result['message'],
|
||||
"i18n": true
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user