From 86ebf39f87def1acefc6e61bf3891f28d768fff9 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 26 Nov 2024 13:36:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/advertising/hdl_base.go | 20 +++ app/hdl/article/hdl_cate.go | 51 +++++++ app/hdl/article/hdl_list.go | 51 +++++++ app/hdl/financial_center/hdl_withdraw.go | 2 +- app/hdl/notice/hdl_aliyun_sms.go | 109 +++++++++++++++ app/hdl/notice/hdl_notice.go | 81 ++++++++++++ app/md/financial_center/md_withdraw.go | 61 +++++---- app/md/md_advertising.go | 17 +++ app/md/md_article.go | 62 +++++++++ app/md/md_mq.go | 10 ++ app/md/md_notice.go | 101 ++++++++++++++ app/router/router.go | 44 +++++- app/svc/advertising/svc_base.go | 7 + app/svc/article/svc_cate.go | 85 ++++++++++++ app/svc/article/svc_list.go | 108 +++++++++++++++ app/svc/notice/svc_aliyun_sms.go | 159 ++++++++++++++++++++++ app/svc/notice/svc_notice.go | 162 +++++++++++++++++++++++ app/svc/svc_comm.go | 18 +++ go.mod | 4 +- 19 files changed, 1118 insertions(+), 34 deletions(-) create mode 100644 app/hdl/advertising/hdl_base.go create mode 100644 app/hdl/article/hdl_cate.go create mode 100644 app/hdl/article/hdl_list.go create mode 100644 app/hdl/notice/hdl_aliyun_sms.go create mode 100644 app/hdl/notice/hdl_notice.go create mode 100644 app/md/md_advertising.go create mode 100644 app/md/md_article.go create mode 100644 app/md/md_mq.go create mode 100644 app/md/md_notice.go create mode 100644 app/svc/advertising/svc_base.go create mode 100644 app/svc/article/svc_cate.go create mode 100644 app/svc/article/svc_list.go create mode 100644 app/svc/notice/svc_aliyun_sms.go create mode 100644 app/svc/notice/svc_notice.go create mode 100644 app/svc/svc_comm.go diff --git a/app/hdl/advertising/hdl_base.go b/app/hdl/advertising/hdl_base.go new file mode 100644 index 0000000..f98dc79 --- /dev/null +++ b/app/hdl/advertising/hdl_base.go @@ -0,0 +1,20 @@ +package advertising + +import ( + "applet/app/svc/advertising" + "github.com/gin-gonic/gin" +) + +// GetBasic +// @Summary 广告管理-广告设置-信息 +// @Tags 广告管理 +// @Description 广告管理-广告设置-信息 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.NoticeAliyunSmsListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/advertising/base [get] +func GetBasic(c *gin.Context) { + advertising.GetBasic(c) +} diff --git a/app/hdl/article/hdl_cate.go b/app/hdl/article/hdl_cate.go new file mode 100644 index 0000000..f71d457 --- /dev/null +++ b/app/hdl/article/hdl_cate.go @@ -0,0 +1,51 @@ +package article + +import ( + "applet/app/svc/article" + "github.com/gin-gonic/gin" +) + +// CateList +// @Summary 文章资讯-分类列表 +// @Tags 文章资讯 +// @Description 分类列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.ArticleCateListReq true "(分页信息必填)" +// @Success 200 {object} md.ArticleCateListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/article/cate/list [post] +func CateList(c *gin.Context) { + article.CateList(c) +} + +// CateSave +// @Summary 文章资讯-分类列表-分类保存 +// @Tags 文章资讯 +// @Description 分类列表-分类保存 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.ArticleCateSaveReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/article/cate/save [post] +func CateSave(c *gin.Context) { + article.CateSave(c) +} + +// CateDel +// @Summary 文章资讯-分类列表-分类删除 +// @Tags 文章资讯 +// @Description 分类列表-分类删除 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.ArticleCateDelReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/article/cate/del [post] +func CateDel(c *gin.Context) { + article.CateDel(c) +} diff --git a/app/hdl/article/hdl_list.go b/app/hdl/article/hdl_list.go new file mode 100644 index 0000000..c37c17b --- /dev/null +++ b/app/hdl/article/hdl_list.go @@ -0,0 +1,51 @@ +package article + +import ( + "applet/app/svc/article" + "github.com/gin-gonic/gin" +) + +// List +// @Summary 文章资讯-文章列表 +// @Tags 文章资讯 +// @Description 文章列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.ArticleListReq true "(分页信息必填)" +// @Success 200 {object} md.ArticleListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/article/content/list [post] +func List(c *gin.Context) { + article.List(c) +} + +// Save +// @Summary 文章资讯-文章列表-文章保存 +// @Tags 文章资讯 +// @Description 文章列表-文章保存 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.ArticleSaveReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/article/content/save [post] +func Save(c *gin.Context) { + article.Save(c) +} + +// Del +// @Summary 文章资讯-文章列表-文章删除 +// @Tags 文章资讯 +// @Description 文章列表-文章删除 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.ArticleDelReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/article/content/del [post] +func Del(c *gin.Context) { + article.Del(c) +} diff --git a/app/hdl/financial_center/hdl_withdraw.go b/app/hdl/financial_center/hdl_withdraw.go index 3acb213..7a82d7f 100644 --- a/app/hdl/financial_center/hdl_withdraw.go +++ b/app/hdl/financial_center/hdl_withdraw.go @@ -65,7 +65,7 @@ func GetWithdrawSetting(c *gin.Context) { return } } - var frequency md2.WithdrawFrequencySettingStruct + var frequency md.WithdrawFrequencySettingStruct utils.Unserialize([]byte(setting.FrequencySet), &frequency) resp := md.GetWithdrawSettingResp{ Id: setting.Id, diff --git a/app/hdl/notice/hdl_aliyun_sms.go b/app/hdl/notice/hdl_aliyun_sms.go new file mode 100644 index 0000000..944810f --- /dev/null +++ b/app/hdl/notice/hdl_aliyun_sms.go @@ -0,0 +1,109 @@ +package notice + +import ( + "applet/app/svc/notice" + "github.com/gin-gonic/gin" +) + +// AliyunSmsFilePhone +// @Summary 消息中心-短信推送记录-通知模板 +// @Tags 消息中心 +// @Description 短信推送记录-通知模板 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body true "参数 file-----文件上传格式" +// @Success 200 {object} "phone 一个数组" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/aliyunSms/file/phone [post] +func AliyunSmsFilePhone(c *gin.Context) { + notice.AliyunSmsFilePhone(c) +} + +// AliyunSmsBase +// @Summary 消息中心-短信推送记录-通知模板 +// @Tags 消息中心 +// @Description 短信推送记录-通知模板 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.NoticeAliyunSmsListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/aliyunSms/base [get] +func AliyunSmsBase(c *gin.Context) { + notice.AliyunSmsBase(c) +} + +// AliyunSmsSave +// @Summary 消息中心-短信推送记录-通知模板添加编辑 +// @Tags 消息中心 +// @Description 短信推送记录-通知模板添加编辑 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body true "数组 把列表的数组传过来" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/aliyunSms/save [post] +func AliyunSmsSave(c *gin.Context) { + notice.AliyunSmsSave(c) +} + +// AliyunSmsSaleBase +// @Summary 消息中心-短信推送记录-营销短信-通知模板 +// @Tags 消息中心 +// @Description 短信推送记录-营销短信-通知模板 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.NoticeAliyunSmsListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/aliyunSms/sale/base [get] +func AliyunSmsSaleBase(c *gin.Context) { + notice.AliyunSmsSaleBase(c) +} + +// AliyunSmsSaleSave +// @Summary 消息中心-短信推送记录-营销短信-通知模板添加编辑 +// @Tags 消息中心 +// @Description 短信推送记录-营销短信-通知模板添加编辑 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body true "数组 把列表的数组传过来" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/aliyunSms/sale/save [post] +func AliyunSmsSaleSave(c *gin.Context) { + notice.AliyunSmsSaleSave(c) +} + +// AliyunSmsPushList +// @Summary 消息中心-短信推送记录-推送记录列表 +// @Tags 消息中心 +// @Description 短信推送记录-推送记录列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.NoticeAliyunSmsListReq true "(分页信息必填)" +// @Success 200 {object} md.NoticePushListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/aliyunSms/push/list [post] +func AliyunSmsPushList(c *gin.Context) { + notice.AliyunSmsPushList(c) +} + +// AliyunSmsPushSave +// @Summary 消息中心-短信推送记录-推送记录添加-发送(不做编辑了) +// @Tags 消息中心 +// @Description 短信推送记录-推送记录添加-发送 (不做编辑了) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.NoticeAliyunSmsSaveReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/aliyunSms/push/save [post] +func AliyunSmsPushSave(c *gin.Context) { + notice.AliyunSmsPushSave(c) +} diff --git a/app/hdl/notice/hdl_notice.go b/app/hdl/notice/hdl_notice.go new file mode 100644 index 0000000..7cfb311 --- /dev/null +++ b/app/hdl/notice/hdl_notice.go @@ -0,0 +1,81 @@ +package notice + +import ( + "applet/app/svc/notice" + "github.com/gin-gonic/gin" +) + +// List +// @Summary 消息中心-APP推送记录-通知模板 +// @Tags 消息中心 +// @Description APP推送记录-通知模板 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.NoticeListReq true "(分页信息必填)" +// @Success 200 {object} md.NoticeListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/jPush/list [post] +func List(c *gin.Context) { + notice.List(c) +} + +// Save +// @Summary 消息中心-APP推送记录-通知模板添加编辑 +// @Tags 消息中心 +// @Description APP推送记录-通知模板添加编辑 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.NoticeSaveReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/jPush/save [post] +func Save(c *gin.Context) { + notice.Save(c) +} + +// Del +// @Summary 消息中心-APP推送记录-通知模板删除 +// @Tags 消息中心 +// @Description APP推送记录-通知模板删除 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.NoticeDelReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/jPush/del [post] +func Del(c *gin.Context) { + notice.Del(c) +} + +// PushList +// @Summary 消息中心-APP推送记录-推送记录列表 +// @Tags 消息中心 +// @Description APP推送记录-推送记录列表 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.NoticeListReq true "(分页信息必填)" +// @Success 200 {object} md.NoticePushListResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/jPush/push/list [post] +func PushList(c *gin.Context) { + notice.PushList(c) +} + +// PushSave +// @Summary 消息中心-APP推送记录-推送记录添加-发送(不做编辑了) +// @Tags 消息中心 +// @Description APP推送记录-推送记录添加-发送 (不做编辑了) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.NoticeSaveReq true "(分页信息必填)" +// @Success 200 {string} "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/notice/jPush/push/save [post] +func PushSave(c *gin.Context) { + notice.PushSave(c) +} diff --git a/app/md/financial_center/md_withdraw.go b/app/md/financial_center/md_withdraw.go index af23abe..52ef45e 100644 --- a/app/md/financial_center/md_withdraw.go +++ b/app/md/financial_center/md_withdraw.go @@ -1,9 +1,5 @@ package md -import ( - "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" -) - type Paginate struct { Limit int `json:"limit"` // 每页大小 Page int `json:"page"` // 页数 @@ -11,37 +7,40 @@ type Paginate struct { } type GetWithdrawSettingResp struct { - Id int64 `json:"id"` - FrequencySet md.WithdrawFrequencySettingStruct `json:"frequency_set"` // 频率设置(0:日 1:周 2:月 3:年) - WithdrawType int `json:"withdraw_type"` // 提现方式(1:支付宝 2:微信) - VipLevelLimit int `json:"vip_level_limit"` // 提现等级限制 - IsRealName int `json:"is_real_name"` // 是否实名(0:否 1:是) - WithdrawNumsLimit int `json:"withdraw_nums_limit"` // 提现次数限制(对应上方设置周期,0为不限制,失败、驳回不计数 ) - WithdrawAmountLimit string `json:"withdraw_amount_limit"` // 提现金额限制(0为不限制,大于等于该金额才可以申请提现 ) - WithdrawMultipleLimit string `json:"withdraw_multiple_limit"` // 提现倍数限制(0为不限制,金额限制倍数才可以申请提现 ) - IsSupportDecimalPoint int `json:"is_support_decimal_point"` // 是否支持小数点(0:否 1:是) - IsAuto int `json:"is_auto"` // 是否开启自动提现(0:否 1:是) - WithdrawTimeInterval string `json:"withdraw_time_interval"` // 提现时段 - WithdrawFeeSet string `json:"withdraw_fee_set"` // 提现手续费设置 - CreateAt string `json:"create_at"` // 申请时间 - UpdateAt string `json:"update_at"` // 处理时间 + Id int64 `json:"id"` + FrequencySet WithdrawFrequencySettingStruct `json:"frequency_set"` // 频率设置(0:日 1:周 2:月 3:年) + WithdrawType int `json:"withdraw_type"` // 提现方式(1:支付宝 2:微信) + VipLevelLimit int `json:"vip_level_limit"` // 提现等级限制 + IsRealName int `json:"is_real_name"` // 是否实名(0:否 1:是) + WithdrawNumsLimit int `json:"withdraw_nums_limit"` // 提现次数限制(对应上方设置周期,0为不限制,失败、驳回不计数 ) + WithdrawAmountLimit string `json:"withdraw_amount_limit"` // 提现金额限制(0为不限制,大于等于该金额才可以申请提现 ) + WithdrawMultipleLimit string `json:"withdraw_multiple_limit"` // 提现倍数限制(0为不限制,金额限制倍数才可以申请提现 ) + IsSupportDecimalPoint int `json:"is_support_decimal_point"` // 是否支持小数点(0:否 1:是) + IsAuto int `json:"is_auto"` // 是否开启自动提现(0:否 1:是) + WithdrawTimeInterval string `json:"withdraw_time_interval"` // 提现时段 + WithdrawFeeSet string `json:"withdraw_fee_set"` // 提现手续费设置 + CreateAt string `json:"create_at"` // 申请时间 + UpdateAt string `json:"update_at"` // 处理时间 } type UpdateWithdrawSettingReq struct { - Id int64 `json:"id,required"` - FrequencySet md.WithdrawFrequencySettingStruct `json:"frequency_set"` // 频率设置(num 个 duration) (duration (0.天 1.小时 2.周 3.月 4.年)) - WithdrawType int `json:"withdraw_type"` // 提现方式(1:支付宝 2:微信) - VipLevelLimit int `json:"vip_level_limit"` // 提现等级限制 - IsRealName int `json:"is_real_name"` // 是否实名(0:否 1:是) - WithdrawNumsLimit int `json:"withdraw_nums_limit"` // 提现次数限制(对应上方设置周期,0为不限制,失败、驳回不计数 ) - WithdrawAmountLimit string `json:"withdraw_amount_limit"` // 提现金额限制(0为不限制,大于等于该金额才可以申请提现 ) - WithdrawMultipleLimit string `json:"withdraw_multiple_limit"` // 提现倍数限制(0为不限制,金额限制倍数才可以申请提现 ) - IsSupportDecimalPoint int `json:"is_support_decimal_point"` // 是否支持小数点(0:否 1:是) - IsAuto int `json:"is_auto"` // 是否开启自动提现(0:否 1:是) - WithdrawTimeInterval string `json:"withdraw_time_interval"` // 提现时段 - WithdrawFeeSet string `json:"withdraw_fee_set"` // 提现手续费设置 + Id int64 `json:"id,required"` + FrequencySet WithdrawFrequencySettingStruct `json:"frequency_set"` // 频率设置(num 个 duration) (duration (0.天 1.小时 2.周 3.月 4.年)) + WithdrawType int `json:"withdraw_type"` // 提现方式(1:支付宝 2:微信) + VipLevelLimit int `json:"vip_level_limit"` // 提现等级限制 + IsRealName int `json:"is_real_name"` // 是否实名(0:否 1:是) + WithdrawNumsLimit int `json:"withdraw_nums_limit"` // 提现次数限制(对应上方设置周期,0为不限制,失败、驳回不计数 ) + WithdrawAmountLimit string `json:"withdraw_amount_limit"` // 提现金额限制(0为不限制,大于等于该金额才可以申请提现 ) + WithdrawMultipleLimit string `json:"withdraw_multiple_limit"` // 提现倍数限制(0为不限制,金额限制倍数才可以申请提现 ) + IsSupportDecimalPoint int `json:"is_support_decimal_point"` // 是否支持小数点(0:否 1:是) + IsAuto int `json:"is_auto"` // 是否开启自动提现(0:否 1:是) + WithdrawTimeInterval string `json:"withdraw_time_interval"` // 提现时段 + WithdrawFeeSet string `json:"withdraw_fee_set"` // 提现手续费设置 +} +type WithdrawFrequencySettingStruct struct { //swag 生成不了,把这个挪出来了 + Duration int `json:"duration"` // 周期 (0.天 1.小时 2.周 3.天 4.月 5.年) + Num int `json:"num"` // 周期数 } - type GetWithdrawApplyListReq struct { Uid string `json:"uid"` // 用户 ID Nickname string `json:"nickname"` // 用户昵称 diff --git a/app/md/md_advertising.go b/app/md/md_advertising.go new file mode 100644 index 0000000..95ae79e --- /dev/null +++ b/app/md/md_advertising.go @@ -0,0 +1,17 @@ +package md + +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"` +} diff --git a/app/md/md_article.go b/app/md/md_article.go new file mode 100644 index 0000000..a77a6ac --- /dev/null +++ b/app/md/md_article.go @@ -0,0 +1,62 @@ +package md + +type ArticleCateListReq struct { + Page string `json:"page,required"` // 页数 + Limit string `json:"limit,required"` // 每页大小 +} +type ArticleCateListResp struct { + Total int64 `json:"total"` + SelectData []map[string]string `json:"select_data"` + List []ArticleCateList `json:"list"` +} +type ArticleCateList struct { + Id string `json:"id"` + Pid string `json:"pid"` + Name string `json:"name"` + IsShow string `json:"is_show"` + Sort string `json:"sort"` +} +type ArticleCateSaveReq struct { + Id string `json:"id"` + Pid string `json:"pid"` + Name string `json:"name"` + IsShow string `json:"is_show"` + Sort string `json:"sort"` +} +type ArticleCateDelReq struct { + Id []string `json:"id"` +} + +type ArticleListReq struct { + Page string `json:"page,required"` // 页数 + Limit string `json:"limit,required"` // 每页大小 +} +type ArticleListResp struct { + Total int64 `json:"total"` + SelectData []map[string]interface{} `json:"select_data"` + List []ArticleList `json:"list"` +} +type ArticleList struct { + Id string `json:"id"` + Pid string `json:"pid" example:"一级分类id"` + CateId string `json:"cate_id" example:"二级分类id"` + Title string `json:"title"` + Content string `json:"content"` + Cover string `json:"cover" example:"一级分类id=4 显示 封面图"` + CoverUrl string `json:"cover_url"` + IsShow string `json:"is_show"` + Sort string `json:"sort"` +} +type ArticleSaveReq struct { + Id string `json:"id"` + Pid string `json:"pid" example:"一级分类id"` + CateId string `json:"cate_id" example:"二级分类id"` + Title string `json:"title"` + Content string `json:"content"` + Cover string `json:"cover" example:"一级分类id=4 显示 封面图"` + IsShow string `json:"is_show"` + Sort string `json:"sort"` +} +type ArticleDelReq struct { + Id []string `json:"id"` +} diff --git a/app/md/md_mq.go b/app/md/md_mq.go new file mode 100644 index 0000000..20b7c82 --- /dev/null +++ b/app/md/md_mq.go @@ -0,0 +1,10 @@ +package md + +const ( + EggJpushRecordQueueExchange = "egg.jpush" + EggJpushRecordQueue = "jpush_record" +) + +type JpushRecordFundData struct { + Id string `json:"id"` +} diff --git a/app/md/md_notice.go b/app/md/md_notice.go new file mode 100644 index 0000000..ad5c051 --- /dev/null +++ b/app/md/md_notice.go @@ -0,0 +1,101 @@ +package md + +type NoticeListReq struct { + Page string `json:"page,required"` // 页数 + Limit string `json:"limit,required"` // 每页大小 +} +type NoticeListResp struct { + Total int64 `json:"total"` + SelectData []map[string]string `json:"select_data"` + ChangeData []map[string]string `json:"change_data"` + List []NoticeList `json:"list"` +} +type NoticeList struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Type string `json:"type"` +} +type NoticeSaveReq struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Type string `json:"type"` +} +type NoticeDelReq struct { + Id []string `json:"id"` +} +type NoticePushListResp struct { + Total int64 `json:"total"` + PlatformData []map[string]string `json:"platform_data"` + TargetData []map[string]string `json:"target_data"` + List []NoticePushList `json:"list"` +} +type NoticePushList struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Platform string `json:"platform"` + Target string `json:"target"` + SendType string `json:"send_type" example:"0立即推送 1定时推送"` + SendStartTime string `json:"send_start_time" example:"如 2024-11-25 11:56:00"` + SendEndTime string `json:"send_end_time" example:"如 2024-11-25 11:56:00"` + State string `json:"state" example:"0待发送 1发送成功"` +} +type NoticePushSaveReq struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Platform string `json:"platform"` + Target string `json:"target"` + SendType string `json:"send_type"` + SendStartTime string `json:"send_start_time"` + SendEndTime string `json:"send_end_time"` + UserList []string `json:"user_list"` + Level string `json:"level"` +} + +type NoticeAliyunSmsListReq struct { + Page string `json:"page,required"` // 页数 + Limit string `json:"limit,required"` // 每页大小 +} +type NoticeAliyunSmsListResp struct { + Total int64 `json:"total"` + SelectData []map[string]string `json:"select_data"` + List []NoticeAliyunSmsList `json:"list"` +} +type NoticeAliyunSmsList struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Type string `json:"type"` +} +type NoticeAliyunSmsSaveReq struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Type string `json:"type"` +} +type NoticeAliyunSmsDelReq struct { + Id []string `json:"id"` +} +type NoticeAliyunSmsPushListResp struct { + Total int64 `json:"total"` + TargetData []map[string]string `json:"target_data"` + List []NoticeAliyunSmsPushList `json:"list"` +} +type NoticeAliyunSmsPushList struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Target string `json:"target"` + State string `json:"state" example:"0待发送 1发送成功"` +} +type NoticeAliyunSmsPushSaveReq struct { + Id string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Target string `json:"target"` + PhoneList []string `json:"phone_list"` + Level string `json:"level"` +} diff --git a/app/router/router.go b/app/router/router.go index 70abd77..98f1921 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -3,6 +3,8 @@ package router import ( "applet/app/cfg" "applet/app/hdl" + "applet/app/hdl/advertising" + "applet/app/hdl/article" "applet/app/hdl/comm" "applet/app/hdl/financial_center" "applet/app/hdl/im" @@ -10,6 +12,7 @@ import ( "applet/app/hdl/institutional_management/public_platoon" "applet/app/hdl/marketing_applications/new_user_red_package" "applet/app/hdl/member_center" + "applet/app/hdl/notice" "applet/app/hdl/setCenter/oss/aliyun" "applet/app/mw" _ "applet/docs" @@ -65,6 +68,9 @@ func route(r *gin.RouterGroup) { rMemberCenter(r.Group("/memberCenter")) rSettCenter(r.Group("/settCenter")) rFinancialCenter(r.Group("/financialCenter")) + rAdvertising(r.Group("/advertising")) + rNotice(r.Group("/notice")) + rArticle(r.Group("/article")) } func rSettCenter(r *gin.RouterGroup) { //设置中心 @@ -77,7 +83,43 @@ func rSettCenter(r *gin.RouterGroup) { //设置中心 } } } - +func rAdvertising(r *gin.RouterGroup) { + r.GET("/getBasic", advertising.GetBasic) +} +func rNotice(r *gin.RouterGroup) { + rJpush := r.Group("/jPush") //极光 + { + rJpush.POST("/list", notice.List) + rJpush.POST("/save", notice.Save) + rJpush.POST("/del", notice.Del) + rJpush.POST("/push/list", notice.PushList) + rJpush.POST("/push/save", notice.PushSave) + } + rAliyunSms := r.Group("/aliyunSms") //阿里云短信 + { + rAliyunSms.POST("/file/phone", notice.AliyunSmsFilePhone) + rAliyunSms.GET("/base", notice.AliyunSmsBase) + rAliyunSms.POST("/save", notice.AliyunSmsSave) + rAliyunSms.GET("/sale/base", notice.AliyunSmsSaleBase) + rAliyunSms.POST("/sale/save", notice.AliyunSmsSaleSave) + rAliyunSms.POST("/push/list", notice.AliyunSmsPushList) + rAliyunSms.POST("/push/save", notice.AliyunSmsPushSave) + } +} +func rArticle(r *gin.RouterGroup) { + rCate := r.Group("/cate") // + { + rCate.POST("/list", article.CateList) + rCate.POST("/save", article.CateSave) + rCate.POST("/del", article.CateDel) + } + rContent := r.Group("/content") // + { + rContent.POST("/list", article.List) + rContent.POST("/save", article.Save) + rContent.POST("/del", article.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 new file mode 100644 index 0000000..5d82f37 --- /dev/null +++ b/app/svc/advertising/svc_base.go @@ -0,0 +1,7 @@ +package advertising + +import "github.com/gin-gonic/gin" + +func GetBasic(c *gin.Context) { + +} diff --git a/app/svc/article/svc_cate.go b/app/svc/article/svc_cate.go new file mode 100644 index 0000000..a842538 --- /dev/null +++ b/app/svc/article/svc_cate.go @@ -0,0 +1,85 @@ +package article + +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.ArticleCateListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.ArticleCateListResp + noticeList := make([]md.ArticleCateList, 0) + NewJpushNoticeDb := implement.NewArticleCateDb(db.Db) + notice, total, _ := NewJpushNoticeDb.FindArticleCateAndTotalPid(req.Page, req.Limit) + resp.Total = total + resp.SelectData = []map[string]string{} + pid, _ := NewJpushNoticeDb.FindArticleCate("1", "100", "0") + if pid != nil { + for _, v := range *pid { + tmp := map[string]string{ + "name": v.Name, "value": utils.IntToStr(v.Id), + } + resp.SelectData = append(resp.SelectData, tmp) + } + } + if notice != nil { + for _, v := range *notice { + tmp := md.ArticleCateList{ + Id: utils.IntToStr(v.Id), + Sort: utils.IntToStr(v.Sort), + IsShow: utils.IntToStr(v.IsShow), + Pid: utils.IntToStr(v.Pid), + Name: v.Name, + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func CateSave(c *gin.Context) { + var req *md.ArticleCateSaveReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var data = new(model.ArticleCate) + if utils.StrToInt(req.Id) > 0 { + NewArticleCateDb := implement.NewArticleCateDb(db.Db) + notice, _ := NewArticleCateDb.GetArticleCate(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) + data.Pid = utils.StrToInt(req.Pid) + data.IsShow = utils.StrToInt(req.IsShow) + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return +} +func CateDel(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.ArticleCate{}) + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/article/svc_list.go b/app/svc/article/svc_list.go new file mode 100644 index 0000000..eaffad5 --- /dev/null +++ b/app/svc/article/svc_list.go @@ -0,0 +1,108 @@ +package article + +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" + "time" +) + +func List(c *gin.Context) { + var req *md.ArticleListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.ArticleListResp + noticeList := make([]md.ArticleList, 0) + NewArticleDb := implement.NewArticleDb(db.Db) + notice, total, _ := NewArticleDb.FindArticleAndTotal(req.Page, req.Limit, "", "") + resp.Total = total + resp.SelectData = make([]map[string]interface{}, 0) + NewArticleCateDb := implement.NewArticleCateDb(db.Db) + pid, _ := NewArticleCateDb.FindArticleCate("1", "100", "0") + if pid != nil { + for _, v := range *pid { + list := make([]map[string]string, 0) + tmp := map[string]interface{}{ + "name": v.Name, "value": utils.IntToStr(v.Id), "list": list, + } + cate, _ := NewArticleCateDb.FindArticleCate("1", "1000", utils.IntToStr(v.Id)) + if cate != nil { + for _, v1 := range *cate { + tmp1 := map[string]string{ + "name": v1.Name, "value": utils.IntToStr(v1.Id), + } + list = append(list, tmp1) + } + } + resp.SelectData = append(resp.SelectData, tmp) + } + } + if notice != nil { + for _, v := range *notice { + tmp := md.ArticleList{ + CateId: utils.IntToStr(v.CateId), + Title: v.Title, + Content: v.Content, + Cover: v.Cover, + CoverUrl: svc.GetOssUrl(v.Cover), + Id: utils.IntToStr(v.Id), + Sort: utils.IntToStr(v.Sort), + IsShow: utils.IntToStr(v.IsShow), + Pid: utils.IntToStr(v.Pid), + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func Save(c *gin.Context) { + var req *md.ArticleSaveReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var data = new(model.Article) + if utils.StrToInt(req.Id) > 0 { + NewArticleDb := implement.NewArticleDb(db.Db) + notice, _ := NewArticleDb.GetArticle(req.Id) + if notice == nil { + e.OutErr(c, 400, e.NewErr(400, "记录不存在")) + return + } + data = notice + } else { + data.CreatedAt = int(time.Now().Unix()) + db.Db.Insert(data) + } + data.UpdatedAt = int(time.Now().Unix()) + data.Title = req.Title + data.Cover = req.Cover + data.Content = req.Content + data.TypeId = utils.StrToInt(req.Pid) + data.CateId = utils.StrToInt(req.CateId) + data.Sort = utils.StrToInt(req.Sort) + data.Pid = utils.StrToInt(req.Pid) + data.IsShow = utils.StrToInt(req.IsShow) + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return +} +func Del(c *gin.Context) { + var req *md.ArticleDelReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + db.Db.In("id", req.Id).Delete(&model.Article{}) + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/notice/svc_aliyun_sms.go b/app/svc/notice/svc_aliyun_sms.go new file mode 100644 index 0000000..4daa429 --- /dev/null +++ b/app/svc/notice/svc_aliyun_sms.go @@ -0,0 +1,159 @@ +package notice + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "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" + "encoding/json" + "github.com/360EntSecGroup-Skylar/excelize" + "github.com/gin-gonic/gin" + "time" +) + +func AliyunSmsFilePhone(c *gin.Context) { + file, _, err := c.Request.FormFile("file") + if err != nil { + e.OutErr(c, 400, e.NewErr(400, "上传文件错误")) + return + } + // 打开上传的文件 + xlsx, err := excelize.OpenReader(file) + if err != nil { + e.OutErr(c, 400, e.NewErr(400, "打开文件失败")) + return + } + + rows := xlsx.GetRows(xlsx.GetSheetName(xlsx.GetActiveSheetIndex())) + phone := make([]string, 0) + for i, row := range rows { + // 去掉第一行是excel表头部分 + if i == 0 { + continue + } + phone = append(phone, row[0]) + } + res := map[string]interface{}{ + "phone": phone, + } + e.OutSuc(c, res, nil) + return +} +func AliyunSmsBase(c *gin.Context) { + SelectData := []map[string]string{ + {"name": "签到提醒", "value": "sign", "temple_id": "", "is_show": "1"}, + {"name": "注销提醒", "value": "user_delete", "temple_id": "", "is_show": "1"}, + {"name": "提现到账提醒", "value": "withdraw", "temple_id": "", "is_show": "1"}, + {"name": "X天未登录提醒", "value": "login", "temple_id": "", "is_show": "1"}, + {"name": "升级提醒", "value": "update", "temple_id": "", "is_show": "1"}, + } + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + aliyunSmsNotice := sysCfgDb.SysCfgGetWithDb("aliyun_sms_notice") + notice := make([]map[string]string, 0) + json.Unmarshal([]byte(aliyunSmsNotice), ¬ice) + for k, v := range SelectData { + for _, v1 := range notice { + if v1["value"] == v["value"] { + SelectData[k]["temple_id"] = v1["temple_id"] + SelectData[k]["temple_id"] = v1["is_show"] + } + } + } + e.OutSuc(c, SelectData, nil) + return +} +func AliyunSmsSave(c *gin.Context) { + var req []map[string]string + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + sysCfgDb.SysCfgUpdate("aliyun_sms_notice", utils.SerializeStr(req)) + e.OutSuc(c, "success", nil) + return +} + +func AliyunSmsSaleBase(c *gin.Context) { + + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + aliyunSmsNotice := sysCfgDb.SysCfgGetWithDb("aliyun_sms_sale_code") + res := map[string]string{ + "aliyun_sms_sale_code": aliyunSmsNotice, + } + e.OutSuc(c, res, nil) + return +} +func AliyunSmsSaleSave(c *gin.Context) { + var req map[string]string + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + sysCfgDb.SysCfgUpdate("aliyun_sms_sale_code", req["aliyun_sms_sale_code"]) + e.OutSuc(c, "success", nil) + return +} +func AliyunSmsPushList(c *gin.Context) { + var req *md.NoticeAliyunSmsListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.NoticeAliyunSmsPushListResp + noticeList := make([]md.NoticeAliyunSmsPushList, 0) + resp.TargetData = []map[string]string{ + {"name": "全部会员", "value": "0"}, + {"name": "指定会员", "value": "1"}, + {"name": "指定等级", "value": "2"}, + } + NewAliyunSmsRecordDb := implement.NewAliyunSmsRecordDb(db.Db) + notice, total, _ := NewAliyunSmsRecordDb.FindAliyunSmsRecordAndTotal(req.Page, req.Limit, "") + resp.Total = total + if notice != nil { + for _, v := range *notice { + tmp := md.NoticeAliyunSmsPushList{ + Id: utils.IntToStr(v.Id), + Title: v.Title, + Content: v.Content, + Target: v.Target, + State: utils.IntToStr(v.State), + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func AliyunSmsPushSave(c *gin.Context) { + var req *md.NoticeAliyunSmsPushSaveReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + if utils.StrToInt(req.Id) > 0 { + } else { + data := &model.AliyunSmsRecord{ + Platform: "all", + Target: req.Target, + Phone: utils.SerializeStr(req.PhoneList), + Level: utils.StrToInt(req.Level), + Title: req.Title, + Content: req.Content, + CreateAt: time.Now(), + UpdateAt: time.Now(), + } + db.Db.Insert(data) + } + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/notice/svc_notice.go b/app/svc/notice/svc_notice.go new file mode 100644 index 0000000..8dd2fcd --- /dev/null +++ b/app/svc/notice/svc_notice.go @@ -0,0 +1,162 @@ +package notice + +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" + "time" +) + +func List(c *gin.Context) { + var req *md.NoticeListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.NoticeListResp + noticeList := make([]md.NoticeList, 0) + NewJpushNoticeDb := implement.NewJpushNoticeDb(db.Db) + notice, total, _ := NewJpushNoticeDb.FindJpushNoticeAndTotal(req.Page, req.Limit, "") + resp.Total = total + resp.ChangeData = []map[string]string{ + {"name": "昵称", "value": "{昵称}"}, + {"name": "手机号", "value": "{手机号}"}, + {"name": "金额", "value": "{金额}"}, + {"name": "时间", "value": "{时间}"}, + {"name": "未登陆天数", "value": "{未登陆天数}"}, + {"name": "升级后等级", "value": "{升级后等级}"}, + } + resp.SelectData = []map[string]string{ + {"name": "签到提醒", "value": "sign"}, + {"name": "提现到账提醒", "value": "withdraw"}, + {"name": "X天未登录提醒", "value": "login"}, + {"name": "升级提醒", "value": "update"}, + } + if notice != nil { + for _, v := range *notice { + tmp := md.NoticeList{ + Id: utils.IntToStr(v.Id), + Title: v.Title, + Content: v.Content, + Type: v.Type, + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func Save(c *gin.Context) { + var req *md.NoticeSaveReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var data = new(model.JpushNotice) + if utils.StrToInt(req.Id) > 0 { + NewJpushNoticeDb := implement.NewJpushNoticeDb(db.Db) + notice, _ := NewJpushNoticeDb.GetJpushNotice(req.Id) + if notice == nil { + e.OutErr(c, 400, e.NewErr(400, "记录不存在")) + return + } + data = notice + } else { + data.CreateAt = time.Now() + db.Db.Insert(data) + } + data.UpdateAt = time.Now() + data.Content = req.Content + data.Type = req.Type + data.Title = req.Title + db.Db.Where("id=?", data.Id).Update(data) + e.OutSuc(c, "success", nil) + return +} +func Del(c *gin.Context) { + var req *md.NoticeDelReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + db.Db.In("id", req.Id).Delete(&model.JpushNotice{}) + e.OutSuc(c, "success", nil) + return +} + +func PushList(c *gin.Context) { + var req *md.NoticeListReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + var resp md.NoticePushListResp + noticeList := make([]md.NoticePushList, 0) + resp.PlatformData = []map[string]string{ + {"name": "全平台", "value": "all"}, + {"name": "安卓", "value": "android"}, + {"name": "iOS", "value": "ios"}, + } + resp.TargetData = []map[string]string{ + {"name": "全部会员", "value": "0"}, + {"name": "指定会员", "value": "1"}, + {"name": "指定等级", "value": "2"}, + } + NewJpushRecordDb := implement.NewJpushRecordDb(db.Db) + notice, total, _ := NewJpushRecordDb.FindJpushRecordAndTotal(req.Page, req.Limit, "") + resp.Total = total + if notice != nil { + for _, v := range *notice { + tmp := md.NoticePushList{ + Id: utils.IntToStr(v.Id), + Title: v.Title, + Content: v.Content, + Platform: v.Platform, + Target: v.Target, + SendType: utils.IntToStr(v.SendType), + State: utils.IntToStr(v.State), + } + if v.SendStartTime.IsZero() == false { + tmp.SendStartTime = v.SendStartTime.Format("2006-01-02 15:04:05") + } + if v.SendEndTime.IsZero() == false { + tmp.SendEndTime = v.SendEndTime.Format("2006-01-02 15:04:05") + } + noticeList = append(noticeList, tmp) + } + } + resp.List = noticeList + e.OutSuc(c, resp, nil) + return +} +func PushSave(c *gin.Context) { + var req *md.NoticePushSaveReq + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + if utils.StrToInt(req.Id) > 0 { + } else { + data := &model.JpushRecord{ + Platform: req.Platform, + Target: req.Target, + UserId: utils.SerializeStr(req.UserList), + Level: utils.StrToInt(req.Level), + Title: req.Title, + Content: req.Content, + SendType: utils.StrToInt(req.SendType), + SendStartTime: utils.TimeParseStd(req.SendStartTime), + SendEndTime: utils.TimeParseStd(req.SendStartTime), + CreateAt: time.Now(), + UpdateAt: time.Now(), + } + db.Db.Insert(data) + } + e.OutSuc(c, "success", nil) + return +} diff --git a/app/svc/svc_comm.go b/app/svc/svc_comm.go new file mode 100644 index 0000000..81a5c85 --- /dev/null +++ b/app/svc/svc_comm.go @@ -0,0 +1,18 @@ +package svc + +import ( + "applet/app/db" + "applet/app/utils/cache" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "strings" +) + +func GetOssUrl(img string) string { + redisConn := cache.GetPool().Get() + sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) + sysCfg := sysCfgDb.SysCfgFindWithDb("file_bucket_scheme", "file_bucket_host") + if strings.Contains(img, "http") == false && img != "" { + img = sysCfg["file_bucket_scheme"] + "://" + sysCfg["file_bucket_host"] + img + } + return img +} diff --git a/go.mod b/go.mod index 6a0ef32..15a3c6b 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241125113426-87a1c00e0545 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126025500-fff8f11fcef5 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 @@ -48,6 +48,7 @@ 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 @@ -83,6 +84,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/pelletier/go-toml/v2 v2.2.1 // indirect github.com/pkg/errors v0.9.1 // indirect