Exemplo n.º 1
0
 def addFriend(self, uid, fid):
     sql = "insert into friend (uid, fid) values ('%d', '%d') " % (uid, fid)
     sql2 = "insert into friend (uid, fid) values ('%d', '%d') " % (fid,
                                                                    uid)
     DbServiceBase.getDB().query(sql)
     DbServiceBase.getDB().query(sql2)
     return True
Exemplo n.º 2
0
 def addGuild(self, guildid, guildname, guildchiefname):
     now = ffext.datetime_to_str(ffext.datetime_from_time(ffext.getTime()))
     sql = "insert into guildinfo (guildid, guildname, guildimage, guildnotice, guildlevel, guildexp, guildchiefname, lastdatecontribution, lastdate) \
             values ('%d', '%s', '', '', 1, 0, '%s', 0, '%s') " % (
         guildid, guildname, guildchiefname, now)
     DbServiceBase.getDB().query(sql)
     return True
Exemplo n.º 3
0
 def delBrother(self, brotherCtrl):
     sql = "delete from brother where bid=%d" % (brotherCtrl.bid)
     DbServiceBase.getDB().query(sql)
     for key, val in brotherCtrl.getBrotherMember().iteritems():
         sql = 'update player set brotherid =%d where uid = %d' % (0,
                                                                   val.uid)
         DbServiceBase.getDB().query(sql)
     return True
Exemplo n.º 4
0
 def addGmLog(self, gmParam, callback):
     if not gmParam:
         return
     sql = "INSERT INTO `gm_log` (`server_id`,`gm_user_id`,`gm_name`,`gm_cmd`,`from_type`,`result_val`,`raw_input`,`param`) \
           VALUES (%d, %d, '%s', %d, %d, %d, '%s', '%s') " % \
           (gmParam.server_id, gmParam.gm_user_id, gmParam.gm_name, gmParam.gm_cmd, gmParam.from_type, gmParam.result_val, \
            gmParam.raw_input, gmParam.param)
     DbServiceBase.getLogDB(GM_LOG_INDEX).query(sql, callback)
     return
Exemplo n.º 5
0
 def updateGuildRankWarInvitedOverTime(self,
                                       memberUid,
                                       overTime,
                                       callback=None):
     sql = "update guildmemberinfo set rankWarInvitedOverTime = %d where uid = %d " % (
         overTime, memberUid)
     ffext.dump("sql", sql)
     DbServiceBase.getDB().query(sql, callback)
     return True
Exemplo n.º 6
0
 def loadPlayerDetail(self, idList, cb):
     sql = 'select uid,name,job,gender,,level from player where uid in ('
     for k in range(len(idList)):
         if k == 0:
             sql += str(k)
         else:
             sql += ',' + str(k)
     sql += ')'
     DbServiceBase.getDB().query(sql, cb)
     return True
Exemplo n.º 7
0
 def addBrother(self, bid, uid1, uid2, uid3):
     sql = "insert into brother (bid, uid1, uid2, uid3, extra) values (%d, %d, %d, %d, '') " % (
         bid, uid1, uid2, uid3)
     ffext.dump(sql)
     DbServiceBase.getDB().query(sql)
     sql = 'update player set brotherid =%d where uid in (%d,%d,%d)' % (
         bid, uid1, uid2, uid3)
     DbServiceBase.getDB().query(sql)
     ffext.dump(sql)
     return True
Exemplo n.º 8
0
 def addMoneyLog(self, moneyParam, callback):
     if moneyParam:
         return
     sql = "INSERT INTO `money_log` (`server_id`,`account_id`,`player_id`,`player_name`,`op_type`,`op_sub_type`,`delta`, \
            `result_val`,`ext1`,`ext2`,`ext3`,`ext4`,`ext5`,`param`) \
           VALUES (%d, %d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s') " % \
           (moneyParam.server_id, moneyParam.account_id, moneyParam.player_id, moneyParam.player_name, \
            moneyParam.op_type, moneyParam.op_sub_type, moneyParam.delta, moneyParam.result_val, moneyParam.ext1, \
            moneyParam.ext2, moneyParam.ext3, moneyParam.ext4, moneyParam.ext5, moneyParam.param)
     DbServiceBase.getLogDB(MONEY_LOG_INDEX).query(sql, callback)
     return
