1d41d7ca7e
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / bff (push) Successful in 3s
CI / chore (push) Successful in 0s
CI / express (push) Successful in 0s
CI / product (push) Successful in 1s
CI / sale (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 31s
50 lines
983 B
Go
50 lines
983 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{
|
|
{Value: dao.UserTypeAdmin, Label: "管理员"},
|
|
{Value: dao.UserTypeSale, Label: "销售"},
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|