package services

import (
	"fmt"
	"hongze/hongze_cygx/models"
	"hongze/hongze_cygx/utils"
	"time"
)

// 添加用户关注，取消关注产业日志记录
func AddCygxIndustryFllowLog(item *models.CygxIndustryFllow) (err error) {
	defer func() {
		if err != nil {
			go utils.SendAlarmMsg("添加用户关注，取消关注产业日志记录失败"+err.Error()+fmt.Sprint(item), 2)
		}
	}()
	itemlog := new(models.CygxIndustryFllowLog)
	itemlog.IndustrialManagementId = item.IndustrialManagementId
	itemlog.UserId = item.UserId
	itemlog.Email = item.Email
	itemlog.Mobile = item.Mobile
	itemlog.RealName = item.RealName
	itemlog.CompanyId = item.CompanyId
	itemlog.CompanyName = item.CompanyName
	itemlog.Type = item.Type
	itemlog.Source = utils.REGISTER_PLATFORM
	itemlog.CreateTime = time.Now()
	itemlog.ModifyTime = time.Now()
	_, err = models.AddCygxIndustryFllowLog(itemlog)
	return err
}
