|
@@ -1,14 +1,19 @@
|
|
package logic
|
|
package logic
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/entity"
|
|
IC "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/config"
|
|
IC "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/config"
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/service"
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/service"
|
|
|
|
+ fpb "bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/pb"
|
|
"context"
|
|
"context"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"log"
|
|
"log"
|
|
|
|
+ "path"
|
|
|
|
+ "strings"
|
|
)
|
|
)
|
|
|
|
|
|
type MaterialSaveLogic struct {
|
|
type MaterialSaveLogic struct {
|
|
@@ -39,7 +44,7 @@ func (l *MaterialSaveLogic) MaterialSave(in *pb.MaterialSaveReq) (*pb.MaterialSa
|
|
//获取分发人的userid
|
|
//获取分发人的userid
|
|
userIdArr := service.GetSendUserId(in.ReceiveUserId, in.EntId)
|
|
userIdArr := service.GetSendUserId(in.ReceiveUserId, in.EntId)
|
|
log.Println("物料分发给:", userIdArr)
|
|
log.Println("物料分发给:", userIdArr)
|
|
- /*if in.QrcodeUrl == "" {
|
|
|
|
|
|
+ if in.QrcodeUrl == "" {
|
|
return &pb.MaterialSaveResp{
|
|
return &pb.MaterialSaveResp{
|
|
ErrorCode: 1,
|
|
ErrorCode: 1,
|
|
ErrorMsg: "",
|
|
ErrorMsg: "",
|
|
@@ -47,34 +52,34 @@ func (l *MaterialSaveLogic) MaterialSave(in *pb.MaterialSaveReq) (*pb.MaterialSa
|
|
MaterialId: mid,
|
|
MaterialId: mid,
|
|
UserIdArr: userIdArr,
|
|
UserIdArr: userIdArr,
|
|
}, nil
|
|
}, nil
|
|
- }*/
|
|
|
|
- //positionArr := strings.Split(in.ReceiveUserId, ",")
|
|
|
|
- /*for k, v := range strings.Split(in.ReceiveUserName, ",") {
|
|
|
|
|
|
+ }
|
|
|
|
+ positionArr := strings.Split(in.ReceiveUserId, ",")
|
|
|
|
+ for k, v := range strings.Split(in.ReceiveUserName, ",") {
|
|
if len(strings.Split(in.FileUrl, ",")) == 0 {
|
|
if len(strings.Split(in.FileUrl, ",")) == 0 {
|
|
break
|
|
break
|
|
}
|
|
}
|
|
|
|
+ personCode := service.GetPersonCode(gconv.Int64(positionArr[k]))
|
|
for _, val := range strings.Split(in.FileUrl, ",") {
|
|
for _, val := range strings.Split(in.FileUrl, ",") {
|
|
go func(fileUrl, name string, positionId int64) {
|
|
go func(fileUrl, name string, positionId int64) {
|
|
- imgByte, err := service.PersonImgSaveComposite(fileUrl, in.QrcodeUrl, name, positionId)
|
|
|
|
|
|
+ imgByte, err := service.PersonImgSaveComposite(fileUrl, in.QrcodeUrl, name, personCode, positionId)
|
|
|
|
+ log.Println(imgByte)
|
|
if err != nil {
|
|
if err != nil {
|
|
log.Println("合成图片出错:", err)
|
|
log.Println("合成图片出错:", err)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
log.Println("图片名称", path.Base(fileUrl))
|
|
log.Println("图片名称", path.Base(fileUrl))
|
|
- up, err := entity.FileCenterRpc.Upload(l.ctx, &fpb.UploadReq{
|
|
|
|
|
|
+ up, err := entity.FileCenterRpc.Upload(context.Background(), &fpb.UploadReq{
|
|
File: imgByte,
|
|
File: imgByte,
|
|
OssBucketName: entity.OssBucketName,
|
|
OssBucketName: entity.OssBucketName,
|
|
OssUrl: entity.OssUrl,
|
|
OssUrl: entity.OssUrl,
|
|
Name: path.Base(fileUrl),
|
|
Name: path.Base(fileUrl),
|
|
NeedEncryption: false,
|
|
NeedEncryption: false,
|
|
})
|
|
})
|
|
|
|
+ //log.Println(err)
|
|
if up == nil || up.Url == "" {
|
|
if up == nil || up.Url == "" {
|
|
log.Println("上传合成图片失败:", err)
|
|
log.Println("上传合成图片失败:", err)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //key := up.Key
|
|
|
|
- //ossAddr = gconv.String(Ret["downUrl"])
|
|
|
|
-
|
|
|
|
ok := service.PersonImageSave(up.Url, msgId, positionId, mid)
|
|
ok := service.PersonImageSave(up.Url, msgId, positionId, mid)
|
|
if !ok {
|
|
if !ok {
|
|
log.Println("合成图片存库失败")
|
|
log.Println("合成图片存库失败")
|
|
@@ -82,7 +87,7 @@ func (l *MaterialSaveLogic) MaterialSave(in *pb.MaterialSaveReq) (*pb.MaterialSa
|
|
}
|
|
}
|
|
}(val, v, gconv.Int64(positionArr[k]))
|
|
}(val, v, gconv.Int64(positionArr[k]))
|
|
}
|
|
}
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
|
|
return &pb.MaterialSaveResp{
|
|
return &pb.MaterialSaveResp{
|
|
ErrorCode: 1,
|
|
ErrorCode: 1,
|