修改数据返回结构

This commit is contained in:
fengjunfeng
2022-01-27 16:06:20 +08:00
parent 5bf71b65b3
commit 6f5b42cc73

View File

@@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil;
import cn.hutool.log.Log;
import com.license.bean.LicenseInfo;
import com.license.bean.Rets;
import com.license.cache.CacheManager;
import com.license.utils.Constant;
import com.license.utils.GetIpProtUtil;
@@ -42,23 +43,23 @@ public class LicenseController {
@PostMapping("/licenseOperation")
public Object licenseOperation(@RequestBody LicenseInfo licenseInfo) {
if (!verify(licenseInfo.getServerId())){
return null;
return Rets.failure("");
}
if (licenseInfo.getType().equals(Constant.LICENSE_C2V)){
//获取C2V信息
return HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
return Rets.success(HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId()));
}else if (licenseInfo.getType().equals(Constant.LICENSE_UPDATE)){
//上传license信息
return HaspUtil.updateKeyWithLicense(licenseInfo.getV2C());
return Rets.success(HaspUtil.updateKeyWithLicense(licenseInfo.getV2C()));
}else if (licenseInfo.getType().equals(Constant.LICENSE_QUERY)){
//获取license信息
return HaspUtil.getLicenseInfo(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
return Rets.success(HaspUtil.getLicenseInfo(licenseInfo.getVendorCode(),licenseInfo.getFeatureId()));
}else if (licenseInfo.getType().equals(Constant.LICENSE_VERIFY)){
//验证license信息
return HaspUtil.verify(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
return Rets.success(HaspUtil.verify(licenseInfo.getVendorCode(),licenseInfo.getFeatureId()));
}else {
log.info("type error");
return null;
return Rets.failure("");
}
}