当前位置: 首页 > news >正文

做网站用地图天津做网站的公司

做网站用地图,天津做网站的公司,类似美团网的网站是怎么做的,邢台做网站推广费用目的:给返回对象补充一些信息,告诉前端这个请求在业务层面上是成功还是失败,以及具体的描述信息。 我们需要自定义错误码(因为前端的HTTP状态码默认的值比较少)和正常错误返回类。 ErrorCode : package …

目的:给返回对象补充一些信息,告诉前端这个请求在业务层面上是成功还是失败,以及具体的描述信息。

我们需要自定义错误码(因为前端的HTTP状态码默认的值比较少)和正常错误返回类。

ErrorCode :

package com.heo.ezyuserbackend.common;public enum ErrorCode {SUCCESS(0, "ok", ""),PARAMS_ERROR(40000, "请求参数错误", ""),NULL_ERROR(40001, "请求参数为空", ""),NOT_LOGIN(40100, "未登录", ""),NO_AUTH(40101, "无权限", ""),SYSTEM_ERROR(50000,"系统内部异常","");private final int code;/*** 状态码信息*/private  final String message;public int getCode() {return code;}public String getMessage() {return message;}public String getDescription() {return description;}/*** 状态码描述(详情)*/private final String description;ErrorCode(int code, String message, String description) {this.code = code;this.message = message;this.description = description;}
}

BaseResponse:

package com.heo.ezyuserbackend.common;import lombok.Data;import java.io.Serializable;/*** 通用返回类** @param <T>*/
@Data
public class BaseResponse<T> implements Serializable {private int code;private T data;private String message;private String description;public BaseResponse(int code, T data, String message, String description) {this.code = code;this.data = data;this.message = message;this.description = description;}public BaseResponse(int code, T data,String message) {this(code, data, message,"");}public BaseResponse(int code, T data) {this(code, data, "", "");}public BaseResponse(ErrorCode errorCode) {this(errorCode.getCode(), null, errorCode.getMessage(), errorCode.getDescription());}
}

ResultUtil :

package com.heo.ezyuserbackend.common;import com.fasterxml.jackson.databind.ser.Serializers;/*** 返回工具类*/
public class ResultUtil {/*** 成功** @param data* @param <T>* @return*/public static <T> BaseResponse<T> success(T data) {return new BaseResponse<>(0, data, "ok");}/*** 失败** @param errorCode* @return*/public static <T> BaseResponse<T> error(ErrorCode errorCode) {return new BaseResponse<>(errorCode);}/*** 失败** @param code* @param message* @param description* @param <T>* @return*/public static <T> BaseResponse<T> error(int code, String message, String description) {return new BaseResponse<>(code, null, message, description);}/*** 失败** @param errorCode* @param message* @param description* @param <T>* @return*/public static <T> BaseResponse<T> error(ErrorCode errorCode, String message, String description) {return new BaseResponse<>(errorCode.getCode(), null, message, description);}/*** 失败** @param errorCode* @param description* @return*/public static BaseResponse error(ErrorCode errorCode, String description) {return new BaseResponse<>(errorCode.getCode(), errorCode.getMessage(), description);}
}
http://www.hkea.cn/news/202770/

相关文章:

  • 校园网站建设需求天津放心站内优化seo
  • 哈尔滨微网站建设热搜在哪里可以看
  • 网站用oracle做数据库福州seo推广服务
  • 康保县城乡建设委员会网站营销型网站重要特点是
  • 手机做网站的步骤跨境电商有哪些平台
  • 请人做网站要多少网络事件营销
  • 网站页脚有什么作用厦门seo哪家强
  • 东莞百度提升优化优化推广网站推荐
  • 查企业网站有哪些站长统计app软件
  • 做a高清视频在线观看网站济源新站seo关键词排名推广
  • 刚做的网站怎么搜索不出来百度seo收录软件
  • 视频拍摄app站长工具seo综合查询广告
  • 新闻单位建设网站的意义武汉seo推广优化
  • 低价网站公司软文怎么写
  • 东莞市建设公共交易中心网站百度官网首页
  • 如何建立的网站能争钱优化营商环境 助推高质量发展
  • 做百度网站营销型网站建设排名
  • 网站域名被黑国际新闻最新消息战争
  • 苏州网站开发公司济南兴田德润厉害吗网络自动推广软件
  • 广药网站建设试卷株洲最新今日头条
  • 网站建设管理考核办法微信推广平台怎么做
  • 网站新闻模块代码网络推广有哪些常见的推广方法
  • 合肥大型网站如何推广普通话
  • 高端网站制作软件怎么样推广自己的店铺和产品
  • 无障碍浏览网站怎么做关键词seo排名优化推荐
  • wordpress 247seo推广系统
  • 做深圳门户网站起什么名字好泰州seo外包公司
  • 网站视频上传怎么做百度站长平台论坛
  • wordpress农业模板下载小时seo
  • 做网站语言排名2018发帖推广哪个平台好