123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- package services
- import (
- "errors"
- "fmt"
- "hongze/hongze_cygx/models"
- "hongze/hongze_cygx/utils"
- "strconv"
- "time"
- )
- // 是否展示限免标签
- func GetShowSustainable() (isShowSustainable bool) {
- total, err := models.GetShowSustainable()
- if err != nil {
- fmt.Println("GetShowSustainable Err:", err.Error())
- return
- }
- if total > 0 {
- isShowSustainable = true
- }
- return
- }
- func GetShowSustainableNew() (isShowSustainable bool, err error) {
- total, err := models.GetShowSustainable()
- if err != nil {
- fmt.Println("GetShowSustainable Err:", err.Error())
- return
- }
- if total > 0 {
- isShowSustainable = true
- }
- return
- }
- // GetIndustryUserFollowMap 获取用户关注的产业
- func GetIndustryUserFollowMap(user *models.WxUserItem) (itemMap map[int]bool, err error) {
- condition := ` AND user_id = ` + strconv.Itoa(user.UserId)
- listIndustryFllow, e := models.GetCygxIndustryFllowListByUserId(condition)
- if e != nil {
- err = errors.New("GetCygxIndustryFllowList " + e.Error())
- return
- }
- follwMap := make(map[int]bool)
- for _, v := range listIndustryFllow {
- follwMap[v.IndustrialManagementId] = true
- }
- itemMap = follwMap
- return
- }
- func init1231() {
- var condition string
- var pars []interface{}
- condition += ` AND t.id < 10000 `
- list, err := models.GetCygxActivitySpecialTripListinit(condition, pars)
- if err != nil {
- fmt.Println(err)
- return
- }
- for _, v := range list {
- //流水记录表
- itemBill := new(models.CygxActivitySpecialTripBill)
- itemBill.UserId = v.UserId
- itemBill.ActivityId = v.ActivityId
- itemBill.CreateTime = v.CreateTime
- itemBill.Mobile = v.Mobile
- itemBill.Email = v.Email
- itemBill.CompanyId = v.CompanyId
- itemBill.CompanyName = v.CompanyName
- itemBill.RealName = v.RealName
- itemBill.Source = 1
- itemBill.DoType = 1
- itemBill.BillDetailed = -1 // 流水减一
- itemBill.RegisterPlatform = 1
- itemBill.ChartPermissionId = v.ChartPermissionId
- go models.AddCygxActivitySpecialTripBill(itemBill)
- }
- }
- // 添加关于我们浏览记录
- func AddCygxAboutUsVideoHistory(user *models.WxUserItem) (err error) {
- defer func() {
- if err != nil {
- go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
- }
- }()
- historyRecord := new(models.CygxAboutUsVideoHistory)
- historyRecord.UserId = user.UserId
- historyRecord.CreateTime = time.Now()
- historyRecord.Mobile = user.Mobile
- historyRecord.Email = user.Email
- historyRecord.CompanyId = user.CompanyId
- historyRecord.CompanyName = user.CompanyName
- sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
- if err != nil && err.Error() != utils.ErrNoRow() {
- return
- }
- historyRecord.RealName = user.RealName
- historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
- if sellerItem != nil {
- historyRecord.SellerName = sellerItem.RealName
- }
- _, err = models.AddCygxAboutUsVideoHistory(historyRecord)
- return
- }
|