diff --git a/app/hdl/advertising/hdl_base.go b/app/hdl/advertising/hdl_base.go index f98dc79..573c8bd 100644 --- a/app/hdl/advertising/hdl_base.go +++ b/app/hdl/advertising/hdl_base.go @@ -6,15 +6,30 @@ import ( ) // GetBasic -// @Summary 广告管理-广告设置-信息 +// @Summary 广告管理-基础设置-信息 // @Tags 广告管理 -// @Description 广告管理-广告设置-信息 +// @Description 广告管理-基础设置-信息 // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Success 200 {object} md.NoticeAliyunSmsListResp "具体数据" +// @Success 200 {object} md.AdvertisingBaseResp "具体数据" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/advertising/base [get] +// @Router /api/advertising/getBasic [get] func GetBasic(c *gin.Context) { advertising.GetBasic(c) } + +// SetBasic +// @Summary 广告管理-基础设置-信息保存 +// @Tags 广告管理 +// @Description 广告管理-基础设置-信息保存 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingBase true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/setBasic [post] +func SetBasic(c *gin.Context) { + advertising.SetBasic(c) +} diff --git a/app/hdl/advertising/hdl_function.go b/app/hdl/advertising/hdl_function.go new file mode 100644 index 0000000..e50b944 --- /dev/null +++ b/app/hdl/advertising/hdl_function.go @@ -0,0 +1,51 @@ +package advertising + +import ( + "applet/app/svc/advertising" + "github.com/gin-gonic/gin" +) + +// FunctionList +// @Summary 广告管理-广告位置列表 +// @Tags 广告管理 +// @Description 广告管理-广告位置列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingFunctionListReq true "(分页信息必填)" +// @Success 200 {object} md.AdvertisingFunctionResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/function/list [post] +func FunctionList(c *gin.Context) { + advertising.FunctionList(c) +} + +// FunctionDel +// @Summary 广告管理-广告位置列表-删除 +// @Tags 广告管理 +// @Description 广告管理-广告位置列表-删除 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingDelReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/function/del [post] +func FunctionDel(c *gin.Context) { + advertising.FunctionDel(c) +} + +// FunctionSave +// @Summary 广告管理-广告位置列表-保存 +// @Tags 广告管理 +// @Description 广告管理-广告位置列表-保存 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingFunctionList true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/function/save [post] +func FunctionSave(c *gin.Context) { + advertising.FunctionSave(c) +} diff --git a/app/hdl/advertising/hdl_limit.go b/app/hdl/advertising/hdl_limit.go new file mode 100644 index 0000000..eb5b67d --- /dev/null +++ b/app/hdl/advertising/hdl_limit.go @@ -0,0 +1,35 @@ +package advertising + +import ( + "applet/app/svc/advertising" + "github.com/gin-gonic/gin" +) + +// GetLimit +// @Summary 广告管理-广告设置-信息 +// @Tags 广告管理 +// @Description 广告管理-广告设置-信息 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.AdvertisingLimit "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/getLimit [get] +func GetLimit(c *gin.Context) { + advertising.GetLimit(c) +} + +// SetLimit +// @Summary 广告管理-广告设置-信息保存 +// @Tags 广告管理 +// @Description 广告管理-广告设置-信息保存 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingLimit true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/setLimit [post] +func SetLimit(c *gin.Context) { + advertising.SetLimit(c) +} diff --git a/app/hdl/advertising/hdl_list.go b/app/hdl/advertising/hdl_list.go new file mode 100644 index 0000000..481c2e2 --- /dev/null +++ b/app/hdl/advertising/hdl_list.go @@ -0,0 +1,51 @@ +package advertising + +import ( + "applet/app/svc/advertising" + "github.com/gin-gonic/gin" +) + +// List +// @Summary 广告管理-广告列表 +// @Tags 广告管理 +// @Description 广告管理-广告列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingListReq true "(分页信息必填)" +// @Success 200 {object} md.AdvertisingResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/list [post] +func List(c *gin.Context) { + advertising.List(c) +} + +// Del +// @Summary 广告管理-广告列表-删除 +// @Tags 广告管理 +// @Description 广告管理-广告列表-删除 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingDelReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/del [post] +func Del(c *gin.Context) { + advertising.Del(c) +} + +// Save +// @Summary 广告管理-广告列表-保存 +// @Tags 广告管理 +// @Description 广告管理-广告列表-保存 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AdvertisingSaveReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/save [post] +func Save(c *gin.Context) { + advertising.Save(c) +} diff --git a/app/hdl/institutional_management/module_setting/hdl_basic.go b/app/hdl/institutional_management/module_setting/hdl_basic.go index 3405731..7508fa3 100644 --- a/app/hdl/institutional_management/module_setting/hdl_basic.go +++ b/app/hdl/institutional_management/module_setting/hdl_basic.go @@ -5,10 +5,13 @@ import ( "applet/app/e" "applet/app/md/institutional_management/module_setting" "applet/app/utils" + "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc" "errors" "github.com/gin-gonic/gin" + "strings" "time" ) @@ -92,6 +95,9 @@ func ModuleSettingGet(c *gin.Context) { return } } + redisConn := cache.GetPool().Get() + scheme, domain := svc.ImageBucket(db.Db, redisConn) + moduleStyle.Data = svc.ImageFormatWithBucketNew(scheme, domain, moduleStyle.Data) utils.Unserialize([]byte(moduleStyle.Data), &dataMap) resp := md.ModuleSettingGetResp{ @@ -114,7 +120,7 @@ func ModuleSettingGet(c *gin.Context) { // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Param req body md.ModuleSettingUpdateReq true "模块类型值必填" +// @Param req body md.ModuleSettingUpdateReq true "模块类型值必填 链接传入完整 URL" // @Success 200 {int} "修改数据条数" // @Failure 400 {object} md.Response "具体错误" // @Router /api/institutionalManagement/moduleSetting/updateModuleSetting [POST] @@ -147,6 +153,8 @@ func ModuleSettingUpdate(c *gin.Context) { moduleStyle.Position = req.Position moduleStyle.Data = utils.SerializeStr(req.Data) + // 替换所有 host + moduleStyle.Data = strings.ReplaceAll(moduleStyle.Data, "http", "{{host}}") affected, err := moduleStyleDb.ModuleStyleUpdate(moduleStyle.ModId, moduleStyle, forceColumns...) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) diff --git a/app/hdl/member_center/hdl_tag__management.go b/app/hdl/member_center/hdl_tag__management.go index beac03c..7a0b113 100644 --- a/app/hdl/member_center/hdl_tag__management.go +++ b/app/hdl/member_center/hdl_tag__management.go @@ -165,7 +165,10 @@ func DeleteTag(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - affected, err := recordsDb.UserTagRecordDeleteBySession(session, utils.StrToInt64(req.TagID)) + affected, err := recordsDb.UserTagRecordsDeleteBySession(session, map[string]interface{}{ + "key": "id", + "value": req.TagID, + }) if err != nil { session.Rollback() e.OutErr(c, e.ERR_DB_ORM, err.Error()) diff --git a/app/hdl/member_center/hdl_user_management.go b/app/hdl/member_center/hdl_user_management.go index ba8c0d8..02977d2 100644 --- a/app/hdl/member_center/hdl_user_management.go +++ b/app/hdl/member_center/hdl_user_management.go @@ -7,7 +7,6 @@ import ( svc "applet/app/svc/member_center" "applet/app/utils" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" - "code.fnuoos.com/EggPlanet/egg_models.git/src/model" "errors" "fmt" "github.com/gin-gonic/gin" @@ -149,75 +148,9 @@ func UserManagementUpdateUserInfo(c *gin.Context) { e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) return } - session := db.Db.NewSession() - defer session.Close() - session.Begin() - userDb := implement.NewUserDb(db.Db) - var affected int64 - var err1 error - forceColumns := make([]string, 0) - user := model.User{ - Id: req.UID, - Phone: req.Phone, - UnionId: req.UnionId, - Nickname: req.Nickname, - Avatar: req.Avatar, - LastLoginIp: req.LastLoginIp, - Memo: req.Memo, - } - if req.Level != "" { - user.Level = utils.StrToInt(req.Level) - } - if req.State != "" { - user.State = utils.StrToInt(req.State) - } - if req.Sex != "" { - user.Sex = utils.StrToInt(req.Sex) - } - if req.ParentUid != "" { - user.ParentUid = utils.StrToInt64(req.ParentUid) - } else { - user.ParentUid = 0 - } - - forceColumns = []string{"sex", "parent_uid"} - affected, err1 = userDb.UserUpdateBySession(session, req.UID, &user, forceColumns...) - if err1 != nil { - session.Rollback() - e.OutErr(c, e.ERR_DB_ORM, err1.Error()) - return - } - - relateDb := implement.NewUserRelateDb(db.Db) - relateForceColumns := []string{"sex", "parent_uid"} - relate := &model.UserRelate{ - ParentUid: user.ParentUid, - } - affected, err1 = relateDb.UpdateUserRelateBySession(session, req.UID, relate, relateForceColumns...) - if err1 != nil { - session.Rollback() - e.OutErr(c, e.ERR_DB_ORM, err1.Error()) - return - } - - var err2 error - if req.Tag != "" { - record := model.UserTagRecords{ - TagId: utils.StrToInt(req.Tag), - } - recordsDb := implement.NewUserTagRecordsDb(db.Db) - affected, err2 = recordsDb.UserTagRecordsUpdateBySession(session, req.UID, &record, "tag_id") - if err2 != nil { - session.Rollback() - e.OutErr(c, e.ERR_DB_ORM, err2.Error()) - return - } - - } - err3 := session.Commit() - if err3 != nil { - session.Rollback() - e.OutErr(c, e.ERR_DB_ORM, err3.Error()) + affected, err := svc.UserManagementUpdateUserInfo(db.Db, req) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } diff --git a/app/hdl/setCenter/oss/aliyun/hdl_basic.go b/app/hdl/setCenter/oss/aliyun/hdl_basic.go index acdbc38..2656a4f 100644 --- a/app/hdl/setCenter/oss/aliyun/hdl_basic.go +++ b/app/hdl/setCenter/oss/aliyun/hdl_basic.go @@ -19,7 +19,7 @@ import ( // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Success 200 {object} md.GetBasicResp "设置列表" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/comm/oss/getBasic [get] +// @Router /api/settCenter/oss/aliYun/getBasic [get] func GetBasic(c *gin.Context) { redisConn := cache.GetPool().Get() sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) @@ -85,7 +85,7 @@ func GetBasic(c *gin.Context) { // @param req body md.SetBasicReq true "上传需要修改的信息" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/comm/oss/setBasic [post] +// @Router /api/settCenter/oss/aliYun/setBasic [post] func SetBasic(c *gin.Context) { var req *md.SetBasicReq if err1 := c.ShouldBindJSON(&req); err1 != nil { diff --git a/app/hdl/user_feedback/hdl_cate.go b/app/hdl/user_feedback/hdl_cate.go new file mode 100644 index 0000000..194256f --- /dev/null +++ b/app/hdl/user_feedback/hdl_cate.go @@ -0,0 +1,51 @@ +package user_feedback + +import ( + "applet/app/svc/user_feedback" + "github.com/gin-gonic/gin" +) + +// CateList +// @Summary 反馈列表-分类列表 +// @Tags 消息中心 +// @Description 分类列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackCateListReq true "(分页信息必填)" +// @Success 200 {object} md.UserFeedbackCateListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/userFeedback/cate/list [post] +func CateList(c *gin.Context) { + user_feedback.CateList(c) +} + +// CateSave +// @Summary 反馈列表-分类列表-分类保存 +// @Tags 消息中心 +// @Description 分类列表-分类保存 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackCateSaveReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/user_feedback/cate/save [post] +func CateSave(c *gin.Context) { + user_feedback.CateSave(c) +} + +// CateDel +// @Summary 反馈列表-分类列表-分类删除 +// @Tags 消息中心 +// @Description 分类列表-分类删除 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackCateDelReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/user_feedback/cate/del [post] +func CateDel(c *gin.Context) { + user_feedback.CateDel(c) +} diff --git a/app/hdl/user_feedback/hdl_list.go b/app/hdl/user_feedback/hdl_list.go new file mode 100644 index 0000000..7a0e371 --- /dev/null +++ b/app/hdl/user_feedback/hdl_list.go @@ -0,0 +1,81 @@ +package user_feedback + +import ( + "applet/app/svc/user_feedback" + "github.com/gin-gonic/gin" +) + +// List +// @Summary 用户反馈-反馈列表 +// @Tags 消息中心 +// @Description 反馈列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackListReq true "(分页信息必填)" +// @Success 200 {object} md.UserFeedbackListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/userFeedback/content/list [post] +func List(c *gin.Context) { + user_feedback.List(c) +} + +// RecordList +// @Summary 用户反馈-反馈列表-沟通记录 +// @Tags 消息中心 +// @Description 反馈列表-沟通记录 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackRecordListReq true "(分页信息必填)" +// @Success 200 {object} md.UserFeedbackRecordListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/userFeedback/content/record/list [post] +func RecordList(c *gin.Context) { + user_feedback.RecordList(c) +} + +// Say +// @Summary 用户反馈-反馈列表-沟通发送 +// @Tags 消息中心 +// @Description 反馈列表-沟通发送 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackSayReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/userFeedback/content/say [post] +func Say(c *gin.Context) { + user_feedback.Say(c) +} + +// ChangeState +// @Summary 用户反馈-反馈列表-修改状态 +// @Tags 消息中心 +// @Description 反馈列表-修改状态 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackSayReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/userFeedback/content/change/state [post] +func ChangeState(c *gin.Context) { + user_feedback.ChangeState(c) +} + +// Del +// @Summary 用户反馈-反馈列表-反馈删除 +// @Tags 消息中心 +// @Description 反馈列表-反馈删除 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.UserFeedbackDelReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/userFeedback/content/del [post] +func Del(c *gin.Context) { + user_feedback.Del(c) +} diff --git a/app/md/md_advertising.go b/app/md/md_advertising.go index 95ae79e..be96b6a 100644 --- a/app/md/md_advertising.go +++ b/app/md/md_advertising.go @@ -1,17 +1,70 @@ package md +type AdvertisingBase struct { + AndroidAdIsOpen string `json:"android_ad_is_open" example:"安卓广告是否开启(1:开启 0:不开启)"` + IosAdIsOpen string `json:"ios_ad_is_open" example:"ios广告是否开启(1:开启 0:不开启)"` + AndroidOpenAdIsOpen string `json:"android_open_ad_is_open" example:"安卓开屏广告是否开启(1:开启 0:不开启)"` + IosOpenAdIsOpen string `json:"ios_open_ad_is_open" example:"ios开屏广告是否开启(1:开启 0:不开启)"` + Voice string `json:"voice" example:"领取奖励声音"` + VoiceUrl string `json:"voice_url"` + Info string `json:"info" example:"广告商配置 {\"chuanshanjia\":{\"android_app_key\":\"\"}}"` +} type AdvertisingBaseResp struct { - AndroidAdIsOpen string `json:"android_ad_is_open"` - IosAdIsOpen string `json:"ios_ad_is_open"` - AndroidOpenAdIsOpen string `json:"android_open_ad_is_open"` - IosOpenAdIsOpen string `json:"ios_open_ad_is_open"` - Voice string `json:"voice"` - VoiceUrl string `json:"voice_url"` - Info map[string]AdvertisingBaseKey `json:"info"` -} -type AdvertisingBaseKey struct { - AndroidKey string `json:"android_key"` - AndroidSecret string `json:"android_secret"` - IosKey string `json:"ios_key"` - IosSecret string `json:"ios_secret"` + SelectData []map[string]string `json:"select_data"` + AdvertisingBase AdvertisingBase `json:"advertising_base"` +} +type AdvertisingListReq struct { + Page string `json:"page"` + Limit string `json:"limit"` + Name string `json:"name"` + Kind string `json:"kind"` +} +type AdvertisingListResp struct { + SelectData []map[string]string `json:"select_data"` + Total int64 `json:"total"` + List []AdvertisingList `json:"list"` +} +type AdvertisingList struct { + Id string `json:"id" ` + Name string `json:"name" example:"名称"` + Kind string `json:"kind" example:"广告类型(1:开屏广告 2:插屏广告 3:激励视频 4:信息流广告 5:全屏视频)"` + Info string `json:"info" example:"广告位配置 {\"chuanshanjia\":{\"android_ad_id\":[\"\"],\"ios_ad_id\":[\"\"]}}"` + CountingDown string `json:"counting_down" example:"倒计时 单位秒"` +} +type AdvertisingDelReq struct { + Id []string `json:"id"` +} +type AdvertisingSaveReq struct { + Id string `json:"id"` + Name string `json:"name" example:"名称"` + Kind string `json:"kind" example:"广告类型(1:开屏广告 2:插屏广告 3:激励视频 4:信息流广告 5:全屏视频)"` + Info string `json:"info" example:"广告位配置 {\"chuanshanjia\":{\"android_ad_id\":[\"\"],\"ios_ad_id\":[\"\"]}}"` + CountingDown string `json:"counting_down" example:"倒计时 单位秒"` +} +type AdvertisingLimit struct { + Minute string `json:"minute" example:"分钟"` + ImeiNum string `json:"imei_num" example:"设备数量"` + Tip string `json:"tip" example:"限制提示"` + PublicImg string `json:"public_img" example:"公共弹窗图"` + PublicImgUrl string `json:"public_img_url" example:"公共弹窗图"` + PublicStr string `json:"public_str" example:"公共弹窗文字"` + WithdrawImg string `json:"withdraw_img" example:"提现弹窗图"` + WithdrawImgUrl string `json:"withdraw_img_url" example:"提现弹窗图"` + WithdrawStr string `json:"withdraw_str" example:"提现弹窗文字"` +} + +type AdvertisingFunctionListReq struct { + Page string `json:"page"` + Limit string `json:"limit"` +} +type AdvertisingFunctionListResp struct { + SelectData []map[string]string `json:"select_data"` + AdvData []map[string]string `json:"adv_data"` + Total int64 `json:"total"` + List []AdvertisingFunctionList `json:"list"` +} +type AdvertisingFunctionList struct { + Id string `json:"id" ` + Type string `json:"type" example:"类型"` + AdId string `json:"ad_id" example:"广告id"` } diff --git a/app/md/md_user_feedback.go b/app/md/md_user_feedback.go new file mode 100644 index 0000000..96442d9 --- /dev/null +++ b/app/md/md_user_feedback.go @@ -0,0 +1,71 @@ +package md + +type UserFeedbackCateListReq struct { + Page string `json:"page,required"` // 页数 + Limit string `json:"limit,required"` // 每页大小 +} +type UserFeedbackCateListResp struct { + Total int64 `json:"total"` + List []UserFeedbackCateList `json:"list"` +} +type UserFeedbackCateList struct { + Id string `json:"id"` + Name string `json:"name"` + Sort string `json:"sort"` +} +type UserFeedbackCateSaveReq struct { + Id string `json:"id"` + Name string `json:"name"` + Sort string `json:"sort"` +} +type UserFeedbackCateDelReq struct { + Id []string `json:"id"` +} + +type UserFeedbackListReq struct { + Page string `json:"page,required"` // 页数 + Limit string `json:"limit,required"` // 每页大小 + Uid string `json:"uid"` + Phone string `json:"phone"` + Cid string `json:"cid"` +} +type UserFeedbackRecordListReq struct { + Page string `json:"page,required"` // 页数 + Limit string `json:"limit,required"` // 每页大小 + Id string `json:"id"` +} +type UserFeedbackRecordListResp struct { + Type string `json:"type"` + Nickname string `json:"nickname"` + HeadImg string `json:"head_img"` + CreateAt string `json:"create_at"` + Content string `json:"content"` +} +type UserFeedbackListResp struct { + Total int64 `json:"total"` + SelectData []map[string]interface{} `json:"select_data"` + List []UserFeedbackList `json:"list"` +} +type UserFeedbackList struct { + Id string `json:"id"` + Phone string `json:"phone"` + Title string `json:"title"` + Platform string `json:"platform"` + Version string `json:"version"` + Type string `json:"type"` + Img []string `json:"img"` + Content string `json:"content"` + CreateAt string `json:"create_at"` + State string `json:"state" example:"0待解决 1处理中 2已解决"` +} +type UserFeedbackSayReq struct { + Id string `json:"id"` + Content string `json:"content"` +} +type UserFeedbackChangeStateReq struct { + Id string `json:"id"` + State string `json:"state" example:"0待解决 1处理中 2已解决"` +} +type UserFeedbackDelReq struct { + Id []string `json:"id"` +} diff --git a/app/md/member_center/md_user_management.go b/app/md/member_center/md_user_management.go index 994f19c..a8c2fff 100644 --- a/app/md/member_center/md_user_management.go +++ b/app/md/member_center/md_user_management.go @@ -78,18 +78,18 @@ type LevelCount struct { } type UserManagementUpdateUserInfoReq struct { - UID int64 `json:"uid,required"` - Avatar string `json:"avatar"` // 头像 - Sex string `json:"sex"` // 性别(0:未知 1:男 2:女) - Level string `json:"level"` // 会员等级 ID - Tag string `json:"tag"` // 用户标签 ID - Phone string `json:"phone"` // 手机号 - Nickname string `json:"nickname"` // 用户名 - UnionId string `json:"union_id"` // 微信号 - Memo string `json:"memo" example:"备注"` - State string `json:"state"` // 账号状态 1正常,2冻结 - LastLoginIp string `json:"last_login_ip"` // 用户最后登录 IP - ParentUid string `json:"parent_uid"` // 邀请人 ID + UID int64 `json:"uid,required"` + Avatar string `json:"avatar"` // 头像 + Sex string `json:"sex"` // 性别(0:未知 1:男 2:女) + Level string `json:"level"` // 会员等级 ID + Tag []string `json:"tag"` // 用户标签 ID列表 + Phone string `json:"phone"` // 手机号 + Nickname string `json:"nickname"` // 用户名 + UnionId string `json:"union_id"` // 微信号 + Memo string `json:"memo" example:"备注"` + State string `json:"state"` // 账号状态 1正常,2冻结 + LastLoginIp string `json:"last_login_ip"` // 用户最后登录 IP + ParentUid string `json:"parent_uid"` // 邀请人 ID } type BasicInfoNode struct { diff --git a/app/router/router.go b/app/router/router.go index 05cbe26..98272b1 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -15,6 +15,7 @@ import ( "applet/app/hdl/member_center" "applet/app/hdl/notice" "applet/app/hdl/setCenter/oss/aliyun" + "applet/app/hdl/user_feedback" "applet/app/mw" _ "applet/docs" "github.com/gin-gonic/gin" @@ -72,6 +73,7 @@ func route(r *gin.RouterGroup) { rAdvertising(r.Group("/advertising")) rNotice(r.Group("/notice")) rArticle(r.Group("/article")) + rUserFeedback(r.Group("/userFeedback")) } func rSettCenter(r *gin.RouterGroup) { //设置中心 @@ -86,6 +88,15 @@ func rSettCenter(r *gin.RouterGroup) { //设置中心 } func rAdvertising(r *gin.RouterGroup) { r.GET("/getBasic", advertising.GetBasic) + r.POST("/setBasic", advertising.SetBasic) + r.POST("/list", advertising.List) + r.POST("/save", advertising.Save) + r.POST("/del", advertising.Del) + r.GET("/getLimit", advertising.GetLimit) + r.POST("/setLimit", advertising.SetLimit) + r.POST("/function/list", advertising.FunctionList) + r.POST("/function/save", advertising.FunctionSave) + r.POST("/function/del", advertising.FunctionDel) } func rNotice(r *gin.RouterGroup) { rJpush := r.Group("/jPush") //极光 @@ -107,7 +118,7 @@ func rNotice(r *gin.RouterGroup) { rAliyunSms.POST("/push/save", notice.AliyunSmsPushSave) } } -func rArticle(r *gin.RouterGroup) { +func rArticle(r *gin.RouterGroup) { //文章 rCate := r.Group("/cate") // { rCate.POST("/list", article.CateList) @@ -121,6 +132,22 @@ func rArticle(r *gin.RouterGroup) { rContent.POST("/del", article.Del) } } +func rUserFeedback(r *gin.RouterGroup) { //用户反馈 + rCate := r.Group("/cate") // + { + rCate.POST("/list", user_feedback.CateList) + rCate.POST("/save", user_feedback.CateSave) + rCate.POST("/del", user_feedback.CateDel) + } + rContent := r.Group("/content") // + { + rContent.POST("/list", user_feedback.List) + rContent.POST("/record/list", user_feedback.RecordList) + rContent.POST("/say", user_feedback.Say) + rContent.POST("/change/state", user_feedback.ChangeState) + rContent.POST("/del", user_feedback.Del) + } +} func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rPublicPlatoon := r.Group("/publicPlatoon") //公排设置 { diff --git a/app/svc/advertising/svc_base.go b/app/svc/advertising/svc_base.go index 5d82f37..63620bf 100644 --- a/app/svc/advertising/svc_base.go +++ b/app/svc/advertising/svc_base.go @@ -1,7 +1,58 @@ package advertising -import "github.com/gin-gonic/gin" +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/svc" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "github.com/gin-gonic/gin" +) func GetBasic(c *gin.Context) { - + NewAdvertisingBasicDb := implement.NewAdvertisingBasicDb(db.Db) + data, _ := NewAdvertisingBasicDb.GetAdvertisingBasicDb() + if data == nil { + data = &model.AdvertisingBasic{} + db.Db.Insert(data) + } + selsctData := []map[string]string{ + {"name": "穿山甲", "value": "chuanshanjia"}, + {"name": "广点通", "value": "guangdiantong"}, + } + AdvertisingBase := md.AdvertisingBase{ + AndroidAdIsOpen: utils.IntToStr(data.AndroidAdIsOpen), + IosAdIsOpen: utils.IntToStr(data.IosAdIsOpen), + AndroidOpenAdIsOpen: utils.IntToStr(data.AndroidOpenAdIsOpen), + IosOpenAdIsOpen: utils.IntToStr(data.IosOpenAdIsOpen), + Voice: data.Voice, + VoiceUrl: svc.GetOssUrl(data.Voice), + Info: data.Info, + } + res := md.AdvertisingBaseResp{ + SelectData: selsctData, + AdvertisingBase: AdvertisingBase, + } + e.OutSuc(c, res, nil) + return +} +func SetBasic(c *gin.Context) { + var req *md.AdvertisingBase + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + NewAdvertisingBasicDb := implement.NewAdvertisingBasicDb(db.Db) + data, _ := NewAdvertisingBasicDb.GetAdvertisingBasicDb() + data.AndroidAdIsOpen = utils.StrToInt(req.AndroidAdIsOpen) + data.IosAdIsOpen = utils.StrToInt(req.IosAdIsOpen) + data.AndroidOpenAdIsOpen = utils.StrToInt(req.AndroidOpenAdIsOpen) + data.IosOpenAdIsOpen = utils.StrToInt(req.IosOpenAdIsOpen) + data.Voice = req.Voice + data.Info = req.Info + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return } diff --git a/app/svc/advertising/svc_function.go b/app/svc/advertising/svc_function.go new file mode 100644 index 0000000..65eda5d --- /dev/null +++ b/app/svc/advertising/svc_function.go @@ -0,0 +1,88 @@ +package advertising + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "github.com/gin-gonic/gin" +) + +func FunctionList(c *gin.Context) { + var req *md.AdvertisingFunctionListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.AdvertisingFunctionListResp + noticeList := make([]md.AdvertisingFunctionList, 0) + resp.SelectData = []map[string]string{ + {"name": "首页砸蛋", "value": "egg"}, + {"name": "首页签到", "value": "egg_sign"}, + } + NewAdvertisingSpaceDb := implement.NewAdvertisingSpaceDb(db.Db) + adv, _, _ := NewAdvertisingSpaceDb.FindUserFeedbackCateAndTotal("1", "1000", "", "3") + advList := make([]map[string]string, 0) + if adv != nil { + for _, v := range *adv { + tmp := map[string]string{ + "name": v.Name, + "value": utils.IntToStr(v.Id), + } + advList = append(advList, tmp) + } + } + resp.AdvData = advList + NewJpushNoticeDb := implement.NewAdvertisingFunctionDb(db.Db) + notice, total, _ := NewJpushNoticeDb.FindUserFeedbackFunctionAndTotal(req.Page, req.Limit) + resp.Total = total + if notice != nil { + for _, v := range *notice { + tmp := md.AdvertisingFunctionList{ + Id: utils.Int64ToStr(v.Id), + AdId: utils.IntToStr(v.AdId), + Type: v.Type, + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func FunctionDel(c *gin.Context) { + var req *md.ArticleCateDelReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + db.Db.In("id", req.Id).Delete(&model.AdvertisingFunction{}) + e.OutSuc(c, "success", nil) + return +} +func FunctionSave(c *gin.Context) { + var req *md.AdvertisingFunctionList + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var data = new(model.AdvertisingFunction) + if utils.StrToInt(req.Id) > 0 { + NewAdvertisingSpaceDb := implement.NewAdvertisingFunctionDb(db.Db) + space, _ := NewAdvertisingSpaceDb.GetAdvertisingFunction(req.Id) + if space == nil { + e.OutErr(c, 400, e.NewErr(400, "记录不存在")) + return + } + data = space + } else { + db.Db.Insert(data) + } + data.Type = req.Type + data.AdId = utils.StrToInt(req.AdId) + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/advertising/svc_limit.go b/app/svc/advertising/svc_limit.go new file mode 100644 index 0000000..39e9d88 --- /dev/null +++ b/app/svc/advertising/svc_limit.go @@ -0,0 +1,53 @@ +package advertising + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/svc" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "github.com/gin-gonic/gin" +) + +func GetLimit(c *gin.Context) { + NewAdvertisingBasicDb := implement.NewAdvertisingLimitDb(db.Db) + data, _ := NewAdvertisingBasicDb.GetAdvertisingLimit() + if data == nil { + data = &model.AdvertisingLimit{} + db.Db.Insert(data) + } + AdvertisingBase := md.AdvertisingLimit{ + Minute: utils.IntToStr(data.Minute), + ImeiNum: utils.IntToStr(data.ImeiNum), + Tip: data.Tip, + PublicImg: data.PublicImg, + PublicImgUrl: svc.GetOssUrl(data.PublicImg), + PublicStr: data.PublicStr, + WithdrawImg: data.WithdrawImg, + WithdrawImgUrl: svc.GetOssUrl(data.WithdrawImg), + WithdrawStr: data.WithdrawStr, + } + e.OutSuc(c, AdvertisingBase, nil) + return +} +func SetLimit(c *gin.Context) { + var req *md.AdvertisingLimit + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + NewAdvertisingBasicDb := implement.NewAdvertisingLimitDb(db.Db) + data, _ := NewAdvertisingBasicDb.GetAdvertisingLimit() + data.Minute = utils.StrToInt(req.Minute) + data.ImeiNum = utils.StrToInt(req.ImeiNum) + data.Tip = req.Tip + data.PublicImg = req.PublicImg + data.PublicStr = req.PublicStr + data.WithdrawImg = req.WithdrawImg + data.WithdrawStr = req.WithdrawStr + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/advertising/svc_list.go b/app/svc/advertising/svc_list.go new file mode 100644 index 0000000..0b7d9d9 --- /dev/null +++ b/app/svc/advertising/svc_list.go @@ -0,0 +1,81 @@ +package advertising + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "github.com/gin-gonic/gin" +) + +func List(c *gin.Context) { + var req *md.AdvertisingListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.AdvertisingListResp + noticeList := make([]md.AdvertisingList, 0) + resp.SelectData = []map[string]string{ + {"name": "开屏广告", "value": "1"}, + {"name": "插屏广告", "value": "2"}, + {"name": "激励视频", "value": "3"}, + {"name": "信息流广告", "value": "4"}, + {"name": "全屏视频", "value": "5"}, + } + NewJpushNoticeDb := implement.NewAdvertisingSpaceDb(db.Db) + notice, total, _ := NewJpushNoticeDb.FindUserFeedbackCateAndTotal(req.Page, req.Limit, req.Name, req.Kind) + resp.Total = total + if notice != nil { + for _, v := range *notice { + tmp := md.AdvertisingList{ + Id: utils.IntToStr(v.Id), + CountingDown: utils.IntToStr(v.CountingDown), + Kind: utils.IntToStr(v.Kind), + Info: v.Info, + Name: v.Name, + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func Del(c *gin.Context) { + var req *md.ArticleCateDelReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + db.Db.In("id", req.Id).Delete(&model.AdvertisingSpace{}) + e.OutSuc(c, "success", nil) + return +} +func Save(c *gin.Context) { + var req *md.AdvertisingSaveReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var data = new(model.AdvertisingSpace) + if utils.StrToInt(req.Id) > 0 { + NewAdvertisingSpaceDb := implement.NewAdvertisingSpaceDb(db.Db) + space, _ := NewAdvertisingSpaceDb.GetAdvertisingSpace(req.Id) + if space == nil { + e.OutErr(c, 400, e.NewErr(400, "记录不存在")) + return + } + data = space + } else { + db.Db.Insert(data) + } + data.Name = req.Name + data.Info = req.Info + data.CountingDown = utils.StrToInt(req.CountingDown) + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/member_center/svc_user_management.go b/app/svc/member_center/svc_user_management.go index f9fb48d..ba4a959 100644 --- a/app/svc/member_center/svc_user_management.go +++ b/app/svc/member_center/svc_user_management.go @@ -1,7 +1,12 @@ package svc import ( + "applet/app/db" "applet/app/md/member_center" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "time" "xorm.io/xorm" ) @@ -67,3 +72,105 @@ func UserManagementGetUsers(engine *xorm.Engine, req *md.UserManagementGetUserLi } return &users, total, nil } + +func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpdateUserInfoReq) (int64, error) { + session := engine.NewSession() + defer session.Close() + session.Begin() + userDb := implement.NewUserDb(db.Db) + var affected int64 + var err1 error + forceColumns := make([]string, 0) + user := model.User{ + Id: req.UID, + Phone: req.Phone, + UnionId: req.UnionId, + Nickname: req.Nickname, + Avatar: req.Avatar, + LastLoginIp: req.LastLoginIp, + Memo: req.Memo, + } + if req.Level != "" { + user.Level = utils.StrToInt(req.Level) + } + if req.State != "" { + user.State = utils.StrToInt(req.State) + } + if req.Sex != "" { + user.Sex = utils.StrToInt(req.Sex) + } + if req.ParentUid != "" { + user.ParentUid = utils.StrToInt64(req.ParentUid) + } else { + user.ParentUid = 0 + } + + forceColumns = []string{"sex", "parent_uid"} + affected, err1 = userDb.UserUpdateBySession(session, req.UID, &user, forceColumns...) + if err1 != nil { + session.Rollback() + return 0, err1 + } + + relateDb := implement.NewUserRelateDb(db.Db) + relateForceColumns := []string{"sex", "parent_uid"} + relate := &model.UserRelate{ + ParentUid: user.ParentUid, + } + affected, err1 = relateDb.UpdateUserRelateBySession(session, req.UID, relate, relateForceColumns...) + if err1 != nil { + session.Rollback() + return 0, err1 + } + // 获取用户所有标签记录 + recordsDb := implement.NewUserTagRecordsDb(db.Db) + records, err := recordsDb.UserTagRecordsFindByParams(map[string]interface{}{ + "key": "uid", + "value": req.UID, + }) + if err != nil { + return 0, err + } + if records != nil { + recordIds := make([]int, 0) + for _, record := range *records { + recordIds = append(recordIds, record.TagId) + } + + // 删除所有用户的所有标签记录 + _, err := recordsDb.UserTagRecordsDeleteBySession(session, map[string]interface{}{ + "key": "id", + "value": recordIds, + }) + if err != nil { + return 0, err + } + } + + // 新增用户标签记录 + if len(req.Tag) > 0 { + newRecords := make([]*model.UserTagRecords, 0) + now := time.Now() + for _, tag := range req.Tag { + newRecord := &model.UserTagRecords{ + TagId: utils.StrToInt(tag), + Uid: req.UID, + Memo: req.Memo, + CreateAt: now.Format("2006-01-02 15:04:05"), + } + newRecords = append(newRecords, newRecord) + } + affected, err = recordsDb.UserTagRecordsBatchInsert(newRecords) + if err != nil { + return 0, err + } + } + + err3 := session.Commit() + if err3 != nil { + session.Rollback() + return 0, err3 + } + + return affected, nil +} diff --git a/app/svc/svc_comm.go b/app/svc/svc_comm.go index 81a5c85..6cad089 100644 --- a/app/svc/svc_comm.go +++ b/app/svc/svc_comm.go @@ -10,9 +10,19 @@ import ( func GetOssUrl(img string) string { redisConn := cache.GetPool().Get() sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) - sysCfg := sysCfgDb.SysCfgFindWithDb("file_bucket_scheme", "file_bucket_host") + sysCfg := sysCfgDb.SysCfgFindWithDb("oss_domain") if strings.Contains(img, "http") == false && img != "" { - img = sysCfg["file_bucket_scheme"] + "://" + sysCfg["file_bucket_host"] + img + http := "" + if strings.Contains(sysCfg["oss_domain"], "http") == false { + http = "http://" + } + img = http + sysCfg["oss_domain"] + img } return img } +func GetSysCfgStr(key string) string { + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + return sysCfgDb.SysCfgGetWithDb(key) + +} diff --git a/app/svc/user_feedback/svc_cate.go b/app/svc/user_feedback/svc_cate.go new file mode 100644 index 0000000..29067e9 --- /dev/null +++ b/app/svc/user_feedback/svc_cate.go @@ -0,0 +1,71 @@ +package user_feedback + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "github.com/gin-gonic/gin" +) + +func CateList(c *gin.Context) { + var req *md.UserFeedbackCateListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.UserFeedbackCateListResp + noticeList := make([]md.UserFeedbackCateList, 0) + NewJpushNoticeDb := implement.NewUserFeedbackCateDb(db.Db) + notice, total, _ := NewJpushNoticeDb.FindUserFeedbackCateAndTotal(req.Page, req.Limit) + resp.Total = total + if notice != nil { + for _, v := range *notice { + tmp := md.UserFeedbackCateList{ + Id: utils.IntToStr(v.Id), + Sort: utils.IntToStr(v.Sort), + Name: v.Name, + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func CateSave(c *gin.Context) { + var req *md.UserFeedbackCateSaveReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var data = new(model.UserFeedbackCate) + if utils.StrToInt(req.Id) > 0 { + NewUserFeedbackCateDb := implement.NewUserFeedbackCateDb(db.Db) + notice, _ := NewUserFeedbackCateDb.GetUserFeedbackCate(req.Id) + if notice == nil { + e.OutErr(c, 400, e.NewErr(400, "记录不存在")) + return + } + data = notice + } else { + db.Db.Insert(data) + } + data.Name = req.Name + data.Sort = utils.StrToInt(req.Sort) + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return +} +func CateDel(c *gin.Context) { + var req *md.UserFeedbackCateDelReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + db.Db.In("id", req.Id).Delete(&model.UserFeedbackCate{}) + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/user_feedback/svc_list.go b/app/svc/user_feedback/svc_list.go new file mode 100644 index 0000000..2b8427e --- /dev/null +++ b/app/svc/user_feedback/svc_list.go @@ -0,0 +1,175 @@ +package user_feedback + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/svc" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "encoding/json" + "github.com/gin-gonic/gin" + "github.com/tidwall/gjson" + "strings" + "time" +) + +func List(c *gin.Context) { + var req *md.UserFeedbackListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.UserFeedbackListResp + noticeList := make([]md.UserFeedbackList, 0) + NewUserFeedbackDb := implement.NewUserFeedbackDb(db.Db) + uid := "" + if req.Uid != "" { + uid = req.Uid + } + if req.Phone != "" { + uid = "-1" + NewUserDb := implement.NewUserDb(db.Db) + user, _ := NewUserDb.UserGetOneByParams(map[string]interface{}{ + "key": "phone", + "value": req.Phone, + }) + if user != nil { + uid = utils.Int64ToStr(user.Id) + } + } + notice, total, _ := NewUserFeedbackDb.FindUserFeedbackAndTotal(req.Page, req.Limit, uid, req.Cid, "") + resp.Total = total + resp.SelectData = make([]map[string]interface{}, 0) + NewUserFeedbackCateDb := implement.NewUserFeedbackCateDb(db.Db) + pid, _ := NewUserFeedbackCateDb.FindUserFeedbackCate("1", "100") + if pid != nil { + for _, v := range *pid { + tmp := map[string]interface{}{ + "name": v.Name, "value": utils.IntToStr(v.Id), + } + resp.SelectData = append(resp.SelectData, tmp) + } + } + if notice != nil { + platformMap := map[string]string{ + "android": "安卓", + "iOS": "iOS", + "wx_applet": "小程序", + } + for _, v := range *notice { + v.Extra = strings.ToLower(v.Extra) + platform := gjson.Get(v.Extra, "platform").String() + img := make([]string, 0) + json.Unmarshal([]byte(v.Img), &img) + if v.Phone == "" { + NewUserDb := implement.NewUserDb(db.Db) + user, _ := NewUserDb.UserGetOneByParams(map[string]interface{}{ + "key": "id", + "value": v.Uid, + }) + if user != nil { + v.Phone = user.Phone + } + } + tmp := md.UserFeedbackList{ + Id: utils.IntToStr(v.Id), + Phone: v.Phone, + Title: v.Title, + Platform: platformMap[platform], + Version: gjson.Get(v.Extra, "devicemodel").String() + " " + gjson.Get(v.Extra, "osversion").String() + " " + gjson.Get(v.Extra, "appversionname").String(), + Type: v.Type, + Img: img, + Content: v.Content, + CreateAt: v.CreateAt.Format("2006-01-02 15:04:05"), + State: utils.IntToStr(v.State), + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func RecordList(c *gin.Context) { + eg := db.Db + var req md.UserFeedbackRecordListReq + err := c.ShouldBindJSON(&req) + if err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + NewUserFeedbackRecordDb := implement.NewUserFeedbackRecordDb(eg) + article, _ := NewUserFeedbackRecordDb.FindUserFeedback(req.Page, "1000", req.Id) + data := make([]md.UserFeedbackRecordListResp, 0) + if article != nil { + for _, v := range *article { + tmp := md.UserFeedbackRecordListResp{ + Content: v.Content, + CreateAt: v.CreateAt.Format("2006-01-02"), + Type: "official", + } + if v.Uid > 0 { + NewUserDb := implement.NewUserDb(eg) + user, _ := NewUserDb.GetUser(int64(v.Uid)) + if user != nil { + tmp.Nickname = user.Nickname + tmp.HeadImg = svc.GetOssUrl(user.Avatar) + } + tmp.Type = "user" + } else { + tmp.Nickname = svc.GetSysCfgStr("app_name") + tmp.HeadImg = svc.GetOssUrl(svc.GetSysCfgStr("app_logo")) + } + data = append(data, tmp) + } + } + e.OutSuc(c, data, nil) + return +} + +func Say(c *gin.Context) { + var req *md.UserFeedbackSayReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + data := model.UserFeedbackRecord{ + Lid: utils.StrToInt(req.Id), + Content: req.Content, + CreateAt: time.Now(), + } + db.Db.Insert(&data) + e.OutSuc(c, "success", nil) + return +} +func ChangeState(c *gin.Context) { + var req *md.UserFeedbackChangeStateReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + NewUserFeedbackDb := implement.NewUserFeedbackDb(db.Db) + notice, _ := NewUserFeedbackDb.GetUserFeedback(req.Id) + if notice == nil { + e.OutErr(c, 400, e.NewErr(400, "记录不存在")) + return + } + notice.State = utils.StrToInt(req.State) + db.Db.Where("id=?", notice.Id).Cols("state").Update(notice) + e.OutSuc(c, "success", nil) + return +} + +func Del(c *gin.Context) { + var req *md.UserFeedbackDelReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + db.Db.In("id", req.Id).Delete(&model.UserFeedback{}) + db.Db.In("lid", req.Id).Delete(&model.UserFeedbackRecord{}) + e.OutSuc(c, "success", nil) + return +} diff --git a/docs/docs.go b/docs/docs.go index 459483f..f8f2e8d 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2365,6 +2365,98 @@ const docTemplate = `{ } } }, + "/api/institutionalManagement/moduleSetting/getModuleSetting": { + "get": { + "description": "个性化设置(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "模块设置" + ], + "summary": "制度中心-模块设置-个性化设置(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "模块类型值", + "name": "mod_name_value", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.ModuleSettingGetResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/institutionalManagement/moduleSetting/updateModuleSetting": { + "post": { + "description": "个性化设置(更新)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "模块设置" + ], + "summary": "制度中心-模块设置-个性化设置(更新)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "模块类型值必填", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.ModuleSettingUpdateReq" + } + } + ], + "responses": { + "200": { + "description": "修改数据条数", + "schema": { + "type": "int" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/publicPlatoon/communityDividends/communityDividendsAdd": { "post": { "description": "社区分红(新增)", @@ -7145,6 +7237,74 @@ const docTemplate = `{ } } }, + "md.ModuleSettingGetResp": { + "type": "object", + "properties": { + "data": { + "description": "内容", + "type": "object", + "additionalProperties": true + }, + "mod_name": { + "description": "模块名称", + "type": "string" + }, + "mod_name_list": { + "description": "模块名称对照", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "position": { + "description": "位置", + "type": "string" + }, + "skip_identifier": { + "description": "跳转标识", + "type": "string" + }, + "subtitle": { + "description": "副标题", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + } + }, + "md.ModuleSettingUpdateReq": { + "type": "object", + "properties": { + "data": { + "description": "内容", + "type": "object", + "additionalProperties": true + }, + "mod_name_value": { + "description": "模块类型值", + "type": "string" + }, + "position": { + "description": "位置", + "type": "string" + }, + "skip_identifier": { + "description": "跳转标识", + "type": "string" + }, + "subtitle": { + "description": "副标题", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + } + }, "md.NewUserRedPackageGetBasicResp": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 864af8e..d463cac 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2358,6 +2358,98 @@ } } }, + "/api/institutionalManagement/moduleSetting/getModuleSetting": { + "get": { + "description": "个性化设置(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "模块设置" + ], + "summary": "制度中心-模块设置-个性化设置(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "模块类型值", + "name": "mod_name_value", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.ModuleSettingGetResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/institutionalManagement/moduleSetting/updateModuleSetting": { + "post": { + "description": "个性化设置(更新)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "模块设置" + ], + "summary": "制度中心-模块设置-个性化设置(更新)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "模块类型值必填", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.ModuleSettingUpdateReq" + } + } + ], + "responses": { + "200": { + "description": "修改数据条数", + "schema": { + "type": "int" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/publicPlatoon/communityDividends/communityDividendsAdd": { "post": { "description": "社区分红(新增)", @@ -7138,6 +7230,74 @@ } } }, + "md.ModuleSettingGetResp": { + "type": "object", + "properties": { + "data": { + "description": "内容", + "type": "object", + "additionalProperties": true + }, + "mod_name": { + "description": "模块名称", + "type": "string" + }, + "mod_name_list": { + "description": "模块名称对照", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "position": { + "description": "位置", + "type": "string" + }, + "skip_identifier": { + "description": "跳转标识", + "type": "string" + }, + "subtitle": { + "description": "副标题", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + } + }, + "md.ModuleSettingUpdateReq": { + "type": "object", + "properties": { + "data": { + "description": "内容", + "type": "object", + "additionalProperties": true + }, + "mod_name_value": { + "description": "模块类型值", + "type": "string" + }, + "position": { + "description": "位置", + "type": "string" + }, + "skip_identifier": { + "description": "跳转标识", + "type": "string" + }, + "subtitle": { + "description": "副标题", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + } + }, "md.NewUserRedPackageGetBasicResp": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 9f51df0..838144f 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1684,6 +1684,56 @@ definitions: example: 分数 type: string type: object + md.ModuleSettingGetResp: + properties: + data: + additionalProperties: true + description: 内容 + type: object + mod_name: + description: 模块名称 + type: string + mod_name_list: + description: 模块名称对照 + items: + additionalProperties: true + type: object + type: array + position: + description: 位置 + type: string + skip_identifier: + description: 跳转标识 + type: string + subtitle: + description: 副标题 + type: string + title: + description: 标题 + type: string + type: object + md.ModuleSettingUpdateReq: + properties: + data: + additionalProperties: true + description: 内容 + type: object + mod_name_value: + description: 模块类型值 + type: string + position: + description: 位置 + type: string + skip_identifier: + description: 跳转标识 + type: string + subtitle: + description: 副标题 + type: string + title: + description: 标题 + type: string + type: object md.NewUserRedPackageGetBasicResp: properties: create_at: @@ -4939,6 +4989,67 @@ paths: summary: 制度中心-绿色能量持有者明细-蛋蛋积分流水明细(查询) tags: - 公排管理 + /api/institutionalManagement/moduleSetting/getModuleSetting: + get: + consumes: + - application/json + description: 个性化设置(获取) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 模块类型值 + in: query + name: mod_name_value + required: true + type: string + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.ModuleSettingGetResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-模块设置-个性化设置(获取) + tags: + - 模块设置 + /api/institutionalManagement/moduleSetting/updateModuleSetting: + post: + consumes: + - application/json + description: 个性化设置(更新) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 模块类型值必填 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.ModuleSettingUpdateReq' + produces: + - application/json + responses: + "200": + description: 修改数据条数 + schema: + type: int + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-模块设置-个性化设置(更新) + tags: + - 模块设置 /api/institutionalManagement/publicPlatoon/communityDividends/communityDividendsAdd: post: consumes: diff --git a/go.mod b/go.mod index 8ed48ab..446d694 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,9 @@ module applet go 1.19 -// replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models +replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models -// replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules + replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules require ( github.com/boombuler/barcode v1.0.1 @@ -33,7 +33,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126070618-9a7e2400a08f + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126104405-980be92ee61d code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241125081706-0915be3f4144 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5