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}} data = {'id': rec_id, 'updated_at': curDateString()} if 'project_id' in params_kw: data['project_id'] = params_kw['project_id'] if 'iteration_name' in params_kw: data['iteration_name'] = params_kw['iteration_name'] if 'iteration_type' in params_kw: data['iteration_type'] = params_kw['iteration_type'] if 'scope' in params_kw: data['scope'] = params_kw['scope'] if 'priority' in params_kw: data['priority'] = params_kw['priority'] 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.U('sd_iterations', data) 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}}