Ejemplo n.º 1
0
def agreeInviteJoinTeam(request):
    response_data = {}
    user = User.objects.get(id_code=request.POST['id_code'])
    team = Team.objects.get(manager=user,status=1)
    msg = Message.objects.get(id_code=request.POST['msg_id_code'])
    player = request.user.player
    if Logics.checkNum(team,request.POST['r-number']):
        response_data['success'] = 0
        response_data['message'] = '号码已存在'
        return HttpResponse(json.dumps(response_data),content_type="application/json")
    result = Logics.joinTeam(player,team,request.POST['r-number'],request.POST['r-position'])
    if result:
        response_data['success'] = 1
        response_data['message'] = '保存成功'
        MsgLogics.readMsg(msg)
    return HttpResponse(json.dumps(response_data),content_type="application/json")
Ejemplo n.º 2
0
def changeNumAndPos(request):
    response_data = {}
    team = Team.objects.get(manager=request.user,status=1)
    player = Player.objects.get(id_code=request.POST['id_code'])
    if player is None or player.team != team:
        response_data['success'] = 0
        response_data['message'] = '修改失败'
    else:
        if Logics.checkNum(team,request.POST['number']):
            response_data['success'] = 0
            response_data['message'] = '号码已存在'
        else:
            result = Logics.changeNumAndPos(player,request.POST['number'],request.POST['position'])
            if result :
                response_data['success'] = 1
                response_data['message'] = '修改成功'
    return HttpResponse(json.dumps(response_data),content_type="application/json")