...
|
...
|
@@ -50,13 +50,14 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC |
|
|
for _, v := range createCooperationContractCommand.Undertakers {
|
|
|
u := allied_creation_cooperation.Undertaker{
|
|
|
UndertakerId: v.UndertakerId,
|
|
|
RerferrerId: v.RerferrerId,
|
|
|
UserId: v.UserId,
|
|
|
ReferrerId: v.RerferrerId,
|
|
|
SalesmanId: v.SalesmanId,
|
|
|
Attachment: v.Attachment,
|
|
|
}
|
|
|
underTakers = append(underTakers, u)
|
|
|
}
|
|
|
_, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
|
|
|
result, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
|
|
|
MoneyIncentivesRules: rules2,
|
|
|
DividendsIncentivesRules: rules1,
|
|
|
Undertakers: underTakers,
|
...
|
...
|
@@ -67,7 +68,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC |
|
|
CooperationContractUndertakerType: createCooperationContractCommand.CooperationContract.CooperationContractUndertakerType,
|
|
|
CooperationContractName: createCooperationContractCommand.CooperationContract.CooperationContractName,
|
|
|
CooperationModeNumber: createCooperationContractCommand.CooperationContract.CooperationModeNumber,
|
|
|
SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUid,
|
|
|
SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUserId,
|
|
|
CompanyId: int(createCooperationContractCommand.Operator.CompanyId),
|
|
|
UserId: int(createCooperationContractCommand.Operator.UserId),
|
|
|
UserBaseId: int(createCooperationContractCommand.Operator.UserBaseId),
|
...
|
...
|
@@ -76,7 +77,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return createCooperationContractCommand, err
|
|
|
return dto.ToCooperationContractInfo(&result.CooperationContract), err
|
|
|
}
|
|
|
|
|
|
// 暂停恢复共创合约
|
...
|
...
|
@@ -84,8 +85,15 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC |
|
|
if err := enableCooperationContractCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
return nil, nil
|
|
|
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(enableCooperationContractCommand.Operator)
|
|
|
_, err := creationCooperationGateway.CooperationContractsBatchOperate(allied_creation_cooperation.ReqCooperationContractsBatchOperate{
|
|
|
CooperationContractIds: enableCooperationContractCommand.CooperationContractId,
|
|
|
Action: enableCooperationContractCommand.Status,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return enableCooperationContractCommand, nil
|
|
|
}
|
|
|
|
|
|
// 返回共创合约详情
|
...
|
...
|
@@ -141,10 +149,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
|
CooperationContractNumber: v.CooperationContractNumber,
|
|
|
ReferrerPercentage: v.ReferrerPercentage,
|
|
|
SalesmanPercentage: v.SalesmanPercentage,
|
|
|
DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,
|
|
|
DividendsIncentivesStage: v.DividendsIncentivesStage,
|
|
|
DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsIncentivesStageEnd/1e3), 0),
|
|
|
DividendsIncentivesStageStart: time.Unix(int64(v.DividendsIncentivesStageStart/1e3), 0),
|
|
|
DividendsIncentivesPercentage: v.DividendsPercentage,
|
|
|
DividendsIncentivesStage: v.DividendsStage,
|
|
|
DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsStageEnd/1e3), 0),
|
|
|
DividendsIncentivesStageStart: time.Unix(int64(v.DividendsStageStart/1e3), 0),
|
|
|
}
|
|
|
rules1 = append(rules1, r)
|
|
|
}
|
...
|
...
|
@@ -165,13 +173,14 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
|
for _, v := range updateCooperationContractCommand.Undertakers {
|
|
|
u := allied_creation_cooperation.Undertaker{
|
|
|
UndertakerId: v.UndertakerId,
|
|
|
RerferrerId: v.RerferrerId,
|
|
|
UserId: v.UserId,
|
|
|
ReferrerId: v.RerferrerId,
|
|
|
SalesmanId: v.SalesmanId,
|
|
|
Attachment: v.Attachment,
|
|
|
}
|
|
|
underTakers = append(underTakers, u)
|
|
|
}
|
|
|
_, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
|
|
|
result, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
|
|
|
CooperationContractId: updateCooperationContractCommand.CooperationContract.CooperationContractId,
|
|
|
MoneyIncentivesRules: rules2,
|
|
|
DividendsIncentivesRules: rules1,
|
...
|
...
|
@@ -184,7 +193,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
|
CooperationContractUndertakerType: updateCooperationContractCommand.CooperationContract.CooperationContractUndertakerType,
|
|
|
CooperationContractName: updateCooperationContractCommand.CooperationContract.CooperationContractName,
|
|
|
CooperationModeNumber: updateCooperationContractCommand.CooperationContract.CooperationModeNumber,
|
|
|
SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUid,
|
|
|
SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUserId,
|
|
|
CompanyId: int(updateCooperationContractCommand.Operator.CompanyId),
|
|
|
UserId: int(updateCooperationContractCommand.Operator.UserId),
|
|
|
UserBaseId: int(updateCooperationContractCommand.Operator.UserBaseId),
|
...
|
...
|
@@ -193,7 +202,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
return dto.ToCooperationContractInfo(&result.CooperationContract), nil
|
|
|
}
|
|
|
|
|
|
func NewCooperationContractService(options map[string]interface{}) *CooperationContractService {
|
...
|
...
|
|