def set_game_web_status(ucenter='android', status=0): white_ip_list = WhiteIp.query(condition="ucenter='%s'" % ucenter) ip_list = [] for white_ip in white_ip_list: ip_list.append(white_ip.ip) info = {} timestamp = int(time.time() * 1000) info["timestamp"] = timestamp info["sign"] = md5mgr.mkmd5fromstr("%s%s" % (timestamp, "gCvKaE0tTcWtHsPkbRdE")) info["status"] = status info["id"] = 5 if ucenter == "android" else 6 info["whiteList"] = ",".join(ip_list) if ucenter == "android": host = "wapi.android.3qchibi.com" elif ucenter == "ios": host = "wapi.ios.3qchibi.com" url = "http://" + host + ":8088//webApi//setServerStatus.do" success, ret_val = http_util.request(url, info) if success: logging.info(ret_val) result = json.loads(ret_val) return result.get("rc") == 1000
def fill_payment_order(ucenter, order_id, partner_order_id): info = {} timestamp = int(time.time() * 1000) info["timestamp"] = timestamp info["sign"] = md5mgr.mkmd5fromstr( "%s%s%s%s" % (timestamp, order_id, partner_order_id, "$#@$%%eweqwlkfef")) info["orderNo"] = order_id info["partnerOrderId"] = partner_order_id if ucenter == "android": host = "wapi.android.3qchibi.com" elif ucenter == "wapi" or ucenter == "bapi": host = "wapi.ldsg.tkp.wartown.com.tw" elif ucenter == "ios": host = "wapi.ios.3qchibi.com" url = "http://" + host + ":8088//webApi/fillOrder.do" logging.debug(url) success, ret_val = http_util.request(url, info) logging.debug(ret_val) if success: logging.info(ret_val) result = json.loads(ret_val) return result.get("rc") == 1000
def get_partner_user_id(self, username): url = "http://42.62.4.167:9015/web/api/sdk/third/1/queryuidbyloginname" success, ret_val = http_util.request(url, {"param": username}) if success: try: _ = json.loads(ret_val) return None except: return ret_val
def sync_server_status(server_zone): server_zone = int(server_zone) host = server_zone_api_url_map[server_zone] url = "http://" + host + ":8088//webApi//updateConfigs.do" success, ret_val = http_util.request(url, {}) if success: result = json.loads(ret_val) success = result.get("rc") == 1000 logging.debug("success sync url[%s], result[%s]" % (url, success)) return success
def block_user(server_id, user_id, due_time): info = {} info["userId"] = user_id info["dueTime"] = due_time server = server_business.get_server(server_id=server_id) url = "http://" + server.server_host + ":8088//gameApiAdmin/banUser.do" success, ret_val = http_util.request(url, info) if success: result = json.loads(ret_val) return result.get("rt") == 1000 return False
def update_user_vip_level(server_id, user_id, vip_level): info = {} info["userId"] = user_id info["vipLevel"] = vip_level server = server_business.get_server(server_id=server_id) url = "http://" + server.server_host + ":8088//gameApiAdmin/assignVipLevel.do" success, ret_val = http_util.request(url, info) if success: result = json.loads(ret_val) return result.get("rt") == 1000 return False
def send_notice_to_server(self, server_id, content): info = {} timestamp = int(time.time() * 1000) info["timestamp"] = timestamp info["sign"] = md5mgr.mkmd5fromstr("%s%s%s" % (content, timestamp, "gCvKaE0tTcWtHsPkbRdE")) info["partnerIds"] = "all" info["content"] = content server = server_business.get_server(server_id=server_id) url = "http://" + server.server_host + ":8088//gameApi/sendSysMsg.do" success, ret_val = http_util.request(url, info) if success: result = json.loads(ret_val) return result.get("rt") == 1000
def fill_payment_order(ucenter, order_id, partner_order_id): info = {} timestamp = int(time.time() * 1000) info["timestamp"] = timestamp info["sign"] = md5mgr.mkmd5fromstr("%s%s%s%s" % (timestamp, order_id, partner_order_id, "$#@$%%eweqwlkfef")) info["orderNo"] = order_id info["partnerOrderId"] = partner_order_id if ucenter == "android": host = "wapi.android.3qchibi.com" elif ucenter == "wapi" or ucenter == "bapi": host = "wapi.ldsg.tkp.wartown.com.tw" elif ucenter == "ios": host = "wapi.ios.3qchibi.com" url = "http://" + host + ":8088//webApi/fillOrder.do" logging.debug(url) success, ret_val = http_util.request(url, info) logging.debug(ret_val) if success: logging.info(ret_val) result = json.loads(ret_val) return result.get("rc") == 1000
def add_activity(server_id,activity_info): server = Server.load(server_id=server_id) url = "http://" + server.server_host + ":8088//gameApi//modifyActivity.do" _, ret_val = http_util.request(url, activity_info) return ret_val
def add_activity(server_id, activity_info): server = Server.load(server_id=server_id) url = "http://" + server.server_host + ":8088//gameApi//modifyActivity.do" _, ret_val = http_util.request(url, activity_info) return ret_val