22 lines
946 B
Plaintext
22 lines
946 B
Plaintext
user_id = await get_user()
|
|
if not user_id:
|
|
return {"widgettype":"Error","options":{"title":"操作失败","message":'未登录',"cwidth":16,"cheight":9,"timeout":3}}
|
|
|
|
data = {
|
|
'id': getID(),
|
|
'project_id': params_kw.get('project_id', ''),
|
|
'repo_name': params_kw.get('repo_name', ''),
|
|
'repo_url': params_kw.get('repo_url', ''),
|
|
'default_branch': params_kw.get('default_branch', 'main'),
|
|
'local_path': params_kw.get('local_path', ''),
|
|
'org_id': params_kw.get('org_id', '0'),
|
|
'created_at': curDateString(),
|
|
}
|
|
|
|
try:
|
|
async with get_sor_context(request._run_ns, 'pipeline') as sor:
|
|
await sor.C('sd_project_repos', data)
|
|
return {"widgettype":"Message","options":{"title":"创建成功","message":"ok","cwidth":16,"cheight":9,"timeout":3,"user_data": data}}
|
|
except Exception as e:
|
|
return {"widgettype":"Error","options":{"title":"操作失败","message":str(e),"cwidth":16,"cheight":9,"timeout":3}}
|