renjiaojiao 2 долоо хоног өмнө
parent
commit
1454c5a0cb

+ 0 - 1
api/internal/logic/materialsavelogic.go

@@ -43,7 +43,6 @@ func (l *MaterialSaveLogic) MaterialSave(req *types.MaterialSaveReq) (resp *type
 		return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg}, err
 	}
 	msgId := res.MsgId
-	//log.Println("***************88", msgId)
 	_, err = l.svcCtx.MessageCenterRpc.UpdateMsgSummary(l.ctx, &messageclient.UpdateMsgSummaryReq{
 		MsgLogId: msgId,
 		GroupId:  11,

+ 4 - 2
rpc/internal/logic/materialsavelogic.go

@@ -1,6 +1,7 @@
 package logic
 
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	"bp.jydev.jianyu360.cn/BaseService/biService/entity"
 	IC "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/config"
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
@@ -53,12 +54,13 @@ func (l *MaterialSaveLogic) MaterialSave(in *pb.MaterialSaveReq) (*pb.MaterialSa
 		}, nil
 	}
 	positionArr := strings.Split(in.ReceiveUserId, ",")
+	userIdMap := service.GetUserIds(in.ReceiveUserId)
 	for k, v := range strings.Split(in.ReceiveUserName, ",") {
 		if len(strings.Split(in.FileUrl, ",")) == 0 {
 			break
 		}
-		personCode := service.GetPersonCode(gconv.Int64(positionArr[k]), v)
-		qrcodeUrl := fmt.Sprintf("%s/material/%d/%s", IC.IC.JyWebDomain, mid, personCode)
+		personCode := service.GetPersonCode(gconv.Int64(positionArr[k]), v, userIdMap[common.IntAll(positionArr[k])])
+		qrcodeUrl := fmt.Sprintf("%s/material/%d/%s?tp=material", IC.IC.JyWebDomain, mid, personCode)
 		//log.Println("二维码链接", qrcodeUrl)
 		for _, val := range strings.Split(in.FileUrl, ",") {
 			go func(fileUrl, name string, positionId int64) {

+ 12 - 26
service/material.go

@@ -1,6 +1,7 @@
 package service
 
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/date"
 	entity "bp.jydev.jianyu360.cn/BaseService/biService/entity"
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
@@ -10,7 +11,6 @@ import (
 	"github.com/gogf/gf/v2/util/gconv"
 	"log"
 	"math/big"
-	"net/url"
 	"strings"
 	"time"
 )
@@ -84,10 +84,10 @@ func PersonImageSave(imgUrl string, msgId, positionId, materialsId int64) bool {
 	return entity.BiService.Insert("operating_materials_attachment", saveMap) > 0
 }
 
-func GetPersonCode(positionId int64, name string) string {
+func GetPersonCode(positionId int64, name, userId string) string {
 	//根据职位id获取到对应的渠道码
 	code := ""
-	data := entity.JyBiTidb.FindOne("dwd_d_userbase_belongto_rulecode", map[string]interface{}{"position_id": positionId}, "code", "")
+	data := entity.JyBiTidb.FindOne("dwd_d_userbase_belongto_rulecode", map[string]interface{}{"user_id": positionId}, "code", "")
 	if data != nil && len(*data) > 0 {
 		code = gconv.String((*data)["code"])
 	} else {
@@ -104,27 +104,12 @@ func GetPersonCode(positionId int64, name string) string {
 			"SZ_PID0":     "04",
 			"SZ_PID1":     code,
 			"position_id": positionId,
+			"user_id":     userId,
 		})
 	}
 	return code
 }
 
-/*func PersonImgSaveComposite(fileUrl, qrcodeUrl, name, personCode string, positionId int64) ([]byte, error) {
-
-	//合成图片
-	ok, err := hasAnyParameters(qrcodeUrl)
-	if err != nil {
-		return nil, err
-	}
-	if ok {
-		qrcodeUrl = fmt.Sprintf("%s&personnelChannel=%s", qrcodeUrl, personCode)
-	} else {
-		qrcodeUrl = fmt.Sprintf("%s?personnelChannel=%s", qrcodeUrl, personCode)
-	}
-	err, imgByte := CompositeImage(fileUrl, qrcodeUrl)
-	return imgByte, err
-}*/
-
 func generateRandomString(length int) string {
 	const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
 	b := make([]byte, length)
@@ -136,12 +121,13 @@ func generateRandomString(length int) string {
 	return string(b)
 }
 
-func hasAnyParameters(rawURL string) (bool, error) {
-	parsedURL, err := url.Parse(rawURL)
-	if err != nil {
-		return false, err
+func GetUserIds(positionIds string) map[int]string {
+	res := map[int]string{}
+	data := entity.BiService.SelectBySql("SELECT userid,position_id FROM data_service.`user_system` FROM position_id in (?)", positionIds)
+	if data != nil && len(*data) > 0 {
+		for _, v := range *data {
+			res[common.IntAll(v["position_id"])] = common.InterfaceToStr(v["userid"])
+		}
 	}
-
-	// 检查查询参数或片段标识符中的参数
-	return parsedURL.RawQuery != "" || (parsedURL.Fragment != "" && strings.Contains(parsedURL.Fragment, "=")), nil
+	return res
 }