1.定义返回码枚举 1 public interface ResultCode { 2 public static Integer SUCCESS = 20000; 3 public static Integer ERROR = 20001; 4 } 2. 创建结果类 1 @Data 2 publi ...
分类:
其他好文 时间:
2021-07-27 17:30:58
阅读次数:
0
最近碰到一个奇怪问题,调用第三方接口时,返回{resultCode=INVALID_PARAMETER, resultMsg=too long time span between now and req_time}, 参数异常,请求时间离现在时间太久. 于是把参数打印出来,一切正常,参数也就一个流程 ...
分类:
其他好文 时间:
2021-04-30 12:08:57
阅读次数:
0
一、隐士intent,紧接着上一次复习 得到第二个活动返回的数据之后,我们需要重写onActivityResult()来获取数据 protected void onActivityResult(int requestCode,int resultCode,Intent data){ switch(r ...
分类:
移动开发 时间:
2020-07-24 09:22:13
阅读次数:
88
例如如下格式json: { "resultcode": "200", "reason": "查询成功", "result": { "area": "河南省郑州市", "location": "电信" }, "error_code": 0 } 第一步:复制上面的json内容 第二部:看图!直接就会在你 ...
分类:
Web程序 时间:
2020-03-28 11:53:16
阅读次数:
107
新增页面 新增页面接口定义 1、定义响应模型 @Data public class CmsPageResult extends ResponseResult { CmsPage cmsPage; public CmsPageResult(ResultCode resultCode,CmsPage c ...
分类:
其他好文 时间:
2020-01-16 18:41:01
阅读次数:
440
异常分为以下三种 自定义异常 可预知异常 不可预知异常 下面具体说明如何分类处理,从而保证无论触发什么异常均可返回理想的自定义数据格式 ResultCode ResponseResult 自定义异常类 CommonCode (自定义异常信息返回数据枚举类) 异常处理(包含自定义异常和不可预见异常和可 ...
分类:
编程语言 时间:
2019-12-20 13:46:51
阅读次数:
96
PublicUtil:对空值的判断 TreeNode:节点的属性 TreeUtil:获得父节点、子节点信息 ResultCodeEnum:异常枚举类 ResultCode:全局统一返回结果,用于controller上 BusinessException:全局异常处理类 BaseService接口:通 ...
分类:
其他好文 时间:
2019-12-09 23:04:11
阅读次数:
148
在项目下新建 包,包中包含两个文件 数据类, 接口文件 Result.class ResultCode 枚举中错误码、包括其他字段的命名,可以根据自己需求更改,这里面只是举例。 另外推荐一个IDEA的插件, ,在 中搜索 也可以。是阿里巴巴出的一个代码规范化的提示插件。 ...
分类:
编程语言 时间:
2019-11-30 21:31:15
阅读次数:
129
ServerResponse响应类: import com.cxsz.ibosspro.common.constant.ResultCode; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jacks... ...
分类:
其他好文 时间:
2018-12-11 21:41:31
阅读次数:
237
# 1、requests里面自带解析器转字典 print(r.json()) print(type(r.json())) # 取出json中的'result_sk_temp'字段 # {"resultcode":"200","reason":"查询成功","result":{"sk":{"temp"... ...
分类:
编程语言 时间:
2018-06-09 16:43:43
阅读次数:
385