Beispiel #1
0
 def insertMysqlset(self):
     if self.tup_value.has_key("OrderID"):
         orderid = self.tup_value["OrderID"]
     else:
         orderid = None
     uuid = self.tup_value["UUID"]
     amount = self.tup_value["Amount"]
     gameid = self.tup_value["GameID"]
     channelid = self.tup_value["ChannelID"]
     timestamp = self.timefield
     time_struct = time.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
     timestamp = time.strftime("%Y%m%d%H%M%S", time_struct)
     if self.tup_value.has_key("OS"):
         os = self.tup_value["OS"]
     else:
         os = ''
     if not orderid:
         sql = """INSERT INTO settlement(uuid,amount,gameid,channelid,os,date) VALUES ("%s", "%s", "%s","%s","%s","%s")""" % (
             uuid, amount, gameid, channelid, os, timestamp)
     else:
         sql = """INSERT INTO settlement(orderid,uuid,amount,gameid,channelid,os,date) VALUES ("%s","%s", "%s", "%s","%s","%s","%s")""" % (
             orderid, uuid, amount, gameid, channelid, os, timestamp)
     log.debug("付费sql为:%s" % (sql))
     mysql_operation_obj = mysql_operation('logserver')
     mysql_operation_obj.payset_insert(sql)
Beispiel #2
0
 def behavior(self):
     ret = super(GameHandleLogic, self).behavior()
     be_type = 'game'
     strjson = str({'GameID': ret["game_id"], 'ChannelID': ret["channel"]})
     sql = """INSERT INTO behavior(uuid,type, strjson, date) VALUES ("%s", "%s", "%s", "%s")""" % (
         ret["uuid"], be_type, strjson, ret["timestamp"])
     log.debug(u"佣金行为sql为:%s" % (sql))
     mysql_operation_obj = mysql_operation('logserver')
     mysql_operation_obj.mysql_insert(sql)
Beispiel #3
0
 def behavior(self):
     ret = super(PayHandleLogic, self).behavior()
     amount = self.tup_value['Amount']
     be_type = 'pay'
     strjson = str({'GameID': ret["game_id"], 'ChannelID': ret["channel"], 'Amount': amount})
     sql = """INSERT INTO behavior(uuid,type, strjson, date) VALUES ("%s", "%s", "%s", "%s")""" % (ret["uuid"], be_type, strjson, ret["timestamp"])
     log.debug(u"付费行为sql为:%s" % (sql))
     mysql_operation_obj = mysql_operation('logserver')
     mysql_operation_obj.mysql_insert(sql)
def insertpublic(table_name, values, column):
    newvalues = []
    for value in values:
        newvalues.append('"%s"' % (value))
    newvalue = ','.join(newvalues)
    insert_rbd = "INSERT INTO %s(%s) VALUES (%s)" % (table_name, column,
                                                     newvalue)
    log.debug(insert_rbd)
    mysql_operation_rdb_obj = mysql_operation('loginput')
    mysql_operation_rdb_obj.mysql_insert(insert_rbd)
 def logWriteMysql(self):
     ret = self.tup_value
     timestamp = self.timefield
     time_struct = time.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
     timestamp = time.strftime("%Y%m%d%H%M%S", time_struct)
     sql = """INSERT INTO shortlink(ip,url,code,createTime,os,useragent) VALUES ("%s", "%s", "%s", "%s","%s","%s")""" % (
         ret["ip"], ret["url"], ret["code"], timestamp, ret["os"],
         ret["useragent"])
     log.debug("用户行为执行的sql语句为:%s" % (sql))
     mysql_operation_obj = mysql_operation('logserver')
     mysql_operation_obj.mysql_insert(sql)
Beispiel #6
0
 def proxylog(self):
     paymode = self.tup_value["PayMode"]
     log.debug(u"判断是否为代理充值")
     if paymode == "DLPAY":
        ret = self.behavior()
        ret['amount'] = self.tup_value["Amount"]
        ret['paymode'] = paymode
        sql = """INSERT INTO proxylog(uuid,amount, gameid, channelid,timestamp,paymode) VALUES ("%s", "%s", "%s", "%s","%s","%s")""" % (ret["uuid"], ret["amount"], ret["game_id"],ret["channel"],ret["timestamp"],ret["paymode"])
        log.debug("用户行为执行的sql语句为:%s" % (sql))
        #print sql
        mysql_operation_obj = mysql_operation('logserver')
        mysql_operation_obj.mysql_insert(sql)
 def insertMysqlBindphone(self):
     uuid = self.tup_value["uuid"]
     phone = self.tup_value["phone"]
     channelid = self.tup_value["channelid"]
     gameid = self.tup_value["gameid"]
     timestamp = self.timefield
     time_struct = time.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
     timestamp = time.strftime("%Y%m%d%H%M%S", time_struct)
     sql = """INSERT INTO bindphone(uuid,phone, channelid, gameid,date) VALUES ("%s", "%s", "%s", "%s","%s")""" % (
         uuid, phone, channelid, gameid, timestamp)
     log.debug("绑定手机sql为:%s" % (sql))
     mysql_operation_obj = mysql_operation('logserver')
     mysql_operation_obj.mysql_insert(sql)
