Browse Source

用户反馈

master
huangjiajun 1 month ago
parent
commit
c64ccdff1c
9 changed files with 196 additions and 0 deletions
  1. +9
    -0
      src/dao/user_feedback_cate_dao.go
  2. +5
    -0
      src/dao/user_feedback_dao.go
  3. +7
    -0
      src/dao/user_feedback_record_dao.go
  4. +49
    -0
      src/implement/user_feedback_cate_implement.go
  5. +62
    -0
      src/implement/user_feedback_implement.go
  6. +31
    -0
      src/implement/user_feedback_record_implement.go
  7. +13
    -0
      src/model/user_feedback.go
  8. +7
    -0
      src/model/user_feedback_cate.go
  9. +13
    -0
      src/model/user_feedback_record.go

+ 9
- 0
src/dao/user_feedback_cate_dao.go View File

@@ -0,0 +1,9 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type UserFeedbackCateDao interface {
GetUserFeedbackCate(id string) (m *model.UserFeedbackCate, err error)
FindUserFeedbackCate(page, limit string) (*[]model.UserFeedbackCate, error)
FindUserFeedbackCateAndTotal(page, limit string) (*[]model.UserFeedbackCate, int64, error)
}

+ 5
- 0
src/dao/user_feedback_dao.go View File

@@ -0,0 +1,5 @@
package dao

type UserFeedbackDao interface {
//TODO:: You can add specific method definitions here
}

+ 7
- 0
src/dao/user_feedback_record_dao.go View File

@@ -0,0 +1,7 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type UserFeedbackRecordDao interface {
FindUserFeedback(page, limit, lid string) (*[]model.UserFeedbackRecord, error)
}

+ 49
- 0
src/implement/user_feedback_cate_implement.go View File

@@ -0,0 +1,49 @@
package implement

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"xorm.io/xorm"
)

func NewUserFeedbackCateDb(engine *xorm.Engine) dao.UserFeedbackCateDao {
return &UserFeedbackCateDb{Db: engine}
}

type UserFeedbackCateDb struct {
Db *xorm.Engine
}

func (u UserFeedbackCateDb) GetUserFeedbackCate(id string) (m *model.UserFeedbackCate, err error) {
m = new(model.UserFeedbackCate)
has, err := u.Db.Where("id=?", id).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (u UserFeedbackCateDb) FindUserFeedbackCate(page, limit string) (*[]model.UserFeedbackCate, error) {
var m []model.UserFeedbackCate
sess := u.Db.Where("1=1")
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("sort desc,id desc").Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}
func (u UserFeedbackCateDb) FindUserFeedbackCateAndTotal(page, limit string) (*[]model.UserFeedbackCate, int64, error) {
var m []model.UserFeedbackCate
sess := u.Db.Where("1=1")
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("sort desc,id desc").FindAndCount(&m)
if err != nil {
return nil, count, zhios_order_relate_logx.Error(err)
}
return &m, count, nil
}

+ 62
- 0
src/implement/user_feedback_implement.go View File

@@ -0,0 +1,62 @@
package implement

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"strings"
"xorm.io/xorm"
)

func NewUserFeedbackDb(engine *xorm.Engine) dao.UserFeedbackDao {
return &UserFeedbackDb{Db: engine}
}

type UserFeedbackDb struct {
Db *xorm.Engine
}

func (u UserFeedbackDb) GetUserFeedback(id string) (m *model.UserFeedback, err error) {
m = new(model.UserFeedback)
has, err := u.Db.Where("id=?", id).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (u UserFeedbackDb) FindUserFeedback(page, limit, uid string) (*[]model.UserFeedback, error) {
var m []model.UserFeedback
sess := u.Db.Where("1=1")
if uid != "" {
sess.And("uid=?", uid)
}
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("sort desc,id desc").Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}
func (u UserFeedbackDb) FindUserFeedbackAndTotal(page, limit, uid, cid, content string) (*[]model.UserFeedback, int64, error) {
var m []model.UserFeedback
sess := u.Db.Where("1=1")
if uid != "" {
sess.In("uid=?", strings.Split(uid, ","))
}
if cid != "" {
sess.And("cid=?", cid)
}
if content != "" {
sess.And("content like ?", "%"+cid+"%")
}
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("sort desc,id desc").FindAndCount(&m)
if err != nil {
return nil, count, zhios_order_relate_logx.Error(err)
}
return &m, count, nil
}

+ 31
- 0
src/implement/user_feedback_record_implement.go View File

@@ -0,0 +1,31 @@
package implement

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"xorm.io/xorm"
)

func NewUserFeedbackRecordDb(engine *xorm.Engine) dao.UserFeedbackRecordDao {
return &UserFeedbackRecordDb{Db: engine}
}

type UserFeedbackRecordDb struct {
Db *xorm.Engine
}

func (u UserFeedbackRecordDb) FindUserFeedback(page, limit, lid string) (*[]model.UserFeedbackRecord, error) {
var m []model.UserFeedbackRecord
sess := u.Db.Where("1=1")
if lid != "" {
sess.And("lid=?", lid)
}
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id asc").Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}

+ 13
- 0
src/model/user_feedback.go View File

@@ -0,0 +1,13 @@
package model

type UserFeedback struct {
Id int `json:"id" xorm:"not null pk default 0 INT(11)"`
Uid int `json:"uid" xorm:"default 0 INT(11)"`
Type string `json:"type" xorm:"default '0' VARCHAR(255)"`
Extra string `json:"extra" xorm:"comment('api请求头内容') TEXT"`
Content string `json:"content" xorm:"comment('问题内容') VARCHAR(5000)"`
Img string `json:"img" xorm:"comment('图片 [""]') VARCHAR(5000)"`
Idea string `json:"idea" xorm:"comment('建议') VARCHAR(5000)"`
Phone string `json:"phone" xorm:"VARCHAR(255)"`
State int `json:"state" xorm:"default 0 comment('0待解决 1处理中 2已解决') INT(1)"`
}

+ 7
- 0
src/model/user_feedback_cate.go View File

@@ -0,0 +1,7 @@
package model

type UserFeedbackCate struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"VARCHAR(255)"`
Sort int `json:"sort" xorm:"default 0 INT(11)"`
}

+ 13
- 0
src/model/user_feedback_record.go View File

@@ -0,0 +1,13 @@
package model

import (
"time"
)

type UserFeedbackRecord struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Lid int `json:"lid" xorm:"comment('反馈列表id') INT(11)"`
Content string `json:"content" xorm:"VARCHAR(255)"`
Uid int `json:"uid" xorm:"default 0 INT(11)"`
CreateAt time.Time `json:"create_at" xorm:"DATETIME"`
}

Loading…
Cancel
Save