admin 管理员组

文章数量: 1087139


2024年1月11日发(作者:js脚本代码生成器)

jsp发送ajax要求:

/** * 修改或者新增热门搜索 * @param hotSearch * @param request * @return */ @RequestMapping(value = "/servehotselectiveajax") @ResponseBody public int servehotselectiveajax(HttpServletRequest req,HttpServletResponse resp,@RequestBody JSONObject obj) { int count=0; int countAddHotSearch=0; int countEditHotSearch=0; ("data:"+String()); String data=String(); //解析json数据 JSONObject json = bject(data); String createArr=ing("createArr"); String modifyArr=ing("modifyArr");

if(mpty(createArr)){ JSONArray createArray=rray(createArr); for(int i=0;i<();i++){ Long tempId=bject(String((i))).getLong("tempId"); String keyword=bject(String((i))).getString("keyword"); Integer sort=bject(String((i))).getInteger("sort"); //创建热门搜索对象 HotSearch hotSearch=new HotSearch(); pid(tempId); word(keyword); t(sort); ateDate(new Date()); Flag("0"); //添加热门搜索信息 countAddHotSearch = SearchSelective(hotSearch);

} }

if(mpty(modifyArr)){ JSONArray modifyArray=rray(modifyArr); for(int i=0;i<();i++){ Long hotSearchId=bject(String((i))).getLong("id"); Long tempId=bject(String((i))).getLong("tempId"); String keyword=bject(String((i))).getString("keyword"); Integer sort=bject(String((i))).getInteger("sort"); //创建热门搜索对象 HotSearch hotSearch=new HotSearch(); SearchId(hotSearchId); pid(tempId); word(keyword); t(sort); //修改热门搜索信息 countEditHotSearch = HostSearchSelectiveById(hotSearch);

} } //判断修改或者新增成功 if(countAddHotSearch>0 || countEditHotSearch>0){ count=1; } return count; } //data:{"createArr":[{"hotSearchId":"","keyword":"ss","sort":"5","tempid":"21"}],"modifyArr":[{"hotSearchId":"205","keyword":"华为","sort":"2","tempid":"21"},{"hotSe


本文标签: 热门 搜索 修改 脚本 要求