作者 tangxuhui

时间判断0值

... ... @@ -93,7 +93,8 @@ type DividendsEstimateItem struct {
DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段
CooperationContractNumber string `json:"cooperationContractNumber"` // 共创项目合约编号,
DividendsIncentivesStage int `json:"dividendsIncentivesStage"` //分红阶段
IsCanceled bool `json:"isCanceled"` // 取消状态
DividendsUser struct {
UsersId int `json:"usersId,string,"` // 用户ID,
... ...
... ... @@ -93,6 +93,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
DividendsType: v.DividendsType,
OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum,
CooperationProjectNumber: v.CooperationProjectNumber,
CooperationContractNumber: v.CooperationContractNumber,
DividendsIncentivesStage: v.DividendsIncentivesStage,
IsCanceled: v.IsCanceled,
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
... ... @@ -27,20 +24,20 @@ type CooperationUserAddCommand struct {
Phone string `json:"phone" valid:"Required"`
}
func (cooperationUserAddCommand *CooperationUserAddCommand) Valid(validation *validation.Validation) {
// func (cooperationUserAddCommand *CooperationUserAddCommand) Valid(validation *validation.Validation) {
}
// }
func (cooperationUserAddCommand *CooperationUserAddCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cooperationUserAddCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
// func (cooperationUserAddCommand *CooperationUserAddCommand) ValidateCommand() error {
// valid := validation.Validation{}
// b, err := valid.Valid(cooperationUserAddCommand)
// if err != nil {
// return err
// }
// if !b {
// for _, validErr := range valid.Errors {
// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
// }
// }
// return nil
// }
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
... ... @@ -16,20 +13,20 @@ type CooperationUserEnableCommand struct {
EnableStatus int `json:"enableStatus,omitempty"`
}
func (cooperationUserEnableCommand *CooperationUserEnableCommand) Valid(validation *validation.Validation) {
// func (cooperationUserEnableCommand *CooperationUserEnableCommand) Valid(validation *validation.Validation) {
}
// }
func (cooperationUserEnableCommand *CooperationUserEnableCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cooperationUserEnableCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
// func (cooperationUserEnableCommand *CooperationUserEnableCommand) ValidateCommand() error {
// valid := validation.Validation{}
// b, err := valid.Valid(cooperationUserEnableCommand)
// if err != nil {
// return err
// }
// if !b {
// for _, validErr := range valid.Errors {
// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
// }
// }
// return nil
// }
... ...
... ... @@ -3,11 +3,12 @@ package service
import (
"crypto/sha1"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"strconv"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
... ... @@ -286,10 +287,15 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
cooperationDeadline := time.Time{}
if cooperationUserAddCommand.CooperationDeadline > 0 {
cooperationDeadline = time.Unix(cooperationUserAddCommand.CooperationDeadline/1e3, 0)
}
result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
CompanyId: cooperationUserAddCommand.Operator.CompanyId,
CooperationCompany: cooperationUserAddCommand.CooperationCompany,
CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline/1000, 0),
CooperationDeadline: cooperationDeadline,
Email: cooperationUserAddCommand.Email,
EnableStatus: cooperationUserAddCommand.EnableStatus,
UserCode: cooperationUserAddCommand.UsersCode,
... ... @@ -342,7 +348,10 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
deadline := result.CooperationInfo.CooperationDeadline.Unix()
var deadline int64
if !result.CooperationInfo.CooperationDeadline.IsZero() {
deadline = result.CooperationInfo.CooperationDeadline.Unix()
}
userInfo := dto.CooperationUserInfo{
UserId: strconv.Itoa(result.UserId),
UserCode: result.UserCode,
... ... @@ -382,7 +391,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
item = dto.CooperationUserItem{
CooperationCompany: v.CooperationInfo.CooperationCompany,
UserId: strconv.Itoa(v.UserId),
CooperationDeadline: v.CooperationInfo.CooperationDeadline.Format("2006-01-02"),
CooperationDeadline: "",
Phone: v.UserInfo.Phone,
EnableStatus: v.EnableStatus,
UserCode: v.UserCode,
... ... @@ -390,6 +399,10 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
OrgName: v.Org.OrgName,
OrgId: strconv.Itoa(v.Org.OrgId),
}
if !v.CooperationInfo.CooperationDeadline.IsZero() {
item.CooperationDeadline = v.CooperationInfo.CooperationDeadline.Format("2006-01-02")
}
listData = append(listData, item)
}
return cnt, listData, err
... ...
... ... @@ -63,6 +63,7 @@ type (
DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
CooperationContractNumber string `json:"cooperationContractNumber"` // 共创项目合约编号,
DividendsIncentivesStage int `json:"DividendsIncentivesStage"` // 分红阶段
IsCanceled bool `json:"isCanceled"` // 取消状态
DividendsUser struct {
... ...