Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

校园二手书

微信小程序 + 云开发 二手书交易平台,支持发布、搜索、购物车、下单等功能。

技术栈

  • 微信小程序原生框架
  • 微信云开发(云函数 + 云数据库 + 云存储)

功能

功能 说明
首书 分类筛选、关键字搜索、排序(时间/价格/热度)、下拉刷新、加载更多
图书详情 图片轮播、卖家信息、加入购物车、立即购买
购物车 勾选多本、删除、全选、批量结算
发布图书 填写书名/作者/ISBN/分类/成色/价格/描述,上传最多6张图片
我的订单 买家/卖家视角切换,取消订单、确认完成
我发布的 在售/已售切换,下架图书
个人中心 一键登录、头像昵称修改

安全特性

  • 价格从数据库读取,防客户端篡改
  • 购物车/订单操作鉴权校验
  • 正则特殊字符转义,防 ReDoS
  • 输入长度限制与格式校验
  • 云函数 try-catch 错误处理

项目结构

├── cloudfunctions/          # 云函数
│   ├── cartOperation/       # 购物车操作
│   ├── createOrder/         # 创建订单
│   ├── getBookDetail/       # 图书详情
│   ├── getBooks/            # 图书列表
│   ├── getMyBooks/          # 我发布的图书
│   ├── getOrders/           # 订单列表
│   ├── getUserInfo/         # 用户信息
│   ├── logout/              # 退出登录
│   ├── publishBook/         # 发布图书
│   ├── removeBook/          # 下架图书
│   ├── updateOrderStatus/   # 更新订单状态
│   └── updateUserInfo/      # 更新用户信息
└── miniprogram/             # 小程序前端
    ├── pages/
    │   ├── index/           # 首页(书架)
    │   ├── book/detail/     # 图书详情
    │   ├── cart/            # 购物车
    │   ├── mine/            # 个人中心、已发布图书
    │   ├── order/           # 订单列表、订单确认
    │   └── publish/         # 发布图书
    ├── app.js
    ├── app.json
    └── app.wxss

部署

  1. 在微信开发者工具中导入项目
  2. 配置 project.config.json 中的 appid
  3. 开通云开发环境
  4. 上传并部署全部云函数
  5. 在云数据库中创建集合:books、cart、orders、users

数据库集合

集合 说明
books 图书信息(title, author, isbn, price, category, condition, description, images, publisherId, publisherType, status, viewCount, createTime)
cart 购物车(userId, bookId, title, image, price, createTime)
orders 订单(bookId, bookTitle, bookImage, buyerId, sellerId, price, contactInfo, remark, status, createTime)
users 用户(openid, nickName, avatarUrl, isOwner)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages