Exemple #1
0
def load_report(request):
    if request.META.get("REQUEST_METHOD") == 'GET':
        form = LoadReportForm
        return render(request, 'base/load_report.html', {'form': form, 'heading': 'Upload Your WCL log'})

    elif request.META.get("REQUEST_METHOD") == 'POST':
        post_data = request.POST
        code = post_data.get("code")
        result, msg = BaseService.load_fight_data(code=code)
        if result:
            return redirect('/service/')
        else:
            return render(request, 'base/error.html', {'error': msg})
Exemple #2
0
 def post(self, request, *args, **kwargs):
     """
     新增日志
     :param request:
     :param args:
     :param kwargs:
     :return:
     """
     json_str = request.body.decode('utf-8')
     request_data_dict = json.loads(json_str)
     report_code = request_data_dict.get('code', '')
     raid = request_data_dict.get('raid', '')
     if not report_code:
         code, msg, data = 30000, 'code is required', ''
         return api_response(code, msg, data)
     if not raid:
         code, msg, data = 30000, 'raid is required', ''
         return api_response(code, msg, data)
     result, msg = BaseService.load_fight_data(code=report_code, raid=raid)
     if result:
         code, msg, data = 20000, '', {}
     else:
         code, msg, data = 30000, msg, {}
     return api_response(code, msg, data)
Exemple #3
0
def submit_load(request, *args, **kwargs):
    code = kwargs.get("code")
    BaseService.load_fight_data(code=code)
    return redirect('/service/')