user_id = await get_user() if not user_id: return {"widgettype":"Error","options":{"title":"操作失败","message":'未登录',"cwidth":16,"cheight":9,"timeout":3}} rec_id = params_kw.get('id', '') if not rec_id: return {"widgettype":"Error","options":{"title":"操作失败","message":'缺少id',"cwidth":16,"cheight":9,"timeout":3}} try: async with get_sor_context(request._run_ns, 'pipeline') as sor: recs = await sor.sqlExe("SELECT project_id FROM sd_iterations WHERE id=${id}$", {"id": rec_id}) await sor.sqlExe("COMMIT", {}) pid = getattr(recs[0], 'project_id', '') if recs else '' ok, emsg = await check_project_owner(pid, user_id, sor) if not ok: return {"widgettype":"Error","options":{"title":"操作失败","message":emsg,"cwidth":16,"cheight":9,"timeout":3}} await sor.D('sd_iterations', {'id': rec_id}) return {"widgettype":"Message","options":{"title":"操作成功","message":"ok","cwidth":16,"cheight":9,"timeout":3}} except Exception as e: return {"widgettype":"Error","options":{"title":"操作失败","message":str(e),"cwidth":16,"cheight":9,"timeout":3}}