Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
bc662e1986
@ -1,6 +1,7 @@
|
|||||||
package smithy
|
package smithy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"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)
|
cus, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
var customErr = new(comm.CustomError)
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
if errors.As(err, &customErr) {
|
||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
errdata = &pb.ErrorData{
|
||||||
Message: err.Error(),
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ func (s *modelTrade) updateCustomer(uid string, customerId int32) (*pb.DBCustome
|
|||||||
})
|
})
|
||||||
cus.LastRefreshTime = configure.Now().Unix()
|
cus.LastRefreshTime = configure.Now().Unix()
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"customerIds": cus.Customers,
|
"customers": cus.Customers,
|
||||||
"total": cus.Total,
|
"total": cus.Total,
|
||||||
"lastRefreshTime": cus.LastRefreshTime,
|
"lastRefreshTime": cus.LastRefreshTime,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user