Skip to content

Commit 0628d60

Browse files
committed
get friend
1 parent ed6fcfd commit 0628d60

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

root.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4028,7 +4028,6 @@ def warresult2(uid):
40284028
fails += 1
40294029
i -= 1
40304030
if fails == 3:
4031-
print "weak mode"
40324031
weakMode = True
40334032
#if in weak Mode just lost defence 5%
40344033
if weakMode:
@@ -5895,16 +5894,18 @@ def productall(self,user_id,city_id):
58955894
except InvalidRequestError:
58965895
return dict(id=0)
58975896
@expose('json')
5898-
def getfriendall(self,user_id,user_kind,type):#type=0 normal;type=1 leiji
5897+
def getfriendall(self,user_id,friend_num,type):#type=0 normal;type=1 leiji
5898+
print "getfriend "+str(user_id)
58995899
uid = int(user_id)
59005900
type = int(type)
5901+
friend_num = int(friend_num)
59015902
u = checkopdata(uid)
59025903
cornadd = 0
59035904
flag = 0
59045905
bonus = 0
59055906
k = 0#the number of the friend
59065907
try:
5907-
notvisited = DBSession.query(Papayafriend).filter_by(uid=uid).filter_by(visited=0).all()
5908+
notvisited = DBSession.query(Papayafriend).filter_by(uid=uid).filter_by(visited=0).filter("lev > 0").all()
59085909
if notvisited == None or len(notvisited)==0:
59095910
return dict(id=0, reason="do not have not visited friend")
59105911
card = DBSession.query(Card).filter_by(uid=uid).one()
@@ -5935,9 +5936,8 @@ def getfriendall(self,user_id,user_kind,type):#type=0 normal;type=1 leiji
59355936
temp_cae = temp_cae + 2
59365937
for f in notvisited:
59375938
k += 1
5938-
cornadd += 100 + bonus
59395939
f.visited = 1
5940-
5940+
cornadd = (100 + bonus)*friend_num
59415941
else:
59425942
return dict(id=0, reason="cae or card invalid")
59435943
else:#cae=10
@@ -5950,6 +5950,7 @@ def getfriendall(self,user_id,user_kind,type):#type=0 normal;type=1 leiji
59505950
cornadd += 100 + bonus + 5*k
59515951
k += 1
59525952
f.visited = 1
5953+
cornadd = (100+bonus)*friend_num + 5*(friend_num+1)*friend_num/2
59535954
if flag == 1:
59545955
u.corn = u.corn + cornadd
59555956
u.cae = temp_cae

0 commit comments

Comments
 (0)