user_record.go 970 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package services
  2. import (
  3. "context"
  4. "hongze/hongze_task/models"
  5. "hongze/hongze_task/models/data_manage"
  6. "hongze/hongze_task/services/alarm_msg"
  7. "hongze/hongze_task/utils"
  8. "strings"
  9. )
  10. //同步user_record表中的关注状态
  11. func SyncSubStatus(cont context.Context) (err error) {
  12. openIdstr := models.WxUsersGet()
  13. var items []string
  14. if openIdstr != "''"{
  15. items, err = data_manage.GetUnSubUserOpenid(openIdstr)
  16. if err != nil {
  17. utils.FileLog.Info("SyncSubStatus select Err:%s" + err.Error())
  18. go alarm_msg.SendAlarmMsg("SyncSubStatus 查询open_id失败 ErrMsg:"+err.Error(), 3)
  19. return err
  20. }
  21. }
  22. unSubIds := strings.Join(items, "','")
  23. unSubIds = "'" + unSubIds + "'"
  24. if unSubIds != "''" {
  25. err = data_manage.UpdateSubStatus(unSubIds)
  26. if err != nil {
  27. utils.FileLog.Info("SyncSubStatus update Err:%s" + err.Error())
  28. go alarm_msg.SendAlarmMsg("SyncSubStatus 更新关注状态失败 ErrMsg:"+err.Error(), 3)
  29. return err
  30. }
  31. }
  32. return
  33. }