This commit is contained in:
liwei 2023-06-27 16:58:32 +08:00
commit bc662e1986
2 changed files with 16 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package smithy
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
@ -28,11 +29,21 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
cus, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
if err != nil {
var customErr = new(comm.CustomError)
if errors.As(err, &customErr) {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
Code: customErr.Code,
Title: customErr.Code.ToString(),
Message: err.Error(),
}
} else {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
}
return
}

View File

@ -147,7 +147,7 @@ func (s *modelTrade) updateCustomer(uid string, customerId int32) (*pb.DBCustome
})
cus.LastRefreshTime = configure.Now().Unix()
update := map[string]interface{}{
"customerIds": cus.Customers,
"customers": cus.Customers,
"total": cus.Total,
"lastRefreshTime": cus.LastRefreshTime,
}