b79d49d399
CI / changes (push) Successful in 13s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 1s
CI / bff (push) Successful in 0s
CI / chore (push) Successful in 0s
CI / express (push) Successful in 1s
CI / product (push) Successful in 0s
CI / sale (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 32s
50 lines
975 B
Go
50 lines
975 B
Go
package logic
|
|
|
|
import (
|
|
"lone-services/pkg/utils"
|
|
"lone-services/services/wecom/internal/dao"
|
|
)
|
|
|
|
func departmentID() int {
|
|
id := utils.GetConfigInt("wecom.department_id")
|
|
if id < utils.NumberOne {
|
|
return utils.NumberOne
|
|
}
|
|
return id
|
|
}
|
|
|
|
func statusEnable(status uint8) int {
|
|
if status == dao.StatusDisabled {
|
|
return utils.NumberZero
|
|
}
|
|
return utils.NumberOne
|
|
}
|
|
|
|
func typeText(t uint8) string {
|
|
switch t {
|
|
case dao.UserTypeAdmin:
|
|
return "管理员"
|
|
case dao.UserTypeSale:
|
|
return "销售"
|
|
default:
|
|
return utils.StringEmpty
|
|
}
|
|
}
|
|
|
|
func userTypeOptions() []dao.UserTypeOption {
|
|
return []dao.UserTypeOption{
|
|
{ID: dao.UserTypeAdmin, Name: "管理员"},
|
|
{ID: dao.UserTypeSale, Name: "销售"},
|
|
}
|
|
}
|
|
|
|
func resolveStatus(reqStatus uint32, current uint8) uint8 {
|
|
if reqStatus == uint32(dao.StatusEnabled) || reqStatus == uint32(dao.StatusDisabled) {
|
|
return uint8(reqStatus)
|
|
}
|
|
if current > utils.NumberZero {
|
|
return current
|
|
}
|
|
return dao.StatusEnabled
|
|
}
|