Exemple #1
0
func (this *UserController) modifyPasswd(resp *helper.Response) {
	modifypasswdT, err := template.ParseFiles("views/manage/user/modifypasswd.html")
	if err != nil {
		panic(err)
	}
	var buffer bytes.Buffer
	modifypasswdT.Execute(&buffer, nil)
	resp.Data = buffer.String()
}
Exemple #2
0
func (this *SysconfigController) getSitemap(resp *helper.Response) {
	f, err := os.Open(models.SiteFile)
	if err != nil {
		resp.Status = RS.RS_failed
		resp.Err = helper.Error{Level: helper.WARNING, Msg: "错误|" + err.Error()}
		return
	}
	defer f.Close()
	data, _ := ioutil.ReadAll(f)
	resp.Data = string(data)
}
Exemple #3
0
func (this *CategoryController) getCategory(resp *helper.Response) {
	id := this.GetString("id")
	if id != "" {
		if cat := models.Blogger.GetCategoryByID(id); cat != nil {
			b, _ := json.Marshal(cat)
			resp.Data = string(b)
		}
	} else {
		resp.Status = RS.RS_failed
		resp.Err = helper.Error{Level: helper.WARNING, Msg: "错误|参数错误。"}
	}
}
Exemple #4
0
func (this *BlogrollController) getBlogroll(resp *helper.Response) {
	id := this.GetString("id")
	if id != "" {
		if br := models.Blogger.GetBlogrollByID(id); br != nil {
			b, _ := json.Marshal(br)
			resp.Data = string(b)
		}
	} else {
		resp.Status = RS.RS_failed
		resp.Err = helper.Error{Level: helper.WARNING, Msg: "错误|参数错误。"}
	}
}
Exemple #5
0
func (this *TopicsController) getTopic(resp *helper.Response) {
	id, err := this.GetInt("id")
	if err != nil {
		resp.Status = RS.RS_failed
		resp.Err = helper.Error{Level: helper.WARNING, Msg: "错误|ID格式不正确。"}
		return
	}
	if topic, err := models.TMgr.LoadTopic(int32(id)); err != nil || topic == nil {
		resp.Status = RS.RS_failed
		resp.Err = helper.Error{Level: helper.WARNING, Msg: "错误|系统未查询到该文章。"}
		return
	} else {
		resp.Data = topic
	}
}
Exemple #6
0
func (this *UserController) userInfo(resp *helper.Response) {
	infoT, err := template.ParseFiles("views/manage/user/user.html")
	if err != nil {
		panic(err)
	}
	Map := make(map[string]string)
	Map["BlogName"] = models.Blogger.BlogName
	Map["Icon"] = models.Blogger.HeadIcon
	Map["Introduce"] = models.Blogger.Introduce
	Map["Sex"] = models.Blogger.Sex
	Map["Username"] = models.Blogger.UserName
	Map["Email"] = models.Blogger.Email
	Map["Address"] = models.Blogger.Address
	Map["Education"] = models.Blogger.Education
	Map["LoginTime"] = models.Blogger.LoginTime.Format(helper.Layout_y_m_d_time)
	Map["IP"] = models.Blogger.LoginIp

	var buffer bytes.Buffer
	infoT.Execute(&buffer, Map)
	resp.Data = buffer.String()
}
Exemple #7
0
func (this *DataController) Base(resp *helper.Response) {
	resp.Data = models.ManageData
}