微信小程序的茶叶线上购买电商系统源码下载
Posted weixin_40228600
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了微信小程序的茶叶线上购买电商系统源码下载相关的知识,希望对你有一定的参考价值。
本项目采用eclipse工具开发,ssh框架,mysql数据库,微信小程序开发者工具,设计到的功能有:商品分类管理、商品管理、订单管理、留言管理、会员管理等功能。
查看所有用户注册列表:
public void getList(){
String username = request.getParameter("susername");
String sort = request.getParameter("sort");
String order = request.getParameter("order");
Page page = new Page();
Map paramsMap = new HashMap();
paramsMap.put("username", username);
paramsMap.put("sort", "order by "+sort+" "+order);
String pageNo = (String) this.request.getParameter("page");
String pageSizes = (String) this.request.getParameter("rows");
if (pageNo == null) {
page.setPageSize(10);
page.setPageNo(1);
} else {
page.setPageSize(Integer.parseInt(pageSizes));
page.setPageNo(Integer.parseInt(pageNo));
}
page = userService.findByPage(page, paramsMap);
Gson json = new Gson();
Map<String, Object> map = new HashMap<String, Object>();
map.put("total", page.getTotal());
map.put("rows", page.getList());
render(json.toJson(map));
}
微信登陆后端接口:
public void login(){
String username = request.getParameter("username");
String passwd = request.getParameter("passwd");
User user = new User();
user.setPasswd(passwd);
user.setUsername(encodeGet(username));
User r = userService.find(user);
if(r!=null){
session.put("user", r);
renderJsonpObj(r);
}else{
renderJsonpString("fail");
}
}
商品图片上传功能实现:
public String upload(){
System.out.println("开始上传.......");
String uuid = UUID.randomUUID().toString();
uuid = uuid.substring(0, 32);
String fileName = uuid+".gif";
FileOutputStream fos=null;
FileInputStream fis=null;
//int size = 0;
String uploadPath = ServletActionContext.getServletContext().getRealPath("upload");
String path=uploadPath+ File.separator+fileName;
//String type =uploadFileName.substring(uploadFileName.lastIndexOf(".")+1);
File file = new File(uploadPath);
if (!file.exists()){
file.mkdirs();
}
try {
fos=new FileOutputStream(path);
fis=new FileInputStream(img);
//size = fis.available();
byte[] buf=new byte[10240];
int len=-1;
while((len=fis.read(buf))!=-1){
fos.write(buf, 0, len);
}
fos.flush();
//PrintWriter out = ServletActionContext.getResponse().getWriter();
return fileName;
} catch (Exception e) {
e.printStackTrace();
return null;
}finally{
if(fis!=null){
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(fos!=null){
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
部分截图如下:
微信小程序+java后端开发完整代码:请点击下载》》》
以上是关于微信小程序的茶叶线上购买电商系统源码下载的主要内容,如果未能解决你的问题,请参考以下文章