manager

package
v0.0.0-...-8d6dda1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTags

func AddTags(c *core.Context)

func Ads

func Ads(c *core.Context)
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 AdsApi

func AdsApi(c *core.Context)

广告管理

func AttachDelete

func AttachDelete(c *core.Context)

删除附件.

func AttachDetailed

func AttachDetailed(c *core.Context)

附件详情.

func AttachList

func AttachList(c *core.Context)

附件列表.

func Banner(c *core.Context)

//添加友链

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 Books

func Books(c *core.Context)

项目列表.

func Category

func Category(c *core.Context)

分类管理

func CategoryApi

func CategoryApi(c *core.Context)

分类管理

func ChangeMemberRole

func ChangeMemberRole(c *core.Context)

变更用户权限.

func ClearComments

func ClearComments(c *core.Context)

func Comments

func Comments(c *core.Context)

func CreateMember

func CreateMember(c *core.Context)

添加用户.

func CreateToken

func CreateToken(c *core.Context)

CreateToken 创建访问来令牌.

func DelCate

func DelCate(c *core.Context)

删除分类

func DelTags

func DelTags(c *core.Context)

func DeleteBook

func DeleteBook(c *core.Context)

删除项目.

func DeleteComment

func DeleteComment(c *core.Context)

func DeleteMember

func DeleteMember(c *core.Context)

删除一个用户,并将该用户的所有信息转移到超级管理员上.

func EditBookApi

func EditBookApi(c *core.Context)

编辑项目.

func EditBookHtml

func EditBookHtml(c *core.Context)

编辑项目.

func EditMemberApi

func EditMemberApi(c *core.Context)

编辑用户信息.

func EditMemberHtml

func EditMemberHtml(c *core.Context)

编辑用户信息.

func FriendLink(c *core.Context)

//更新分类的图标

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 Index

func Index(c *core.Context)

func PrivatelyOwned

func PrivatelyOwned(c *core.Context)

设置项目私有状态.

func SeoApi

func SeoApi(c *core.Context)

func SetCommentStatus

func SetCommentStatus(c *core.Context)

func SettingApi

func SettingApi(c *core.Context)

func SettingHtml

func SettingHtml(c *core.Context)

func Tags

func Tags(c *core.Context)

标签管理.

func Transfer

func Transfer(c *core.Context)

Transfer 转让项目.

func UpdateCate

func UpdateCate(c *core.Context)

更新分类字段内容

func UpdateMember

func UpdateMember(c *core.Context)

编辑用户信息.

func UpdateMemberStatus

func UpdateMemberStatus(c *core.Context)

更新用户状态.

func Users

func Users(c *core.Context)

用户列表.

Types

type CategoryCreate

type CategoryCreate struct {
	Pid   int    `form:"pid"`
	Cates string `form:"cates"`
}

Jump to

Keyboard shortcuts

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