java - postman 输出 没内容

 Peter-周周周成德 发布于 2022-10-30 11:18

输入:
{
"head": {

"deviceId":"deviceId",
"os":1,
"token":"",

},

"body":{

  "rows": "10",
  "page":"10",
  "type":"1",
}

}
输出
{

"obj": {
    "code": 200,
    "msg": "success"
},
"attributes": {
    "coupons": []
},
"msg": "操作成功",
"success": true

}
后台接口程序
public Map getMyRolls(JSONObject head,JSONObject body) throws Exception {

         
     // 业务信息
     Map attributes=new HashMap();
     
     //cityCode 
 //    String cityCode=head.optString("cityCode");
 //    cityCode=GetCItyCode.getCityCode(cityCode);
     
     String page=body.optString("page");
     String rows=body.optString("rows");
     int type=body.optInt("type");
     
     String token=head.optString("token");
    Object object=UserCacheManage.getAppUser(token);
        
    if(true){        
        UserCache user=(UserCache)object;
        String userId="4028668150c2acb40150c2c69a03000d";
        HhUserEntity hhUserEntity=super.getEntity(HhUserEntity.class, userId);
        if(hhUserEntity!=null){
            
            String nowTime=DateUtils.formatTime();

//%h:%i:%s

            String queryString=" SELECT c.couponname,c.couponfee,"
    • "c.pic1_path,c.pic2_path,date_format(c.endtime,'%Y-%c-%d') as endTime "

    • "FROM couponpool s,couponpublish c "

    • " WHERE s.pubid = c.pubid AND s.owner='"+userId+"'";

                
                String whereString="";
                //优惠卷类别  1.可用;2.历史
                if(type==1){
                    whereString=whereString+" and ( '"+nowTime+"' between c.starttime and c.endtime ) and  s.status=3 ";
                }else{
                    whereString=whereString+" and (( '"+nowTime+"' > c.endtime ) or s.status=7  )";
                }
      
               String orderString=" order by c.updatetime ";
            
    1. offset=PagerUtil.getOffset(Integer.valueOf(page),Integer.valueOf(rows));

                List list=super.findListbySqlReturnMapByPage(queryString+whereString+orderString, offset, Integer.valueOf(rows));
                        
               attributes.put("coupons", list);
               
           }else{
    2. new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));

           }
           
       }else{
    1. new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));

        }
        
    1. attributes;

      }

      输出怎么没有list查的数据??

    1 个回答
    • debug后台打印输出list,首先确保list有值

      2022-11-12 01:49 回答
    撰写答案
    今天,你开发时遇到什么问题呢?
    立即提问
    热门标签
    PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有