Documentation ¶
Index ¶
- func AddTags(c *core.Context)
- func Ads(c *core.Context)
- func AdsApi(c *core.Context)
- func AttachDelete(c *core.Context)
- func AttachDetailed(c *core.Context)
- func AttachList(c *core.Context)
- func Banner(c *core.Context)
- func Books(c *core.Context)
- func Category(c *core.Context)
- func CategoryApi(c *core.Context)
- func ChangeMemberRole(c *core.Context)
- func ClearComments(c *core.Context)
- func Comments(c *core.Context)
- func CreateMember(c *core.Context)
- func CreateToken(c *core.Context)
- func DelCate(c *core.Context)
- func DelTags(c *core.Context)
- func DeleteBook(c *core.Context)
- func DeleteComment(c *core.Context)
- func DeleteMember(c *core.Context)
- func EditBookApi(c *core.Context)
- func EditBookHtml(c *core.Context)
- func EditMemberApi(c *core.Context)
- func EditMemberHtml(c *core.Context)
- func FriendLink(c *core.Context)
- func Index(c *core.Context)
- func PrivatelyOwned(c *core.Context)
- func SeoApi(c *core.Context)
- func SetCommentStatus(c *core.Context)
- func SettingApi(c *core.Context)
- func SettingHtml(c *core.Context)
- func Tags(c *core.Context)
- func Transfer(c *core.Context)
- func UpdateCate(c *core.Context)
- func UpdateMember(c *core.Context)
- func UpdateMemberStatus(c *core.Context)
- func Users(c *core.Context)
- type CategoryCreate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ads ¶
func UpdateAds(c *core.Context) { id, _ := this.GetInt("id") field := this.GetString("field") value := this.GetString("value") if field == "" { c.JSONErrStr(1, "字段不能为空") } _, err := orm.NewOrm().QueryTable(mysql.NewAdsCont()).Filter("id", id).Update(orm.Params{field: value}) if err != nil { c.JSONErrStr(1, err.Error()) } go mysql.UpdateAdsCache() c.JSONErrStr(0, "操作成功") }
func DelAds(c *core.Context) { id, _ := this.GetInt("id") _, err := orm.NewOrm().QueryTable(mysql.NewAdsCont()).Filter("id", id).Delete() if err != nil { c.JSONErrStr(1, err.Error()) } go mysql.UpdateAdsCache() c.JSONErrStr(0, "删除成功") }
广告管理
func Banner ¶
//添加友链
func AddFriendlink(c *core.Context) { if err := new(mysql.FriendLink).Add(this.GetString("title"), this.GetString("link")); err != nil { c.JSONErrStr(1, "新增友链失败:"+err.Error()) } c.JSONErrStr(0, "新增友链成功") }
//更新友链
func UpdateFriendlink(c *core.Context) { id, _ := this.GetInt("id") if err := new(mysql.FriendLink).Update(id, this.GetString("field"), this.GetString("value")); err != nil { c.JSONErrStr(1, "操作失败:"+err.Error()) } c.JSONErrStr(0, "操作成功") }
//删除友链
func DelFriendlink(c *core.Context) { id, _ := this.GetInt("id") if err := new(mysql.FriendLink).Del(id); err != nil { c.JSONErrStr(1, "删除失败:"+err.Error()) } c.JSONErrStr(0, "删除成功") }
// 重建全量索引
func RebuildAllIndex(c *core.Context) { go mysql.NewElasticSearchClient().RebuildAllIndex() c.JSONErrStr(0, "提交成功,请耐心等待") }
func ClearComments ¶
func DeleteComment ¶
func FriendLink ¶
//更新分类的图标
func UpdateCateIcon(c *core.Context) { var err error id, _ := this.GetInt("id") if id == 0 { c.JSONErrStr(1, "参数不正确") } model := new(mysql.Category) if cate := model.Find(id); cate.Id > 0 { cate.Icon = strings.TrimLeft(cate.Icon, "/") f, h, err1 := this.GetFile("icon") if err1 != nil { err = err1 } defer f.Close() tmpFile := fmt.Sprintf("uploads/icons/%v%v"+filepath.Ext(h.Filename), id, time.Now().Unix()) os.MkdirAll(filepath.Dir(tmpFile), os.ModePerm) if err = this.SaveToFile("icon", tmpFile); err == nil { switch utils.StoreType { case utils.StoreOss: store.ModelStoreOss.MoveToOss(tmpFile, tmpFile, true, false) store.ModelStoreOss.DelFromOss(cate.Icon) case utils.StoreLocal: store.ModelStoreLocal.DelFiles(cate.Icon) } err = model.UpdateByField(cate.Id, "icon", "/"+tmpFile) } } if err != nil { c.JSONErrStr(1, err.Error()) } c.JSONErrStr(0, "更新成功") }
友情链接
func SetCommentStatus ¶
func SettingApi ¶
func SettingHtml ¶
Types ¶
type CategoryCreate ¶
Click to show internal directories.
Click to hide internal directories.