Exemplo n.º 1
0
def update_releaseapplystate():
    user_id = session["user_data"]["user_id"]
    action_type = request.form.get('action_type')
    reject_reason = request.form.get('reject_reason') or None
    release_apply_id = request.form.get('release_apply_id')
    result = {'status': 1001, 'message': '请求失败'}
    try:
        user_data = User.objects.filter(id=user_id)[0]
    except:
        user_data = None
    try:
        release_apply_data = ReleaseApply.objects.filter(id=release_apply_id)[0]
    except:
        release_apply_data = None
    ISOTIMEFORMAT = '%Y-%m-%d %X'
    now_time = time.strftime(ISOTIMEFORMAT, time.localtime(time.time()))
    if user_data:
        if action_type == RA_USER_ACTION_OPERATOR_CLAIMED:
            release_apply_data.operator_id = user_id
            release_apply_data.save()
        if action_type == RA_USER_ACTION_OPERATOR_EXECUTED:
            release_apply_data.formal_at = now_time
            release_apply_data.save()
        if action_type == RA_USER_ACTION_DEVELOPER_BUILD_CONFIRMED or action_type == RA_USER_ACTION_TEAM_LEADER_BUILD_CONFIRMED:
            git_url = release_apply_data.application.git_url if release_apply_data.application else None
            if git_url:
                bulidqueue_data = BulidQueue(git_url=git_url, release_apply_id=release_apply_id)
                bulidqueue_data.save()
        if state_transfer(user_data, action_type, release_apply_data, reject_reason):
            result = {'status': 200, 'message': '请求成功'}
    return json.dumps(result)
Exemplo n.º 2
0
def update_releaseapplystate():
    user_id = session["user_data"]["user_id"]
    action_type = request.form.get('action_type')
    reject_reason = request.form.get('reject_reason') or None
    release_apply_id = request.form.get('release_apply_id')
    result = {'status': 1001, 'message': '请求失败'}
    try:
        user_data = User.objects.filter(id=user_id)[0]
    except:
        user_data = None
    try:
        release_apply_data = ReleaseApply.objects.filter(
            id=release_apply_id)[0]
    except:
        release_apply_data = None
    ISOTIMEFORMAT = '%Y-%m-%d %X'
    now_time = time.strftime(ISOTIMEFORMAT, time.localtime(time.time()))
    if user_data:
        if action_type == RA_USER_ACTION_OPERATOR_CLAIMED:
            release_apply_data.operator_id = user_id
            release_apply_data.save()
        if action_type == RA_USER_ACTION_OPERATOR_EXECUTED:
            release_apply_data.formal_at = now_time
            release_apply_data.save()
        if action_type == RA_USER_ACTION_DEVELOPER_BUILD_CONFIRMED or action_type == RA_USER_ACTION_TEAM_LEADER_BUILD_CONFIRMED:
            git_url = release_apply_data.application.git_url if release_apply_data.application else None
            if git_url:
                bulidqueue_data = BulidQueue(git_url=git_url,
                                             release_apply_id=release_apply_id)
                bulidqueue_data.save()
        if state_transfer(user_data, action_type, release_apply_data,
                          reject_reason):
            result = {'status': 200, 'message': '请求成功'}
    return json.dumps(result)
Exemplo n.º 3
0
        return json.dumps(result)
    is_manager = user_data.is_manager()
    if title and application_id and is_self_test:
        if release_apply_id:
            try:
                releaseapply_datas = ReleaseApply.objects.filter(id=release_apply_id)
                releaseapply_datas.update(title=title, tester=tester_id, producter=producter_id,
                                          release_type=release_type,
                                          risk_level=risk_level, application=application_id, deploy=deploy,
                                          planned_at=planned_at, wiki_url=wiki_url, jira_url=jira_url,
                                          is_self_test=is_self_test, update_model=update_model, attention=attention,
                                          update_content=update_content, memo=memo, version=version)

                releaseapply_data = releaseapply_datas[0]
                if is_manager:
                    state_transfer(user_data, RA_USER_ACTION_TEAM_LEADER_RESUBMIT, releaseapply_data)
                else:
                    state_transfer(user_data, RA_USER_ACTION_DEVELOPER_RESUBMIT, releaseapply_data)
                result = {'status': 200, 'message': '更新成功', 'data': {'release_apply_id': releaseapply_data.id}}
            except Exception, e:
                result = {'status': 1001, 'message': '数据库异常'}
        else:
            try:
                releaseapply_data = ReleaseApply(title=title, tester_id=tester_id, applier_id=user_id,
                                                 producter_id=producter_id, release_type=release_type,
                                                 risk_level=risk_level, application_id=application_id, deploy=deploy,
                                                 planned_at=planned_at, wiki_url=wiki_url, jira_url=jira_url,
                                                 is_self_test=is_self_test, update_model=update_model,
                                                 attention=attention, update_content=update_content, memo=memo, version=version)
                releaseapply_data.save()
                if is_manager:
Exemplo n.º 4
0
                                          application=application_id,
                                          deploy=deploy,
                                          planned_at=planned_at,
                                          wiki_url=wiki_url,
                                          jira_url=jira_url,
                                          is_self_test=is_self_test,
                                          update_model=update_model,
                                          attention=attention,
                                          update_content=update_content,
                                          memo=memo,
                                          version=version)

                releaseapply_data = releaseapply_datas[0]
                if is_manager:
                    state_transfer(user_data,
                                   RA_USER_ACTION_TEAM_LEADER_RESUBMIT,
                                   releaseapply_data)
                else:
                    state_transfer(user_data,
                                   RA_USER_ACTION_DEVELOPER_RESUBMIT,
                                   releaseapply_data)
                result = {
                    'status': 200,
                    'message': '更新成功',
                    'data': {
                        'release_apply_id': releaseapply_data.id
                    }
                }
            except Exception, e:
                result = {'status': 1001, 'message': '数据库异常'}
        else: