def POST(self, arg): data = web.input() post_Name = data.post_Name id = arg #note : 需要判断user的身份,是不是作者 postModel.post_update(id, postTitle=post_Name) return '{"status": "y", "info": "标题更新成功"}'
def POST(self): #note 需要判断数据库中用户是不是已经投过票了。 data = web.input() id = data.post_id uid = user.id #当前用户id p = postModel.getPostByPostId(id) #得到目标post magnitude = int(p.magnitude) #得到post的实际投票数 ts = p.creation_ts #得到post的创建时间 delta = (datetime.datetime.now() - ts).days #得到创建时间距今多少天 postModel.post_update(id, magnitude = magnitude + 1) #给post的实际投票数+1, 保存最终得票数 score = magnitude / (delta + 2)**2.1 #算出最终得票数 postModel.post_update(id, score = score) #入库 postModel.addVoteUser(id, uid) #记录片段ID和投票的用户ID/时间 #插入提醒 判断是不是自己喜欢自己的 if p.postAuthor != int(uid): notification.new_notification(p.postAuthor, uid, id, p.nodeId, tp=2) #如果开启了邮件提醒,给作者发送邮件 author = users.get_user_by_id(p.postAuthor) person = users.get_profile_by_user_id(p.postAuthor) if person.has_key('email_subscribe') and person.email_subscribe == 1 and author.email: email_templates.someone_like_ur_post(user, author, p) print '=== email send ==' return '{"status": "y", "info": "投票成功"}'
def POST(self,arg): data = web.input() post_Name = data.post_Name id = arg #note : 需要判断user的身份,是不是作者 postModel.post_update(id, postTitle = post_Name) return '{"status": "y", "info": "标题更新成功"}'
def POST(self): data = web.input() id = data.id #note : 需要判断user的身份,是不是作者 path = data.path postModel.post_update(id, postImage=path) success = "s" return success
def POST(self, arg): data = web.input() pid = arg path = data.path # 判断user的身份,是不是作者 if postModel.getPostByPostId(pid).postAuthor == user.id: postModel.post_update(pid, postImage=path) success = "s" return success
def POST(self,arg): data = web.input() #note : 需要判断user的身份,是不是作者 postCaption = data.post_Caption postArticle = data.post_Article # postArticle = htmlquote(postArticle).strip().replace("\r\n", "<br/>") # postArticle = htmlquote(postArticle).strip() id = arg postModel.post_update(id, postCaption = postCaption, postArticle=postArticle) return '{"status": "y", "info": "更新成功"}'
def POST(self, arg): data = web.input() #note : 需要判断user的身份,是不是作者 postCaption = data.post_Caption postArticle = data.post_Article # postArticle = htmlquote(postArticle).strip().replace("\r\n", "<br/>") # postArticle = htmlquote(postArticle).strip() id = arg postModel.post_update(id, postCaption=postCaption, postArticle=postArticle) return '{"status": "y", "info": "更新成功"}'
def POST(self): data = web.input() id = data.post_id uid = user.id p = postModel.getPostByPostId(id) magnitude = int(p.magnitude) ts = p.creation_ts delta = (datetime.datetime.now() - ts).days postModel.post_update(id, magnitude=magnitude - 1) score = magnitude / (delta + 2)**2.1 postModel.post_update(id, score=score) #更新最终的票数 postModel.delVoteUser(id, uid) #删除片段ID和投票的用户ID/时间 return '{"status": "y", "info": "已取消投票"}'
def POST(self): data = web.input() id = data.post_id uid = user.id p = postModel.getPostByPostId(id) magnitude = int(p.magnitude) ts = p.creation_ts delta = (datetime.datetime.now() - ts).days postModel.post_update(id, magnitude = magnitude - 1) score = magnitude / (delta + 2)**2.1 postModel.post_update(id, score = score) #更新最终的票数 postModel.delVoteUser(id, uid) #删除片段ID和投票的用户ID/时间 return '{"status": "y", "info": "已取消投票"}'
def POST(self): #note 需要判断数据库中用户是不是已经投过票了。 data = web.input() id = data.post_id uid = user.id #当前用户id p = postModel.getPostByPostId(id) #得到目标post magnitude = int(p.magnitude) #得到post的实际投票数 ts = p.creation_ts #得到post的创建时间 delta = (datetime.datetime.now() - ts).days #得到创建时间距今多少天 postModel.post_update(id, magnitude=magnitude + 1) #给post的实际投票数+1, 保存最终得票数 score = magnitude / (delta + 2)**2.1 #算出最终得票数 postModel.post_update(id, score=score) #入库 postModel.addVoteUser(id, uid) #记录片段ID和投票的用户ID/时间 #插入提醒 判断是不是自己喜欢自己的 if p.postAuthor != int(uid): notification.new_notification(p.postAuthor, uid, id, p.nodeId, tp=2) #如果开启了邮件提醒,给作者发送邮件 author = users.get_user_by_id(p.postAuthor) person = users.get_profile_by_user_id(p.postAuthor) if person.has_key( 'email_subscribe' ) and person.email_subscribe == 1 and author.email: email_templates.someone_like_ur_post(user, author, p) print '=== email send ==' return '{"status": "y", "info": "投票成功"}'