输入:
{
"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<String, Object> getMyRolls(JSONObject head,JSONObject body) throws Exception {
// 业务信息
Map<String, Object> attributes=new HashMap<String, Object>();
//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 ";
-
offset=PagerUtil.getOffset(Integer.valueOf(page),Integer.valueOf(rows));
List<Map> list=super.findListbySqlReturnMapByPage(queryString+whereString+orderString, offset, Integer.valueOf(rows)); attributes.put("coupons", list); }else{
-
new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));
} }else{
-
new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));
}
-
attributes;
}
输出怎么没有list查的数据??
debug后台打印输出list,首先确保list有值