@@ -4028,7 +4028,6 @@ def warresult2(uid):
4028
4028
fails += 1
4029
4029
i -= 1
4030
4030
if fails == 3 :
4031
- print "weak mode"
4032
4031
weakMode = True
4033
4032
#if in weak Mode just lost defence 5%
4034
4033
if weakMode :
@@ -5895,16 +5894,18 @@ def productall(self,user_id,city_id):
5895
5894
except InvalidRequestError :
5896
5895
return dict (id = 0 )
5897
5896
@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 )
5899
5899
uid = int (user_id )
5900
5900
type = int (type )
5901
+ friend_num = int (friend_num )
5901
5902
u = checkopdata (uid )
5902
5903
cornadd = 0
5903
5904
flag = 0
5904
5905
bonus = 0
5905
5906
k = 0 #the number of the friend
5906
5907
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 ()
5908
5909
if notvisited == None or len (notvisited )== 0 :
5909
5910
return dict (id = 0 , reason = "do not have not visited friend" )
5910
5911
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
5935
5936
temp_cae = temp_cae + 2
5936
5937
for f in notvisited :
5937
5938
k += 1
5938
- cornadd += 100 + bonus
5939
5939
f .visited = 1
5940
-
5940
+ cornadd = ( 100 + bonus ) * friend_num
5941
5941
else :
5942
5942
return dict (id = 0 , reason = "cae or card invalid" )
5943
5943
else :#cae=10
@@ -5950,6 +5950,7 @@ def getfriendall(self,user_id,user_kind,type):#type=0 normal;type=1 leiji
5950
5950
cornadd += 100 + bonus + 5 * k
5951
5951
k += 1
5952
5952
f .visited = 1
5953
+ cornadd = (100 + bonus )* friend_num + 5 * (friend_num + 1 )* friend_num / 2
5953
5954
if flag == 1 :
5954
5955
u .corn = u .corn + cornadd
5955
5956
u .cae = temp_cae
0 commit comments