Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	go.mod
master
huangjiajun 4 dni temu
rodzic
commit
6d1765b769
13 zmienionych plików z 6345 dodań i 1672 usunięć
  1. +57
    -0
      app/hdl/im/hdl_send_red_package_ord.go
  2. +156
    -0
      app/hdl/institutional_management/module_setting/hdl_basic.go
  3. +4
    -4
      app/hdl/notice/hdl_aliyun_sms.go
  4. +49
    -0
      app/md/im/md_send_red_package_ord.go
  5. +20
    -0
      app/md/institutional_management/module_setting/md_basic.go
  6. +8
    -0
      app/router/router.go
  7. +1
    -1
      app/svc/im/svc_customer_service.go
  8. +1
    -1
      app/svc/im/svc_emoticon.go
  9. +134
    -0
      app/svc/im/svc_send_red_package_ord.go
  10. +2418
    -825
      docs/docs.go
  11. +2418
    -825
      docs/swagger.json
  12. +1077
    -14
      docs/swagger.yaml
  13. +2
    -2
      go.mod

+ 57
- 0
app/hdl/im/hdl_send_red_package_ord.go Wyświetl plik

@@ -0,0 +1,57 @@
package im

import (
"applet/app/e"
md "applet/app/md/im"
svc "applet/app/svc/im"
"github.com/gin-gonic/gin"
)

// PageSendRedPackageOrd
// @Summary Im-红包记录(列表)
// @Tags 红包记录
// @Description 红包记录(列表)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @param req body md.PageSendRedPackageOrdReq true "相关参数"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/im/pageSendRedPackageOrd [POST]
func PageSendRedPackageOrd(c *gin.Context) {
var req *md.PageSendRedPackageOrdReq
if err1 := c.ShouldBindJSON(&req); err1 != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
return
}

err, resp := svc.PageSendRedPackageOrd(*req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

e.OutSuc(c, resp, nil)
}

// RedPackageRecordsDetail
// @Summary Im-红包记录(详情)
// @Tags 红包记录
// @Description 红包记录(详情)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param red_package_id query string true "红包id"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/im/redPackageRecordsDetail [GET]
func RedPackageRecordsDetail(c *gin.Context) {
redPackageId := c.DefaultQuery("red_package_id", "")
err, resp := svc.RedPackageRecordsDetail(redPackageId)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

e.OutSuc(c, resp, nil)
}

+ 156
- 0
app/hdl/institutional_management/module_setting/hdl_basic.go Wyświetl plik

@@ -0,0 +1,156 @@
package module_setting

import (
"applet/app/db"
"applet/app/e"
"applet/app/md/institutional_management/module_setting"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"errors"
"github.com/gin-gonic/gin"
"time"
)

// ModuleSettingGet
// @Summary 制度中心-模块设置-个性化设置(获取)
// @Tags 模块设置
// @Description 个性化设置(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param mod_name_value query string true "模块类型值"
// @Success 200 {object} md.ModuleSettingGetResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/institutionalManagement/moduleSetting/getModuleSetting [GET]
func ModuleSettingGet(c *gin.Context) {
modNameValue := c.DefaultQuery("mod_name_value", "1")
modNameList := []map[string]interface{}{
{
"mod_name": "home_page",
"value": "1",
},
{
"mod_name": "member_center",
"value": "2",
},
{
"mod_name": "bottom_bar",
"value": "3",
},
{
"mod_name": "invitation_download_landing_page",
"value": "4",
},
{
"mod_name": "invitation_poster",
"value": "5",
},
}
modNameMap := map[string]string{
"1": "home_page",
"2": "member_center",
"3": "bottom_bar",
"4": "invitation_download_landing_page",
"5": "invitation_poster",
}
moduleStyleDb := implement.NewModuleStyleDb(db.Db)
var moduleStyle *model.ModuleStyle
var err error
moduleStyle, err = moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
"key": "mod_name",
"value": modNameMap[modNameValue],
})

