|
@@ -3,7 +3,6 @@ package logic
|
|
|
import (
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
"context"
|
|
|
- "fmt"
|
|
|
IC "jyBXCore/rpc/init"
|
|
|
"jyBXCore/rpc/model/es"
|
|
|
"jyBXCore/rpc/service"
|
|
@@ -31,24 +30,29 @@ func NewUpdateBidStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *U
|
|
|
|
|
|
// 投标状态更新
|
|
|
func (l *UpdateBidStatusLogic) UpdateBidStatus(in *bxcore.UpdateBidStatusReq) (*bxcore.UpdateBidStatusRes, error) {
|
|
|
- result := &bxcore.UpdateBidStatusRes{}
|
|
|
+ result := &bxcore.UpdateBidStatusRes{
|
|
|
+ ErrCode: -1,
|
|
|
+ }
|
|
|
// 1. 判断身份是否有权限 不是超级订阅也不是大会员 则直接返回不展示
|
|
|
userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
|
|
|
// 不是超级订阅 也不是大会员
|
|
|
if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
|
|
|
- return result, fmt.Errorf("没权限")
|
|
|
+ result.ErrMsg = "没有权限"
|
|
|
+ return result, nil
|
|
|
}
|
|
|
participateService := service.NewParticipateBid(in.EntId, in.EntUserId, in.PositionType, in.PositionId)
|
|
|
participateService.EntRoleId = userInfo.Ent.EntRoleId
|
|
|
// 信息id解密
|
|
|
infoList, _ := service.DecodeId(in.Sid)
|
|
|
if len(infoList) == 0 {
|
|
|
- return result, fmt.Errorf("信息id无效")
|
|
|
+ result.ErrMsg = "信息id无效"
|
|
|
+ return result, nil
|
|
|
}
|
|
|
// 根据标讯id 查询项目信息
|
|
|
projectInfos := es.GetProjectByInfoId(infoList)
|
|
|
if projectInfos == nil || len(*projectInfos) == 0 {
|
|
|
- return result, fmt.Errorf("无效的信息id")
|
|
|
+ result.ErrMsg = "未查询到项目信息"
|
|
|
+ return result, nil
|
|
|
}
|
|
|
// 判断是否已经过了开标时间
|
|
|
var isValid bool
|
|
@@ -58,18 +62,21 @@ func (l *UpdateBidStatusLogic) UpdateBidStatus(in *bxcore.UpdateBidStatusReq) (*
|
|
|
isValid = true
|
|
|
}
|
|
|
if !isValid {
|
|
|
- return result, fmt.Errorf("已经过开标时间,无法更新")
|
|
|
+ result.ErrMsg = "已经过开标时间,无法更新"
|
|
|
+ return result, nil
|
|
|
}
|
|
|
// 验证身份
|
|
|
if !participateService.CheckBidPower(projectId, true) {
|
|
|
- return result, fmt.Errorf("没有权限")
|
|
|
+ result.ErrMsg = "没有更新权限"
|
|
|
+ return result, nil
|
|
|
}
|
|
|
// 2. 更新
|
|
|
flag := participateService.UpdateBidStatus(in, projectId)
|
|
|
- var err error
|
|
|
if !flag {
|
|
|
- err = fmt.Errorf("更新失败")
|
|
|
+ result.ErrMsg = "更新失败"
|
|
|
+ } else {
|
|
|
+ result.ErrCode = 0
|
|
|
}
|
|
|
result.Data = flag
|
|
|
- return result, err
|
|
|
+ return result, nil
|
|
|
}
|