You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.8 KiB
46 lines
1.8 KiB
package modelbookimg
|
|
|
|
import (
|
|
"key_performance_indicators/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 举报
|
|
type Reporting struct {
|
|
Id int64 `json:"id" gorm:"primaryKey;column:r_id;type:bigint unsigned;not null;auto_increment;comment:ID"`
|
|
UserKey int64 `json:"userkey" gorm:"column:r_user_key;type:bigint unsigned;not null;default:0;comment:编辑人员"`
|
|
UserJson string `json:"userjson" gorm:"column:r_user_json;type:mediumtext;comment:举报人基本信息"`
|
|
Content string `json:"content" gorm:"column:r_content;type:mediumtext;comment:举报内容"`
|
|
AnsId int64 `json:"ansid" gorm:"column:r_ans_id;type:bigint unsigned;not null;comment:被举报答案ID"`
|
|
AnsCont string `json:"anscont" gorm:"column:r_ans_cont;type:mediumtext;comment:被举报内容"`
|
|
Time int64 `json:"time" gorm:"column:r_time;type:bigint unsigned;default:0;not null;comment:举报时间"`
|
|
State int `json:"state" gorm:"column:r_state;type:tinyint unsigned;default:1;not null;comment:状态(1:审核,2:有效;3:无效;4:删除)"`
|
|
}
|
|
|
|
func (r *Reporting) TableName() string {
|
|
return "reporting"
|
|
}
|
|
|
|
// 编辑举报内容
|
|
func (cont *Reporting) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_FILE_BOOK.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取举报内容
|
|
func (cont *Reporting) GetCont(whereMap interface{}, field ...string) (err error) {
|
|
gormDb := overall.CONSTANT_DB_FILE_BOOK.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
gormDb = gormDb.Where(whereMap)
|
|
err = gormDb.First(&cont).Error
|
|
return
|
|
}
|
|
|
|
// 删除内容
|
|
func (cont *Reporting) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_FILE_BOOK.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|