作者 唐旭辉

调试提交

package filesave
import (
"fmt"
"github.com/sony/sonyflake"
)
var sf = sonyflake.NewSonyflake(sonyflake.Settings{})
func GenerateIDBySonyflake() int64 {
num, _ := sf.NextID()
return int64(num)
}
func GenerateNewName() string {
id := GenerateIDBySonyflake()
return fmt.Sprint(id)
}
... ... @@ -42,10 +42,23 @@ type PermissionContentObject interface {
ObjectMarshal() (string, error)
}
type UserObject struct {
UserId int64 `json:"user_id"`
CompanyId int64 `json:"company_id"`
UserCompanyId int64 `json:"user_company_id"`
}
type PermissionContentBase struct {
Check int8 `json:"check"`
}
func (p *PermissionContentBase) ValidDefault(obj UserObject) bool {
if p.Check == 1 {
return true
}
return false
}
func NewPermissionContentBase() PermissionContentObject {
return &PermissionContentBase{}
}
... ...