123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package services
- import (
- "encoding/json"
- "eta/eta_mini_crm_ht/models"
- "strconv"
- "strings"
- )
- func CreateMeta(authorName string, authorId int, mediaId int, publishTime string, sourceType models.SourceType) (id int64, err error) {
- ids, err := models.GetPostUser(authorId, publishTime)
- if err != nil {
- return
- }
- var idStrList []string
- for _, id := range ids {
- idStrList = append(idStrList, strconv.Itoa(id))
- }
- Meta := models.MetaData{
- AuthorName: authorName,
- AuthorId: authorId,
- SourceId: mediaId,
- PublishedTime: publishTime,
- }
- metaStr, _ := json.Marshal(Meta)
- toStr := strings.Join(idStrList, ",")
- metaContent := models.MetaInfo{
- From: "ADMIN",
- Meta: string(metaStr),
- MetaType: "USER_NOTICE",
- SourceType: sourceType,
- Status: models.InitStatusType,
- To: toStr,
- }
- id, err = metaContent.Insert()
- return
- }
- func CreateRefundMeta(toUserId int) (id int64, err error) {
- Meta := models.RefundMetaData{
- ProductOrderNo: "",
- RealName: "",
- Result: "",
- }
- metaStr, _ := json.Marshal(Meta)
- toStr := strconv.Itoa(toUserId)
- metaContent := models.MetaInfo{
- From: "SYSTEM",
- Meta: string(metaStr),
- MetaType: "SYSTEM_NOTICE",
- SourceType: models.RefundSourceType,
- Status: models.InitStatusType,
- To: toStr,
- }
- id, err = metaContent.Insert()
- return
- }
|