Exemplo n.º 9
0
 def addItemLog(self, itemParam, callback):
     if not itemParam:
         return
     sql = "INSERT INTO `item_log` (`server_id`,`account_id`,`player_id`,`player_name`,`op_type`,`op_sub_type`,`delta`, \
            `result_val`,`ext1`,`ext2`,`ext3`,`ext4`,`ext5`,`param`) \
           VALUES (%d, %d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s') " % \
           (itemParam.server_id, itemParam.account_id, itemParam.player_id, itemParam.player_name, \
            itemParam.op_type, itemParam.op_sub_type, itemParam.delta, itemParam.result_val, itemParam.ext1, \
            itemParam.ext2, itemParam.ext3, itemParam.ext4, itemParam.ext5, itemParam.param)
     DbServiceBase.getLogDB(ITEM_LOG_INDEX).query(sql, callback)
     return
Exemplo n.º 10
0
 def addActionLog(self, actionParam, callback):
     if not actionParam:
         return
     sql = "INSERT INTO `action_log` (`server_id`,`account_id`,`player_id`,`player_name`,`op_type`,`op_sub_type`,`delta`, \
            `result_val`,`ext1`,`ext2`,`ext3`,`ext4`,`ext5`,`param`) \
           VALUES (%d, %d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s') " % \
           (actionParam.server_id, actionParam.account_id, actionParam.player_id, actionParam.player_name, \
            actionParam.op_type, actionParam.op_sub_type, actionParam.delta, actionParam.result_val, actionParam.ext1, \
            actionParam.ext2, actionParam.ext3, actionParam.ext4, actionParam.ext5, actionParam.param)
     DbServiceBase.getLogDB(ACTION_LOG_INDEX).query(sql, callback)
     return
Exemplo n.º 11
0
 def addUserLog(self, userParam, callback=None):
     if not userParam:
         return
     try:
         sql = "INSERT INTO `user_log` (`server_id`,`account_id`,`player_id`,`player_name`,`op_type`,`reason`,`from_ip`,`geo_x`,`geo_y`,`param`) \
               VALUES (%d, %d, %d, '%s', %d, %d, %d, %d, %d, '%s') " % \
               (userParam.server_id, userParam.account_id, userParam.player_id, userParam.player_name, userParam.op_type, userParam.reason, \
                userParam.from_ip, userParam.geo_x, userParam.geo_y, userParam.param)
         DbServiceBase.getLogDB(USER_LOG_INDEX).query(sql, callback)
     except:
         pass
     return
Exemplo n.º 12
0
    def contributionGuild(self, uid, guildID, tm, userContribution,
                          userDateContribution, guildExp,
                          lastDateContribution):
        now = ffext.datetime_to_str(ffext.datetime_from_time(tm))
        sql1 = "update guildinfo set guildexp = %d, lastdatecontribution = %d, lastdate = '%s' where guildid = %d limit 1" % (
            guildExp, lastDateContribution, now, guildID)
        sql2 = "update guildmemberinfo set contribute = %d, daycontribute = %d, lastdate = '%s' where uid = %d limit 1" % (
            userContribution, userDateContribution, now, uid)
        print(sql1)
        print(sql2)

        DbServiceBase.getDB().query(sql1)
        DbServiceBase.getDB().query(sql2)
        return True
Exemplo n.º 13
0
    def syncGetGuildMemberInfoList(self, callback):
        sql = "select guildinfo.guildid as guildid, guildmemberinfo.uid as uid, name, memberpost, contribute, guildname, guildimage, guildnotice, guildlevel, guildexp, guildchiefname, \
            lastdatecontribution, guildinfo.lastdate as guildinfolastdate from guildmemberinfo, player, guildinfo where player.uid = guildmemberinfo.uid and guildinfo.guildid = guildmemberinfo.guildid"

        ret = DbServiceBase.getDB().queryResult(sql)
        callback(ret)
        return
Exemplo n.º 14
0
 def addEnemy(self, uid, eid, typeId):
     sql = "insert into enemy (uid, eid, typeId) values ('%d', '%d', '%d') " % (
         uid, eid, typeId)
     DbServiceBase.getDB().query(sql)
     return True
Exemplo n.º 15
0
 def getGoldInfoList(self, callback):
     sql = "select uid, name, job, gold from player order by gold desc limit 20"
     DbServiceBase.getDB().query(sql, callback)
     return
Exemplo n.º 16
0
 def getRankInfoList(self, callback, job):
     sql = "select uid, name, job, level from player where job = %d order by level desc limit 20" % (
         job)
     DbServiceBase.getDB().query(sql, callback)
     return
