|
@@ -1,19 +1,14 @@
|
|
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 {
|
|
@@ -44,56 +39,6 @@ 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 == "" {
|
|
|
|
- return &pb.MaterialSaveResp{
|
|
|
|
- ErrorCode: 1,
|
|
|
|
- ErrorMsg: "",
|
|
|
|
- MsgId: msgId,
|
|
|
|
- MaterialId: mid,
|
|
|
|
- UserIdArr: userIdArr,
|
|
|
|
- }, nil
|
|
|
|
- }
|
|
|
|
- positionArr := strings.Split(in.ReceiveUserId, ",")
|
|
|
|
- for k, v := range strings.Split(in.ReceiveUserName, ",") {
|
|
|
|
- if len(strings.Split(in.FileUrl, ",")) == 0 {
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- for _, val := range strings.Split(in.FileUrl, ",") {
|
|
|
|
- imgByte, err := service.PersonImgSaveComposite(val, in.QrcodeUrl, v)
|
|
|
|
- if err != nil {
|
|
|
|
- return &pb.MaterialSaveResp{
|
|
|
|
- ErrorCode: -1,
|
|
|
|
- ErrorMsg: "",
|
|
|
|
- }, nil
|
|
|
|
- }
|
|
|
|
- up, err := entity.FileCenterRpc.Upload(l.ctx, &fpb.UploadReq{
|
|
|
|
- File: imgByte,
|
|
|
|
- OssBucketName: entity.OssBucketName,
|
|
|
|
- OssUrl: entity.OssUrl,
|
|
|
|
- Name: path.Base(in.FileUrl),
|
|
|
|
- NeedEncryption: false,
|
|
|
|
- })
|
|
|
|
- if up == nil || up.Url == "" {
|
|
|
|
- return &pb.MaterialSaveResp{
|
|
|
|
- ErrorCode: -1,
|
|
|
|
- ErrorMsg: "",
|
|
|
|
- }, nil
|
|
|
|
- }
|
|
|
|
- //key := up.Key
|
|
|
|
- //ossAddr = gconv.String(Ret["downUrl"])
|
|
|
|
- //log.Println("url", up.Url)
|
|
|
|
- //fileName := filepath.Base(up.Url)
|
|
|
|
- //downUrl := fmt.Sprintf("%s/jyoss/ml/attachment/%s", IC.IC.JyWebDomain, fileName)
|
|
|
|
- //log.Println("downUrl:", downUrl)
|
|
|
|
- ok := service.PersonImageSave(up.Url, msgId, gconv.Int64(positionArr[k]), mid)
|
|
|
|
- if !ok {
|
|
|
|
- return &pb.MaterialSaveResp{
|
|
|
|
- ErrorCode: -1,
|
|
|
|
- ErrorMsg: "",
|
|
|
|
- }, nil
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
return &pb.MaterialSaveResp{
|
|
return &pb.MaterialSaveResp{
|
|
ErrorCode: 1,
|
|
ErrorCode: 1,
|