作者 陈志颖

fix:新增公司增加栏目设置数据

... ... @@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/constant"
"time"
"github.com/astaxie/beego/logs"
... ... @@ -196,6 +197,12 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error {
}); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
var columnSettingRepository domain.ColumnSettingRepository
if columnSettingRepository, err = factory.CreateColumnSettingRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
oldCompany, err = companyRespository.FindOne(domain.CompanyFindOneOptions{
Id: data.Company.Id,
})
... ... @@ -277,6 +284,21 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error {
if err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
// 初始化栏目设置
newColumnSetting := &domain.ColumnSetting{
Description: "订单管理栏目设置",
UserName: data.User.Name,
CompanyId: int(data.User.CompanyId),
Uid: data.User.Id,
Key: constant.ORDER_BASE, // 订单栏目模块名称
Value: domain.DefaultColumns, // 栏目值数组,创建用户时使用默认栏目设置
InvalidValue: domain.DefaultInvalidColumns, // 初始化无效栏目数组
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
if _, err = columnSettingRepository.Save(newColumnSetting); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
err = transactionContext.CommitTransaction()
return nil
}
... ...