Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into cygx/mfyx_2.0

xingzai 1 year ago
parent
commit
78bdbb2c7c

+ 1 - 1
controllers/cygx/activity_signup.go

@@ -2059,7 +2059,7 @@ func (this *ActivitySignupCoAntroller) AddSignuUser() {
 	if len(items) > 0 {
 		//1用户报名添加到处理研选扣点
 		for _, v := range items {
-			time.Sleep(500 * time.Millisecond) // 添加半秒的延时
+			time.Sleep(100 * time.Millisecond) // 添加0.1秒的延时
 			cygxService.YanXuanActivityPointsBillSignupAdd(v.ActivityId, v.UserId, adminInfo.AdminId)
 		}
 

+ 2 - 1
controllers/cygx/contract_allocation.go

@@ -13,6 +13,7 @@ import (
 	"hongze/hz_crm_api/models/system"
 	cygxService "hongze/hz_crm_api/services/cygx"
 	"hongze/hz_crm_api/utils"
+	"math"
 	"os"
 	"path/filepath"
 	"strconv"
@@ -519,7 +520,7 @@ func (this *ContractAllocationController) CompanyContracDetail() {
 	for _, p := range hasPermissions {
 		hasMap[p.ChartPermissionId] = p
 		if p.ChartPermissionId == utils.YAN_XUAN_KOU_DIAN_BAO_ID {
-			pointMoney = 0.2 * p.Points
+			pointMoney = math.Round(0.2*p.Points*100) / 100 // 将给定数字舍入到最近的整数,处理精度问题
 		}
 	}
 

+ 63 - 1
controllers/cygx/yanxuan_special.go

@@ -2,6 +2,7 @@ package cygx
 
 import (
 	"encoding/json"
+	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"github.com/tealeg/xlsx"
 	"hongze/hz_crm_api/controllers"
@@ -75,6 +76,7 @@ func (this *YanxuanSpecialController) Add() {
 		UserId:      req.UserId,
 		RealName:    req.RealName,
 		Mobile:      req.Mobile,
+		MobileInit:  infoUser.Mobile,
 		CompanyName: infoUser.CompanyName,
 		CompanyId:   infoUser.CompanyId,
 		CreateTime:  time.Now(),
@@ -252,15 +254,46 @@ func (this *YanxuanSpecialController) AuthorList() {
 	}
 
 	var userIds []int
-
+	var mobiles []string
 	for _, v := range list {
 		userIds = append(userIds, v.UserId)
+		if v.MobileInit != "" {
+			mobiles = append(mobiles, v.MobileInit)
+		}
+	}
+
+	listUser, err := models.GetWxUserRaiSllerListByUserMobile(mobiles)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
 	}
+	//获取用户当前最新的公司信息
+	mapWxUserSller := make(map[string]*models.WxUserSller)
+	for _, v := range listUser {
+		mapWxUserSller[v.Mobile] = v
+	}
+
+	//对权益管理员跟超管展示全部手机号
+	var isShow bool
+	if sysUser.RoleTypeCode == utils.ROLE_TYPE_CODE_RAI_ADMIN || sysUser.RoleTypeCode == utils.ROLE_TYPE_CODE_ADMIN {
+		isShow = true
+	}
+
 	//获取专栏用户最新的一篇文章信息
 	mapNewTime := cygxService.GetBestNewYanxuanSpecialByUserId(userIds)
 	for _, v := range list {
 		v.SpecialAuthorId = v.Id
 		v.ArticlePublishTime = mapNewTime[v.UserId]
+		mapItem := mapWxUserSller[v.MobileInit]
+		if mapItem != nil {
+			v.CompanyName = mapItem.CompanyName
+			v.CompanyId = mapItem.CompanyId
+		}
+		if isShow {
+			v.Mobile = v.MobileInit
+		}
+
 	}
 	resp := new(cygx.GetCygxYanxuanSpecialAuthorItemResp)
 	page := paging.GetPaging(currentIndex, pageSize, total)
@@ -812,3 +845,32 @@ func (this *YanxuanSpecialController) SpecialAuthorFansList() {
 	br.Success = true
 	br.Msg = "获取成功"
 }
+
+func init_928() {
+	var condition string
+	var pars []interface{}
+	list, err := cygx.GetYanxuanSpecialAuthorList(condition, pars, 0, 999)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	for k, v := range list {
+		fmt.Println(k)
+		//获取关联公司的用户信息
+		infoUser, err := cygx.GetUserAndCompanyNameList(v.UserId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			fmt.Println(err)
+			return
+		}
+		if infoUser == nil {
+			continue
+		}
+		err = cygx.UpdateSpecialAuthormobile_init(infoUser.Mobile, infoUser.UserId)
+		if err != nil {
+			fmt.Println(err)
+			return
+		}
+	}
+	return
+}

+ 11 - 4
controllers/help_doc/doc.go

@@ -68,6 +68,10 @@ func (this *HelpDocController) Add() {
 		}
 	}
 
+	var resp help_doc.HelpDocSaveResp
+	resp.HelpDocId = req.Id
+	resp.ModifyTime = time.Now().Format(utils.FormatDateTime)
+
 	item := new(help_doc.HelpDoc)
 	item.ClassifyId = req.ClassifyId
 	item.Title = req.Title
@@ -85,13 +89,16 @@ func (this *HelpDocController) Add() {
 	}
 
 	if req.Id == 0 {
-		_, err = help_doc.AddHelpDoc(item)
-		if err != nil {
+		id, e := help_doc.AddHelpDoc(item)
+		if e != nil {
+			err = e
 			br.Msg = "新增失败"
 			br.ErrMsg = "保存失败,Err:" + err.Error()
 			return
 		}
-	} else {
+		resp.HelpDocId = id
+		resp.ModifyTime = item.ModifyTime.Format(utils.FormatDateTime)
+	} else if req.IsChange {
 		err = help_doc.EditHelpDoc(item, req.Id)
 		if err != nil {
 			br.Msg = "保存失败"
@@ -107,7 +114,7 @@ func (this *HelpDocController) Add() {
 	}
 	br.Ret = 200
 	br.Success = true
-
+	br.Data = resp
 }
 
 // @Title 获取报告详情接口

+ 2 - 2
models/company/company.go

@@ -1307,9 +1307,9 @@ func CompanyFreeze(companyId, productId int, freezeReason string) (err error) {
 	freezeStartDate := time.Now().Format(utils.FormatDate)
 	freezeEndDate := time.Now().AddDate(0, 3, 0).Format(utils.FormatDate)
 
-	// ficc是个月的冻结期
+	// ficc是个月的冻结期
 	if productId == 1 {
-		freezeEndDate = time.Now().AddDate(0, 2, 0).Format(utils.FormatDate)
+		freezeEndDate = time.Now().AddDate(0, 6, 0).Format(utils.FormatDate)
 	}
 
 	// 权益也调整为 两个月的冻结期

+ 12 - 0
models/cygx/cygx_yanxuan_special_user.go

@@ -15,6 +15,7 @@ type CygxYanxuanSpecialAuthor struct {
 	NickName     string    // 昵称
 	RealName     string    // 姓名
 	Mobile       string    // 手机号
+	MobileInit   string    // 初始化手机号(没有脱敏的)
 	CreateTime   time.Time // 创建时间
 	ModifyTime   time.Time // 修改时间
 	HeadImg      string    // 头像
@@ -30,12 +31,14 @@ type CygxYanxuanSpecialAuthorItem struct {
 	Id                 int    `orm:"column(id);pk"`
 	UserId             int    // 用户ID
 	CompanyName        string // 公司名
+	CompanyId          int    // 公Id
 	SpecialName        string // 专栏名称
 	Introduction       string // 介绍
 	Label              string // 标签
 	NickName           string // 昵称
 	RealName           string // 姓名
 	Mobile             string // 手机号
+	MobileInit         string // 初始化手机号(没有脱敏的)
 	CreateTime         string // 创建时间
 	ModifyTime         string // 修改时间
 	HeadImg            string // 头像
@@ -135,3 +138,12 @@ type CygxYanxuanSpecialCenterAuthorResp struct {
 	PublishTime string // 提审过审或驳回时间
 	Title       string // 标题
 }
+
+// 启用禁用作者
+func UpdateSpecialAuthormobile_init(mobile_init string, userId int) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := ``
+	sql = `UPDATE cygx_yanxuan_special_author SET mobile_init = ?  WHERE user_id = ? `
+	_, err = o.Raw(sql, mobile_init, userId).Exec()
+	return
+}

+ 7 - 1
models/help_doc/help_doc.go

@@ -52,6 +52,7 @@ type AddHelpDocReq struct {
 	Author        string `description:"作者"`
 	Status        int    `description:"状态:1:未发布,2:已发布"`
 	Content       string `description:"内容"`
+	IsChange      bool   `description:"内容是否改变"`
 	AnchorData    []AnchorList
 	RecommendData []RecommendList
 }
@@ -189,4 +190,9 @@ func GetAllHelpDoc() (items []*HelpDocItem, err error) {
 	sql := `SELECT * FROM help_doc `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}
+
+type HelpDocSaveResp struct {
+	HelpDocId  int64  `description:"智能研报ID"`
+	ModifyTime string `description:"修改时间"`
+}

+ 27 - 1
models/wx_user.go

@@ -562,6 +562,32 @@ func GetWxUserRaiSllerListByUserIds(userIds []int) (list []*WxUserSller, err err
 	return
 }
 
+// GetWxUserRaiSllerListByUserMobile 根据用户手机号获取权益相关用户信息
+func GetWxUserRaiSllerListByUserMobile(mobiles []string) (list []*WxUserSller, err error) {
+	lenarr := len(mobiles)
+	if lenarr == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := ` SELECT
+				w.user_id,
+				w.real_name,
+				w.mobile,
+				c.company_name,
+				c.company_id,
+				p.seller_name 
+			FROM
+				wx_user AS w
+				INNER JOIN company_product AS p ON p.company_id = w.company_id
+				INNER JOIN company AS c ON c.company_id = w.company_id 
+			WHERE
+				1 = 1 
+				AND p.product_id = 2 
+				AND w.mobile IN (` + utils.GetOrmInReplace(lenarr) + `)  `
+	_, err = o.Raw(sql, mobiles).QueryRows(&list)
+	return
+}
+
 // GetWxUserByCompanyIds 根据客户ID集合获取用户列表
 func GetWxUserByCompanyIds(companyIds []int) (items []*WxUser, err error) {
 	num := len(companyIds)
@@ -598,4 +624,4 @@ func GetCompanyFollowCount(companyId int) (count int, err error) {
 	sql := ` SELECT COUNT(1) FROM wx_user WHERE company_id=? AND is_follow = 1 `
 	err = o.Raw(sql, companyId).QueryRow(&count)
 	return
-}
+}

+ 2 - 2
services/cygx/mail.go

@@ -22,7 +22,7 @@ func SendResearchSummaryEmail(detail *cygx.DetailCygxResearchSummaryRep, touser
 	user = append(user, "zwxi@hzinsights.com ")
 	user = append(user, "zqliu@hzinsights.com ")
 	user = append(user, "tshen@hzinsights.com ")
-	user = append(user, "krfeng@hzinsights.com ")
+	user = append(user, "hdong@hzinsights.com ")
 	user = append(user, "cxzhang@hzinsights.com ")
 	m.SetHeader("Bcc", user...)
 	m.SetHeader("Subject", detail.Title)
@@ -291,7 +291,7 @@ func SendMinutesSummaryEmail(detail *cygx.DetailCygxMinutesSummaryRep, touser []
 	user = append(user, "zwxi@hzinsights.com ")
 	user = append(user, "zqliu@hzinsights.com ")
 	user = append(user, "tshen@hzinsights.com ")
-	user = append(user, "krfeng@hzinsights.com ")
+	user = append(user, "hdong@hzinsights.com ")
 	user = append(user, "cxzhang@hzinsights.com ")
 	m.SetHeader("To", user...)
 	m.SetHeader("Subject", detail.Title)