Esempio n. 1
0
 def GET(self):
     getData = web.input()
     render = web.template.render(
         configfile.getConfig("web", "Templates_Path"))
     name = getData['openid']
     user = UserDao()
     flag = user.selectUserFlag(name)
     if (flag == 3):
         errMsg = '您已绑定'
         return render.error(errMsg)
     return render.bangding(name)
Esempio n. 2
0
	def bangding(self):
		fromUser = self.xml.find("FromUserName").text
		user = UserDao()
		flag=user.selectUserFlag(fromUser)
		if(flag!=3):
			data = "<a href='http://xiwai.chdbwtx.cn/binding?openid=%s'>绑定</a>"%fromUser
		else:
			userInfo=user.selectUserInfoByOpenid(fromUser)
			username=userInfo[0]
			password=userInfo[1]
			data='您已绑定,您的绑定信息为\n用户名:{username}\n密  码:{password}'.format(username=username,password=password)
		return data
Esempio n. 3
0
 def chengji(self):
     fromUser = self.xml.find("FromUserName").text
     user = UserDao()
     flag = user.selectUserFlag(fromUser)
     if (flag != 3):
         data = '您未绑定'
         return data
     score = ScoreDao(fromUser)
     scoreStr = score.selectScore()
     # 调取后台接口,获取成绩的数据
     if (scoreStr == 2):
         data = '网络繁忙,稍后再试'
         return data
     else:
         data = ''
         jidian = 0.0
         datascore = json.loads(scoreStr)
         for score in datascore:
             jidian += float(score['jidian'])
             data += score['name']+":\n"+\
             "成绩:"+score['zuizhong']+"\n\n"
         data += "平均绩点:" + str(round(jidian / len(datascore), 1)) + "\n"
         data += "<a href='http://xiwai.chdbwtx.cn/Score?openid=%s'>详细成绩</a>" % fromUser
         return data
Esempio n. 4
0
    def GET(self):
        render = web.template.render(
            configfile.getConfig("web", "Templates_Path"))
        getData = web.input()
        openid = getData['openid']

        user = UserDao()
        flag = user.selectUserFlag(openid)
        if (flag != 3):
            errMsg = '您未绑定'
            return render.error(errMsg)
        score = ScoreDao(openid)
        scoreStr = score.selectScore()
        # 调取后台接口,获取成绩的数据
        if (scoreStr == 2):
            errMsg = '网络繁忙,稍后再试'
            return render.error(errMsg)
        else:
            data = json.loads(scoreStr)
            # data = [
            # 	{
            # 		'name':'数学',
            # 		'zuizhong':'89',
            # 		'xuefen':'2.1',
            # 		'jidian':'254'

            # 	},
            # 	{
            # 		'name':'数学',
            # 		'zuizhong':'89',
            # 		'xuefen':'2.1',
            # 		'jidian':'254'

            # 	}
            # ]
            return render.detail(data)