Exemplo n.º 17
0
 def getGuildContributeInfoList(self, guildid, callback):
     sql = "select guildid, guildcontributeinfo.uid as uid, name, thiscontribute, contributedate from guildcontributeinfo, player where player.uid = guildcontributeinfo.uid and guildid = %d" % (
         guildid)
     DbServiceBase.getDB().query(sql, callback)
     return
Exemplo n.º 18
0
 def updateGuildRankWarApply(self, guildStatus, guildId, callback=None):
     sql = "update guildinfo set rankWarApplied = %d where guildid = %d " % (
         guildStatus, guildId)
     ffext.dump("sql", sql)
     DbServiceBase.getDB().query(sql, callback)
     return True
Exemplo n.º 19
0
 def delGuild(self, guildid):
     sql = "delete from guildmemberinfo where guildid = %d" % (guildid)
     sql2 = "delete from guildinfo where guildid = %d limit 1" % (guildid)
     DbServiceBase.getDB().query(sql)
     DbServiceBase.getDB().query(sql2)
     return True
Exemplo n.º 20
0
 def syncGetAllGuildInfo(self, callback):
     sql = "select guildid, guildname, guildimage, guildnotice, guildlevel, guildExp, guildchiefname, lastdatecontribution, lastdate from guildinfo order by guildlevel desc, guildExp desc"
     ret = DbServiceBase.getDB().queryResult(sql)
     callback(ret)
     return
Exemplo n.º 21
0
 def updateGuild(self, guildid, guildExp, guildlevel):
     sql1 = "update guildinfo set guildexp = %d, guildlevel = %d   where guildid = %d limit 1" % (
         guildExp, guildlevel, guildid)
     DbServiceBase.getDB().query(sql1)
     return True
Exemplo n.º 22
0
 def queryRankWarAllFightPower(self, guildId, status, callback=None):
     sql = "select fightpower from player, guildmemberinfo where guildmemberinfo.guildid = %d and guildmemberinfo.rankWarInvited = %d " \
           "and player.uid = guildmemberinfo.uid " %(guildId, status)
     ffext.dump("sql", sql)
     DbServiceBase.getDB().query(sql, callback)
     return True
Exemplo n.º 23
0
 def getLevelInfoList(self, callback):
     sql = "select uid, name, job, level from player order by level desc limit 20"
     DbServiceBase.getDB().query(sql, callback)
     return
Exemplo n.º 24
0
 def queryRankWarWinTeam(self, status, callback=None):
     sql = "select guildId from player where rankWarApplied = 1 and rankWarWin = %d" % (
         status)
     ffext.dump("sql", sql)
     DbServiceBase.getDB().query(sql, callback)
     return True
Exemplo n.º 25
0
 def getRankInfoList(self, callback):
     sql = "select guildid, name, createrName,empiric from guildinfo"
     DbServiceBase.getDB().query(sql, callback)
     return
Exemplo n.º 26
0
 def queryRankWarTeamMember(self, status, team1, team2, callback=None):
     sql = "select uid, guildid from guildmemberinfo where rankWarInvited = %d and guildid = %d or guildid = %d " % (
         status, team1, team2)
     ffext.dump("sql", sql)
     DbServiceBase.getDB().query(sql, callback)
     return True
Exemplo n.º 27
0
 def delFriend(self, uid, fid):
     sql = "delete from friend where uid = %d and fid = %d" % (uid, fid)
     sql2 = "delete from friend where uid = %d and fid = %d" % (fid, uid)
     DbServiceBase.getDB().query(sql)
     DbServiceBase.getDB().query(sql2)
     return True
Exemplo n.º 28
0
 def updateRankWarWin(self, status, guildId1, guildId2=0, callback=None):
     sql = "update guildinfo set rankWarWin = %d where guildid = %d or guildid = %d" % (
         status, guildId1, guildId2)
     ffext.dump("sql", sql)
     DbServiceBase.getDB().query(sql, callback)
     return True
Exemplo n.º 29
0
 def delEnemy(self, uid, eid, typeId):
     sql = "delete from enemy where uid = %d and eid = %d and typeId = %d" % (
         uid, eid, typeId)
     DbServiceBase.getDB().query(sql)
     return True
Exemplo n.º 30
0
 def syncGetAllGuildMember(self, callback):
     sql = "select guildid, guildmemberinfo.uid as uid, name,memberpost, contribute, daycontribute, lastdate,level, job  from guildmemberinfo, player where player.uid = guildmemberinfo.uid and player.delflag = 0"
     ret = DbServiceBase.getDB().queryResult(sql)
     #ffext.dump('syncGetAllGuildMember', sql)
     callback(ret)
     return