-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmoveMap.py
32 lines (30 loc) · 1.09 KB
/
moveMap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import MySQLdb
import json
con = MySQLdb.connect(host="223.4.87.9", user='root', passwd='2e4n5k2w2x', db='stcHong')
cursor = con.cursor()
sql = 'select mapid, count(*) from warMap where map_kind = 1 group by mapid'
cursor.execute(sql)
allMap = cursor.fetchall()
for aMap in allMap:
if aMap[1] < 10:
sql = 'select userid, map_kind from warMap where mapid = ' + str(aMap[0])
cursor.execute(sql)
data = cursor.fetchall()
maxnob = -1000
notEqual = []
for d in data:
sql = 'select nobility from operationalData where userid = '+str(d[0])
cursor.execute(sql)
res = cursor.fetchall()
if len(res) == 0:
continue
for n in res:
nob = n[0]
if nob > maxnob:
maxnob = nob
if nob != d[1]:
print d[0], nob, d[1]
sql = 'update warMap set map_kind = '+str(nob) +' where userid = ' + str(d[0]) + ' and mapid = ' + str(aMap[0])
print sql
cursor.execute(sql)
print "max", maxnob