if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var dataMap map[string]interface{}
if moduleStyle == nil {
now := time.Now()
m := model.ModuleStyle{
ModName: modNameMap[modNameValue],
Position: modNameMap[modNameValue],
SkipIdentifier: "",
Title: "主标题",
Subtitle: "子标题",
Data: utils.SerializeStr(dataMap),
CreateAt: now.Format("2006-01-02 15:04:05"),
}
_, err = moduleStyleDb.ModuleStyleInsert(&m)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
moduleStyle, err = moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
"key": "mod_name",
"value": modNameMap[modNameValue],
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
}
utils.Unserialize([]byte(moduleStyle.Data), &dataMap)

resp := md.ModuleSettingGetResp{
ModNameList: modNameList,
ModName: moduleStyle.ModName,
Position: moduleStyle.Position,
SkipIdentifier: moduleStyle.SkipIdentifier,
Title: moduleStyle.Title,
Subtitle: moduleStyle.Subtitle,
Data: dataMap,
}

e.OutSuc(c, resp, nil)
}

// ModuleSettingUpdate
// @Summary 制度中心-模块设置-个性化设置(更新)
// @Tags 模块设置
// @Description 个性化设置(更新)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.ModuleSettingUpdateReq true "模块类型值必填"
// @Success 200 {int} "修改数据条数"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/institutionalManagement/moduleSetting/updateModuleSetting [POST]
func ModuleSettingUpdate(c *gin.Context) {
var req *md.ModuleSettingUpdateReq
if err1 := c.ShouldBindJSON(&req); err1 != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
return
}

modNameMap := map[string]string{
"1": "home_page",
"2": "member_center",
"3": "bottom_bar",
"4": "invitation_download_landing_page",
"5": "invitation_poster",
}
moduleStyleDb := implement.NewModuleStyleDb(db.Db)
moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
"key": "mod_name",
"value": modNameMap[req.ModNameValue],
})
if moduleStyle == nil {
e.OutErr(c, e.ERR_NO_DATA, errors.New("不存在该页面"))
return
}
forceColumns := []string{"title", "subtitle", "data"}
moduleStyle.Title = req.Title
moduleStyle.Subtitle = req.Subtitle
moduleStyle.Position = req.Position
moduleStyle.Data = utils.SerializeStr(req.Data)

affected, err := moduleStyleDb.ModuleStyleUpdate(moduleStyle.ModId, moduleStyle, forceColumns...)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, affected, nil)
}

+ 4
- 4
app/hdl/notice/hdl_aliyun_sms.go Wyświetl plik

