def POST(self): webinput = web.input() weibo_id = webinput[u'weibo_id'] ac = activities.find_one({u'weibo_id': weibo_id}) hostname = ac[u'peoplePay'][0] hostuid = ac[u'uid'] ifpay = True for people in ac[u'peopleInvited']: if people in ac[u'peopleIn']: ifpay = True else: ifpay = False break cookies = web.cookies() acc = cookies[u'access_token'] exp = cookies[u'expires_in'] uid = cookies[u'uid'] client = getClient(acc, exp) myname = getClientName(client, int(uid)) if myname in ac['peoplePay']: ifpay = False if ifpay: paymoney = float(ac[u'money']) / len(ac[u'peopleIn']) hostacount = bank.find_one({u'name': hostname}) hostmoney = hostacount[u'money'] hostmoney += paymoney bank.update({u"name": hostname}, {"$set": {u"money": hostmoney}}) cookies = web.cookies() acc = cookies[u'access_token'] exp = cookies[u'expires_in'] uid = cookies[u'uid'] client = getClient(acc, exp) myname = getClientName(client, int(uid)) myacount = bank.find_one({u'name': myname}) mymoney = myacount[u'money'] mymoney -= paymoney bank.update({u"name": myname}, {"$set": {u"money": mymoney}}) peoplePay = ac[u'peoplePay'] peoplePay.append(myname) activities.update({u"weibo_id": weibo_id}, {"$set": { u"peoplePay": peoplePay }}) string = myname + u"\u652f\u4ed8\u4e86\u6d3b\u52d5" + u":" + ac[ u'name'] user = users.find_one({u'uid': hostuid}) informations = refreshInformations(user[u'informations'], string) users.update({u'uid': hostuid}, {"$set": { u'informations': informations }}) web.SeeOther("/currentActivity")
def POST(self): webinput=web.input() weibo_id=webinput[u'weibo_id'] ac=activities.find_one({u'weibo_id':weibo_id}) hostname=ac[u'peoplePay'][0] ifpay=True for people in ac[u'peopleInvited']: if people in ac[u'peopleIn']: ifpay=True else: ifpay=False break if ifpay: paymoney=float(ac[u'money'])/len(ac[u'peopleIn']) print paymoney print len(ac[u'peopleIn']) hostacount=bank.find_one({u'name':hostname}) hostmoney=hostacount[u'money'] hostmoney+=paymoney bank.update({u"name":hostname},{"$set":{u"money":hostmoney}}) cookies=web.cookies() acc=cookies[u'access_token'] exp=cookies[u'expires_in'] uid=cookies[u'uid'] client=getClient(acc,exp) myname=getClientName(client,int(uid)) myacount=bank.find_one({u'name':myname}) mymoney=myacount[u'money'] mymoney-=paymoney bank.update({u"name":myname},{"$set":{u"money":mymoney}}) peoplePay=ac[u'peoplePay'] peoplePay.append(myname) activities.update({u"weibo_id":weibo_id},{"$set":{u"peoplePay":peoplePay}}) web.SeeOther("/currentActivity")
def POST(self): webinput=web.input() weibo_id=webinput[u'weibo_id'] ac=activities.find_one({u'weibo_id':weibo_id}) hostname=ac[u'peoplePay'][0] hostuid=ac[u'uid'] ifpay=True for people in ac[u'peopleInvited']: if people in ac[u'peopleIn']: ifpay=True else: ifpay=False break cookies=web.cookies() acc=cookies[u'access_token'] exp=cookies[u'expires_in'] uid=cookies[u'uid'] client=getClient(acc,exp) myname=getClientName(client,int(uid)) if myname in ac['peoplePay']: ifpay=False if ifpay: paymoney=float(ac[u'money'])/len(ac[u'peopleIn']) hostacount=bank.find_one({u'name':hostname}) hostmoney=hostacount[u'money'] hostmoney+=paymoney bank.update({u"name":hostname},{"$set":{u"money":hostmoney}}) cookies=web.cookies() acc=cookies[u'access_token'] exp=cookies[u'expires_in'] uid=cookies[u'uid'] client=getClient(acc,exp) myname=getClientName(client,int(uid)) myacount=bank.find_one({u'name':myname}) mymoney=myacount[u'money'] mymoney-=paymoney bank.update({u"name":myname},{"$set":{u"money":mymoney}}) peoplePay=ac[u'peoplePay'] peoplePay.append(myname) activities.update({u"weibo_id":weibo_id},{"$set":{u"peoplePay":peoplePay}}) string=myname+u"\u652f\u4ed8\u4e86\u6d3b\u52d5"+u":"+ac[u'name'] user=users.find_one({u'uid':hostuid}) informations=refreshInformations(user[u'informations'],string) users.update({u'uid':hostuid},{"$set":{u'informations':informations}}) web.SeeOther("/currentActivity")
def POST(self): webinput = web.input() weibo_id = webinput[u'weibo_id'] ac = activities.find_one({u'weibo_id': weibo_id}) cookies = web.cookies() myuid = cookies[u'uid'] act = cookies[u'access_token'] exp = cookies[u'expires_in'] client = getClient(act, exp) myname = getClientName(client, int(myuid)) hostuid = ac[u'uid'] hostname = ac[u'peoplePay'][0] if myname in ac['peoplePay']: return "Already payed,take it easy" else: paymoney = float(ac[u'fillmoney']) myacount = bank.find_one({u'name': myname}) money = myacount[u'money'] - paymoney bank.update({u'name': myname}, {"$set": {u'money': money}}) hostacount = bank.find_one({u'name': hostname}) money = hostacount[u'money'] + paymoney bank.update({u'name': hostname}, {"$set": {u'money': money}}) host = users.find_one({u'uid': hostuid}) string = myname + u'\u652f\u4ed8\u4e86\u6d3b\u52a8\uff1a' + ac[ u'name'] informations = refreshInformations(host[u'informations'], string) users.update({u'uid': hostuid}, {"$set": { u'informations': informations }}) peoplepay = ac[u'peoplePay'] peoplepay.append(myname) activities.update({u'weibo_id': weibo_id}, {"$set": { u'peoplePay': peoplepay }}) ifpayend = False for people in ac[u'peopleIn']: if people in peoplepay: ifpayend = True else: ifpayend = False break if ifpayend: activities.update({u'weibo_id': weibo_id}, {"$set": { u'fillmoney': 0.0 }}) web.seeother("/pastActivity")
def POST(self): webinput=web.input() weibo_id=webinput[u'weibo_id'] ac=activities.find_one({u'weibo_id':weibo_id}) cookies=web.cookies() myuid=cookies[u'uid'] act=cookies[u'access_token'] exp=cookies[u'expires_in'] client=getClient(act,exp) myname=getClientName(client,int(myuid)) hostuid=ac[u'uid'] hostname=ac[u'peoplePay'][0] if myname in ac['peoplePay']: return "Already payed,take it easy" else: paymoney=float(ac[u'fillmoney']) myacount=bank.find_one({u'name':myname}) money=myacount[u'money']-paymoney bank.update({u'name':myname},{"$set":{u'money':money}}) hostacount=bank.find_one({u'name':hostname}) money=hostacount[u'money']+paymoney bank.update({u'name':hostname},{"$set":{u'money':money}}) host=users.find_one({u'uid':hostuid}) string=myname+u'\u652f\u4ed8\u4e86\u6d3b\u52a8\uff1a'+ac[u'name'] informations=refreshInformations(host[u'informations'],string) users.update({u'uid':hostuid},{"$set":{u'informations':informations}}) peoplepay=ac[u'peoplePay'] peoplepay.append(myname) activities.update({u'weibo_id':weibo_id},{"$set":{u'peoplePay':peoplepay}}) ifpayend=False for people in ac[u'peopleIn']: if people in peoplepay: ifpayend=True else: ifpayend=False break if ifpayend: activities.update({u'weibo_id':weibo_id},{"$set":{u'fillmoney':0.0}}) web.seeother("/pastActivity")