java - postman 输出 没内容
大家讲道理
大家讲道理 2017-04-17 17:22:19
[Java讨论组]

输入:
{
"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有值

    热门教程
    更多>
    最新下载
    更多>
    网站特效
    网站源码
    网站素材
    前端模板
    关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
    php中文网:公益在线php培训,帮助PHP学习者快速成长!
    关注服务号 技术交流群
    PHP中文网订阅号
    每天精选资源文章推送
    PHP中文网APP
    随时随地碎片化学习

    Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号