Example #1
0
func (this *licenseMgr) chenckValid(newLicense string) bool {
	checkLicData := strings.TrimSpace(newLicense)

	checkLicData = utils.DeCodeBase64(checkLicData)
	checkLicData = utils.DeCodeBase64(checkLicData)
	checkLicData = utils.DeCodeBase64(checkLicData)

	checkLic := &FastLicenseInfo{}
	err := json.Unmarshal([]byte(checkLicData), checkLic)

	if err != nil {
		return false
	}

	if this.GetLicenseId() != checkLic.LicenseId {
		return false
	}
	if this.GetLicenseType() != checkLic.LicenseType {
		return false
	}
	if this.GetCustomerId() != checkLic.CustomerId {
		return false
	}
	if this.GetCustomerName() != checkLic.CustomerName {
		return false
	}

	return true
}
Example #2
0
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
}
Example #3
0
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)

}