@@ -12,8 +12,8 @@ import (
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body true "参数 file-----文件上传格式"
// @Success 200 {object} "phone 一个数组"
// @Param file formData string true "参数 file-----文件上传格式"
// @Success 200 {string} "phone 一个数组"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/notice/aliyunSms/file/phone [post]
func AliyunSmsFilePhone(c *gin.Context) {
@@ -41,7 +41,7 @@ func AliyunSmsBase(c *gin.Context) {
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body true "数组 把列表的数组传过来"
// @Param req body string true "数组 把列表的数组传过来"
// @Success 200 {string} "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/notice/aliyunSms/save [post]
@@ -70,7 +70,7 @@ func AliyunSmsSaleBase(c *gin.Context) {
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body true "数组 把列表的数组传过来"
// @Param req body string true "数组 把列表的数组传过来"
// @Success 200 {string} "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/notice/aliyunSms/sale/save [post]


+ 49
- 0
app/md/im/md_send_red_package_ord.go Wyświetl plik

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

type PageSendRedPackageOrdReq struct {
Page int `json:"page"`
PageSize int `json:"page_size"`
State int `json:"state"` //状态
Uid int `json:"uid"`
RedPacketType int `json:"red_packet_type"` //红包类型
StartTimeStart string `json:"start_time_start" example:"发送时间-起始"`
StartTimeEnd string `json:"start_time_end" example:"发送时间-截止"`
InviteCode string `json:"invite_code" example:"邀请码"` //邀请码
Phone string `json:"phone" example:"手机号"` //手机号
Nickname string `json:"nickname" example:"昵称"` //昵称
OrdNo string `json:"ord_no" example:"订单号"` //订单号
}

type PageSendRedPackageOrdResp struct {
Page int `json:"page"`
PageSize int `json:"page_size"`
Total int64 `json:"total"`
List []struct {
Id int64 `json:"id"` //记录id
Uid int64 `json:"uid"`
Phone string `json:"ord_no" example:"订单号"`
Nickname string `json:"nickname" example:"昵称"`
AvatarUrl string `json:"avatar_url" example:"头像"`
InviteCode string `json:"invite_code" example:"邀请码"`
State int `json:"state"` // 红包状态(0:未领取 1:领取中 2:领取完 3:已过期)
Amount string `json:"amount"` // 金额
RedPacketBalanceAmount string `json:"red_packet_balance_amount" example:"红包剩余金额"` // 红包剩余金额
RedPacketType int `json:"red_packet_type" example:"红包类型"` // 红包类型
RedPacketNums string `json:"red_packet_nums" example:"红包剩余个数"` // 红包剩余个数
WaitDrawUserIds string `json:"wait_draw_user_ids" example:"待领取用户id"` // 待领取用户id
ReceivedUserIds string `json:"received_user_ids" example:"领取用户id"` // 领取用户id
ReceivedTimes string `json:"received_times" example:"已领取时间"` // 已领取时间
ReceivedUserAmount string `json:"received_user_amount" example:"已领取用户金额"` // 已领取用户金额
CreateTime string `json:"create_time" example:"创建时间"` // 创建时间
UpdateTime string `json:"update_time" example:"更新时间"` // 更新时间
} `json:"list"`
}

type RedPackageRecordsDetailResp struct {
Uid int64 `json:"uid"`
InviteCode string `json:"invite_code" example:"邀请码"`
Nickname string `json:"nickname" example:"昵称"`
AvatarUrl string `json:"avatar_url" example:"头像"`
Amount string `json:"amount"` // 金额
ReceivedTimes string `json:"received_times" example:"领取时间"` // 领取时间
}

+ 20
- 0
app/md/institutional_management/module_setting/md_basic.go Wyświetl plik

@@ -0,0 +1,20 @@
package md

type ModuleSettingGetResp struct {
ModNameList []map[string]interface{} `json:"mod_name_list"` // 模块名称对照
ModName string `json:"mod_name"` // 模块名称
Position string `json:"position"` // 位置
SkipIdentifier string `json:"skip_identifier"` // 跳转标识
Title string `json:"title"` // 标题
Subtitle string `json:"subtitle"` // 副标题
Data map[string]interface{} `json:"data"` // 内容
}

type ModuleSettingUpdateReq struct {
ModNameValue string `json:"mod_name_value,required"` // 模块类型值
Position string `json:"position"` // 位置
SkipIdentifier string `json:"skip_identifier"` // 跳转标识
Title string `json:"title"` // 标题
Subtitle string `json:"subtitle"` // 副标题
Data map[string]interface{} `json:"data"` // 内容
}

+ 8
- 0
app/router/router.go Wyświetl plik

@@ -9,6 +9,7 @@ import (
"applet/app/hdl/financial_center"
"applet/app/hdl/im"
"applet/app/hdl/institutional_management/egg_energy"
"applet/app/hdl/institutional_management/module_setting"
"applet/app/hdl/institutional_management/public_platoon"
"applet/app/hdl/marketing_applications/new_user_red_package"
"applet/app/hdl/member_center"
@@ -223,6 +224,11 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理
rContributionValue.POST("/updateBasic", egg_energy.UpdateContributionValueBasicSetting)
}
}
rModuleSetting := r.Group("/moduleSetting")
{
rModuleSetting.GET("/getModuleSetting", module_setting.ModuleSettingGet)
rModuleSetting.POST("/updateModuleSetting", module_setting.ModuleSettingUpdate)
}
}

func rMarketingApplications(r *gin.RouterGroup) { //营销应用
@@ -276,6 +282,8 @@ func rIm(r *gin.RouterGroup) {
r.POST("/addCustomerService", im.AddCustomerService)
r.POST("/setCustomerServiceState", im.SetCustomerServiceState)
r.POST("/updateCustomerServiceMemo", im.UpdateCustomerServiceMemo)
r.GET("/redPackageRecordsDetail", im.RedPackageRecordsDetail)
r.POST("/pageSendRedPackageOrd", im.PageSendRedPackageOrd)
}

func rFinancialCenter(r *gin.RouterGroup) {


+ 1
- 1
app/svc/im/svc_customer_service.go Wyświetl plik

@@ -17,7 +17,7 @@ func PageCustomerService(req md.PageCustomerServiceReq) (err error, resp md.Page
sess.And("memo = ?", req.State)
}
var mm []*model.CustomerService
resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Asc("a.id").FindAndCount(&mm)
resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Asc("id").FindAndCount(&mm)
if err != nil {
return
}


+ 1
- 1
app/svc/im/svc_emoticon.go Wyświetl plik

@@ -17,7 +17,7 @@ func PageEmoticon(req md.PageEmoticonReq) (err error, resp md.PageEmoticonResp)
sess.And("memo = ?", req.State)
}
var mm []*model.Emoticon
resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Asc("a.id").FindAndCount(&mm)
resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Desc("id").FindAndCount(&mm)
if err != nil {
return
}


+ 134
- 0
app/svc/im/svc_send_red_package_ord.go Wyświetl plik

@@ -0,0 +1,134 @@
package svc

import (
"applet/app/db"
md "applet/app/md/im"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"errors"
"fmt"
"strings"
)

type PageSendRedPackageOrdJoinUser struct {
model.ImSendRedPackageOrd `xorm:"extends"`
model.User `xorm:"extends"`
}

func PageSendRedPackageOrd(req md.PageSendRedPackageOrdReq) (err error, resp md.PageSendRedPackageOrdResp) {
sess := db.DbIm.Table("im_send_red_package_ord").Where("1=1")
if req.Phone != "" {
sess.And("user.phone LIKE ?", "%"+req.Phone+"%")
}
if req.Nickname != "" {
sess.And("user.nickname LIKE ?", "%"+req.Nickname+"%")
}
if req.OrdNo != "" {
sess.And("im_send_red_package_ord.ord_no LIKE ?", "%"+req.OrdNo+"%")
}
if req.State != 0 {
sess.And("im_send_red_package_ord.state = ?", req.State)
}
if req.Uid != 0 {
sess.And("im_send_red_package_ord.uid = ?", req.Uid)
}
if req.RedPacketType != 0 {
sess.And("im_send_red_package_ord.red_packet_type = ?", req.RedPacketType)
}
if req.StartTimeStart != "" {
sess.And("im_send_red_package_ord.create_time >= ?", req.StartTimeStart)
}
if req.StartTimeEnd != "" {
sess.And("im_send_red_package_ord.create_time <= ?", req.StartTimeEnd)
}
if req.InviteCode != "" {
sess.And("user.invite_code = ?", req.InviteCode)
}
sess.Join("LEFT", "user", "im_send_red_package_ord.uid = user.id")

var mm []*PageSendRedPackageOrdJoinUser
resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Desc("im_send_red_package_ord.create_time").FindAndCount(&mm)
sql, _ := sess.LastSQL()
fmt.Println("PageSendRedPackageOrd___SQL:::", sql)
if err != nil {
return
}
resp.Page = req.Page
resp.PageSize = req.PageSize
for _, v := range mm {
resp.List = append(resp.List, struct {
Id int64 `json:"id"` //记录id
Uid int64 `json:"uid"`
Phone string `json:"ord_no" example:"订单号"`
Nickname string `json:"nickname" example:"昵称"`
AvatarUrl string `json:"avatar_url" example:"头像"`
InviteCode string `json:"invite_code" example:"邀请码"`
State int `json:"state"` // 红包状态(0:未领取 1:领取中 2:领取完 3:已过期)
Amount string `json:"amount"` // 金额
RedPacketBalanceAmount string `json:"red_packet_balance_amount" example:"红包剩余金额"` // 红包剩余金额
RedPacketType int `json:"red_packet_type" example:"红包类型"` // 红包类型
RedPacketNums string `json:"red_packet_nums" example:"红包剩余个数"` // 红包剩余个数
WaitDrawUserIds string `json:"wait_draw_user_ids" example:"待领取用户id"` // 待领取用户id
ReceivedUserIds string `json:"received_user_ids" example:"领取用户id"` // 领取用户id
ReceivedTimes string `json:"received_times" example:"已领取时间"` // 已领取时间
ReceivedUserAmount string `json:"received_user_amount" example:"已领取用户金额"` // 已领取用户金额
CreateTime string `json:"create_time" example:"创建时间"` // 创建时间
UpdateTime string `json:"update_time" example:"更新时间"` // 更新时间
}{
Id: v.ImSendRedPackageOrd.Id,
Uid: int64(v.ImSendRedPackageOrd.Uid),
Phone: v.User.Phone,
InviteCode: v.User.SystemInviteCode,
Nickname: v.User.Nickname,
AvatarUrl: v.User.Avatar,
State: v.ImSendRedPackageOrd.State,
Amount: v.ImSendRedPackageOrd.Amount,
RedPacketType: v.ImSendRedPackageOrd.RedPacketType,
WaitDrawUserIds: v.ImSendRedPackageOrd.WaitDrawUserIds,
ReceivedUserIds: v.ImSendRedPackageOrd.ReceivedUserIds,
ReceivedUserAmount: v.ImSendRedPackageOrd.ReceivedUserAmount,
CreateTime: v.ImSendRedPackageOrd.CreateTime,
UpdateTime: v.ImSendRedPackageOrd.UpdateTime,
})
}
return
}

func RedPackageRecordsDetail(redPackageId string) (err error, resp []md.RedPackageRecordsDetailResp) {
var imSendRedPackageOrd model.ImSendRedPackageOrd
has, err := db.Db.Where("`id`=?", redPackageId).Get(&imSendRedPackageOrd)
if err != nil {
return
}
if !has {
err = errors.New("红包记录不存在!")
return
}

if imSendRedPackageOrd.ReceivedUserIds != "" {
uids := strings.Split(imSendRedPackageOrd.ReceivedUserIds, ",")
receivedTimes := strings.Split(imSendRedPackageOrd.ReceivedTimes, ",")
receivedUserAmount := strings.Split(imSendRedPackageOrd.ReceivedUserAmount, ",")
var users []*model.User
err = db.Db.In("id", uids).Find(&users)
if err != nil {
return
}
var usersMap = map[string]model.User{}
for _, v := range users {
usersMap[utils.Int64ToStr(v.Id)] = *v
}
for i, v := range uids {
resp = append(resp, md.RedPackageRecordsDetailResp{
Uid: utils.StrToInt64(v),
InviteCode: usersMap[v].SystemInviteCode,
Nickname: usersMap[v].Nickname,
AvatarUrl: usersMap[v].Avatar,
Amount: receivedUserAmount[i],
ReceivedTimes: receivedTimes[i],
})
}
}

return
}

+ 2418
- 825
docs/docs.go
Plik diff jest za duży
Wyświetl plik


+ 2418
- 825
docs/swagger.json
Plik diff jest za duży
Wyświetl plik


+ 1077
- 14
docs/swagger.yaml
Plik diff jest za duży
Wyświetl plik


+ 2
- 2
go.mod Wyświetl plik

@@ -33,10 +33,11 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126101821-4c17f7b1fe4b
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126070618-9a7e2400a08f
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
github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/gin-contrib/sessions v1.0.1
github.com/go-sql-driver/mysql v1.8.1
@@ -48,7 +49,6 @@ require (

require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/360EntSecGroup-Skylar/excelize v1.4.1 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/goquery v1.9.2 // indirect


Ładowanie…
Anuluj
Zapisz