def send_welfare(request): print request.POST data = request.POST.copy() print data server = get_server_by_request(request) data["server_id"] = server.id data_urlencode = urllib.urlencode(data) url = "%s/add_item?" % server.gm_url url_get = url + data_urlencode result,dt = url_request_handler(url_get) if result: response = dt else: msg_dict = dt ctxt = RequestContext(request,msg_dict) return render_to_response("error.html", ctxt) a = response.read() print a,type(a) res = simplejson.loads(a) resdata = { "ret":res["ret"], "msg":res["msg"], } ctxt = RequestContext(request,resdata) return render_to_response("result.html")
def search_recharge(request): data = request.POST.copy() server = get_server_by_request(request) data["server_id"] = server.id data_urlencode = urllib.urlencode(data) url = "%s/check_recharge_info?" % server.gm_url url_get = url + data_urlencode result,dt = url_request_handler(url_get) if result: response = dt else: msg_dict = dt ctxt = RequestContext(request,msg_dict) return render_to_response("error.html", ctxt) a = response.read() print "response:",a, type(a) res = simplejson.loads(a) print res["data"],type(res["data"]) if not res.has_key("data"): res["data"] = [] resdata = { "ret":res["ret"], "msg":res["msg"], "orderinfos":res["data"] } ctxt = RequestContext(request,resdata) return render_to_response("recharge/rechargeinfo.html", ctxt)
def send_mail(request): ''' 发送系统邮件 ''' server = get_server_by_request(request) #userID = request.POST["playerIdList"] data = dict(request.POST.items()) data["severId"] = server.id data["playerIdList"] = ','.join(data["playerIdList"].split("\r\n")) data_urlencode = urllib.urlencode(data) url = "%s/send_mail/?" % server.gm_url url_get = url + data_urlencode result, dt = url_request_handler(url_get) if result: response = dt else: msg_dict = dt ctxt = RequestContext(request, msg_dict) return render_to_response("error.html", ctxt) res = simplejson.loads(response.read()) userCount = len(data["playerIdList"].split(",")) countList = range(1, userCount + 1) if data["playerIdList"] == "all": all = True else: all = False resdata = {"all": all, "userCount": userCount, "data": res} ctxt = RequestContext(request, resdata) return render_to_response("mail/send_result.html", ctxt)
def get_mail(request): ''' 查看玩家邮件 ''' server = get_server_by_request(request) data = dict(request.POST.items()) data["playerId"] = ','.join(data["playerId"].split("\r\n")) data["server_id"] = server.id data_urlencode = urllib.urlencode(data) print data_urlencode url = "%s/get_mail/?" % server.gm_url url_get = url + data_urlencode result, dt = url_request_handler(url_get) if result: response = dt else: msg_dict = dt ctxt = RequestContext(request, msg_dict) return render_to_response("error.html", ctxt) res = simplejson.loads(response.read()) resdata = { "ret": res["success"], "msg": res["message"], "mails": res["data"], } ctxt = RequestContext(request, resdata) return render_to_response("mail/get_result.html", ctxt)
def search_action(request): userID = request.POST.get("player_id") print request.POST, "***********" data = request.POST.copy() server = get_server_by_request(request) data["server_id"] = server.id serverID = server.id data_urlencode = urllib.urlencode(data) url = "%s/check_player_action?" % server.gm_url url_get = url + data_urlencode result, dt = url_request_handler(url_get) if result: response = dt else: msg_dict = dt ctxt = RequestContext(request, msg_dict) return render_to_response("error.html", ctxt) a = response.read() print "response:", a, type(a) res = simplejson.loads(a) if not res.has_key("data"): res["data"] = [] resdata = { "ret": res["ret"], "msg": res["msg"], "playeractions": res["data"] } ctxt = RequestContext(request, resdata) return render_to_response("action/search_action.html", ctxt)
def search(request): serverID = request.POST.get("server_id") userID = request.POST.get("player_id") data = request.POST.copy() server = get_server_by_request(request) data["server_id"] = server.id data["player_id"] = ','.join(data["player_id"].split("\r\n")) data_urlencode = urllib.urlencode(data) url = "%s/check_player_info?" % server.gm_url url_get = url + data_urlencode print url_get result, dt = url_request_handler(url_get) if result: response = dt else: msg_dict = dt ctxt = RequestContext(request, msg_dict) return render_to_response("error.html", ctxt) print response a = response.read() print "response:", a, type(a) res = simplejson.loads(a) if res.has_key("data"): canBan = check_func(request, FUNC_USER_BAN) canGag = check_func(request, FUNC_USER_GAG) resdata = { "serverID": serverID, "userID": userID, "canBan": canBan, "canGag": canGag, "ret": res["ret"], "msg": res["msg"], "playerinfos": res["data"] } ctxt = RequestContext(request, resdata) return render_to_response("user/search.html", ctxt) else: return render_to_response("result.html")
def search_server(request): data = request.POST.copy() print data server = get_server_by_request(request) data["server_id"] = server.id data_urlencode = urllib.urlencode(data) url = "%s/check_server_info_timezone?" % server.gm_url url_get = url + data_urlencode print url_get result, dt = url_request_handler(url_get) if result: response = dt else: msg_dict = dt ctxt = RequestContext(request, msg_dict) return render_to_response("error.html", ctxt) a = response.read() res = simplejson.loads(a) print res if not res.has_key("data"): res["data"] = [] for data in res["data"]: dic = data["level_array"] lis = sorted(dic.keys()) for key in lis: if not dic.has_key(str(i)): dic[str(i)] = 0 lis.append(dic[str(i)]) data["level_array"] = lis resdata = { "ret": res["ret"], "msg": res["msg"], "serverinfos": res["data"] } ctxt = RequestContext(request, resdata) return render_to_response("server/info_with_timezone.html", ctxt)