tserverlogic

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleAddComment

func HandleAddComment(w http.ResponseWriter, r *http.Request)

HandleAddComment 添加评论Handler 请求地址: domain:port/addComment body: 先将key和value进行URL编码 js调用encodeURIComponent()函数 然后再将 key和value 以 key1=value1&key2=value2 的形式编码发送

参数 含义 domain 博客的域名

email 评论者的email displayname 评论者显示的名字(昵称),可选 site 评论者的主页,可选

articlekey 评论文章的特征码(可以使用文章的URL地址) content 评论内容 replyid 如果评论是回复某条评论,则在这里填写回复评论的评论ID,如果不是回复,不要设置这个字段

lastcommentid 客户端最新一条评论的评论id,若不传这个值,服务器会返回刚刚插入的评论,否则返回lastcommentid以后的评论。若找不到lastcommentid所对应的评论。则返回错误。

func HandleCommentList

func HandleCommentList(w http.ResponseWriter, r *http.Request)

HandleCommentList 获取评论列表Handler 请求地址: domain:port/commentList body: 先将key和value进行URL编码 js调用encodeURIComponent()函数 然后再将 key和value 以 key1=value1&key2=value2 的形式编码发送

参数 含义 domain 博客的域名 articlekey 评论文章的特征码(可以使用文章的URL地址) lastcommentid 客户端最新一条评论的评论id,若不传这个值,服务器会返回articlekey下的所有评论,否则返回lastcommentid以后的评论。若找不到lastcommentid所对应的评论。则返回错误。

Types

type CommentResult

type CommentResult struct {
	//key:userid value:user
	User map[string]OutUser

	Comment []OutComment
}

CommentResult 服务器返回给客户端的结果数据

type OutComment

type OutComment struct {
	UserID         string
	Content        string
	CommentID      uint32
	CreateTime     int64
	ReplyCommentID *uint32 `json:",omitempty"`
}

OutComment 服务器返回给客户端的Comment数据结构

type OutErr

type OutErr struct {
	ErrorNum uint32
	ErrorMsg string
}

OutErr 服务器返回给客户端的错误信息

type OutUser

type OutUser struct {
	Email       string
	DisplayName *string `json:",omitempty"`
	Site        *string `json:",omitempty"`
}

OutUser 服务器返回给客户端的User数据

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL