1234567891011121314151617181920212223242526272829303132333435363738 |
- package services
- import (
- "context"
- "hongze/hongze_task/models"
- "hongze/hongze_task/models/data_manage"
- "hongze/hongze_task/services/alarm_msg"
- "hongze/hongze_task/utils"
- "strings"
- )
- //同步user_record表中的关注状态
- func SyncSubStatus(cont context.Context) (err error) {
- openIdstr := models.WxUsersGet()
- var items []string
- if openIdstr != "''"{
- items, err = data_manage.GetUnSubUserOpenid(openIdstr)
- if err != nil {
- utils.FileLog.Info("SyncSubStatus select Err:%s" + err.Error())
- go alarm_msg.SendAlarmMsg("SyncSubStatus 查询open_id失败 ErrMsg:"+err.Error(), 3)
- return err
- }
- }
- unSubIds := strings.Join(items, "','")
- unSubIds = "'" + unSubIds + "'"
- if unSubIds != "''" {
- err = data_manage.UpdateSubStatus(unSubIds)
- if err != nil {
- utils.FileLog.Info("SyncSubStatus update Err:%s" + err.Error())
- go alarm_msg.SendAlarmMsg("SyncSubStatus 更新关注状态失败 ErrMsg:"+err.Error(), 3)
- return err
- }
- }
- return
- }
|