Beispiel #8
0
 def behavior(self):
     ret = super(LoginHandleLogic, self).behavior()
     account_key = self.handle_key_obj.account_key("LOGINACCOUNT")
     field = self.handle_field_obj.channel_type("UUID")
     be_type = 'login'
     if not self.redis_obj.hexists(account_key, field):
         be_type = 'register'
     strjson = str({'GameID': ret["game_id"], 'ChannelID': ret["channel"]})
     sql = """INSERT INTO behavior(uuid,type, strjson, date) VALUES ("%s", "%s", "%s", "%s")""" % (
         ret["uuid"], be_type, strjson, ret["timestamp"])
     log.debug("用户行为执行的sql语句为:%s" % (sql))
     #print sql
     mysql_operation_obj = mysql_operation('logserver')
     mysql_operation_obj.mysql_insert(sql)
Beispiel #9
0
 def insertMysqlSysscore(self):
     if self.tup_value["androidFlag"] == 0:
         timestamp = self.timefield
         time_struct = time.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
         timestamp = time.strftime("%Y%m%d%H%M%S", time_struct)
         game_id = "ENG-HJDWC-001"
         gamekindId = self.tup_value["gameKindId"]
         uuid = self.tup_value['uuid']
         sysscore = -self.tup_value['addscore']
         sql = """INSERT INTO sysscore(uuid,gameid, gamekindid, sysscore,timestamp) VALUES ("%s", "%s", "%s", "%s","%s")""" % (
             uuid, game_id, gamekindId, sysscore, timestamp)
         log.debug(u"系统输赢sql为:%s" % (sql))
         mysql_operation_obj = mysql_operation('logserver')
         mysql_operation_obj.mysql_insert(sql)
Beispiel #10
0
 def insertMysqlRegister(self):
     '''gameid, channel, devicetype,IMEI, mac,IPv4,os, uuid, userid, timestamp, Latitude":"0.0","Longitude":"0.0"'''
     if self.tup_value["DeviceInfo"].has_key('GameID'):
         gameid = self.tup_value["DeviceInfo"]["GameID"]
     else:
         gameid = ''
     if self.tup_value["DeviceInfo"].has_key("Channel"):
         channel = self.tup_value["DeviceInfo"]["Channel"]
     else:
         channel = ''
     if self.tup_value["DeviceInfo"].has_key("DeviceType"):
         devicetype = self.tup_value["DeviceInfo"]["DeviceType"]
     else:
         devicetype = ''
     if self.tup_value["DeviceInfo"].has_key("IMEI"):
         imei = self.tup_value["DeviceInfo"]["IMEI"]
     else:
         imei = ''
     if self.tup_value["DeviceInfo"].has_key('MAC'):
         mac = self.tup_value["DeviceInfo"]["MAC"]
     else:
         mac = ''
     if self.tup_value["DeviceInfo"].has_key("IPv4"):
         ipv4 = self.tup_value["DeviceInfo"]["IPv4"]
     else:
         ipv4 = ''
     os = self.tup_value["DeviceInfo"]["OS"]
     uuid = self.tup_value["UUID"]
     if self.tup_value.has_key("Username"):
         username = self.tup_value["Username"]
     else:
         username = ''
     if self.tup_value["DeviceInfo"].has_key("Longitude"):
         latitude = self.tup_value["DeviceInfo"]["Longitude"]
     else:
         latitude = ''
     if self.tup_value["DeviceInfo"].has_key("Latitude"):
         longitude = self.tup_value["DeviceInfo"]["Latitude"]
     else:
         longitude = ''
     timestamp = self.timefield
     time_struct = time.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
     timestamp = time.strftime("%Y%m%d%H%M%S", time_struct)
     sql = """INSERT INTO register(gameid,channel,devicetype,imei,mac,ipv4,os,uuid,username,latitude,longitude,timestamp) VALUES ("%s", "%s", "%s", "%s","%s","%s","%s","%s","%s","%s","%s","%s")""" % (
         gameid, channel, devicetype, imei, mac, ipv4, os, uuid, username,
         latitude, longitude, timestamp)
     log.debug(sql)
     mysql_operation_obj = mysql_operation('logserver')
     mysql_operation_obj.mysql_insert(sql)