|
@@ -1,18 +1,12 @@
|
|
|
package logic
|
|
|
|
|
|
import (
|
|
|
- "app.yhyue.com/moapp/MessageCenter/entity"
|
|
|
service "app.yhyue.com/moapp/MessageCenter/rpc/internal/common"
|
|
|
- "app.yhyue.com/moapp/jybase/common"
|
|
|
- "context"
|
|
|
- "github.com/gogf/gf/v2/util/gconv"
|
|
|
- "path"
|
|
|
- "strings"
|
|
|
-
|
|
|
"app.yhyue.com/moapp/MessageCenter/rpc/internal/svc"
|
|
|
"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
|
|
|
+ "context"
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
|
|
|
|
- fpb "bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/pb"
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
|
|
|
|
@@ -36,46 +30,6 @@ func (l *MlDetailsLogic) MlDetails(in *message.MaterialDetailReq) (*message.Mate
|
|
|
//先查询详情
|
|
|
data := service.MaterialDetail(in.MsgLogId, in.PositionId)
|
|
|
if data != nil {
|
|
|
- attUrl := []string{}
|
|
|
- qrCodeUrl := common.InterfaceToStr(data["qrcode_url"])
|
|
|
- fileUrl := common.InterfaceToStr(data["file_url"])
|
|
|
- if qrCodeUrl != "" && common.InterfaceToStr(data["attUrl"]) == "" && len(strings.Split(fileUrl, ",")) != 0 {
|
|
|
- for _, val := range strings.Split(fileUrl, ",") {
|
|
|
- imgByte, err := service.PersonImgSaveComposite(val, qrCodeUrl, "", in.PositionId)
|
|
|
- if err != nil {
|
|
|
- return &message.MaterialDetailResp{
|
|
|
- Code: 1,
|
|
|
- Message: "获取详情成功",
|
|
|
- Data: nil,
|
|
|
- }, nil
|
|
|
- }
|
|
|
- up, err := entity.FileCenterRpc.Upload(l.ctx, &fpb.UploadReq{
|
|
|
- File: imgByte,
|
|
|
- OssBucketName: entity.OssBucketName,
|
|
|
- OssUrl: entity.OssUrl,
|
|
|
- Name: path.Base(fileUrl),
|
|
|
- NeedEncryption: false,
|
|
|
- })
|
|
|
- if up == nil || up.Url == "" {
|
|
|
- return &message.MaterialDetailResp{
|
|
|
- Code: -1,
|
|
|
- Message: "上传合成图片失败",
|
|
|
- Data: nil,
|
|
|
- }, nil
|
|
|
- }
|
|
|
- attUrl = append(attUrl, up.Url)
|
|
|
- ok := service.PersonImageSave(up.Url, common.Int64All(data["id"]), in.PositionId, common.Int64All(data["mid"]))
|
|
|
- if !ok {
|
|
|
- return &message.MaterialDetailResp{
|
|
|
- Code: -1,
|
|
|
- Message: "保存个人图片失败",
|
|
|
- Data: nil,
|
|
|
- }, nil
|
|
|
- }
|
|
|
- }
|
|
|
- //}
|
|
|
- data["attUrl"] = strings.Join(attUrl, ",")
|
|
|
- }
|
|
|
return &message.MaterialDetailResp{
|
|
|
Code: 1,
|
|
|
Message: "获取详情成功",
|