func (this *licenseMgr) ExportLicense() string { if !utils.SysParaMgr().ExistPara(LICENSE_PARA_NAME) { return comm.NULL_STR } license := utils.SysParaMgr().GetPara(LICENSE_PARA_NAME) license = strings.TrimSpace(license) return license }
func (this *licenseMgr) ClearLicense() { if !utils.SysParaMgr().ExistPara(LICENSE_PARA_NAME) { return } emptyLicense := &FastLicenseInfo{} emptyLicense.Reset() byteEmptyLicense, err := json.MarshalIndent(emptyLicense, "", " ") utils.VerifyErr(err) emptyLicenseStr := utils.EnCodeBase64(string(byteEmptyLicense)) emptyLicenseStr = utils.EnCodeBase64(emptyLicenseStr) emptyLicenseStr = utils.EnCodeBase64(emptyLicenseStr) utils.SysParaMgr().ChangePara(LICENSE_PARA_NAME, emptyLicenseStr) return }
func (this *licenseMgr) init() { this.licenseData = &FastLicenseInfo{} this.licenseData.Reset() if !utils.SysParaMgr().ExistPara(LICENSE_PARA_NAME) { return } existLicense := utils.SysParaMgr().GetPara(LICENSE_PARA_NAME) existLicense = strings.TrimSpace(existLicense) if existLicense == comm.NULL_STR { return } existLicense = utils.DeCodeBase64(existLicense) existLicense = utils.DeCodeBase64(existLicense) existLicense = utils.DeCodeBase64(existLicense) json.Unmarshal([]byte(existLicense), this.licenseData) }
func (this *licenseMgr) ImportLicense(newLicense string) bool { newLicenseData := strings.TrimSpace(newLicense) newLicenseData = utils.DeCodeBase64(newLicenseData) newLicenseData = utils.DeCodeBase64(newLicenseData) newLicenseData = utils.DeCodeBase64(newLicenseData) newLicenseObj := &FastLicenseInfo{} err := json.Unmarshal([]byte(newLicenseData), newLicenseObj) if err != nil { return false } this.licenseData = newLicenseObj utils.SysParaMgr().ChangePara(LICENSE_PARA_NAME, newLicense) return true }