package message import "spaceofcheng/services/models/model" // GetLocations 获取位置列表 func (c *MessageController) GetLocations() { issys := c.GetString("issys") orgid := c.GetString("orgid") if orgid == "" { org := c.Context.Get("org").(model.SysOrg) orgid = org.OrgId } location, err := c.dao.GetLocationList(issys, orgid) if err != nil { c.ResponseError(err) } c.ResponseJSON(location) } // GetLocationById 根据id获取位置信息 func (c *MessageController) GetLocationById() { locationid := c.GetString(":locationid") location, err := c.dao.GetLocationByID(locationid) if err != nil { c.ResponseError(err) } c.ResponseJSON(location) } // SaveLocation 保存位置信息 func (c *MessageController) SaveLocation() { location := model.TdCmsImageLocation{} if err := c.ParseForm(&location); err != nil { c.ResponseError(err) } newInfo, err := c.dao.SaveLocation(location) if err != nil { c.ResponseError(err) } c.ResponseJSON(newInfo) } // DelLocation 删除位置信息 func (c *MessageController) DelLocation() { locationID := c.GetString(":locationid") err := c.dao.DelLocation(locationID) if err != nil { c.ResponseError(err) } c.ResponseJSON("删除成功!") } // UpdateLocationSort 修改位置的排序 func (c *MessageController) UpdateLocationSort() { locations := c.GetString("locations") err := c.dao.UpdateLocationSort(locations) if err != nil { c.ResponseError(err) } c.ResponseJSON("操作成功!") } // GetLocationInfoList 根据位置信息 func (c *MessageController) GetLocationInfoList() { infos, err := c.dao.GetLocationInfoList() if err != nil { c.ResponseError(err) } c.ResponseJSON(infos) }