├── pre ├── pages │ ├── index │ │ ├── index.json │ │ ├── index.wxss │ │ ├── index.wxml │ │ └── index.js │ ├── list │ │ ├── list.json │ │ ├── list.wxml │ │ ├── list.wxss │ │ └── list.js │ ├── mine │ │ ├── mine.json │ │ ├── mine.wxss │ │ ├── mine.wxml │ │ └── mine.js │ ├── coupon │ │ ├── coupon.json │ │ ├── coupon.wxml │ │ ├── coupon.wxss │ │ └── coupon.js │ ├── order │ │ ├── list │ │ │ ├── list.json │ │ │ ├── list.wxss │ │ │ ├── list.js │ │ │ └── list.wxml │ │ ├── balance │ │ │ ├── balance.json │ │ │ ├── balance.wxml │ │ │ ├── balance.js │ │ │ └── balance.wxss │ │ └── detail │ │ │ ├── detail.json │ │ │ ├── detail.js │ │ │ ├── detail.wxss │ │ │ └── detail.wxml │ ├── usercard │ │ ├── usercard.json │ │ ├── usercard.wxml │ │ ├── usercard.wxss │ │ └── usercard.js │ └── reserve │ │ ├── reserve.json │ │ ├── reserve.wxml │ │ ├── reserve.wxss │ │ └── reserve.js ├── README.md ├── images │ ├── close.png │ ├── lb_01.gif │ ├── lb_02.gif │ ├── lb_03.gif │ ├── my_a.png │ ├── my_b.png │ ├── smdc.gif │ ├── cart_a.png │ ├── cart_b.png │ ├── home_a.png │ ├── home_b.png │ ├── rou_01.gif │ ├── rou_02.gif │ ├── yhq_10.png │ ├── yhq_20.png │ ├── yhq_50.png │ ├── icon-card.png │ ├── icon-err.png │ ├── icon-yhq.png │ ├── touxiang.png │ ├── usercard.png │ └── icon-success.png ├── utils │ └── util.js ├── LICENSE ├── app.json ├── app.js ├── project.config.json └── app.wxss ├── app截图 ├── 01.png ├── 02.png ├── 03.png ├── 04.png ├── 05.png ├── 06.png ├── 07.png ├── 08.png ├── 09.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 16.png └── 17.png ├── 餐厅数据库.xmind ├── ResSpringBoot └── restaurant │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── html │ │ │ │ ├── index.html │ │ │ │ └── Demo_socket.html │ │ │ ├── mapper │ │ │ │ ├── DishTypeMapper.xml │ │ │ │ ├── ResTableMapper.xml │ │ │ │ ├── CouponMapper.xml │ │ │ │ ├── BalanceMapper.xml │ │ │ │ ├── MyCouponMapper.xml │ │ │ │ ├── ShopCartMapper.xml │ │ │ │ ├── ReserveMapper.xml │ │ │ │ ├── DishMapper.xml │ │ │ │ ├── CouponDTOMapper.xml │ │ │ │ └── DishDTOMapper.xml │ │ │ └── generator │ │ │ │ └── generatorConfig.xml │ │ └── java │ │ │ └── com │ │ │ └── wx │ │ │ └── restaurant │ │ │ ├── mybatis │ │ │ ├── mapper │ │ │ │ ├── DishMapper.java │ │ │ │ ├── CouponMapper.java │ │ │ │ ├── DishTypeMapper.java │ │ │ │ ├── MyCouponMapper.java │ │ │ │ ├── ResTableMapper.java │ │ │ │ ├── DishDTOMapper.java │ │ │ │ ├── CouponDTOMapper.java │ │ │ │ ├── ReserveMapper.java │ │ │ │ ├── BalanceMapper.java │ │ │ │ └── ShopCartMapper.java │ │ │ └── model │ │ │ │ ├── DishDTO.java │ │ │ │ ├── ResTable.java │ │ │ │ ├── DishType.java │ │ │ │ ├── Coupon.java │ │ │ │ ├── CouponDTO.java │ │ │ │ ├── Balance.java │ │ │ │ ├── MyCoupon.java │ │ │ │ ├── ShopCart.java │ │ │ │ ├── Reserve.java │ │ │ │ └── Dish.java │ │ │ ├── util │ │ │ ├── MyMapper.java │ │ │ ├── RandomCode.java │ │ │ ├── NowDate.java │ │ │ └── HttpRequest.java │ │ │ ├── ServletInitializer.java │ │ │ ├── enums │ │ │ ├── IntegerVarEnum.java │ │ │ ├── DeleteEnum.java │ │ │ ├── StatusEnum.java │ │ │ ├── BalanceStatusEnum.java │ │ │ └── ReserveStatusEnum.java │ │ │ ├── service │ │ │ ├── DishService.java │ │ │ ├── CouponService.java │ │ │ ├── ResTableService.java │ │ │ ├── UserService.java │ │ │ ├── BalanceService.java │ │ │ └── ReserveService.java │ │ │ ├── RestaurantApplication.java │ │ │ └── controller │ │ │ ├── DishController.java │ │ │ ├── UserController.java │ │ │ ├── ReserveController.java │ │ │ ├── TestController.java │ │ │ ├── IndexController.java │ │ │ ├── LoginController.java │ │ │ └── OrderController.java │ └── test │ │ └── java │ │ └── com │ │ └── wx │ │ └── restaurant │ │ └── RestaurantApplicationTests.java │ ├── .gitignore │ ├── mvnw.cmd │ ├── mvnw │ └── pom.xml ├── README.md └── resdb.sql /pre/pages/index/index.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pre/pages/list/list.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pre/pages/mine/mine.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pre/pages/coupon/coupon.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pre/pages/order/list/list.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pre/README.md: -------------------------------------------------------------------------------- 1 | # wxdc 2 | 点餐系统的微信小程序 -------------------------------------------------------------------------------- /pre/pages/order/balance/balance.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pre/pages/order/detail/detail.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pre/pages/usercard/usercard.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /app截图/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/01.png -------------------------------------------------------------------------------- /app截图/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/02.png -------------------------------------------------------------------------------- /app截图/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/03.png -------------------------------------------------------------------------------- /app截图/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/04.png -------------------------------------------------------------------------------- /app截图/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/05.png -------------------------------------------------------------------------------- /app截图/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/06.png -------------------------------------------------------------------------------- /app截图/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/07.png -------------------------------------------------------------------------------- /app截图/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/08.png -------------------------------------------------------------------------------- /app截图/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/09.png -------------------------------------------------------------------------------- /app截图/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/10.png -------------------------------------------------------------------------------- /app截图/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/11.png -------------------------------------------------------------------------------- /app截图/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/12.png -------------------------------------------------------------------------------- /app截图/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/13.png -------------------------------------------------------------------------------- /app截图/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/14.png -------------------------------------------------------------------------------- /app截图/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/15.png -------------------------------------------------------------------------------- /app截图/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/16.png -------------------------------------------------------------------------------- /app截图/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/app截图/17.png -------------------------------------------------------------------------------- /餐厅数据库.xmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/餐厅数据库.xmind -------------------------------------------------------------------------------- /pre/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/close.png -------------------------------------------------------------------------------- /pre/images/lb_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/lb_01.gif -------------------------------------------------------------------------------- /pre/images/lb_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/lb_02.gif -------------------------------------------------------------------------------- /pre/images/lb_03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/lb_03.gif -------------------------------------------------------------------------------- /pre/images/my_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/my_a.png -------------------------------------------------------------------------------- /pre/images/my_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/my_b.png -------------------------------------------------------------------------------- /pre/images/smdc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/smdc.gif -------------------------------------------------------------------------------- /pre/images/cart_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/cart_a.png -------------------------------------------------------------------------------- /pre/images/cart_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/cart_b.png -------------------------------------------------------------------------------- /pre/images/home_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/home_a.png -------------------------------------------------------------------------------- /pre/images/home_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/home_b.png -------------------------------------------------------------------------------- /pre/images/rou_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/rou_01.gif -------------------------------------------------------------------------------- /pre/images/rou_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/rou_02.gif -------------------------------------------------------------------------------- /pre/images/yhq_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/yhq_10.png -------------------------------------------------------------------------------- /pre/images/yhq_20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/yhq_20.png -------------------------------------------------------------------------------- /pre/images/yhq_50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/yhq_50.png -------------------------------------------------------------------------------- /pre/images/icon-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/icon-card.png -------------------------------------------------------------------------------- /pre/images/icon-err.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/icon-err.png -------------------------------------------------------------------------------- /pre/images/icon-yhq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/icon-yhq.png -------------------------------------------------------------------------------- /pre/images/touxiang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/touxiang.png -------------------------------------------------------------------------------- /pre/images/usercard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/usercard.png -------------------------------------------------------------------------------- /pre/pages/reserve/reserve.json: -------------------------------------------------------------------------------- 1 | { 2 | "window":{ 3 | "enablePullDownRefresh":true 4 | } 5 | } -------------------------------------------------------------------------------- /pre/images/icon-success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/pre/images/icon-success.png -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/ResSpringBoot/restaurant/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiam/wxapp-wxdc/HEAD/ResSpringBoot/restaurant/src/main/resources/application.properties -------------------------------------------------------------------------------- /pre/pages/usercard/usercard.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NO:{{userNo}} 4 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | hello 9 | 10 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/DishMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.Dish; 4 | import com.wx.restaurant.util.MyMapper; 5 | 6 | public interface DishMapper extends MyMapper { 7 | } -------------------------------------------------------------------------------- /pre/pages/usercard/usercard.wxss: -------------------------------------------------------------------------------- 1 | .user-card { 2 | width: 95%; 3 | margin: 10px auto auto 2.5%; 4 | border-radius: 10px; 5 | height: 200px; 6 | } 7 | 8 | .card-no{ 9 | position: fixed; 10 | top: 175px; 11 | left: 7%; 12 | color: #757575; 13 | font-size: 12px; 14 | } 15 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/CouponMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.Coupon; 4 | import com.wx.restaurant.util.MyMapper; 5 | 6 | public interface CouponMapper extends MyMapper { 7 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/DishTypeMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.DishType; 4 | import com.wx.restaurant.util.MyMapper; 5 | 6 | public interface DishTypeMapper extends MyMapper { 7 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/MyCouponMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.MyCoupon; 4 | import com.wx.restaurant.util.MyMapper; 5 | 6 | public interface MyCouponMapper extends MyMapper { 7 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/ResTableMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.ResTable; 4 | import com.wx.restaurant.util.MyMapper; 5 | 6 | public interface ResTableMapper extends MyMapper { 7 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wxapp-wxdc 2 | 微信点餐小程,含后台(SpringBoot),是一个完整的微信小程序项目。 3 | 4 | ### 前言 5 | 6 | pre目录即为微信前端项目目录,ResSpringBoot目录即为后台服务目录 7 | 8 | ### 如何开始? 9 | 10 | - 先将项目clone下来 11 | - 使用微信开发者工具打开pre文件夹 12 | - 使用后台编辑器IDEA打开ResSpringBoot文件夹(会自动读取目录,相关配置问题在这里忽略了,请自行查阅相关文档),启动后台服务 13 | - 将`resdb.sql`文件导入到数据库中,这里用的是mysql(这里不再一一阐述如何) 14 | - 具体效果详见`app截图`目录。 15 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/DishDTOMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.DishDTO; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @param 9 | * @author Joe.Cai 10 | * @date 2018/8/12 10:46 11 | */ 12 | public interface DishDTOMapper { 13 | List dishList(); 14 | } 15 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/util/MyMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.util; 2 | 3 | import tk.mybatis.mapper.common.Mapper; 4 | import tk.mybatis.mapper.common.MySqlMapper; 5 | 6 | /** 7 | * @param 8 | * @author Joe.Cai 9 | * @date 2018/6/27 9:05 10 | */ 11 | public interface MyMapper extends Mapper, MySqlMapper { 12 | //TODO:继承自己Mapper 该接口不能被扫描 13 | } 14 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /pre/pages/reserve/reserve.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A{{diningId}} 10 | 您前面还有 11 | {{preNo}}位正在等待就餐 12 | 13 | 14 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/CouponDTOMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.CouponDTO; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @param 10 | * @author Joe.Cai 11 | * @date 2018/8/13 8:55 12 | */ 13 | public interface CouponDTOMapper { 14 | List myCouponList(@Param("openId") String openId); 15 | } 16 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/test/java/com/wx/restaurant/RestaurantApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class RestaurantApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/ServletInitializer.java: -------------------------------------------------------------------------------- 1 | /*package com.wx.restaurant; 2 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 5 | 6 | public class ServletInitializer extends SpringBootServletInitializer { 7 | 8 | @Override 9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 10 | return application.sources(RestaurantApplication.class); 11 | } 12 | 13 | }*/ 14 | -------------------------------------------------------------------------------- /pre/utils/util.js: -------------------------------------------------------------------------------- 1 | const formatTime = date => { 2 | const year = date.getFullYear() 3 | const month = date.getMonth() + 1 4 | const day = date.getDate() 5 | const hour = date.getHours() 6 | const minute = date.getMinutes() 7 | const second = date.getSeconds() 8 | 9 | return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':') 10 | } 11 | 12 | const formatNumber = n => { 13 | n = n.toString() 14 | return n[1] ? n : '0' + n 15 | } 16 | 17 | module.exports = { 18 | formatTime: formatTime 19 | } 20 | -------------------------------------------------------------------------------- /pre/pages/coupon/coupon.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ¥{{item.coupon.je}} 5 | 6 | 本店通用优惠券 7 | · {{item.coupon.mztj}} 8 | · {{item.createTime}}至{{item.endTime}} 9 | 10 | 立即使用 11 | 12 | 13 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/enums/IntegerVarEnum.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.enums; 2 | 3 | /** 4 | * @param 5 | * @author 6 | * @date 2018/8/15 10:03 7 | * 基本常量 8 | */ 9 | public enum IntegerVarEnum { 10 | 11 | MAX_RESERVE(2), 12 | INVALID_SEVENTH(7); 13 | private Integer value; 14 | 15 | IntegerVarEnum(Integer value) { 16 | this.value = value; 17 | } 18 | 19 | public Integer getValue() { 20 | return value; 21 | } 22 | 23 | public void setValue(Integer value) { 24 | this.value = value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/ReserveMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.Reserve; 4 | import com.wx.restaurant.util.MyMapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | public interface ReserveMapper extends MyMapper { 11 | @Select("SELECT * from reserve where open_id =#{openId} and reserve_status BETWEEN 1 and 2 ORDER BY create_time desc") 12 | List myReserveList(@Param("openId") String openId); 13 | 14 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/BalanceMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.Balance; 4 | import com.wx.restaurant.util.MyMapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | public interface BalanceMapper extends MyMapper { 11 | @Select("select * from balance where open_id =#{openId} and balance_status between 0 and 1 and is_delete = 1 order by update_time desc") 12 | ListbalanceList(@Param("openId") String openId); 13 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/mapper/ShopCartMapper.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.mapper; 2 | 3 | import com.wx.restaurant.mybatis.model.ShopCart; 4 | import com.wx.restaurant.util.MyMapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | public interface ShopCartMapper extends MyMapper { 9 | @Update("UPDATE `shop_cart` LEFT JOIN dish on shop_cart.dish_id=dish.dish_id SET dish.sales_volume= shop_cart.count+dish.sales_volume WHERE shop_cart.balance_id = #{balanceId}") 10 | void salesVolumeAdd(@Param("balanceId") Integer balanceId); 11 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/service/DishService.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.service; 2 | 3 | /** 4 | * @param 5 | * @author 6 | * @date 2018/8/12 10:54 7 | */ 8 | import com.wx.restaurant.mybatis.mapper.DishDTOMapper; 9 | import com.wx.restaurant.mybatis.model.DishDTO; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class DishService { 17 | @Autowired 18 | DishDTOMapper dishDTOMapper; 19 | 20 | public List dishList(){ 21 | return dishDTOMapper.dishList(); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/service/CouponService.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.service; 2 | 3 | import com.wx.restaurant.mybatis.mapper.CouponMapper; 4 | import com.wx.restaurant.mybatis.model.Coupon; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import tk.mybatis.mapper.entity.Example; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @param 13 | * @author 14 | * @date 2018/8/11 21:53 15 | */ 16 | @Service 17 | public class CouponService { 18 | @Autowired 19 | CouponMapper couponMapper; 20 | 21 | public List couponList(){ 22 | return couponMapper.selectAll(); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pre/pages/reserve/reserve.wxss: -------------------------------------------------------------------------------- 1 | .card { 2 | width: 80%; 3 | height: 100px; 4 | margin: 200px auto auto auto; 5 | border-radius: 3px; 6 | } 7 | 8 | .card-left { 9 | width: 12%; 10 | height: 100px; 11 | float: left; 12 | padding-top: 22px; 13 | text-align: center; 14 | color: #fff; 15 | background-color: #dc143c; 16 | } 17 | 18 | .card-right { 19 | width: 88%; 20 | height: 122px; 21 | float: left; 22 | background-color: rgba(219, 185, 146, 0.288); 23 | } 24 | 25 | .card-right-top { 26 | height: 45px; 27 | color: rgb(221, 146, 33); 28 | font-size: 30px; 29 | padding-top: 20px; 30 | padding-left: 20px; 31 | } 32 | 33 | .card-right-bottom { 34 | width: 100%; 35 | font-size: 12px; 36 | color: #999; 37 | padding-left: 20px; 38 | padding-top: 10px; 39 | } 40 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/enums/DeleteEnum.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.enums; 2 | 3 | /** 4 | * @param 5 | * @author 6 | * @date 2018/8/14 9:10 7 | */ 8 | public enum DeleteEnum { 9 | HIDE(0, "隐藏"), 10 | DISPLAY(1, "显示"); 11 | private Integer index; 12 | private String value; 13 | 14 | DeleteEnum(Integer index, String value) { 15 | this.index = index; 16 | this.value = value; 17 | } 18 | 19 | public Integer getIndex() { 20 | return index; 21 | } 22 | 23 | public void setIndex(Integer index) { 24 | this.index = index; 25 | } 26 | 27 | public String getValue() { 28 | return value; 29 | } 30 | 31 | public void setValue(String value) { 32 | this.value = value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/enums/StatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.enums; 2 | 3 | /** 4 | * @param 5 | * @author 6 | * @date 2018/8/16 9:53 7 | */ 8 | public enum StatusEnum { 9 | SUCCESS(0, "SUCCESS"), 10 | FAIL(-1, "FAIL"); 11 | private Integer index; 12 | private String value; 13 | 14 | StatusEnum(Integer index, String value) { 15 | this.index = index; 16 | this.value = value; 17 | } 18 | 19 | public Integer getIndex() { 20 | return index; 21 | } 22 | 23 | public void setIndex(Integer index) { 24 | this.index = index; 25 | } 26 | 27 | public String getValue() { 28 | return value; 29 | } 30 | 31 | public void setValue(String value) { 32 | this.value = value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/DishTypeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | type_id, dish_type, name 17 | 18 | -------------------------------------------------------------------------------- /pre/pages/mine/mine.wxss: -------------------------------------------------------------------------------- 1 | /* pages/mine/mine.wxss */ 2 | 3 | .top-mode { 4 | background: #dc143c; 5 | height: 400rpx; 6 | display: block; 7 | } 8 | 9 | .userinfo { 10 | display: flex; 11 | flex-direction: column; 12 | align-items: center; 13 | padding-top: 50rpx; 14 | } 15 | 16 | .userinfo-avatar { 17 | width: 128rpx; 18 | height: 128rpx; 19 | margin: 20rpx; 20 | border-radius: 50%; 21 | } 22 | 23 | .userinfo-nickname { 24 | color: #aaa; 25 | } 26 | 27 | .usermotto { 28 | margin-top: 200px; 29 | } 30 | 31 | .card-info { 32 | width: 80%; 33 | height: 180rpx; 34 | box-shadow: 0.5px 0.5px 0.5px 0.5px rgba(255, 156, 53, 10); 35 | z-index: 1000; 36 | background: white; 37 | padding: 10px; 38 | } 39 | 40 | .card-box { 41 | margin-top: -20px; 42 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/service/ResTableService.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.service; 2 | 3 | 4 | import com.wx.restaurant.mybatis.mapper.ResTableMapper; 5 | 6 | import com.wx.restaurant.mybatis.model.ResTable; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import tk.mybatis.mapper.entity.Example; 10 | 11 | /** 12 | * @param 13 | * @author 14 | * @date 2018/8/11 10:49 15 | */ 16 | @Service 17 | public class ResTableService { 18 | 19 | @Autowired 20 | ResTableMapper resTableMapper; 21 | 22 | public ResTable getTable(){ 23 | Example example = new Example(ResTable.class); 24 | example.createCriteria().andEqualTo("tableId",1); 25 | return resTableMapper.selectByExample(example).get(0); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/ResTableMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | table_id, max_seating, table_status 17 | 18 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/enums/BalanceStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.enums; 2 | 3 | /** 4 | * @param 5 | * @author 6 | * @date 2018/8/14 9:17 7 | * 0==已失效1==未付款2==已付款 8 | */ 9 | public enum BalanceStatusEnum { 10 | 11 | INVALID(0, "失效"), 12 | UNPAID(1, "未付款"), 13 | PAID(2, "已付款"); 14 | 15 | private Integer index; 16 | private String value; 17 | 18 | BalanceStatusEnum(Integer index, String value) { 19 | this.index = index; 20 | this.value = value; 21 | } 22 | 23 | public Integer getIndex() { 24 | return index; 25 | } 26 | 27 | public void setIndex(Integer index) { 28 | this.index = index; 29 | } 30 | 31 | public String getValue() { 32 | return value; 33 | } 34 | 35 | public void setValue(String value) { 36 | this.value = value; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/RestaurantApplication.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cache.annotation.EnableCaching; 7 | import org.springframework.scheduling.annotation.EnableScheduling; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.transaction.annotation.EnableTransactionManagement; 10 | 11 | @Controller 12 | @SpringBootApplication 13 | @EnableTransactionManagement 14 | @EnableCaching 15 | @MapperScan(basePackages = "com.wx.restaurant.mybatis.mapper") 16 | @EnableScheduling 17 | public class RestaurantApplication { 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(RestaurantApplication.class, args); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/enums/ReserveStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.enums; 2 | 3 | /** 4 | * @param 5 | * @author 6 | * @date 2018/8/14 9:02 7 | * 0==失效 1==预约 2== 等待 3==无法预约 8 | */ 9 | public enum ReserveStatusEnum { 10 | INVALID(0, "失效"), 11 | RESERVE(1, "预约"), 12 | WAIT(2, "等待"), 13 | UNABLE_RESERVE(3, "无法预约"); 14 | 15 | ReserveStatusEnum(Integer index, String value) { 16 | this.index = index; 17 | this.value = value; 18 | } 19 | 20 | private Integer index; 21 | private String value; 22 | 23 | public String getValue() { 24 | return value; 25 | } 26 | 27 | public void setValue(String value) { 28 | this.value = value; 29 | } 30 | 31 | public Integer getIndex() { 32 | return index; 33 | } 34 | 35 | public void setIndex(Integer index) { 36 | this.index = index; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/CouponMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | yhqid, imgurl, je, mzje, mztj 19 | 20 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/controller/DishController.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.controller; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.wx.restaurant.mybatis.model.DishDTO; 6 | import com.wx.restaurant.service.DishService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @param 15 | * @author 16 | * @date 2018/8/12 11:21 17 | */ 18 | @RestController 19 | public class DishController { 20 | @Autowired 21 | DishService dishService; 22 | 23 | /** 24 | * 获取菜单列表接口 25 | */ 26 | @GetMapping("/dish/list") 27 | public JSONArray dishList() { 28 | System.out.println(">>>>>>>>>>>>>>>>>调用获取菜单列表接口"); 29 | List dishDTOList = dishService.dishList(); 30 | String str = JSONObject.toJSONString(dishDTOList); 31 | return JSONObject.parseArray(str); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pre/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 handsomebird 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/BalanceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | id, is_delete, balance_status, total_price, open_id, create_time, update_time 21 | 22 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/util/RandomCode.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.util; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * @param 7 | * @author Joe.Cai 8 | * @date 2018/7/13 14:16 9 | */ 10 | public class RandomCode { 11 | public static String getRandomCode(){ 12 | StringBuffer flag = new StringBuffer(); 13 | String sources = "0123456789"; // 加上一些字母,就可以生成pc站的验证码了 14 | Random rand = new Random(); 15 | for (int j = 0; j < 3; j++) 16 | { 17 | flag.append(sources.charAt(rand.nextInt(9)) + ""); 18 | } 19 | System.out.println(flag.toString()); 20 | return flag.toString(); 21 | } 22 | public static String getRandomOpenCode(){ 23 | StringBuffer flag = new StringBuffer(); 24 | String sources = "0123456789abcdefghijklmnopqrestuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 加上一些字母,就可以生成pc站的验证码了 25 | Random rand = new Random(); 26 | for (int j = 0; j < 27; j++) 27 | { 28 | flag.append(sources.charAt(rand.nextInt(61)) + ""); 29 | } 30 | System.out.println(flag.toString()); 31 | return flag.toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pre/pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /**index.wxss**/ 2 | .slide-image{ 3 | width:100%; 4 | height:280rpx; 5 | } 6 | .btn_op1{ 7 | text-align: center; 8 | font-size:14px; 9 | color:#DC143C; 10 | padding: 5px 20px; 11 | border:1px solid #DC143C; 12 | border-radius: 25px; 13 | width: 100px; 14 | z-index: 10; 15 | } 16 | .btn_op2{ 17 | text-align: center; 18 | font-size:14px; 19 | color:#B6D9A9; 20 | padding: 5px 20px; 21 | border:1px solid #B6D9A9; 22 | border-radius: 25px; 23 | width: 100px; 24 | } 25 | .btn-bar{ 26 | display: flex; 27 | margin-top:20px; 28 | } 29 | .btn-block{ 30 | width: 50%; 31 | display: flex; 32 | justify-content:center; 33 | } 34 | .ad-box{ 35 | margin-top:30px; 36 | width: 100%; 37 | text-align: center; 38 | } 39 | .image_ad{ 40 | width: 95%; 41 | height:370rpx; 42 | } 43 | .scroll-box{ 44 | display:flex; 45 | white-space: nowrap; 46 | width:95% 47 | } 48 | .bottom-box{ 49 | margin-top:40rpx; 50 | display: flex; 51 | justify-content:center; 52 | } 53 | .bottom-image{ 54 | width:310rpx; 55 | height:150rpx; 56 | } 57 | .slide-inline-box{ 58 | display:inline-block; 59 | margin-right:10px; 60 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/html/Demo_socket.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | websocket client 7 | 8 | 34 | 35 | 36 |

Hello World!

37 |
38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/MyCouponMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | id, open_id, user_name, yhqid, create_time, update_time, end_time, is_delete 22 | 23 | -------------------------------------------------------------------------------- /pre/pages/mine/mine.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/DishDTO.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @param 7 | * @author Joe.Cai 8 | * @date 2018/8/12 10:42 9 | */ 10 | public class DishDTO { 11 | 12 | private Integer typeId; 13 | 14 | /** 15 | * 1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 16 | */ 17 | private Integer dishType; 18 | 19 | /** 20 | * 种类名字 21 | */ 22 | private String name; 23 | /** 24 | * 菜 25 | */ 26 | private List foods; 27 | 28 | public Integer getTypeId() { 29 | return typeId; 30 | } 31 | 32 | public void setTypeId(Integer typeId) { 33 | this.typeId = typeId; 34 | } 35 | 36 | public Integer getDishType() { 37 | return dishType; 38 | } 39 | 40 | public void setDishType(Integer dishType) { 41 | this.dishType = dishType; 42 | } 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setName(String name) { 49 | this.name = name; 50 | } 51 | 52 | public List getFoods() { 53 | return foods; 54 | } 55 | 56 | public void setFoods(List foods) { 57 | this.foods = foods; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/ShopCartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | shop_cart_id, balance_id, dish_id, name, price, detail, count, create_time, update_time 23 | 24 | -------------------------------------------------------------------------------- /pre/pages/coupon/coupon.wxss: -------------------------------------------------------------------------------- 1 | .view-container{ 2 | width: 100%; 3 | height: 100%; 4 | padding-top:5px; 5 | } 6 | 7 | .card-lists{ 8 | width: 100%; 9 | } 10 | 11 | .card{ 12 | width: 90%; 13 | height: 100px; 14 | margin: 10px auto; 15 | border-radius: 3px; 16 | box-shadow: 5px 5px 5px #b6b6b6; 17 | background-color: rgb(230, 230, 230); 18 | } 19 | 20 | .card-left{ 21 | width: 25%; 22 | height: 100px; 23 | line-height: 100px; 24 | float: left; 25 | font-size: 30px; 26 | color: #DC143C; 27 | text-align: center; 28 | vertical-align: middle; 29 | } 30 | 31 | .card-center{ 32 | width: 50%; 33 | height: 100%; 34 | float: left; 35 | } 36 | 37 | .card-right{ 38 | width: 55px; 39 | height: 20px; 40 | line-height: 20px; 41 | vertical-align: middle; 42 | text-align: center; 43 | float: left; 44 | font-size: 12px; 45 | border: 1px solid #B6D9A9; 46 | border-radius: 3px; 47 | background-color: #B6D9A9; 48 | color: #FFF; 49 | margin-top: 40px; 50 | margin-left: 10px; 51 | } 52 | 53 | .card-center-top{ 54 | width: 100%; 55 | height: 30px; 56 | font-size: 18px; 57 | color: #000; 58 | margin-top:5px; 59 | line-height:30px; 60 | vertical-align:middle; 61 | } 62 | 63 | .card-center-bottom{ 64 | width: 100%; 65 | font-size: 12px; 66 | color: #a8a8a8; 67 | margin-top: 5px; 68 | } -------------------------------------------------------------------------------- /pre/pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 我要点餐 17 | 18 | 19 | 我要预约 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /pre/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages":[ 3 | "pages/index/index", 4 | "pages/list/list", 5 | "pages/order/balance/balance", 6 | "pages/mine/mine", 7 | "pages/order/list/list", 8 | "pages/order/detail/detail", 9 | "pages/reserve/reserve", 10 | "pages/coupon/coupon", 11 | "pages/usercard/usercard" 12 | ], 13 | "window":{ 14 | "backgroundTextStyle":"light", 15 | "navigationBarBackgroundColor": "#DC143C", 16 | "navigationBarTitleText": "一起捞", 17 | "navigationBarTextStyle":"white" 18 | }, 19 | "tabBar": { 20 | "color": "#8a8a8a", 21 | "selectedColor": "#DC143C", 22 | "borderStyle": "black", 23 | "list": [ 24 | { 25 | "selectedIconPath": "images/home_a.png", 26 | "iconPath": "images/home_b.png", 27 | "pagePath": "pages/index/index", 28 | "text": "首页" 29 | }, 30 | { 31 | "selectedIconPath": "images/cart_a.png", 32 | "iconPath": "images/cart_b.png", 33 | "pagePath": "pages/order/list/list", 34 | "text": "订单" 35 | }, 36 | { 37 | "selectedIconPath": "images/my_a.png", 38 | "iconPath": "images/my_b.png", 39 | "pagePath": "pages/mine/mine", 40 | "text": "我的" 41 | } 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/ReserveMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | id, open_id, user_id, table_id, reserve_no, reserve_status, reserve_date, create_time, 24 | update_time, is_delete 25 | 26 | -------------------------------------------------------------------------------- /pre/pages/reserve/reserve.js: -------------------------------------------------------------------------------- 1 | const app = getApp() 2 | var util = require('../../utils/util.js') 3 | 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | diningId: '024', 11 | preNo: 10 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function(options) { 18 | this.setData({ 19 | diningId: options.diningId, 20 | preNo: options.preNo 21 | }); 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面初次渲染完成 27 | */ 28 | onReady: function() { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面显示 34 | */ 35 | onShow: function() { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面隐藏 41 | */ 42 | onHide: function() { 43 | 44 | }, 45 | 46 | /** 47 | * 生命周期函数--监听页面卸载 48 | */ 49 | onUnload: function() { 50 | 51 | }, 52 | 53 | /** 54 | * 页面相关事件处理函数--监听用户下拉动作 55 | */ 56 | onPullDownRefresh: function() { 57 | var that = this; 58 | wx.request({ 59 | method: "GET", 60 | url: app.globalData.host + '/reserve/wait/count', 61 | data: { 62 | reserve_date: util.formatTime(new Date()) 63 | }, 64 | success: res => { 65 | that.setData({ 66 | preNo: res.data.count 67 | }) 68 | } 69 | }) 70 | }, 71 | 72 | /** 73 | * 页面上拉触底事件的处理函数 74 | */ 75 | onReachBottom: function() { 76 | 77 | }, 78 | 79 | /** 80 | * 用户点击右上角分享 81 | */ 82 | onShareAppMessage: function() { 83 | 84 | } 85 | }) -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/DishMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | dish_id, dish_name, dish_url, hot_status, praise_times, is_sign, is_new_dish, sales_volume, 25 | dish_price, dish_type, dish_description 26 | 27 | -------------------------------------------------------------------------------- /pre/pages/coupon/coupon.js: -------------------------------------------------------------------------------- 1 | var app = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | couponList: [] 10 | }, 11 | 12 | /** 13 | * 生命周期函数--监听页面加载 14 | */ 15 | onLoad: function(options) { 16 | wx.setNavigationBarTitle({ 17 | title: '我的优惠券' 18 | }) 19 | var that = this; 20 | wx.showLoading({ 21 | title: '查询中', 22 | }) 23 | wx.request({ 24 | method: "GET", 25 | url: app.globalData.host + '/my/coupon/list', 26 | data: { 27 | open_id: wx.getStorageSync('openid') 28 | }, 29 | success: res => { 30 | wx.hideLoading(); 31 | console.log(res); 32 | that.setData({ 33 | couponList: res.data 34 | }) 35 | } 36 | }) 37 | }, 38 | 39 | gotouse: function() { 40 | wx.navigateTo({ 41 | url: '../list/list', 42 | }) 43 | }, 44 | 45 | /** 46 | * 生命周期函数--监听页面初次渲染完成 47 | */ 48 | onReady: function() { 49 | 50 | }, 51 | 52 | /** 53 | * 生命周期函数--监听页面显示 54 | */ 55 | onShow: function() { 56 | 57 | }, 58 | 59 | /** 60 | * 生命周期函数--监听页面隐藏 61 | */ 62 | onHide: function() { 63 | 64 | }, 65 | 66 | /** 67 | * 生命周期函数--监听页面卸载 68 | */ 69 | onUnload: function() { 70 | 71 | }, 72 | 73 | /** 74 | * 页面相关事件处理函数--监听用户下拉动作 75 | */ 76 | onPullDownRefresh: function() { 77 | 78 | }, 79 | 80 | /** 81 | * 页面上拉触底事件的处理函数 82 | */ 83 | onReachBottom: function() { 84 | 85 | }, 86 | 87 | /** 88 | * 用户点击右上角分享 89 | */ 90 | onShareAppMessage: function() { 91 | 92 | } 93 | }) -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/ResTable.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | 5 | import javax.persistence.*; 6 | 7 | @Table(name = "res_table") 8 | public class ResTable { 9 | /** 10 | * 桌子主键 11 | */ 12 | @Id 13 | @Column(name = "table_id") 14 | @JSONField(name = "table_id") 15 | private Integer tableId; 16 | 17 | @Column(name = "max_seating") 18 | private Integer maxSeating; 19 | 20 | @Column(name = "table_status") 21 | private Integer tableStatus; 22 | 23 | /** 24 | * 获取桌子主键 25 | * 26 | * @return table_id - 桌子主键 27 | */ 28 | public Integer getTableId() { 29 | return tableId; 30 | } 31 | 32 | /** 33 | * 设置桌子主键 34 | * 35 | * @param tableId 桌子主键 36 | */ 37 | public void setTableId(Integer tableId) { 38 | this.tableId = tableId; 39 | } 40 | 41 | /** 42 | * @return max_seating 43 | */ 44 | public Integer getMaxSeating() { 45 | return maxSeating; 46 | } 47 | 48 | /** 49 | * @param maxSeating 50 | */ 51 | public void setMaxSeating(Integer maxSeating) { 52 | this.maxSeating = maxSeating; 53 | } 54 | 55 | /** 56 | * @return table_status 57 | */ 58 | public Integer getTableStatus() { 59 | return tableStatus; 60 | } 61 | 62 | /** 63 | * @param tableStatus 64 | */ 65 | public void setTableStatus(Integer tableStatus) { 66 | this.tableStatus = tableStatus; 67 | } 68 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/util/NowDate.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.util; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Calendar; 6 | import java.util.Date; 7 | 8 | 9 | /** 10 | * @param 11 | * @author Joe.Cai 12 | * @date 2018/6/27 9:36 13 | * 获取当前时间 14 | */ 15 | 16 | public class NowDate { 17 | public static String getDate() { 18 | Date date = new Date();//获得系统时间. 19 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 20 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 21 | String nowTime = sdf.format(date);//将时间格式转换成符合Timestamp要求的格式. 22 | return nowTime; 23 | } 24 | 25 | /** 26 | * 指定日期加上天数后的日期 27 | * 28 | * @param num 为增加的天数 29 | * @param newDate 创建时间 30 | * @return 31 | * @throws ParseException 32 | */ 33 | public static String plusDay(int num, String newDate) { 34 | try { 35 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 36 | Date currDate = format.parse(newDate); 37 | System.out.println("现在的日期是:" + currDate); 38 | Calendar ca = Calendar.getInstance(); 39 | ca.add(Calendar.DATE, num);// num为增加的天数,可以改变的 40 | currDate = ca.getTime(); 41 | String endDate = format.format(currDate); 42 | System.out.println("增加天数以后的日期:" + endDate); 43 | return endDate; 44 | } catch (ParseException e) { 45 | return null; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pre/pages/order/list/list.wxss: -------------------------------------------------------------------------------- 1 | /* pages/order/list/list.wxss */ 2 | 3 | .active-color { 4 | background: #dc143c; 5 | } 6 | 7 | .unactive-color { 8 | background: #999; 9 | } 10 | 11 | .start-btn { 12 | width: 100px; 13 | height: 30px; 14 | background: #dc143c; 15 | font-size: 14px; 16 | color: white; 17 | } 18 | 19 | .note-btn { 20 | font-size: 14px; 21 | color: #999; 22 | margin-top: 30px; 23 | } 24 | 25 | .dindgan-i { 26 | font-size: 100px; 27 | color: #999; 28 | } 29 | 30 | .tab-box { 31 | width: 50%; 32 | display: flex; 33 | font-size: 14px; 34 | color: white; 35 | } 36 | 37 | .full-width { 38 | width: 100%; 39 | } 40 | 41 | .list-cards { 42 | width: 100%; 43 | margin-top: 15px; 44 | margin-bottom: 15px; 45 | } 46 | 47 | .list-card { 48 | width: 90%; 49 | height: 60px; 50 | border-radius: 3px; 51 | margin: 0 auto; 52 | color: #999; 53 | font-size: 12px; 54 | } 55 | 56 | .list-card-top { 57 | width: 100%; 58 | height: 20px; 59 | line-height: 20px; 60 | vertical-align: middle; 61 | border-bottom: 1px solid rgba(153, 153, 153, 0.199); 62 | } 63 | 64 | .list-card-left{ 65 | float: left; 66 | height: 30px; 67 | line-height: 30px; 68 | vertical-align: middle; 69 | padding: 5px; 70 | font-size: 16px; 71 | color: #dc143c 72 | } 73 | 74 | .list-card-right{ 75 | float:right; 76 | width: 41px; 77 | height: 20px; 78 | line-height: 20px; 79 | vertical-align: middle; 80 | border-radius: 3px; 81 | color: #ffffff; 82 | padding-left:5px; 83 | margin: 10px 84 | } -------------------------------------------------------------------------------- /pre/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | globalData: { 4 | //真是接口 5 | host: 'http://127.0.0.1:8088', 6 | //测试接口 7 | // host:"https://easy-mock.com/mock/5b6c4055606a404bd879c836/wxdc", 8 | appId: 'wx46966fd292b7eefe', 9 | appSecret: 'aafd006a905a36bc609aa6788c265c36', 10 | }, 11 | // 登录的接口 --- 获取sessionkey和openid 12 | tologin: function() { 13 | var that = this; 14 | // 登录 15 | wx.login({ 16 | success: res => { 17 | // 发送 res.code 到后台换取 openId, sessionKey, unionId 18 | if (res.code) { 19 | wx.request({ 20 | method: "GET", 21 | // 以code换取 用户唯一标识openid 和 会话密钥session_key 22 | url: that.globalData.host + '/wxlogin/open_id/get', 23 | data: { 24 | code: res.code 25 | }, 26 | success: res => { 27 | // console.log(res); 28 | wx.setStorage({ 29 | key: 'openid', 30 | data: res.data.openid, 31 | }); 32 | wx.setStorage({ 33 | key: 'session_key', 34 | data: res.data.session_key, 35 | }) 36 | } 37 | }) 38 | } else { 39 | wx.showModal({ 40 | title: '提示信息', 41 | content: '登录失败!' 42 | }) 43 | } 44 | } 45 | }) 46 | }, 47 | 48 | onLaunch: function() { 49 | var that = this; 50 | wx.checkSession({ 51 | success: function() {}, 52 | fail: function() { 53 | that.tologin() 54 | } 55 | }) 56 | } 57 | }) -------------------------------------------------------------------------------- /pre/pages/order/detail/detail.js: -------------------------------------------------------------------------------- 1 | // pages/order/detail/detail.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | cartList: [], 9 | sumMonney: 0, 10 | cutMonney: 0, 11 | dining_id:'A001' 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function(options) { 18 | wx.setNavigationBarTitle({ 19 | title: '订单详情' 20 | }); 21 | var dining_id = options.dining_id; 22 | if (dining_id.length==1){ 23 | dining_id = "00" + dining_id 24 | } else if (dining_id.length ==2){ 25 | dining_id = "0" + dining_id 26 | } 27 | dining_id = "A" + dining_id; 28 | this.setData({ 29 | cartList: wx.getStorageSync('cartList'), 30 | sumMonney: wx.getStorageSync('sumMonney'), 31 | cutMonney: wx.getStorageSync('sumMonney') > 149 ? 10 : 0, 32 | dining_id: dining_id 33 | }) 34 | }, 35 | 36 | /** 37 | * 生命周期函数--监听页面初次渲染完成 38 | */ 39 | onReady: function() { 40 | 41 | }, 42 | 43 | /** 44 | * 生命周期函数--监听页面显示 45 | */ 46 | onShow: function() { 47 | 48 | }, 49 | 50 | /** 51 | * 生命周期函数--监听页面隐藏 52 | */ 53 | onHide: function() { 54 | 55 | }, 56 | 57 | /** 58 | * 生命周期函数--监听页面卸载 59 | */ 60 | onUnload: function() { 61 | 62 | }, 63 | 64 | /** 65 | * 页面相关事件处理函数--监听用户下拉动作 66 | */ 67 | onPullDownRefresh: function() { 68 | 69 | }, 70 | 71 | /** 72 | * 页面上拉触底事件的处理函数 73 | */ 74 | onReachBottom: function() { 75 | 76 | }, 77 | 78 | /** 79 | * 用户点击右上角分享 80 | */ 81 | onShareAppMessage: function() { 82 | 83 | } 84 | }) -------------------------------------------------------------------------------- /pre/pages/order/detail/detail.wxss: -------------------------------------------------------------------------------- 1 | /* pages/order/detail/detail.wxss */ 2 | page{ 3 | background:#F8F8F8 4 | } 5 | .card-fetch{ 6 | width:40px; 7 | background:#DC143C; 8 | height:100px; 9 | font-size:14px; 10 | color:white; 11 | } 12 | .card-box{ 13 | display:flex; 14 | width:80%; 15 | height:100px; 16 | background:#FEF9F4; 17 | } 18 | .card-left-bar{ 19 | width:14px; 20 | padding:20px 14px; 21 | } 22 | .order-info{ 23 | background: white; 24 | margin-top:10px; 25 | } 26 | .order-info-title{ 27 | font-size:12px; 28 | color: #D1D1D1; 29 | padding: 12px; 30 | border-bottom: 1px #E3E3E3 solid 31 | } 32 | .order-sum{ 33 | height:20px; 34 | padding:8px 15px; 35 | font-size:14px; 36 | } 37 | .order-sum-number{ 38 | font-size:14px; 39 | float:right; 40 | } 41 | .list-info{ 42 | width:50%; 43 | padding:5px 15px; 44 | } 45 | .list-info-size{ 46 | font-size:12px; 47 | color:#B1B1B1; 48 | } 49 | .activity-color{ 50 | color:#DC143C; 51 | } 52 | .cart-list-box{ 53 | background:#FFFFFF; 54 | display:flex; 55 | font-size:15px; 56 | border-bottom:1px #E3E3E3 solid; 57 | } 58 | .note-exchange{ 59 | padding:3px 5px; 60 | border:1px solid #DC143C; 61 | color:#DC143C; 62 | font-size:16px 63 | } 64 | .order-info-li{ 65 | color:black; 66 | margin-left:10px; 67 | } 68 | .note-card{ 69 | margin-left:20px; 70 | color:#A2A1A0; 71 | font-size:12px; 72 | margin-top:15px 73 | } 74 | .statu-card{ 75 | font-size:12px; 76 | color:#DC143C 77 | } 78 | .number-card{ 79 | font-size:28px; 80 | padding:0px 20px 81 | } 82 | .go-top-10{ 83 | margin-top:10px 84 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.controller; 2 | 3 | import com.wx.restaurant.mybatis.model.CouponDTO; 4 | import com.wx.restaurant.mybatis.model.Reserve; 5 | import com.wx.restaurant.service.ReserveService; 6 | import com.wx.restaurant.service.UserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestParam; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @param 17 | * @author 18 | * @date 2018/8/13 8:50 19 | */ 20 | @RestController 21 | @RequestMapping("/my") 22 | public class UserController { 23 | @Autowired 24 | UserService userService; 25 | @Autowired 26 | ReserveService reserveService; 27 | 28 | /** 29 | * 获取个人优惠券列表接口 30 | * 31 | * @param openId 小程序openId 32 | */ 33 | 34 | @GetMapping("/coupon/list") 35 | public List couponList(@RequestParam("open_id") String openId) { 36 | System.out.println(">>>>>>>>>>>>>>>>>>调用获取个人优惠券列表接口"); 37 | return userService.myCouponList(openId); 38 | } 39 | 40 | /** 41 | * 获取个人预约列表接口 42 | * 43 | * @param openId 小程序openId 44 | * @return 45 | */ 46 | @GetMapping("/reserve/list") 47 | public List reserveList(@RequestParam("open_id") String openId) { 48 | System.out.println(">>>>>>>>>>>>>>>>>>>调用获取个人预约列表接口"); 49 | return reserveService.myReserveList(openId); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /pre/pages/usercard/usercard.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | 3 | /** 4 | * 页面的初始数据 5 | */ 6 | data: { 7 | userNo: '20180813001' 8 | }, 9 | 10 | /** 11 | * 生命周期函数--监听页面加载 12 | */ 13 | onLoad: function(options) { 14 | wx.setNavigationBarTitle({ 15 | title: '我的会员卡' 16 | }); 17 | if (wx.getStorageSync('userNo')){ 18 | this.setData({ 19 | userNo: wx.getStorageSync('userNo') 20 | }) 21 | }else{ 22 | var now_time = new Date; 23 | var year = now_time.getFullYear(); 24 | var month = now_time.getMonth() + 1; 25 | var day = now_time.getDate(); 26 | if (month < 10) { 27 | month = "0" + month; 28 | } 29 | if (day < 10) { 30 | day = "0" + day; 31 | } 32 | var date = year + month + day; 33 | var no = Math.floor(Math.random() * 9000) + 1000; 34 | wx.setStorageSync('userNo', date.toString() + no.toString()); 35 | this.setData({ 36 | userNo: wx.getStorageSync('userNo') 37 | }) 38 | } 39 | }, 40 | 41 | /** 42 | * 生命周期函数--监听页面初次渲染完成 43 | */ 44 | onReady: function() { 45 | 46 | }, 47 | 48 | /** 49 | * 生命周期函数--监听页面显示 50 | */ 51 | onShow: function() { 52 | 53 | }, 54 | 55 | /** 56 | * 生命周期函数--监听页面隐藏 57 | */ 58 | onHide: function() { 59 | 60 | }, 61 | 62 | /** 63 | * 生命周期函数--监听页面卸载 64 | */ 65 | onUnload: function() { 66 | 67 | }, 68 | 69 | /** 70 | * 页面相关事件处理函数--监听用户下拉动作 71 | */ 72 | onPullDownRefresh: function() { 73 | 74 | }, 75 | 76 | /** 77 | * 页面上拉触底事件的处理函数 78 | */ 79 | onReachBottom: function() { 80 | 81 | }, 82 | 83 | /** 84 | * 用户点击右上角分享 85 | */ 86 | onShareAppMessage: function() { 87 | 88 | } 89 | }) -------------------------------------------------------------------------------- /pre/pages/order/list/list.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | // pages/order/list/list.js 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | tabIndex: 0, 10 | jsList: [], 11 | yyList: [] 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function(options) { 18 | this.queryjsList() 19 | }, 20 | 21 | queryjsList:function(){ 22 | var that = this; 23 | wx.showLoading({ 24 | title: '数据加载中', 25 | }) 26 | wx.request({ 27 | method: "GET", 28 | url: app.globalData.host + '/balance/list', 29 | data: { 30 | open_id: wx.getStorageSync("openid") 31 | }, 32 | success: res => { 33 | // console.log(res); 34 | wx.hideLoading(); 35 | that.setData({ 36 | jsList: res.data 37 | }) 38 | } 39 | }) 40 | }, 41 | 42 | queryyyList:function(){ 43 | var that = this; 44 | wx.showLoading({ 45 | title: '数据加载中', 46 | }) 47 | wx.request({ 48 | method: "GET", 49 | url: app.globalData.host + '/my/reserve/list', 50 | data: { 51 | open_id: wx.getStorageSync("openid") 52 | }, 53 | success: res => { 54 | // console.log(res); 55 | wx.hideLoading(); 56 | that.setData({ 57 | yyList: res.data 58 | }) 59 | } 60 | }) 61 | }, 62 | 63 | changeTab: function(e) { 64 | var index = e.currentTarget.dataset.index 65 | this.setData({ 66 | tabIndex: index, 67 | }) 68 | if(index == 0){ 69 | this.queryjsList(); 70 | }else if(index ==1){ 71 | this.queryyyList(); 72 | } 73 | }, 74 | golist: function() { 75 | wx.navigateTo({ 76 | url: '../../list/list' 77 | }) 78 | }, 79 | }) -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/DishType.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import javax.persistence.*; 4 | 5 | @Table(name = "dish_type") 6 | public class DishType { 7 | /** 8 | * 菜的类型主键 9 | */ 10 | @Id 11 | @Column(name = "type_id") 12 | private Integer typeId; 13 | 14 | /** 15 | * 1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 16 | */ 17 | @Column(name = "dish_type") 18 | private Integer dishType; 19 | 20 | /** 21 | * 种类名字 22 | */ 23 | private String name; 24 | 25 | /** 26 | * 获取菜的类型主键 27 | * 28 | * @return type_id - 菜的类型主键 29 | */ 30 | public Integer getTypeId() { 31 | return typeId; 32 | } 33 | 34 | /** 35 | * 设置菜的类型主键 36 | * 37 | * @param typeId 菜的类型主键 38 | */ 39 | public void setTypeId(Integer typeId) { 40 | this.typeId = typeId; 41 | } 42 | 43 | /** 44 | * 获取1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 45 | * 46 | * @return dish_type - 1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 47 | */ 48 | public Integer getDishType() { 49 | return dishType; 50 | } 51 | 52 | /** 53 | * 设置1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 54 | * 55 | * @param dishType 1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 56 | */ 57 | public void setDishType(Integer dishType) { 58 | this.dishType = dishType; 59 | } 60 | 61 | /** 62 | * 获取种类名字 63 | * 64 | * @return name - 种类名字 65 | */ 66 | public String getName() { 67 | return name; 68 | } 69 | 70 | /** 71 | * 设置种类名字 72 | * 73 | * @param name 种类名字 74 | */ 75 | public void setName(String name) { 76 | this.name = name == null ? null : name.trim(); 77 | } 78 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/CouponDTOMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/controller/ReserveController.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.wx.restaurant.enums.ReserveStatusEnum; 5 | import com.wx.restaurant.enums.StatusEnum; 6 | import com.wx.restaurant.mybatis.model.Reserve; 7 | import com.wx.restaurant.service.ReserveService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | /** 15 | * @param 16 | * @author 17 | * @date 2018/8/13 9:49 18 | */ 19 | @RestController 20 | @RequestMapping("/reserve") 21 | public class ReserveController { 22 | @Autowired 23 | ReserveService reserveService; 24 | 25 | /** 26 | * 用户预约接口 27 | * 28 | * @param data 小程序 openId 预约时间 reserveDate 29 | */ 30 | @PostMapping("/insert") 31 | public Map reserveSave(@RequestBody JSONObject data) { 32 | System.out.println(">>>>>>>>>>>>>>>调用用户预约接口"); 33 | String str = JSONObject.toJSONString(data); 34 | Reserve reserve = JSONObject.parseObject(str, Reserve.class); 35 | return reserveService.reserveSave(reserve); 36 | } 37 | 38 | /** 39 | * 用户预约需等待人数接口 40 | * 41 | * @param reserveDate 预约时间 42 | */ 43 | @GetMapping("/wait/count") 44 | public Map waitCount(@RequestParam("reserve_date") String reserveDate) { 45 | System.out.println(">>>>>>>>>>>>>>调用用户预约需等待人数接口"); 46 | Map result = new HashMap<>(); 47 | Integer count = reserveService.reserveList(reserveDate, ReserveStatusEnum.WAIT.getIndex()); 48 | result.put("count", count); 49 | result.put("status", StatusEnum.SUCCESS.getIndex()); 50 | return result; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/mapper/DishDTOMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | -------------------------------------------------------------------------------- /pre/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件。", 3 | "setting": { 4 | "urlCheck": false, 5 | "es6": true, 6 | "postcss": false, 7 | "minified": true, 8 | "newFeature": true 9 | }, 10 | "compileType": "miniprogram", 11 | "libVersion": "1.5.2", 12 | "appid": "wx46966fd292b7eefe", 13 | "projectname": "wxdc", 14 | "condition": { 15 | "search": { 16 | "current": -1, 17 | "list": [] 18 | }, 19 | "conversation": { 20 | "current": -1, 21 | "list": [] 22 | }, 23 | "plugin": { 24 | "current": -1, 25 | "list": [] 26 | }, 27 | "game": { 28 | "list": [] 29 | }, 30 | "miniprogram": { 31 | "current": 8, 32 | "list": [ 33 | { 34 | "id": -1, 35 | "name": "列表", 36 | "pathName": "pages/list/list", 37 | "query": "" 38 | }, 39 | { 40 | "id": -1, 41 | "name": "订单详情", 42 | "pathName": "pages/order/balance/balance", 43 | "query": "" 44 | }, 45 | { 46 | "id": 2, 47 | "name": "我的", 48 | "pathName": "pages/mine/mine", 49 | "query": "" 50 | }, 51 | { 52 | "id": -1, 53 | "name": "订单列表", 54 | "pathName": "pages/order/list/list", 55 | "query": "" 56 | }, 57 | { 58 | "id": 4, 59 | "name": "订单详情", 60 | "pathName": "pages/order/detail/detail", 61 | "query": "dining_id=23" 62 | }, 63 | { 64 | "id": -1, 65 | "name": "订单列表查询窗口", 66 | "pathName": "pages/order/list/list", 67 | "query": "" 68 | }, 69 | { 70 | "id": -1, 71 | "name": "我的优惠券", 72 | "pathName": "pages/coupon/coupon", 73 | "query": "" 74 | }, 75 | { 76 | "id": -1, 77 | "name": "我的会员卡", 78 | "pathName": "pages/usercard/usercard", 79 | "query": "" 80 | }, 81 | { 82 | "id": 8, 83 | "name": "预约号码", 84 | "pathName": "pages/reserve/reserve", 85 | "query": "waitNo=234" 86 | } 87 | ] 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.service; 2 | 3 | import com.wx.restaurant.enums.DeleteEnum; 4 | import com.wx.restaurant.enums.IntegerVarEnum; 5 | import com.wx.restaurant.mybatis.mapper.CouponDTOMapper; 6 | import com.wx.restaurant.mybatis.mapper.MyCouponMapper; 7 | import com.wx.restaurant.mybatis.model.CouponDTO; 8 | import com.wx.restaurant.mybatis.model.MyCoupon; 9 | import com.wx.restaurant.util.NowDate; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | import tk.mybatis.mapper.entity.Example; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @param 18 | * @author Joe.Cai 19 | * @date 2018/8/11 22:37 20 | */ 21 | @Service 22 | public class UserService { 23 | @Autowired 24 | MyCouponMapper myCouponMapper; 25 | @Autowired 26 | CouponDTOMapper couponDTOMapper; 27 | 28 | 29 | public void userSave(String openid, Integer yhqid) { 30 | MyCoupon myCoupon = new MyCoupon(); 31 | String time = NowDate.getDate(); 32 | String endTime = NowDate.plusDay(IntegerVarEnum.INVALID_SEVENTH.getValue(), time); 33 | myCoupon.setOpenId(openid); 34 | myCoupon.setYhqid(yhqid); 35 | myCoupon.setEndTime(endTime); 36 | myCoupon.setCreateTime(time); 37 | myCoupon.setUpdateTime(time); 38 | myCoupon.setIsDelete(DeleteEnum.DISPLAY.getIndex()); 39 | myCouponMapper.insertSelective(myCoupon); 40 | } 41 | 42 | public List userList(String openid, Integer yhqid) { 43 | Example example = new Example(MyCoupon.class); 44 | example.createCriteria().andEqualTo("openId", openid).andEqualTo("yhqid", yhqid); 45 | return myCouponMapper.selectByExample(example); 46 | } 47 | 48 | public List myCouponList(String openId) { 49 | return couponDTOMapper.myCouponList(openId); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /pre/pages/order/detail/detail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 制作中,尽快为你服务 19 | 20 | 21 | 22 | 23 | 24 | 25 | 订单详情 26 | 27 | 28 | {{item.name}} 29 | {{item.detail}} 30 | 31 | 32 | 33 | x {{item.count}} 34 | ¥ {{item.price*item.count}}.00 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 订单信息 47 | 订单编号 48 | WD100321342354351356 49 | 50 | 下单时间 51 | 2018-10-10 14:51:25 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/service/BalanceService.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.service; 2 | 3 | import com.wx.restaurant.enums.BalanceStatusEnum; 4 | import com.wx.restaurant.enums.DeleteEnum; 5 | import com.wx.restaurant.mybatis.mapper.BalanceMapper; 6 | import com.wx.restaurant.mybatis.mapper.ShopCartMapper; 7 | import com.wx.restaurant.mybatis.model.Balance; 8 | import com.wx.restaurant.mybatis.model.ShopCart; 9 | import com.wx.restaurant.util.NowDate; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @param 17 | * @author 18 | * @date 2018/8/12 16:55 19 | */ 20 | @Service 21 | public class BalanceService { 22 | @Autowired 23 | BalanceMapper balanceMapper; 24 | @Autowired 25 | ShopCartMapper shopCartMapper; 26 | 27 | public void balanceSave(Balance balance, List shopCartList) { 28 | String time = NowDate.getDate(); 29 | balance.setCreateTime(time); 30 | balance.setUpdateTime(time); 31 | balance.setBalanceStatus(BalanceStatusEnum.UNPAID.getIndex()); 32 | balance.setIsDelete(DeleteEnum.DISPLAY.getIndex()); 33 | balanceMapper.insertUseGeneratedKeys(balance); 34 | Integer balanceId = balance.getId(); 35 | for (ShopCart shopCart : shopCartList) { 36 | shopCart.setBalanceId(balanceId); 37 | shopCart.setCreateTime(time); 38 | shopCart.setUpdateTime(time); 39 | } 40 | shopCartMapper.insertList(shopCartList); 41 | } 42 | 43 | public void balanceUpdate(Integer balanceId) { 44 | Balance balance = new Balance(); 45 | String time = NowDate.getDate(); 46 | balance.setId(balanceId); 47 | balance.setBalanceStatus(BalanceStatusEnum.PAID.getIndex()); 48 | balance.setUpdateTime(time); 49 | balanceMapper.updateByPrimaryKeySelective(balance); 50 | shopCartMapper.salesVolumeAdd(balanceId); 51 | } 52 | 53 | public List balanceList(String openId) { 54 | return balanceMapper.balanceList(openId); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /pre/pages/mine/mine.js: -------------------------------------------------------------------------------- 1 | var app = getApp(); 2 | // pages/mine/mine.js 3 | Page({ 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | showUser: true, 9 | canIUse: wx.canIUse('button.open-type.getUserInfo'), 10 | nickName: "用户昵称", 11 | avatarUrl: "https://lg-7s6viuzs-1256301647.cos.ap-shanghai.myqcloud.com/touxiang.png", 12 | phoneNumber: '10086' 13 | }, 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function() { 18 | var that = this; 19 | // 查看是否授权 20 | wx.getSetting({ 21 | success: function(res) { 22 | if (res.authSetting['scope.userInfo']) { 23 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称 24 | wx.getUserInfo({ 25 | success: function(res) { 26 | that.setData({ 27 | showUser: false, 28 | nickName: res.userInfo.nickName, 29 | avatarUrl: res.userInfo.avatarUrl 30 | }) 31 | wx.setStorage({ 32 | key: 'userInfo', 33 | data: res.userInfo 34 | }) 35 | } 36 | }) 37 | } 38 | } 39 | }) 40 | }, 41 | // 授权的登录的接口 42 | bindGetUserInfo: function(e) { 43 | var that = this; 44 | if (!this.data.canIUse) { 45 | wx.showModal({ 46 | title: '提示信息', 47 | content: '您的微信版本过低,请升级后尝试。', 48 | }) 49 | } else { 50 | var userInfo = e.detail.userInfo; 51 | that.setData({ 52 | showUser: false, 53 | nickName: userInfo.nickName, 54 | avatarUrl: userInfo.avatarUrl 55 | }); 56 | wx.setStorage({ 57 | key: 'userInfo', 58 | data: userInfo 59 | }) 60 | } 61 | }, 62 | // 拨打电话的接口 63 | bitphone: function() { 64 | wx.makePhoneCall({ 65 | phoneNumber: '10086', 66 | success: function() {} 67 | }) 68 | }, 69 | // 展示我的优惠券 70 | showMyYhqs: function() { 71 | wx.navigateTo({ 72 | url: '../coupon/coupon', 73 | }) 74 | }, 75 | //展示我的会员卡 76 | showMyCard: function() { 77 | wx.navigateTo({ 78 | url: '../usercard/usercard', 79 | }) 80 | } 81 | }) -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.controller; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.wx.restaurant.mybatis.model.Balance; 6 | import com.wx.restaurant.mybatis.model.DishDTO; 7 | import com.wx.restaurant.mybatis.model.ShopCart; 8 | import com.wx.restaurant.service.BalanceService; 9 | import com.wx.restaurant.service.DishService; 10 | import com.wx.restaurant.service.ResTableService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * @param 20 | * @author 21 | * @date 2018/8/11 17:41 22 | * 23 | * TODO:测试接口 等项目完成后删掉 24 | */ 25 | @RestController 26 | public class TestController { 27 | 28 | @Autowired 29 | ResTableService resTableService; 30 | @Autowired 31 | DishService dishService; 32 | @Autowired 33 | BalanceService balanceService; 34 | 35 | @GetMapping("/test/table/get") 36 | public JSONObject getTable() { 37 | String str = JSONObject.toJSONString(resTableService.getTable()); 38 | return JSONObject.parseObject(str); 39 | } 40 | 41 | @GetMapping("/test/dish/list") 42 | public JSONArray dishList() { 43 | List dishDTOList = dishService.dishList(); 44 | String str = JSONObject.toJSONString(dishDTOList); 45 | return JSONObject.parseArray(str); 46 | } 47 | 48 | @PostMapping("/test/balance/insert") 49 | public Map balanceSave(@RequestBody JSONObject data){ 50 | Map map = new HashMap<>(); 51 | Balance balance = new Balance(); 52 | balance.setOpenId(data.getString("open_id")); 53 | balance.setTotalPrice(data.getDouble("total_price")); 54 | String str = data.getJSONArray("cartList").toJSONString(); 55 | List shopList = JSONObject.parseArray(str,ShopCart.class); 56 | balanceService.balanceSave(balance,shopList); 57 | map.put("data",balance); 58 | return map; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /pre/pages/order/balance/balance.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 订单详情 11 | 12 | 13 | {{item.name}} 14 | {{item.detail}} 15 | 16 | 17 | 18 | x {{item.count}} 19 | ¥ {{item.count*item.price}}.00 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | {{cupNumber}} 45 | 46 | ¥ {{sumMonney-cutMonney}}.00 47 | 48 | 49 | 50 | 去支付 51 | 52 | 53 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/Coupon.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import javax.persistence.*; 4 | 5 | public class Coupon { 6 | /** 7 | * 优惠券主键 8 | */ 9 | @Id 10 | private Integer yhqid; 11 | 12 | /** 13 | * 图片url 14 | */ 15 | private String imgurl; 16 | 17 | /** 18 | * 金额 19 | */ 20 | private Integer je; 21 | 22 | /** 23 | * 满足金额 24 | */ 25 | private Integer mzje; 26 | 27 | /** 28 | * 满足条件 29 | */ 30 | private String mztj; 31 | 32 | /** 33 | * 获取优惠券主键 34 | * 35 | * @return yhqid - 优惠券主键 36 | */ 37 | public Integer getYhqid() { 38 | return yhqid; 39 | } 40 | 41 | /** 42 | * 设置优惠券主键 43 | * 44 | * @param yhqid 优惠券主键 45 | */ 46 | public void setYhqid(Integer yhqid) { 47 | this.yhqid = yhqid; 48 | } 49 | 50 | /** 51 | * 获取图片url 52 | * 53 | * @return imgurl - 图片url 54 | */ 55 | public String getImgurl() { 56 | return imgurl; 57 | } 58 | 59 | /** 60 | * 设置图片url 61 | * 62 | * @param imgurl 图片url 63 | */ 64 | public void setImgurl(String imgurl) { 65 | this.imgurl = imgurl == null ? null : imgurl.trim(); 66 | } 67 | 68 | /** 69 | * 获取金额 70 | * 71 | * @return je - 金额 72 | */ 73 | public Integer getJe() { 74 | return je; 75 | } 76 | 77 | /** 78 | * 设置金额 79 | * 80 | * @param je 金额 81 | */ 82 | public void setJe(Integer je) { 83 | this.je = je; 84 | } 85 | 86 | /** 87 | * 获取满足金额 88 | * 89 | * @return mzje - 满足金额 90 | */ 91 | public Integer getMzje() { 92 | return mzje; 93 | } 94 | 95 | /** 96 | * 设置满足金额 97 | * 98 | * @param mzje 满足金额 99 | */ 100 | public void setMzje(Integer mzje) { 101 | this.mzje = mzje; 102 | } 103 | 104 | /** 105 | * 获取满足条件 106 | * 107 | * @return mztj - 满足条件 108 | */ 109 | public String getMztj() { 110 | return mztj; 111 | } 112 | 113 | /** 114 | * 设置满足条件 115 | * 116 | * @param mztj 满足条件 117 | */ 118 | public void setMztj(String mztj) { 119 | this.mztj = mztj == null ? null : mztj.trim(); 120 | } 121 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.controller; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.wx.restaurant.enums.StatusEnum; 6 | import com.wx.restaurant.mybatis.model.Coupon; 7 | import com.wx.restaurant.mybatis.model.MyCoupon; 8 | import com.wx.restaurant.service.CouponService; 9 | import com.wx.restaurant.service.UserService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import java.util.HashMap; 17 | import java.util.List; 18 | import java.util.Map; 19 | 20 | /** 21 | * @param 22 | * @author 23 | * @date 2018/8/11 21:50 24 | */ 25 | @RestController 26 | @RequestMapping("/index") 27 | public class IndexController { 28 | @Autowired 29 | CouponService couponService; 30 | @Autowired 31 | UserService userService; 32 | 33 | /** 34 | * 获取优惠券接口 35 | */ 36 | @GetMapping("/coupon/list") 37 | public JSONArray couponList() { 38 | System.out.println(">>>>>>>>>>>>>>>>>>>>调用获取优惠券接口"); 39 | List couponList = couponService.couponList(); 40 | String str = JSONObject.toJSONString(couponList); 41 | return JSONObject.parseArray(str); 42 | } 43 | 44 | /** 45 | * 用户领取优惠券接口 46 | * 47 | * @param openid 小程序openid 48 | * @param yhqid 优惠券id 49 | */ 50 | @GetMapping("/coupon/receive") 51 | public Map userSave(@RequestParam("openid") String openid, 52 | @RequestParam("yhqid") Integer yhqid) { 53 | Map result = new HashMap<>(); 54 | //调用获取我的某种优惠券数量 TODO:此接口可以修改成count 55 | List myCouponList = userService.userList(openid, yhqid); 56 | if (myCouponList != null && myCouponList.size() >= 3) { 57 | result.put("msg", "同一种优惠券最多只能领取三张"); 58 | result.put("status", StatusEnum.FAIL.getIndex()); 59 | } else { 60 | try { 61 | System.out.println(">>>>>>>>>>>>>>>>>调用用户领取优惠券接口"); 62 | userService.userSave(openid, yhqid); 63 | result.put("msg", "领取成功"); 64 | result.put("status", StatusEnum.SUCCESS.getIndex()); 65 | } catch (Exception e) { 66 | result.put("msg", "领取失败"); 67 | result.put("status", StatusEnum.FAIL.getIndex()); 68 | } 69 | } 70 | return result; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /pre/pages/order/list/list.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 历史订单 6 | 预约订单 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 目前没有历史订单 15 | 16 | 我要点餐 17 | 18 | 19 | 20 | 21 | 22 | 23 | 订单编号:{{item.order_id}} 24 | 创建时间:{{item.create_time}} 25 | 26 | 总价:¥{{item.total_price}}.00 27 | {{item.balance_status == 1?"未付款":"已付款"}} 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 目前没有预约订单 38 | 39 | 我要预约 40 | 41 | 42 | 43 | 44 | 45 | 46 | 订单编号:{{item.id}} 47 | 创建时间:{{item.reserveDate}} 48 | 49 | 预约号:A{{item.reserveNo}} 50 | {{item.reserveStatus == 0?"已失效":"生效中"}} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/CouponDTO.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.GenerationType; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * @param 10 | * @author Joe.Cai 11 | * @date 2018/8/13 8:54 12 | */ 13 | public class CouponDTO { 14 | @Id 15 | @GeneratedValue(strategy = GenerationType.IDENTITY) 16 | private Integer id; 17 | 18 | /** 19 | * 小程序openid 20 | */ 21 | @Column(name = "open_id") 22 | private String openId; 23 | 24 | /** 25 | * 用户昵称 26 | */ 27 | @Column(name = "user_name") 28 | private String userName; 29 | 30 | /** 31 | * 优惠券id 32 | */ 33 | private Integer yhqid; 34 | 35 | /** 36 | * 创建时间 37 | */ 38 | @Column(name = "create_time") 39 | private String createTime; 40 | 41 | /** 42 | * 更新时间 43 | */ 44 | @Column(name = "update_time") 45 | private String updateTime; 46 | 47 | /** 48 | * 0==删除 1==显示 49 | */ 50 | @Column(name = "is_delete") 51 | private Integer isDelete; 52 | /** 53 | * 失效时间 54 | */ 55 | @Column(name = "end_time") 56 | private String endTime; 57 | 58 | private Coupon coupon; 59 | 60 | public Integer getId() { 61 | return id; 62 | } 63 | 64 | public void setId(Integer id) { 65 | this.id = id; 66 | } 67 | 68 | public String getEndTime() { 69 | return endTime; 70 | } 71 | 72 | public void setEndTime(String endTime) { 73 | this.endTime = endTime; 74 | } 75 | 76 | public String getOpenId() { 77 | return openId; 78 | } 79 | 80 | public void setOpenId(String openId) { 81 | this.openId = openId; 82 | } 83 | 84 | public String getUserName() { 85 | return userName; 86 | } 87 | 88 | public void setUserName(String userName) { 89 | this.userName = userName; 90 | } 91 | 92 | public Integer getYhqid() { 93 | return yhqid; 94 | } 95 | 96 | public void setYhqid(Integer yhqid) { 97 | this.yhqid = yhqid; 98 | } 99 | 100 | public String getCreateTime() { 101 | return createTime; 102 | } 103 | 104 | public void setCreateTime(String createTime) { 105 | this.createTime = createTime; 106 | } 107 | 108 | public String getUpdateTime() { 109 | return updateTime; 110 | } 111 | 112 | public void setUpdateTime(String updateTime) { 113 | this.updateTime = updateTime; 114 | } 115 | 116 | public Integer getIsDelete() { 117 | return isDelete; 118 | } 119 | 120 | public void setIsDelete(Integer isDelete) { 121 | this.isDelete = isDelete; 122 | } 123 | 124 | public Coupon getCoupon() { 125 | return coupon; 126 | } 127 | 128 | public void setCoupon(Coupon coupon) { 129 | this.coupon = coupon; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /pre/pages/order/balance/balance.js: -------------------------------------------------------------------------------- 1 | var app = getApp(); 2 | 3 | // pages/order/balance/balance.js 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | cartList: [], 11 | sumMonney: 0, 12 | cutMonney: 0, 13 | beizhu: '' 14 | }, 15 | 16 | /** 17 | * 生命周期函数--监听页面加载 18 | */ 19 | onLoad: function(options) { 20 | wx.setNavigationBarTitle({ 21 | title: '订单详情' 22 | }) 23 | this.setData({ 24 | cartList: wx.getStorageSync('cartList'), 25 | sumMonney: wx.getStorageSync('sumMonney'), 26 | cutMonney: wx.getStorageSync('sumMonney') > 149 ? 10 : 0 27 | }) 28 | 29 | }, 30 | 31 | bindblur: function(e) { 32 | this.data.beizhu = e.detail.value; 33 | }, 34 | 35 | bindconfirm:function(e){ 36 | this.data.beizhu = e.detail.value; 37 | }, 38 | 39 | gopay: function() { 40 | wx.showModal({ 41 | title: '温馨提示', 42 | content: '模拟微信支付,权限问题无法开放。', 43 | confirmColor: '#B6D9A9', 44 | cancelColor: '#DC143C', 45 | success: res => { 46 | if (res.confirm) { 47 | wx.request({ 48 | method: "GET", 49 | url: app.globalData.host + '/balance/update', 50 | data: { 51 | order_id: wx.getStorageSync("order_id") 52 | }, 53 | success: res => { 54 | if (res.data.status == "0") { 55 | wx.setStorageSync("dining_id", res.data.dining_id); 56 | wx.showToast({ 57 | title: '支付成功', 58 | image:'../../../images/icon-success.png' 59 | }) 60 | wx.navigateTo({ 61 | url: '../detail/detail?dining_id=' + res.data.dining_id 62 | }) 63 | }else if(res.data.status == "-1"){ 64 | wx.showToast({ 65 | title: res.data.errmsg, 66 | image: '../../../images/icon-err.png' 67 | }) 68 | } 69 | } 70 | }) 71 | }else if(res.cancel){ 72 | wx.showToast({ 73 | title: '取消支付', 74 | image: '../../../images/icon-err.png' 75 | }) 76 | } 77 | } 78 | }) 79 | 80 | 81 | 82 | }, 83 | /** 84 | * 生命周期函数--监听页面初次渲染完成 85 | */ 86 | onReady: function() { 87 | 88 | }, 89 | 90 | /** 91 | * 生命周期函数--监听页面显示 92 | */ 93 | onShow: function() { 94 | 95 | }, 96 | 97 | /** 98 | * 生命周期函数--监听页面隐藏 99 | */ 100 | onHide: function() { 101 | 102 | }, 103 | 104 | /** 105 | * 生命周期函数--监听页面卸载 106 | */ 107 | onUnload: function() { 108 | 109 | }, 110 | 111 | /** 112 | * 页面相关事件处理函数--监听用户下拉动作 113 | */ 114 | onPullDownRefresh: function() { 115 | 116 | }, 117 | 118 | /** 119 | * 页面上拉触底事件的处理函数 120 | */ 121 | onReachBottom: function() { 122 | 123 | }, 124 | 125 | /** 126 | * 用户点击右上角分享 127 | */ 128 | onShareAppMessage: function() { 129 | 130 | } 131 | }) -------------------------------------------------------------------------------- /pre/pages/order/balance/balance.wxss: -------------------------------------------------------------------------------- 1 | /* pages/order/balance/balance.wxss */ 2 | page{ 3 | background: #F8F8F8 4 | } 5 | .operate-bar{ 6 | z-index: 1001; 7 | position: fixed; 8 | bottom: 0px; 9 | height:55px; 10 | width:100%; 11 | display: flex; 12 | } 13 | .gouwuche{ 14 | width:75%; 15 | background:#353535; 16 | height: 100%; 17 | 18 | } 19 | .gouwuche-icon{ 20 | font-size:40px; 21 | color:#87888E; 22 | margin-left:10px; 23 | position: relative; 24 | } 25 | .number-msg{ 26 | padding: 1px 7px; 27 | border-radius:50%; 28 | background:red; 29 | color:white; 30 | font-size:14px; 31 | position: absolute; 32 | text-align: center; 33 | top:0px; 34 | right:-5px; 35 | } 36 | 37 | .gouwuche-price{ 38 | color:#A9A9A9; 39 | display:flex; 40 | align-items: center; 41 | margin-left:10px; 42 | font-size:15px 43 | } 44 | .submit-btn{ 45 | height:100%; 46 | background:#F7F7F7; 47 | width:25%; 48 | display:flex; 49 | } 50 | .submit-btn-label{ 51 | color:white; 52 | font-size:15px; 53 | margin:auto; 54 | } 55 | .activity-color{ 56 | color:#DC143C; 57 | } 58 | .submit-btn{ 59 | height:100%; 60 | background:#F7F7F7; 61 | width:25%; 62 | display:flex; 63 | } 64 | 65 | .activity-color-bg{ 66 | background:#FF9C35; 67 | } 68 | 69 | .cart-list-box{ 70 | background:#FFFFFF; 71 | display:flex; 72 | font-size:15px; 73 | border-bottom:1px #E3E3E3 solid; 74 | } 75 | .list-info{ 76 | width:50%; 77 | padding:5px 15px; 78 | } 79 | .list-info-size{ 80 | font-size:12px; 81 | color:#B1B1B1; 82 | } 83 | .icon-li-circle{ 84 | margin-left:15px; 85 | font-size:20px 86 | } 87 | .font20{ 88 | font-size:20px 89 | } 90 | .top-bar{ 91 | height:30px; 92 | font-size:14px; 93 | background: white; 94 | } 95 | .top-left-label{ 96 | float:left; 97 | padding:5px; 98 | margin-left:10px; 99 | } 100 | .top-right-label{ 101 | float:right; 102 | font-size:13px; 103 | padding:5px; 104 | } 105 | .order-info{ 106 | background: white; 107 | margin-top:10px; 108 | } 109 | .order-info-title{ 110 | font-size:12px; 111 | color: #D1D1D1; 112 | padding: 12px; 113 | border-bottom: 1px #E3E3E3 solid 114 | } 115 | .order-cut{ 116 | height:30px; 117 | padding:5px 15px; 118 | border-bottom: 1px #E3E3E3 solid; 119 | } 120 | .order-cut-dec{ 121 | background:#F07474; 122 | font-size:13px; 123 | color:white; 124 | padding:2px 125 | } 126 | .order-cut-note{ 127 | margin-left:3px; 128 | font-size:14px 129 | } 130 | .order-cut-number{ 131 | font-size:14px; 132 | float:right; 133 | margin-top:10rpx; 134 | } 135 | .order-sum{ 136 | height:20px; 137 | padding:8px 15px; 138 | font-size:14px; 139 | } 140 | .order-sum-number{ 141 | font-size:14px; 142 | float:right; 143 | } 144 | .note{ 145 | padding:5px 15px; 146 | background:white; 147 | margin-top:10px 148 | } 149 | .note-text{ 150 | width:95%; 151 | font-size:12px; 152 | background:#F2F2F2; 153 | padding:10px; 154 | height:80px; 155 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | 6 | import com.wx.restaurant.enums.StatusEnum; 7 | import com.wx.restaurant.util.HttpRequest; 8 | import org.apache.xerces.impl.dv.util.Base64; 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.crypto.Cipher; 14 | import javax.crypto.spec.IvParameterSpec; 15 | import javax.crypto.spec.SecretKeySpec; 16 | import java.security.spec.AlgorithmParameterSpec; 17 | 18 | /** 19 | * @param 20 | * @author 21 | * @date 2018/8/10 15:31 22 | */ 23 | @Controller 24 | @ResponseBody 25 | @RequestMapping("/wxlogin") 26 | public class LoginController { 27 | @Value(value = "${appid}") 28 | String appid; 29 | @Value(value = "${secret}") 30 | String secret; 31 | @Value(value = "${grant_type}") 32 | String grant_type; 33 | 34 | /** 35 | * 获取小程序openid 36 | * 37 | * @param code 小程序code换取openid和sessionKey 38 | */ 39 | @GetMapping("/open_id/get") 40 | public Object getOpenId(@RequestParam("code") String code) { 41 | System.out.println(">>>>>>>>>>>>>>调用获取小程序openid接口"); 42 | String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appid + "&secret=" + secret + "&js_code=" + code + "&grant_type=" + grant_type; 43 | System.out.println(url); 44 | String data = HttpRequest.get(url); 45 | return JSON.parse(data); 46 | } 47 | 48 | /** 49 | * 小程序授权手机号解密 此接口本项目展示没用 50 | * 51 | * @param encrypdata 52 | * @param ivdata 53 | * @param sessionkey 54 | */ 55 | @GetMapping("/user_phone/get") 56 | public JSONObject getUserPhone(@RequestParam("encrypdata") String encrypdata, 57 | @RequestParam("ivdata") String ivdata, 58 | @RequestParam("sessionkey") String sessionkey) { 59 | JSONObject result = new JSONObject(); 60 | byte[] encrypData = Base64.decode(encrypdata); 61 | byte[] ivData = Base64.decode(ivdata); 62 | byte[] sessionKey = Base64.decode(sessionkey); 63 | String str = ""; 64 | try { 65 | str = decrypt(sessionKey, ivData, encrypData); 66 | result.put("data", str); 67 | result.put("status", StatusEnum.SUCCESS.getIndex()); 68 | } catch (Exception e) { 69 | result.put("errmsg", e); 70 | result.put("status", StatusEnum.FAIL.getIndex()); 71 | } 72 | System.out.println(str); 73 | return result; 74 | 75 | } 76 | 77 | /** 78 | * 解密后的手机号 79 | * 80 | * @param key 81 | * @param iv 82 | * @param encData 83 | * @return 84 | * @throws Exception 85 | */ 86 | private static String decrypt(byte[] key, byte[] iv, byte[] encData) throws Exception { 87 | AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv); 88 | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); 89 | SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); 90 | cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); 91 | //解析解密后的字符串 92 | return new String(cipher.doFinal(encData), "UTF-8"); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.controller; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.wx.restaurant.enums.StatusEnum; 6 | import com.wx.restaurant.mybatis.model.Balance; 7 | import com.wx.restaurant.mybatis.model.ShopCart; 8 | import com.wx.restaurant.service.BalanceService; 9 | import com.wx.restaurant.util.RandomCode; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | /** 18 | * @param 19 | * @author 20 | * @date 2018/8/12 17:41 21 | */ 22 | @RestController 23 | public class OrderController { 24 | @Autowired 25 | BalanceService balanceService; 26 | 27 | /** 28 | * 用户下单接口 29 | * 30 | * @param data 购物列表数据,openid,购物总价 31 | */ 32 | @PostMapping("/balance/insert") 33 | public Map balanceSave(@RequestBody JSONObject data) { 34 | Map result = new HashMap<>(); 35 | try { 36 | /* //赋值小程序openid 37 | balance.setOpenId(data.getString("open_id")); 38 | //赋值购物总价 39 | balance.setTotalPrice(data.getDouble("total_price"));*/ 40 | String strBalance = JSONObject.toJSONString(data); 41 | Balance balance = JSONObject.parseObject(strBalance, Balance.class); 42 | //转化购物车列表 43 | String str = data.getJSONArray("cartList").toJSONString(); 44 | List shopList = JSONObject.parseArray(str, ShopCart.class); 45 | System.out.println(">>>>>>>>>>>>>>>>>>>>调用用户下单接口"); 46 | balanceService.balanceSave(balance, shopList); 47 | result.put("status", StatusEnum.SUCCESS.getIndex()); 48 | result.put("order_id", balance.getId()); 49 | } catch (Exception e) { 50 | result.put("status", StatusEnum.FAIL.getIndex()); 51 | result.put("errmsg", "下单失败"); 52 | } 53 | return result; 54 | } 55 | 56 | /** 57 | * 用户付款接口 TODO:同时要增加销量等信息 58 | * 59 | * @param balanceId 订单号 60 | */ 61 | @GetMapping("/balance/update") 62 | public Map balanceSave(@RequestParam("order_id") Integer balanceId) { 63 | Map result = new HashMap<>(); 64 | try { 65 | System.out.println(">>>>>>>>>>>>>>>>>>>>调用用户付款接口"); 66 | balanceService.balanceUpdate(balanceId); 67 | result.put("status", StatusEnum.SUCCESS.getIndex()); 68 | //付款成功则随机生成一个三位数的订单编号 69 | result.put("dining_id", RandomCode.getRandomCode()); 70 | } catch (Exception e) { 71 | result.put("status", StatusEnum.FAIL.getIndex()); 72 | result.put("errmsg", "付款失败"); 73 | } 74 | return result; 75 | } 76 | 77 | /** 78 | * 用户历史订单接口 79 | * 80 | * @param openId 小程序openid 81 | */ 82 | @GetMapping("/balance/list") 83 | public JSONArray balanceSave(@RequestParam("open_id") String openId) { 84 | System.out.println(">>>>>>>>>>>>>>>>>调用用户历史订单接口"); 85 | List balanceList = balanceService.balanceList(openId); 86 | String str = JSONObject.toJSONString(balanceList); 87 | return JSONObject.parseArray(str); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/resources/generator/generatorConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 61 | 62 |
63 | 64 |
65 |
66 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/service/ReserveService.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.service; 2 | 3 | import com.wx.restaurant.enums.DeleteEnum; 4 | import com.wx.restaurant.enums.IntegerVarEnum; 5 | import com.wx.restaurant.enums.ReserveStatusEnum; 6 | import com.wx.restaurant.enums.StatusEnum; 7 | import com.wx.restaurant.mybatis.mapper.ReserveMapper; 8 | import com.wx.restaurant.mybatis.model.Reserve; 9 | import com.wx.restaurant.util.NowDate; 10 | import com.wx.restaurant.util.RandomCode; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | import tk.mybatis.mapper.entity.Example; 14 | 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * @param 21 | * @author 22 | * @date 2018/8/13 10:43 23 | */ 24 | @Service 25 | public class ReserveService { 26 | @Autowired 27 | ReserveMapper reserveMapper; 28 | 29 | 30 | public Map reserveSave(Reserve reserve) { 31 | Map result = new HashMap<>(); 32 | String time = NowDate.getDate(); 33 | String diningId = RandomCode.getRandomCode(); 34 | reserve.setCreateTime(time); 35 | reserve.setUpdateTime(time); 36 | reserve.setIsDelete(DeleteEnum.DISPLAY.getIndex()); 37 | Integer isReserveCount = isReserve(reserve.getReserveDate(),reserve.getOpenId()); 38 | //当天是否已经预约,目前设计每个人每天只能预约一次 39 | if (isReserveCount < 1) { 40 | Integer count = reserveList(reserve.getReserveDate(), ReserveStatusEnum.RESERVE.getIndex()); 41 | if (count < IntegerVarEnum.MAX_RESERVE.getValue()) { 42 | reserve.setReserveStatus(ReserveStatusEnum.RESERVE.getIndex()); 43 | reserve.setReserveNo(diningId); 44 | result.put("count", 0); 45 | result.put("dining_id", diningId); 46 | result.put("message", "预约成功"); 47 | } else { 48 | count = reserveList(reserve.getReserveDate(), ReserveStatusEnum.WAIT.getIndex()); 49 | reserve.setReserveStatus(ReserveStatusEnum.WAIT.getIndex()); 50 | result.put("dining_id", diningId); 51 | result.put("count", count); 52 | result.put("message", "您的前面还有" + count + "人"); 53 | } 54 | reserveMapper.insertSelective(reserve); 55 | result.put("status", StatusEnum.SUCCESS.getIndex()); 56 | }else { 57 | result.put("errmsg","您已预约"); 58 | result.put("status", StatusEnum.FAIL.getIndex()); 59 | } 60 | return result; 61 | } 62 | 63 | public Integer reserveList(String date, Integer reserveStatus) { 64 | String str[] = date.split(" "); 65 | Example example = new Example(Reserve.class); 66 | example.createCriteria().andEqualTo("reserveStatus", reserveStatus).andLike("reserveDate", str[0] + "%"); 67 | return reserveMapper.selectCountByExample(example); 68 | } 69 | public Integer isReserve(String date, String openId) { 70 | String str[] = date.split(" "); 71 | Example example = new Example(Reserve.class); 72 | example.createCriteria().andEqualTo("openId", openId).andLike("reserveDate", str[0] + "%").andBetween("reserveStatus",ReserveStatusEnum.RESERVE.getIndex(),ReserveStatusEnum.WAIT.getIndex()); 73 | return reserveMapper.selectCountByExample(example); 74 | } 75 | 76 | public List myReserveList(String openId) { 77 | return reserveMapper.myReserveList(openId); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /pre/pages/index/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | var util = require('../../utils/util.js') 3 | //获取应用实例 4 | const app = getApp() 5 | 6 | Page({ 7 | data: { 8 | nowtime: util.formatTime(new Date()), 9 | //轮播图 10 | imgUrls: [ 11 | '../../images/lb_01.gif', 12 | '../../images/lb_02.gif', 13 | '../../images/lb_03.gif' 14 | ], 15 | indicatorDots: true, 16 | autoplay: true, 17 | interval: 3000, 18 | indicatorActiveColor: "#DC143C", 19 | //模态框 20 | item: { 21 | index: 0, 22 | msg: 'this is a template', 23 | time: '2016-09-15' 24 | }, 25 | bottomImgs: [] 26 | }, 27 | onLoad: function() { 28 | var that = this; 29 | wx.showLoading({ 30 | title: '数据加载中', 31 | }) 32 | wx.request({ 33 | method: "GET", 34 | url: app.globalData.host + '/index/coupon/list', 35 | data: {}, 36 | success: res => { 37 | // console.log(res); 38 | that.setData({ 39 | bottomImgs: res.data 40 | }) 41 | wx.hideLoading() 42 | } 43 | }) 44 | }, 45 | // 我要点餐 46 | golist: function() { 47 | wx.navigateTo({ 48 | url: '../list/list' 49 | }) 50 | }, 51 | // 我要预定 52 | goreserve:function(){ 53 | var count = 0; 54 | var that = this; 55 | wx.request({ 56 | method: "GET", 57 | url: app.globalData.host + '/reserve/wait/count', 58 | data: { 59 | reserve_date: that.data.nowtime 60 | }, 61 | success: res => { 62 | count = res.data.count; 63 | wx.showModal({ 64 | title: '温馨提示', 65 | content: '您之前还有'+count+'位顾客正在等待就餐,您确定需要预定吗?', 66 | confirmColor: '#B6D9A9', 67 | cancelColor: '#DC143C', 68 | success:res=>{ 69 | if(res.confirm){ 70 | wx.request({ 71 | method: "POST", 72 | url: app.globalData.host +'/reserve/insert', 73 | data: { 74 | open_id: wx.getStorageSync('openid'), 75 | reserve_date:that.data.nowtime 76 | }, 77 | success:e=>{ 78 | console.log(e); 79 | if (e.data.status == "0") { 80 | wx.navigateTo({ 81 | url: '../reserve/reserve?diningId=' + e.data.dining_id + '&preNo=' + count, 82 | }) 83 | } else { 84 | wx.showToast({ 85 | title: '桌位已满', 86 | image: '../../images/icon-err.png', 87 | mask: true 88 | }) 89 | } 90 | } 91 | }) 92 | } 93 | } 94 | }) 95 | } 96 | }) 97 | }, 98 | // 获取优惠券 99 | insertYhq: function(e) { 100 | var yhqid = e.currentTarget.dataset.item.yhqid; 101 | var je = e.currentTarget.dataset.item.je; 102 | wx.showModal({ 103 | title: '温馨提示', 104 | content: '您确定要领取'+je+'元优惠券?', 105 | confirmColor:'#B6D9A9', 106 | cancelColor:'#DC143C', 107 | success: function (res) { 108 | if (res.confirm) { 109 | wx.request({ 110 | method: "GET", 111 | url: app.globalData.host + '/index/coupon/receive', 112 | data: { 113 | openid: wx.getStorageSync('openid'), 114 | yhqid:yhqid 115 | }, 116 | success: res => { 117 | // console.log(res); 118 | if (res.data.status == "0") { 119 | wx.showToast({ 120 | title: '领取成功', 121 | image: '../../images/icon-success.png', 122 | mask: true 123 | }) 124 | } else { 125 | wx.showToast({ 126 | title: '已达上限', 127 | image: '../../images/icon-err.png', 128 | mask: true 129 | }) 130 | } 131 | } 132 | }) 133 | } else if (res.cancel) { 134 | // console.log('用户点击取消'); 135 | } 136 | } 137 | }) 138 | } 139 | }) -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/Balance.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | 5 | import javax.persistence.*; 6 | 7 | public class Balance { 8 | /** 9 | * 订单主键 10 | */ 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) 13 | @JSONField(name = "order_id") 14 | private Integer id; 15 | 16 | /** 17 | * 0==删除 1==显示 18 | */ 19 | @Column(name = "is_delete") 20 | @JSONField(name = "is_delete") 21 | private Integer isDelete; 22 | 23 | /** 24 | * 1==未付款2==已付款3==已失效 25 | */ 26 | @Column(name = "balance_status") 27 | @JSONField(name = "balance_status") 28 | private Integer balanceStatus; 29 | 30 | /** 31 | * 订单总价 32 | */ 33 | @Column(name = "total_price") 34 | @JSONField(name = "total_price") 35 | private Double totalPrice; 36 | 37 | /** 38 | * 小程序openid 39 | */ 40 | @Column(name = "open_id") 41 | @JSONField(name = "open_id") 42 | private String openId; 43 | 44 | /** 45 | * 创建时间 46 | */ 47 | @Column(name = "create_time") 48 | @JSONField(name = "create_time") 49 | private String createTime; 50 | 51 | /** 52 | * 修改时间 53 | */ 54 | @Column(name = "update_time") 55 | @JSONField(name = "update_time") 56 | private String updateTime; 57 | 58 | /** 59 | * 获取订单主键 60 | * 61 | * @return id - 订单主键 62 | */ 63 | public Integer getId() { 64 | return id; 65 | } 66 | 67 | /** 68 | * 设置订单主键 69 | * 70 | * @param id 订单主键 71 | */ 72 | public void setId(Integer id) { 73 | this.id = id; 74 | } 75 | 76 | /** 77 | * 获取0==删除 1==显示 78 | * 79 | * @return is_delete - 0==删除 1==显示 80 | */ 81 | public Integer getIsDelete() { 82 | return isDelete; 83 | } 84 | 85 | /** 86 | * 设置0==删除 1==显示 87 | * 88 | * @param isDelete 0==删除 1==显示 89 | */ 90 | public void setIsDelete(Integer isDelete) { 91 | this.isDelete = isDelete; 92 | } 93 | 94 | /** 95 | * 获取1==未付款2==已付款3==已失效 96 | * 97 | * @return balance_status - 1==未付款2==已付款3==已失效 98 | */ 99 | public Integer getBalanceStatus() { 100 | return balanceStatus; 101 | } 102 | 103 | /** 104 | * 设置1==未付款2==已付款3==已失效 105 | * 106 | * @param balanceStatus 1==未付款2==已付款3==已失效 107 | */ 108 | public void setBalanceStatus(Integer balanceStatus) { 109 | this.balanceStatus = balanceStatus; 110 | } 111 | 112 | /** 113 | * 获取订单总价 114 | * 115 | * @return total_price - 订单总价 116 | */ 117 | public Double getTotalPrice() { 118 | return totalPrice; 119 | } 120 | 121 | /** 122 | * 设置订单总价 123 | * 124 | * @param totalPrice 订单总价 125 | */ 126 | public void setTotalPrice(Double totalPrice) { 127 | this.totalPrice = totalPrice; 128 | } 129 | 130 | /** 131 | * 获取小程序openid 132 | * 133 | * @return open_id - 小程序openid 134 | */ 135 | public String getOpenId() { 136 | return openId; 137 | } 138 | 139 | /** 140 | * 设置小程序openid 141 | * 142 | * @param openId 小程序openid 143 | */ 144 | public void setOpenId(String openId) { 145 | this.openId = openId == null ? null : openId.trim(); 146 | } 147 | 148 | /** 149 | * 获取创建时间 150 | * 151 | * @return create_time - 创建时间 152 | */ 153 | public String getCreateTime() { 154 | return createTime; 155 | } 156 | 157 | /** 158 | * 设置创建时间 159 | * 160 | * @param createTime 创建时间 161 | */ 162 | public void setCreateTime(String createTime) { 163 | this.createTime = createTime == null ? null : createTime.trim(); 164 | } 165 | 166 | /** 167 | * 获取修改时间 168 | * 169 | * @return update_time - 修改时间 170 | */ 171 | public String getUpdateTime() { 172 | return updateTime; 173 | } 174 | 175 | /** 176 | * 设置修改时间 177 | * 178 | * @param updateTime 修改时间 179 | */ 180 | public void setUpdateTime(String updateTime) { 181 | this.updateTime = updateTime == null ? null : updateTime.trim(); 182 | } 183 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/MyCoupon.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import javax.persistence.*; 4 | 5 | @Table(name = "my_coupon") 6 | public class MyCoupon { 7 | /** 8 | * 用户主键 9 | */ 10 | @Id 11 | @GeneratedValue(strategy = GenerationType.IDENTITY) 12 | private Integer id; 13 | 14 | /** 15 | * 小程序openid 16 | */ 17 | @Column(name = "open_id") 18 | private String openId; 19 | 20 | /** 21 | * 用户昵称 22 | */ 23 | @Column(name = "user_name") 24 | private String userName; 25 | 26 | /** 27 | * 优惠券id 28 | */ 29 | private Integer yhqid; 30 | 31 | /** 32 | * 创建时间 33 | */ 34 | @Column(name = "create_time") 35 | private String createTime; 36 | 37 | /** 38 | * 更新时间 39 | */ 40 | @Column(name = "update_time") 41 | private String updateTime; 42 | 43 | /** 44 | * 失效时间 45 | */ 46 | @Column(name = "end_time") 47 | private String endTime; 48 | 49 | /** 50 | * 0==删除 1==显示 51 | */ 52 | @Column(name = "is_delete") 53 | private Integer isDelete; 54 | 55 | /** 56 | * 获取用户主键 57 | * 58 | * @return id - 用户主键 59 | */ 60 | public Integer getId() { 61 | return id; 62 | } 63 | 64 | /** 65 | * 设置用户主键 66 | * 67 | * @param id 用户主键 68 | */ 69 | public void setId(Integer id) { 70 | this.id = id; 71 | } 72 | 73 | /** 74 | * 获取小程序openid 75 | * 76 | * @return open_id - 小程序openid 77 | */ 78 | public String getOpenId() { 79 | return openId; 80 | } 81 | 82 | /** 83 | * 设置小程序openid 84 | * 85 | * @param openId 小程序openid 86 | */ 87 | public void setOpenId(String openId) { 88 | this.openId = openId == null ? null : openId.trim(); 89 | } 90 | 91 | /** 92 | * 获取用户昵称 93 | * 94 | * @return user_name - 用户昵称 95 | */ 96 | public String getUserName() { 97 | return userName; 98 | } 99 | 100 | /** 101 | * 设置用户昵称 102 | * 103 | * @param userName 用户昵称 104 | */ 105 | public void setUserName(String userName) { 106 | this.userName = userName == null ? null : userName.trim(); 107 | } 108 | 109 | /** 110 | * 获取优惠券id 111 | * 112 | * @return yhqid - 优惠券id 113 | */ 114 | public Integer getYhqid() { 115 | return yhqid; 116 | } 117 | 118 | /** 119 | * 设置优惠券id 120 | * 121 | * @param yhqid 优惠券id 122 | */ 123 | public void setYhqid(Integer yhqid) { 124 | this.yhqid = yhqid; 125 | } 126 | 127 | /** 128 | * 获取创建时间 129 | * 130 | * @return create_time - 创建时间 131 | */ 132 | public String getCreateTime() { 133 | return createTime; 134 | } 135 | 136 | /** 137 | * 设置创建时间 138 | * 139 | * @param createTime 创建时间 140 | */ 141 | public void setCreateTime(String createTime) { 142 | this.createTime = createTime == null ? null : createTime.trim(); 143 | } 144 | 145 | /** 146 | * 获取更新时间 147 | * 148 | * @return update_time - 更新时间 149 | */ 150 | public String getUpdateTime() { 151 | return updateTime; 152 | } 153 | 154 | /** 155 | * 设置更新时间 156 | * 157 | * @param updateTime 更新时间 158 | */ 159 | public void setUpdateTime(String updateTime) { 160 | this.updateTime = updateTime == null ? null : updateTime.trim(); 161 | } 162 | 163 | /** 164 | * 获取失效时间 165 | * 166 | * @return end_time - 失效时间 167 | */ 168 | public String getEndTime() { 169 | return endTime; 170 | } 171 | 172 | /** 173 | * 设置失效时间 174 | * 175 | * @param endTime 失效时间 176 | */ 177 | public void setEndTime(String endTime) { 178 | this.endTime = endTime == null ? null : endTime.trim(); 179 | } 180 | 181 | /** 182 | * 获取0==删除 1==显示 183 | * 184 | * @return is_delete - 0==删除 1==显示 185 | */ 186 | public Integer getIsDelete() { 187 | return isDelete; 188 | } 189 | 190 | /** 191 | * 设置0==删除 1==显示 192 | * 193 | * @param isDelete 0==删除 1==显示 194 | */ 195 | public void setIsDelete(Integer isDelete) { 196 | this.isDelete = isDelete; 197 | } 198 | } -------------------------------------------------------------------------------- /pre/pages/list/list.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{item.name}} 6 | 7 | 8 | 9 | 10 | 11 | {{item.name}} 12 | 13 | 14 | 15 | 16 | 17 | {{items.dish_name}} 18 | 19 | ¥ {{items.dish_price}}.00 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | {{cupNumber}} 32 | 33 | 34 | 购物车是空的 35 | ¥ {{sumMonney}}.00 36 | 37 | 38 | 39 | 选好了 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 60 | 64 | 65 | 66 | 67 | 68 | 69 | {{item.name}} 70 | {{item.detail}} 71 | 72 | 73 | 74 | 75 | 76 | {{item.count}} 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/ShopCart.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import javax.persistence.*; 4 | 5 | @Table(name = "shop_cart") 6 | public class ShopCart { 7 | /** 8 | * 购物车主键 9 | */ 10 | @Id 11 | @Column(name = "shop_cart_id") 12 | private Integer shopCartId; 13 | 14 | /** 15 | * 订单主键 16 | */ 17 | @Column(name = "balance_id") 18 | private Integer balanceId; 19 | 20 | /** 21 | * 菜单主键 22 | */ 23 | @Column(name = "dish_id") 24 | private Integer dishId; 25 | 26 | /** 27 | * 菜名 28 | */ 29 | private String name; 30 | 31 | /** 32 | * 单价 33 | */ 34 | private Double price; 35 | 36 | /** 37 | * 备注 38 | */ 39 | private String detail; 40 | 41 | /** 42 | * 购买数量 43 | */ 44 | private Integer count; 45 | 46 | /** 47 | * 创建时间 48 | */ 49 | @Column(name = "create_time") 50 | private String createTime; 51 | 52 | /** 53 | * 修改时间 54 | */ 55 | @Column(name = "update_time") 56 | private String updateTime; 57 | 58 | /** 59 | * 获取购物车主键 60 | * 61 | * @return shop_cart_id - 购物车主键 62 | */ 63 | public Integer getShopCartId() { 64 | return shopCartId; 65 | } 66 | 67 | /** 68 | * 设置购物车主键 69 | * 70 | * @param shopCartId 购物车主键 71 | */ 72 | public void setShopCartId(Integer shopCartId) { 73 | this.shopCartId = shopCartId; 74 | } 75 | 76 | /** 77 | * 获取订单主键 78 | * 79 | * @return balance_id - 订单主键 80 | */ 81 | public Integer getBalanceId() { 82 | return balanceId; 83 | } 84 | 85 | /** 86 | * 设置订单主键 87 | * 88 | * @param balanceId 订单主键 89 | */ 90 | public void setBalanceId(Integer balanceId) { 91 | this.balanceId = balanceId; 92 | } 93 | 94 | /** 95 | * 获取菜单主键 96 | * 97 | * @return dish_id - 菜单主键 98 | */ 99 | public Integer getDishId() { 100 | return dishId; 101 | } 102 | 103 | /** 104 | * 设置菜单主键 105 | * 106 | * @param dishId 菜单主键 107 | */ 108 | public void setDishId(Integer dishId) { 109 | this.dishId = dishId; 110 | } 111 | 112 | /** 113 | * 获取菜名 114 | * 115 | * @return name - 菜名 116 | */ 117 | public String getName() { 118 | return name; 119 | } 120 | 121 | /** 122 | * 设置菜名 123 | * 124 | * @param name 菜名 125 | */ 126 | public void setName(String name) { 127 | this.name = name == null ? null : name.trim(); 128 | } 129 | 130 | /** 131 | * 获取单价 132 | * 133 | * @return price - 单价 134 | */ 135 | public Double getPrice() { 136 | return price; 137 | } 138 | 139 | /** 140 | * 设置单价 141 | * 142 | * @param price 单价 143 | */ 144 | public void setPrice(Double price) { 145 | this.price = price; 146 | } 147 | 148 | /** 149 | * 获取备注 150 | * 151 | * @return detail - 备注 152 | */ 153 | public String getDetail() { 154 | return detail; 155 | } 156 | 157 | /** 158 | * 设置备注 159 | * 160 | * @param detail 备注 161 | */ 162 | public void setDetail(String detail) { 163 | this.detail = detail == null ? null : detail.trim(); 164 | } 165 | 166 | /** 167 | * 获取购买数量 168 | * 169 | * @return count - 购买数量 170 | */ 171 | public Integer getCount() { 172 | return count; 173 | } 174 | 175 | /** 176 | * 设置购买数量 177 | * 178 | * @param count 购买数量 179 | */ 180 | public void setCount(Integer count) { 181 | this.count = count; 182 | } 183 | 184 | /** 185 | * 获取创建时间 186 | * 187 | * @return create_time - 创建时间 188 | */ 189 | public String getCreateTime() { 190 | return createTime; 191 | } 192 | 193 | /** 194 | * 设置创建时间 195 | * 196 | * @param createTime 创建时间 197 | */ 198 | public void setCreateTime(String createTime) { 199 | this.createTime = createTime == null ? null : createTime.trim(); 200 | } 201 | 202 | /** 203 | * 获取修改时间 204 | * 205 | * @return update_time - 修改时间 206 | */ 207 | public String getUpdateTime() { 208 | return updateTime; 209 | } 210 | 211 | /** 212 | * 设置修改时间 213 | * 214 | * @param updateTime 修改时间 215 | */ 216 | public void setUpdateTime(String updateTime) { 217 | this.updateTime = updateTime == null ? null : updateTime.trim(); 218 | } 219 | } -------------------------------------------------------------------------------- /pre/pages/list/list.wxss: -------------------------------------------------------------------------------- 1 | /* pages/list/list.wxss */ 2 | .page{ 3 | overflow-y:hidden; 4 | } 5 | .list-left-menu{ 6 | width:160rpx; 7 | font-size:28rpx; 8 | position: absolute; 9 | left:0px; 10 | z-index: 10; 11 | } 12 | .list-left-menu-box-unselect{ 13 | padding:10rpx; 14 | border-bottom:1px solid #E3E3E3; 15 | height:72rpx; 16 | color: #6C6C6C; 17 | background:#F9F9F9; 18 | } 19 | .list-left-menu-box-selected{ 20 | padding:10rpx; 21 | height:72rpx; 22 | color: #DC143C; 23 | border-left:3px solid #DC143C; 24 | background:white; 25 | } 26 | 27 | .list-tab{ 28 | margin-left:170rpx; 29 | font-size:25rpx; 30 | background:#F3F4F6; 31 | color:#CBCCCF; 32 | padding:2px 33 | } 34 | .list-menu-name{ 35 | text-align: center; 36 | margin-top:14rpx; 37 | } 38 | .list-image-box{ 39 | width:160rpx; 40 | height:72px; 41 | text-align: center; 42 | } 43 | .content-list{ 44 | margin-left:160rpx; 45 | display:flex; 46 | border-bottom: 1px solid #E3E3E3; 47 | } 48 | .list-image{ 49 | width:108rpx; 50 | margin-top:16rpx; 51 | } 52 | .issue-name{ 53 | width:200px; 54 | font-size:30rpx; 55 | margin-top:20rpx; 56 | } 57 | .plus-icon{ 58 | float:right; 59 | color:#DC143C; 60 | font-size:46rpx; 61 | } 62 | .operate-bar{ 63 | z-index: 1001; 64 | position: absolute; 65 | bottom: 0px; 66 | height:55px; 67 | width:100%; 68 | display: flex; 69 | } 70 | .gouwuche{ 71 | width:75%; 72 | background:#353535; 73 | height: 100%; 74 | 75 | } 76 | .gouwuche-icon{ 77 | font-size:40px; 78 | color:#87888E; 79 | margin-left:10px; 80 | position: relative; 81 | } 82 | .number-msg{ 83 | padding: 1px 7px; 84 | border-radius:50%; 85 | background:red; 86 | color:white; 87 | font-size:14px; 88 | position: absolute; 89 | text-align: center; 90 | top:0px; 91 | right:-5px; 92 | } 93 | 94 | .gouwuche-price{ 95 | color:#A9A9A9; 96 | display:flex; 97 | align-items: center; 98 | margin-left:10px; 99 | font-size:15px 100 | } 101 | .submit-btn{ 102 | height:100%; 103 | background:#F7F7F7; 104 | width:25%; 105 | display:flex; 106 | } 107 | .submit-btn-label{ 108 | color:#A9A9A9; 109 | font-size:15px; 110 | margin:auto; 111 | } 112 | 113 | .drawer_screen { 114 | width: 100%; 115 | height: 100%; 116 | position: fixed; 117 | top: 0; 118 | left: 0; 119 | z-index: 1000; 120 | background: #000; 121 | opacity: 0.5; 122 | overflow: hidden; 123 | } 124 | 125 | .drawer_box_ad { 126 | width: 100%; 127 | height: 90%; 128 | overflow: hidden; 129 | position: fixed; 130 | bottom: 0; 131 | z-index: 1001; 132 | background: #FFFFFF; 133 | border-top-right-radius: 5px; 134 | border-top-left-radius: 5px; 135 | } 136 | .cartlist-float{ 137 | width: 100%; 138 | overflow: hidden; 139 | position: fixed; 140 | z-index: 1001; 141 | bottom: 55px; 142 | max-height: 250px; 143 | } 144 | 145 | .select-line-nav{ 146 | font-size:12px; 147 | margin-left:5px; 148 | margin-top:10px; 149 | color:#ABABAB; 150 | } 151 | 152 | .select-tab{ 153 | padding:5px 7px; 154 | border:1px solid #ABABAB; 155 | font-size:12px; 156 | border-radius:5px; 157 | margin:5px; 158 | color:#ABABAB; 159 | z-index:1002; 160 | } 161 | .select-active{ 162 | color:#DC143C; 163 | border:1px solid #DC143C; 164 | } 165 | .select-price{ 166 | font-size:14px; 167 | color:#DC143C; 168 | margin-top:20px; 169 | display:flex; 170 | align-items: center; 171 | margin-left:10px; 172 | } 173 | .btn-putIn{ 174 | height:40px; 175 | width:100px; 176 | font-size:14px; 177 | background:#DC143C; 178 | color:white; 179 | margin-right:20px; 180 | } 181 | 182 | 183 | .activity-color{ 184 | color:#DC143C; 185 | } 186 | .color-white{ 187 | color:white; 188 | } 189 | .activity-color-bg{ 190 | background:#DC143C; 191 | } 192 | 193 | .label-cart-bar{ 194 | color:#878787; 195 | font-size:12px; 196 | border-left:4px solid #DC143C; 197 | margin-left: 20px; 198 | } 199 | .icon-clear{ 200 | color:#878787; 201 | float: right; 202 | margin-right: 10px; 203 | } 204 | .label-clear{ 205 | color:#878787; 206 | font-size: 12px; 207 | } 208 | .cart-list-box{ 209 | background:#FFFFFF; 210 | display:flex; 211 | font-size:13px; 212 | } 213 | .list-info{ 214 | width:50%; 215 | padding:5px 15px; 216 | } 217 | .list-info-size{ 218 | font-size:10px; 219 | color:#B1B1B1; 220 | } 221 | .icon-li-circle{ 222 | margin-left:15px; 223 | font-size:20px 224 | } 225 | .font20{ 226 | font-size:20px 227 | } 228 | .cart-scroll-list{ 229 | height:450rpx; 230 | } 231 | .cut-bar{ 232 | height:20px; 233 | position: fixed; 234 | bottom:55px; 235 | background:#FFCD9B; 236 | width:100%; 237 | color:#FFF7EC; 238 | font-size:12px; 239 | text-align:center; 240 | } -------------------------------------------------------------------------------- /pre/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | height: 100%; 4 | width: 100%; 5 | } 6 | .go-center{ 7 | display:flex; 8 | justify-content:center; 9 | } 10 | .down-center{ 11 | display:flex; 12 | align-items:center; 13 | } 14 | .flex-display{ 15 | display:flex 16 | } 17 | @font-face { 18 | font-family: 'iconfont'; 19 | src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAwUAA0AAAAAEPQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAL+AAAABoAAAAcgCbwlUdERUYAAAvcAAAAHAAAAB4AJwAXT1MvMgAAAaAAAABDAAAAVlcGSdtjbWFwAAACGAAAAHcAAAGSgQaJm2dhc3AAAAvUAAAACAAAAAj//wADZ2x5ZgAAArQAAAdLAAAJyNpCj9NoZWFkAAABMAAAAC8AAAA2DyKbXmhoZWEAAAFgAAAAHgAAACQH3wPZaG10eAAAAeQAAAAzAAAANiMWA4tsb2NhAAACkAAAACQAAAAkEfoULm1heHAAAAGAAAAAHwAAACABIwCObmFtZQAACgAAAAFJAAACiCnmEVVwb3N0AAALTAAAAIYAAADAozke5nicY2BkYGAAYrETO/fE89t8ZeBmYQCBa4za2xH0/wQWRubJQC4HAxNIFAAbJgl6AHicY2BkYGBu+N/AEMPixwAELIwMjAyogAsATsECwgAAeJxjYGRgYBBkaGLgYAABJiDmAkIGhv9gPgMAF38BsgB4nGNgZOFgnMDAysDA1Ml0hoGBoR9CM75mMGLkAIoysDIzYAUBaa4pDA4MFc/PMjf8b2CIYZ7CsAAozAiSAwDksAx3AHicY2GAAMZQBgbmlww6LAwMD1lcGJKBtA0Q27H4MTAAaVsGBwYVhqNA0pERqBoAl3UFwwB4nGNgYGBmgGAZBkYGEOgB8hjBfBaGAiAtwSAAFOFgqHjG+IzzmcAz6WcKz9Keazy3ee79/Oz//0AVMBmpZ3LIMv+7pZgl/0h+k3wr+VpymcRTiUsSRyScobZgBYxsDHBpRiYgwYSuALdeSgEz7YwmCQAAPSQmkgAAAAAAAAAAAAB2AIwA+gFcAaACPAKuAuYDqgPQBBAEcASCBOR4nG1Wa4wbVxW+517PjO2xZzxjz4zttT0eP2Y2663Xb3fJPrPbbnbZotJIVaEsIkkVKqEGRNtkoUG79IEikR+VQEi8JJSgwo+EgBoiUEK6VGnTf7QRP1hKkq1aQUN+oP0FEjtjznh320TU8txz7uvcOed89ztDODLce49dZkkSJ4OkTmbJw4QAX4GCRLNgOa0qrYBmcZqRkJhTdCyhWKiycTAKfEJvdFq2wQu8DBLkoGk1Ok6VOtBuTdC90NCzAKmB9AG1nFHZyxBOOrmXvAV6GjSzmJEn7vPmhycTjXw8eDyiqilVPRXkOS5IaUCW4ClDD3GhMO/9nJPT2mVzDzUhknLSi5+L5gfUgydbR7NlIwSwugrxgbz0i0klreD/RFqPqykhFg0m09FiKQHHPxCT8UjWfp/gj5L3SI/26DThCE9IiBpdo0t73qa3Wb95sw41ULx/1Tc26riWJ4d7T7Hb7HskSgbIOJkmD5B5jEyjMw4tu8BnIaH7Dt/V6xY1CYQqOO2PFZRKDgxrArpKFZjVtrSdB17QMpmhTEaDuR3lh3tgulafhiWYrten6ODoIqWLo/Qbo4sAi4fcv9DB3Yd+P6P9FHfd2/zgGdyMe5/ZlTB/vzvXXQBY6NLf3z/vLU3dmL4xTUiAjPW+xDboPzDnedIhXUI4p0MdOyDwqqEHuoY+AbZTtmm3UzJ0VeADTtwuCBJ6afhJd6rQ6nRRCuzta4+mj37Lu3bsq+HjXwfr2bfkwQzIbvpQaOkgcE8eDn7hkPffJx8VNCGdyaQFTQ6qiYQaDKYWLj0H+a98Lbx8wnvz2BFh6ZJEc4584eNNXz4cWoKnBWFg38K+tCAngvFauxYPJoKan0tGJnp/ZK+zSSISgziYGQw1RhoDjXHG2KOCXQniVsF26hM+OnWjLgElr3kc57223b5yg+NuvNJvDe87kRhALALf7Es2GXCvXHED/XbrD7vLsIUjSiSi+A8hQUJ6V9kZNoOIiZE0vkkLsfJFcpQQZZQDqwptxVISPCjbeGkrULDbSqvT0DUcbn5ix1Ak3wcfW3gRfXTxBXsc0KUm+qQlePRLQNOOhkMWDrGSt4B35ME9XjguwUUp7h0KiaIiij8KimJMFH/V7wGIn44oUvhEWFKSClSLJ4pVUN6FnO5e1HOAki6gpOtbd2DQpAfcc+Ygfdr9sxSPS3TYPSUG6bNoL+h+12/v0kP0JTwg5D4XEulbEIvOhSUpPBeNoYYn4EGoZ3ZOMJAVsgZicLz3J3aFDWH2Rshe5B0CVRgBu1jgBcylEUdCaXTR57aQwBG+yNsOszv+SLdhIt0Ywl0ZFwq2H7gEz67QscqbYXHosZx3Ms9lXXmP5piwbA1N5A3vZCTGqUFXpFFYTsyYAv+GloPrnf2U7u905iid6yRNc8Q06a+HZwQGZto7bx4oeH9XlTQ8kjt8HzXnde98GPggDEhWBD6rGgCMFRIioIH90G9/61sYMX2+meqtsTVWwXuG3bKftDpmrdNFdDYxzYJevgupbA321d0j9SkAhY6///KpW5PU8KYfX6Z0+fF+W6tNAp0cKaTh4ccOPARZj734xBMvsn5L/Htd6q0GgK1iTOfII+TbGFO8qkWrgAzNI6q2ObqtTEC5axk6L2Cs7RGMu4OvJkHhE1WhiDagiMD0OV1TmkhkPio1pYiGuh+lo6//n6qwfz7AxUXXEhOBB/XcCGgx+m9Zr+W2VsbouTFJsygFXpDFiu1URF6OCHK44qDKxSKCJFYceyjCywHGZTSq3wkEblKuBvnUzVT+vFnE9QF+Z0OY39nQV0W0WMzTi78RJUm8+Kljw+7bsq7LtF0+bv7sx0Of0SleBiNVo7SWiuj3aFVKG+lIEqi16H4eHMoFmLcOTiqfT6HcFIaTOBkxkriunvR3JOu7mj4seEGfm97orbK9mIcAVg8kCbCQA6AP0RzwZeywlHuWHvOu6tnscAZyngd/Y6tbuH5rFgcyldwv6TV3lGxj6HXE0ASyy3D/jmBhTuRoY4K2bFbUtpmh6Nvei4W341fdZv8ijE+duXBmZXZ2ZVv8ZE3NqGuSqkq7Cr00NTOzcvrC6ZVt4X1wz3RfQV+mkWevsikSQhSP9VG8Xfgd6yMtbhctBIlT9D8KfJSYEPernj+J6EOIlRES8Y4NBwdKpU6pNABrO8rJlO2uUL5VGvSPHBRVMLtcs0SDftf9jxijPGyVmlyTRafA39Epwa6kL2SjpSrga8Yir3rPoxofQLVsIuNA3hjy6wQAIXcYoRrWfAICV3YEGBsDAmTsKtVGNzdHf4c+kt7zrIf5EknT9xF4IujEwMpoE9b2C7ygoXtN35+KT0DIGn7pRx93XJaQ28CfLvDQW/c2eB7y63+FPM97G5eVdAzO3pav+4R4Xb59FmJp5dyH8jtRRYm+I3/ovQvNh5r4Z6ucd2t93bvFYeFYXwdra3Z3zTn8uPFN+GXHN6H4FuBVp9HAnejm/wCwC+UoAHicfZA9TgMxEIWf8wckEkIgqF1RANr8lCkTKfQIpaNINt6QaNdeeZ1IOQEtFQeg5RgcgBsg0XIKXpZJkyJr7ejzm5nnsQGc4xsK/98l7oQVjvEoXMERMuEq9RfhGvlduI4WPoUb1H+Em7hVA+EWLtQbHVTthLub0m3LCmcYCFdwiifhKvWVcI38KlzHFT6EG9S/hJsY41e4hWtlqQzhYTBBYJxBY4oN4wIxHCySMgbWoTn0ZhLMTE83ehE7mzgbKO9XYpcDHmg554Ap7T23Zr5KJ/5gy4HUmG4eBUu2KY0uInQoG18snNXdqHOw/Z7ttrTYv2uBNcfsUQ1s1Pw92zPSSGwMr5CSNfIyt6QSU49oa6zxu2cp1vNeCIlOvMv0iMeaNHU6925p4sDi5/KMHH20uZI996gcPmNZCHm/3U7EIIpdhj+T2HEZAAAAeJxtTcsOgjAQ7GAFBNTwK/6Op4bWdgnphsCm8vcWuXhwkpl9zCSjCnWgUf/RZ0IV6okCJ2icUaJCjQsatOhwxa1/k4l+CVnGvK0slaXorYmaBo56f9aTGWnl6JuNJQjNkt3E1pVLYNmOMVKbs8Hw40XT1HmWJENw+3H/dmT5bUiOPtfkL70AAAAAAAH//wACeJxjYGRgYOABYjEgZmJgBEIBIGYB8xgABE4AP3icY2BgYGQAgisqM9VA9DVG7e0wGgA3UQUrAAA=) format('woff'), 20 | url('iconfont.ttf') format('truetype'); 21 | font-weight: normal; 22 | font-style: normal; 23 | } 24 | 25 | .iconfont { 26 | font-family:"iconfont" !important; 27 | font-size:16px; 28 | font-style:normal; 29 | -webkit-font-smoothing: antialiased; 30 | -moz-osx-font-smoothing: grayscale; 31 | } 32 | 33 | .icon-icon:before { content: "\e610"; } 34 | 35 | .icon-youhuiquan:before { content: "\e61e"; } 36 | 37 | .icon-lajitong:before { content: "\e61b"; } 38 | 39 | .icon-jiahao2fill:before { content: "\e728"; } 40 | 41 | .icon-gouwuchefill:before { content: "\e73c"; } 42 | 43 | .icon-xiangshangjiantou:before { content: "\e601"; } 44 | 45 | .icon-jian:before { content: "\e61a"; } 46 | 47 | .icon-xiangxiajiantou:before { content: "\e74b"; } 48 | 49 | .icon-dingdan:before { content: "\e609"; } 50 | 51 | .icon-shouye:before { content: "\e620"; } 52 | 53 | .icon-wode:before { content: "\e61f"; } 54 | 55 | .icon-dingwei:before { content: "\e7cd"; } 56 | 57 | .icon-shouji:before { content: "\e666"; } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/Reserve.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | 5 | import javax.persistence.*; 6 | 7 | public class Reserve { 8 | /** 9 | * 预约主键 10 | */ 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) 13 | private Integer id; 14 | 15 | /** 16 | * 小程序openId 17 | */ 18 | @Column(name = "open_id") 19 | @JSONField(name = "open_id") 20 | private String openId; 21 | 22 | /** 23 | * 用户id 24 | */ 25 | @Column(name = "user_id") 26 | @JSONField(name = "user_id") 27 | private Integer userId; 28 | 29 | /** 30 | * 桌子id 31 | */ 32 | @Column(name = "table_id") 33 | @JSONField(name = "table_id") 34 | private Integer tableId; 35 | 36 | /** 37 | * 预约号码 38 | */ 39 | @Column(name = "reserve_no") 40 | @JSONField(name = "reserve_no") 41 | private String reserveNo; 42 | 43 | /** 44 | * 0==失效 1==预约 2== 等待 3==无法预约 45 | */ 46 | @Column(name = "reserve_status") 47 | @JSONField(name = "reserve_status") 48 | private Integer reserveStatus; 49 | 50 | /** 51 | * 预约时间 52 | */ 53 | @Column(name = "reserve_date") 54 | @JSONField(name = "reserve_date") 55 | private String reserveDate; 56 | 57 | /** 58 | * 创建时间 59 | */ 60 | @Column(name = "create_time") 61 | @JSONField(name = "create_time") 62 | private String createTime; 63 | 64 | /** 65 | * 更新时间 66 | */ 67 | @Column(name = "update_time") 68 | @JSONField(name = "update_time") 69 | private String updateTime; 70 | 71 | /** 72 | * 0==删除 1==显示 73 | */ 74 | @Column(name = "is_delete") 75 | @JSONField(name = "is_delete") 76 | private Integer isDelete; 77 | 78 | /** 79 | * 获取预约主键 80 | * 81 | * @return id - 预约主键 82 | */ 83 | public Integer getId() { 84 | return id; 85 | } 86 | 87 | /** 88 | * 设置预约主键 89 | * 90 | * @param id 预约主键 91 | */ 92 | public void setId(Integer id) { 93 | this.id = id; 94 | } 95 | 96 | /** 97 | * 获取小程序openId 98 | * 99 | * @return open_id - 小程序openId 100 | */ 101 | public String getOpenId() { 102 | return openId; 103 | } 104 | 105 | /** 106 | * 设置小程序openId 107 | * 108 | * @param openId 小程序openId 109 | */ 110 | public void setOpenId(String openId) { 111 | this.openId = openId == null ? null : openId.trim(); 112 | } 113 | 114 | /** 115 | * 获取用户id 116 | * 117 | * @return user_id - 用户id 118 | */ 119 | public Integer getUserId() { 120 | return userId; 121 | } 122 | 123 | /** 124 | * 设置用户id 125 | * 126 | * @param userId 用户id 127 | */ 128 | public void setUserId(Integer userId) { 129 | this.userId = userId; 130 | } 131 | 132 | /** 133 | * 获取桌子id 134 | * 135 | * @return table_id - 桌子id 136 | */ 137 | public Integer getTableId() { 138 | return tableId; 139 | } 140 | 141 | /** 142 | * 设置桌子id 143 | * 144 | * @param tableId 桌子id 145 | */ 146 | public void setTableId(Integer tableId) { 147 | this.tableId = tableId; 148 | } 149 | 150 | /** 151 | * 获取预约号码 152 | * 153 | * @return reserve_no - 预约号码 154 | */ 155 | public String getReserveNo() { 156 | return reserveNo; 157 | } 158 | 159 | /** 160 | * 设置预约号码 161 | * 162 | * @param reserveNo 预约号码 163 | */ 164 | public void setReserveNo(String reserveNo) { 165 | this.reserveNo = reserveNo == null ? null : reserveNo.trim(); 166 | } 167 | 168 | /** 169 | * 获取0==失效 1==预约 2== 等待 3==无法预约 170 | * 171 | * @return reserve_status - 0==失效 1==预约 2== 等待 3==无法预约 172 | */ 173 | public Integer getReserveStatus() { 174 | return reserveStatus; 175 | } 176 | 177 | /** 178 | * 设置0==失效 1==预约 2== 等待 3==无法预约 179 | * 180 | * @param reserveStatus 0==失效 1==预约 2== 等待 3==无法预约 181 | */ 182 | public void setReserveStatus(Integer reserveStatus) { 183 | this.reserveStatus = reserveStatus; 184 | } 185 | 186 | /** 187 | * 获取预约时间 188 | * 189 | * @return reserve_date - 预约时间 190 | */ 191 | public String getReserveDate() { 192 | return reserveDate; 193 | } 194 | 195 | /** 196 | * 设置预约时间 197 | * 198 | * @param reserveDate 预约时间 199 | */ 200 | public void setReserveDate(String reserveDate) { 201 | this.reserveDate = reserveDate == null ? null : reserveDate.trim(); 202 | } 203 | 204 | /** 205 | * 获取创建时间 206 | * 207 | * @return create_time - 创建时间 208 | */ 209 | public String getCreateTime() { 210 | return createTime; 211 | } 212 | 213 | /** 214 | * 设置创建时间 215 | * 216 | * @param createTime 创建时间 217 | */ 218 | public void setCreateTime(String createTime) { 219 | this.createTime = createTime == null ? null : createTime.trim(); 220 | } 221 | 222 | /** 223 | * 获取更新时间 224 | * 225 | * @return update_time - 更新时间 226 | */ 227 | public String getUpdateTime() { 228 | return updateTime; 229 | } 230 | 231 | /** 232 | * 设置更新时间 233 | * 234 | * @param updateTime 更新时间 235 | */ 236 | public void setUpdateTime(String updateTime) { 237 | this.updateTime = updateTime == null ? null : updateTime.trim(); 238 | } 239 | 240 | /** 241 | * 获取0==删除 1==显示 242 | * 243 | * @return is_delete - 0==删除 1==显示 244 | */ 245 | public Integer getIsDelete() { 246 | return isDelete; 247 | } 248 | 249 | /** 250 | * 设置0==删除 1==显示 251 | * 252 | * @param isDelete 0==删除 1==显示 253 | */ 254 | public void setIsDelete(Integer isDelete) { 255 | this.isDelete = isDelete; 256 | } 257 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/mybatis/model/Dish.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.mybatis.model; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | 5 | import javax.persistence.*; 6 | 7 | public class Dish { 8 | /** 9 | * 菜的主键 10 | */ 11 | @Id 12 | @Column(name = "dish_id") 13 | @JSONField(name = "dish_id") 14 | private Integer dishId; 15 | 16 | /** 17 | * 菜名 18 | */ 19 | @Column(name = "dish_name") 20 | @JSONField(name = "dish_name") 21 | private String dishName; 22 | 23 | /** 24 | * 菜的路径 25 | */ 26 | @Column(name = "dish_url") 27 | @JSONField(name = "dish_url") 28 | private String dishUrl; 29 | 30 | /** 31 | * 1==不辣 2==微辣 3==中辣 4==超辣 32 | */ 33 | @Column(name = "hot_status") 34 | @JSONField(name = "hot_status") 35 | private Integer hotStatus; 36 | 37 | /** 38 | * 点赞次数 39 | */ 40 | @Column(name = "praise_times") 41 | @JSONField(name = "praise_times") 42 | private Integer praiseTimes; 43 | 44 | /** 45 | * 0==不是招牌 1==招牌 46 | */ 47 | @Column(name = "is_sign") 48 | @JSONField(name = "is_sign") 49 | private Integer isSign; 50 | 51 | /** 52 | * 0==不是新品 1=新品 53 | */ 54 | @Column(name = "is_new_dish") 55 | @JSONField(name = "is_new_dish") 56 | private Integer isNewDish; 57 | 58 | /** 59 | * 菜的销量 60 | */ 61 | @Column(name = "sales_volume") 62 | @JSONField(name = "sales_volume") 63 | private Integer salesVolume; 64 | 65 | /** 66 | * 菜的价格 67 | */ 68 | @Column(name = "dish_price") 69 | @JSONField(name = "dish_price") 70 | private Double dishPrice; 71 | 72 | /** 73 | * 1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 74 | */ 75 | @Column(name = "dish_type") 76 | @JSONField(name = "dish_type") 77 | private Integer dishType; 78 | 79 | /** 80 | * 菜的描述 81 | */ 82 | @Column(name = "dish_description") 83 | @JSONField(name = "dish_description") 84 | private String dishDescription; 85 | 86 | /** 87 | * 获取菜的主键 88 | * 89 | * @return dish_id - 菜的主键 90 | */ 91 | public Integer getDishId() { 92 | return dishId; 93 | } 94 | 95 | /** 96 | * 设置菜的主键 97 | * 98 | * @param dishId 菜的主键 99 | */ 100 | public void setDishId(Integer dishId) { 101 | this.dishId = dishId; 102 | } 103 | 104 | /** 105 | * 获取菜名 106 | * 107 | * @return dish_name - 菜名 108 | */ 109 | public String getDishName() { 110 | return dishName; 111 | } 112 | 113 | /** 114 | * 设置菜名 115 | * 116 | * @param dishName 菜名 117 | */ 118 | public void setDishName(String dishName) { 119 | this.dishName = dishName == null ? null : dishName.trim(); 120 | } 121 | 122 | /** 123 | * 获取菜的路径 124 | * 125 | * @return dish_url - 菜的路径 126 | */ 127 | public String getDishUrl() { 128 | return dishUrl; 129 | } 130 | 131 | /** 132 | * 设置菜的路径 133 | * 134 | * @param dishUrl 菜的路径 135 | */ 136 | public void setDishUrl(String dishUrl) { 137 | this.dishUrl = dishUrl == null ? null : dishUrl.trim(); 138 | } 139 | 140 | /** 141 | * 获取1==不辣 2==微辣 3==中辣 4==超辣 142 | * 143 | * @return hot_status - 1==不辣 2==微辣 3==中辣 4==超辣 144 | */ 145 | public Integer getHotStatus() { 146 | return hotStatus; 147 | } 148 | 149 | /** 150 | * 设置1==不辣 2==微辣 3==中辣 4==超辣 151 | * 152 | * @param hotStatus 1==不辣 2==微辣 3==中辣 4==超辣 153 | */ 154 | public void setHotStatus(Integer hotStatus) { 155 | this.hotStatus = hotStatus; 156 | } 157 | 158 | /** 159 | * 获取点赞次数 160 | * 161 | * @return praise_times - 点赞次数 162 | */ 163 | public Integer getPraiseTimes() { 164 | return praiseTimes; 165 | } 166 | 167 | /** 168 | * 设置点赞次数 169 | * 170 | * @param praiseTimes 点赞次数 171 | */ 172 | public void setPraiseTimes(Integer praiseTimes) { 173 | this.praiseTimes = praiseTimes; 174 | } 175 | 176 | /** 177 | * 获取0==不是招牌 1==招牌 178 | * 179 | * @return is_sign - 0==不是招牌 1==招牌 180 | */ 181 | public Integer getIsSign() { 182 | return isSign; 183 | } 184 | 185 | /** 186 | * 设置0==不是招牌 1==招牌 187 | * 188 | * @param isSign 0==不是招牌 1==招牌 189 | */ 190 | public void setIsSign(Integer isSign) { 191 | this.isSign = isSign; 192 | } 193 | 194 | /** 195 | * 获取0==不是新品 1=新品 196 | * 197 | * @return is_new_dish - 0==不是新品 1=新品 198 | */ 199 | public Integer getIsNewDish() { 200 | return isNewDish; 201 | } 202 | 203 | /** 204 | * 设置0==不是新品 1=新品 205 | * 206 | * @param isNewDish 0==不是新品 1=新品 207 | */ 208 | public void setIsNewDish(Integer isNewDish) { 209 | this.isNewDish = isNewDish; 210 | } 211 | 212 | /** 213 | * 获取菜的销量 214 | * 215 | * @return sales_volume - 菜的销量 216 | */ 217 | public Integer getSalesVolume() { 218 | return salesVolume; 219 | } 220 | 221 | /** 222 | * 设置菜的销量 223 | * 224 | * @param salesVolume 菜的销量 225 | */ 226 | public void setSalesVolume(Integer salesVolume) { 227 | this.salesVolume = salesVolume; 228 | } 229 | 230 | /** 231 | * 获取菜的价格 232 | * 233 | * @return dish_price - 菜的价格 234 | */ 235 | public Double getDishPrice() { 236 | return dishPrice; 237 | } 238 | 239 | /** 240 | * 设置菜的价格 241 | * 242 | * @param dishPrice 菜的价格 243 | */ 244 | public void setDishPrice(Double dishPrice) { 245 | this.dishPrice = dishPrice; 246 | } 247 | 248 | /** 249 | * 获取1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 250 | * 251 | * @return dish_type - 1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 252 | */ 253 | public Integer getDishType() { 254 | return dishType; 255 | } 256 | 257 | /** 258 | * 设置1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 259 | * 260 | * @param dishType 1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水 261 | */ 262 | public void setDishType(Integer dishType) { 263 | this.dishType = dishType; 264 | } 265 | 266 | /** 267 | * 获取菜的描述 268 | * 269 | * @return dish_description - 菜的描述 270 | */ 271 | public String getDishDescription() { 272 | return dishDescription; 273 | } 274 | 275 | /** 276 | * 设置菜的描述 277 | * 278 | * @param dishDescription 菜的描述 279 | */ 280 | public void setDishDescription(String dishDescription) { 281 | this.dishDescription = dishDescription == null ? null : dishDescription.trim(); 282 | } 283 | } -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Migwn, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | # TODO classpath? 118 | fi 119 | 120 | if [ -z "$JAVA_HOME" ]; then 121 | javaExecutable="`which javac`" 122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 123 | # readlink(1) is not available as standard on Solaris 10. 124 | readLink=`which readlink` 125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 126 | if $darwin ; then 127 | javaHome="`dirname \"$javaExecutable\"`" 128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 129 | else 130 | javaExecutable="`readlink -f \"$javaExecutable\"`" 131 | fi 132 | javaHome="`dirname \"$javaExecutable\"`" 133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 134 | JAVA_HOME="$javaHome" 135 | export JAVA_HOME 136 | fi 137 | fi 138 | fi 139 | 140 | if [ -z "$JAVACMD" ] ; then 141 | if [ -n "$JAVA_HOME" ] ; then 142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 143 | # IBM's JDK on AIX uses strange locations for the executables 144 | JAVACMD="$JAVA_HOME/jre/sh/java" 145 | else 146 | JAVACMD="$JAVA_HOME/bin/java" 147 | fi 148 | else 149 | JAVACMD="`which java`" 150 | fi 151 | fi 152 | 153 | if [ ! -x "$JAVACMD" ] ; then 154 | echo "Error: JAVA_HOME is not defined correctly." >&2 155 | echo " We cannot execute $JAVACMD" >&2 156 | exit 1 157 | fi 158 | 159 | if [ -z "$JAVA_HOME" ] ; then 160 | echo "Warning: JAVA_HOME environment variable is not set." 161 | fi 162 | 163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 164 | 165 | # traverses directory structure from process work directory to filesystem root 166 | # first directory with .mvn subdirectory is considered project base directory 167 | find_maven_basedir() { 168 | 169 | if [ -z "$1" ] 170 | then 171 | echo "Path not specified to find_maven_basedir" 172 | return 1 173 | fi 174 | 175 | basedir="$1" 176 | wdir="$1" 177 | while [ "$wdir" != '/' ] ; do 178 | if [ -d "$wdir"/.mvn ] ; then 179 | basedir=$wdir 180 | break 181 | fi 182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 183 | if [ -d "${wdir}" ]; then 184 | wdir=`cd "$wdir/.."; pwd` 185 | fi 186 | # end of workaround 187 | done 188 | echo "${basedir}" 189 | } 190 | 191 | # concatenates all lines of a file 192 | concat_lines() { 193 | if [ -f "$1" ]; then 194 | echo "$(tr -s '\n' ' ' < "$1")" 195 | fi 196 | } 197 | 198 | BASE_DIR=`find_maven_basedir "$(pwd)"` 199 | if [ -z "$BASE_DIR" ]; then 200 | exit 1; 201 | fi 202 | 203 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 204 | echo $MAVEN_PROJECTBASEDIR 205 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 206 | 207 | # For Cygwin, switch paths to Windows format before running java 208 | if $cygwin; then 209 | [ -n "$M2_HOME" ] && 210 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 211 | [ -n "$JAVA_HOME" ] && 212 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 213 | [ -n "$CLASSPATH" ] && 214 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 215 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 216 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 217 | fi 218 | 219 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 220 | 221 | exec "$JAVACMD" \ 222 | $MAVEN_OPTS \ 223 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 224 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 225 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 226 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.wx 7 | restaurant 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | restaurant 12 | Restaurant project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.0.4.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-web 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-test 36 | test 37 | 38 | 39 | 40 | org.springframework.boot 41 | spring-boot-starter-web 42 | 43 | 49 | 50 | 51 | 57 | 58 | 59 | 60 | com.alibaba 61 | druid 62 | 1.1.6 63 | 64 | 65 | 66 | com.google.code.gson 67 | gson 68 | 2.8.2 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | mysql 79 | mysql-connector-java 80 | 5.1.45 81 | 82 | 83 | 84 | org.springframework.boot 85 | spring-boot-starter-jdbc 86 | 87 | 88 | 89 | org.springframework.boot 90 | spring-boot-starter-thymeleaf 91 | 92 | 93 | 94 | 95 | net.sourceforge.nekohtml 96 | nekohtml 97 | 1.9.22 98 | 99 | 100 | 101 | org.springframework.boot 102 | spring-boot-devtools 103 | true 104 | 105 | 106 | 107 | org.apache.commons 108 | commons-lang3 109 | 3.1 110 | 111 | 112 | commons-beanutils 113 | commons-beanutils 114 | 1.9.3 115 | 116 | 117 | 118 | 119 | org.mybatis.spring.boot 120 | mybatis-spring-boot-starter 121 | 1.3.1 122 | 123 | 124 | 125 | tk.mybatis 126 | mapper-spring-boot-starter 127 | 1.1.7 128 | 129 | 130 | tk.mybatis 131 | mapper 132 | 4.0.0 133 | 134 | 135 | 136 | com.github.pagehelper 137 | pagehelper-spring-boot-starter 138 | 1.2.3 139 | 140 | 141 | 142 | com.alibaba 143 | fastjson 144 | 1.2.42 145 | 146 | 147 | 148 | com.aliyun 149 | aliyun-java-sdk-core 150 | 3.2.8 151 | 152 | 153 | com.aliyun 154 | aliyun-java-sdk-dysmsapi 155 | 1.1.0 156 | 157 | 158 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | org.mybatis.generator 180 | mybatis-generator-maven-plugin 181 | 1.3.2 182 | 183 | 184 | tk.mybatis 185 | mapper 186 | 3.4.4 187 | 188 | 189 | 190 | 191 | src/main/resources/generator/generatorConfig.xml 192 | true 193 | 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /pre/pages/list/list.js: -------------------------------------------------------------------------------- 1 | const app = getApp(); 2 | // pages/list/list.js 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | listData: [], 10 | activeIndex: 0, 11 | toView: 'a0', 12 | scrollTop: 100, 13 | screenWidth: 667, 14 | showModalStatus: false, 15 | cartList: [], 16 | sumMonney: 0, 17 | showCart: false, 18 | loading: false 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面加载 23 | */ 24 | onLoad: function(options) { 25 | var that = this; 26 | // var sysinfo = wx.getSystemInfoSync().windowHeight; 27 | // console.log(sysinfo) 28 | wx.showLoading({ 29 | title: '数据加载中', 30 | }) 31 | //将本来的后台换成了easy-mock 的接口,所有数据一次请求完 略大。。 32 | wx.request({ 33 | url: app.globalData.host + '/dish/list', 34 | method: 'GET', 35 | data: {}, 36 | header: { 37 | 'Accept': 'application/json' 38 | }, 39 | success: function(res) { 40 | wx.hideLoading(); 41 | // console.log(res); 42 | that.setData({ 43 | listData: res.data, 44 | loading: true 45 | }) 46 | } 47 | }) 48 | }, 49 | selectMenu: function(e) { 50 | var index = e.currentTarget.dataset.index 51 | // console.log(index) 52 | this.setData({ 53 | activeIndex: index, 54 | toView: 'a' + index, 55 | }) 56 | console.log(this.data.toView); 57 | }, 58 | scroll: function(e) { 59 | var dis = e.detail.scrollTop; 60 | // console.log(dis); 61 | if (dis > 0 && dis < 385) { 62 | this.setData({ 63 | activeIndex: 0, 64 | }) 65 | } 66 | if (dis > 385 && dis < 772) { 67 | this.setData({ 68 | activeIndex: 1, 69 | }) 70 | } 71 | if (dis > 772 && dis < 1157) { 72 | this.setData({ 73 | activeIndex: 2, 74 | }) 75 | } 76 | if (dis > 1157 && dis < 2273) { 77 | this.setData({ 78 | activeIndex: 3, 79 | }) 80 | } 81 | if (dis > 2273 && dis < 3389) { 82 | this.setData({ 83 | activeIndex: 4, 84 | }) 85 | } 86 | if (dis > 3389 && dis < 3775) { 87 | this.setData({ 88 | activeIndex: 5, 89 | }) 90 | } 91 | if (dis > 3775) { 92 | this.setData({ 93 | activeIndex: 6, 94 | }) 95 | } 96 | }, 97 | /** 98 | * 生命周期函数--监听页面初次渲染完成 99 | */ 100 | selectInfo: function(e) { 101 | // console.log(e); 102 | var type = e.currentTarget.dataset.type; 103 | var index = e.currentTarget.dataset.index; 104 | this.setData({ 105 | showModalStatus: !this.data.showModalStatus 106 | }); 107 | }, 108 | 109 | addToCart: function(e) { 110 | var isHave = false; 111 | var a = this.data; 112 | var cartList = this.data.cartList; 113 | var t = e.currentTarget.dataset.type; 114 | var i = e.currentTarget.dataset.index; 115 | var addItem = {}; 116 | if (cartList.length) { 117 | try { 118 | cartList.forEach(function(item) { 119 | if (item.dish_id == a.listData[t].foods[i].dish_id) { 120 | item.count += 1; 121 | isHave = true; 122 | throw new Error("break foreach"); 123 | } 124 | }) 125 | } catch (e) { 126 | if (e.message != 'break foreach') { 127 | console.log(e); 128 | } 129 | } 130 | if (!isHave) { 131 | addItem = { 132 | "dish_id": a.listData[t].foods[i].dish_id, 133 | "name": a.listData[t].foods[i].dish_name, 134 | "price": a.listData[t].foods[i].dish_price, 135 | "detail": a.listData[t].foods[i].dish_description, 136 | "count": 1 137 | } 138 | cartList.push(addItem); 139 | } 140 | } else { 141 | addItem = { 142 | "dish_id": a.listData[t].foods[i].dish_id, 143 | "name": a.listData[t].foods[i].dish_name, 144 | "price": a.listData[t].foods[i].dish_price, 145 | "detail": a.listData[t].foods[i].dish_description, 146 | "count": 1 147 | } 148 | cartList.push(addItem); 149 | } 150 | var sumMonney = a.sumMonney + a.listData[t].foods[i].dish_price; 151 | this.setData({ 152 | cartList: cartList, 153 | showModalStatus: false, 154 | sumMonney: sumMonney 155 | }); 156 | // console.log(this.data.cartList) 157 | }, 158 | showCartList: function() { 159 | // console.log(this.data.showCart) 160 | if (this.data.cartList.length != 0) { 161 | this.setData({ 162 | showCart: !this.data.showCart, 163 | }); 164 | } 165 | }, 166 | 167 | clearCartList: function() { 168 | this.setData({ 169 | cartList: [], 170 | showCart: false, 171 | sumMonney: 0 172 | }); 173 | }, 174 | 175 | addNumber: function(e) { 176 | var index = e.currentTarget.dataset.index; 177 | var cartList = this.data.cartList; 178 | cartList[index].count++; 179 | var sum = this.data.sumMonney + cartList[index].price; 180 | this.setData({ 181 | cartList: cartList, 182 | sumMonney: sum 183 | }); 184 | }, 185 | decNumber: function(e) { 186 | var index = e.currentTarget.dataset.index; 187 | var cartList = this.data.cartList; 188 | var sum = this.data.sumMonney - cartList[index].price; 189 | cartList[index].count == 1 ? cartList.splice(index, 1) : cartList[index].count--; 190 | this.setData({ 191 | cartList: cartList, 192 | sumMonney: sum, 193 | showCart: cartList.length == 0 ? false : true 194 | }); 195 | }, 196 | goBalance: function() { 197 | var that= this; 198 | wx.showModal({ 199 | title: '温馨提示', 200 | content: '下单后将不可修改订单,确认下单?', 201 | confirmColor: '#B6D9A9', 202 | cancelColor: '#DC143C', 203 | success:res=>{ 204 | if(res.confirm){ 205 | wx.request({ 206 | method:"POST", 207 | url: app.globalData.host +'/balance/insert', 208 | data:{ 209 | cartList: that.data.cartList, 210 | open_id:wx.getStorageSync("openid"), 211 | total_price: that.data.sumMonney 212 | }, 213 | success:res=>{ 214 | if(res.data.status == "0"){ 215 | wx.setStorageSync("order_id", res.data.order_id); 216 | if (this.data.sumMonney != 0) { 217 | wx.setStorageSync('cartList', that.data.cartList); 218 | wx.setStorageSync('sumMonney', that.data.sumMonney); 219 | wx.navigateTo({ 220 | url: '../order/balance/balance' 221 | }) 222 | } 223 | }else if(res.data.status == "-1"){ 224 | wx.showToast({ 225 | title: res.data.errmsg, 226 | image:'../../images/icon-err.png' 227 | }) 228 | } 229 | } 230 | }) 231 | } 232 | } 233 | }) 234 | }, 235 | 236 | onReady: function() { 237 | 238 | }, 239 | 240 | /** 241 | * 生命周期函数--监听页面显示 242 | */ 243 | onShow: function() { 244 | 245 | }, 246 | 247 | /** 248 | * 生命周期函数--监听页面隐藏 249 | */ 250 | onHide: function() { 251 | 252 | }, 253 | 254 | /** 255 | * 生命周期函数--监听页面卸载 256 | */ 257 | onUnload: function() { 258 | 259 | }, 260 | 261 | /** 262 | * 页面相关事件处理函数--监听用户下拉动作 263 | */ 264 | onPullDownRefresh: function() { 265 | 266 | }, 267 | 268 | /** 269 | * 页面上拉触底事件的处理函数 270 | */ 271 | onReachBottom: function() { 272 | 273 | }, 274 | 275 | /** 276 | * 用户点击右上角分享 277 | */ 278 | onShareAppMessage: function() { 279 | 280 | } 281 | }) -------------------------------------------------------------------------------- /resdb.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : 106.14.202.226 5 | Source Server Type : MySQL 6 | Source Server Version : 50722 7 | Source Host : 106.14.202.226:3306 8 | Source Schema : resdb 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 50722 12 | File Encoding : 65001 13 | 14 | Date: 19/08/2018 15:56:07 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for balance 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `balance`; 24 | CREATE TABLE `balance` ( 25 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单主键', 26 | `is_delete` int(11) NULL DEFAULT NULL COMMENT '0==删除 1==显示', 27 | `balance_status` int(11) NULL DEFAULT NULL COMMENT '1==未付款2==已付款3==已失效', 28 | `total_price` double(10, 2) NULL DEFAULT NULL COMMENT '订单总价', 29 | `open_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '小程序openid', 30 | `create_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间', 31 | `update_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修改时间', 32 | PRIMARY KEY (`id`) USING BTREE 33 | ) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 34 | 35 | -- ---------------------------- 36 | -- Table structure for coupon 37 | -- ---------------------------- 38 | DROP TABLE IF EXISTS `coupon`; 39 | CREATE TABLE `coupon` ( 40 | `yhqid` int(11) NOT NULL AUTO_INCREMENT COMMENT '优惠券主键', 41 | `imgurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片url', 42 | `je` int(255) NULL DEFAULT NULL COMMENT '金额', 43 | `mzje` int(255) NULL DEFAULT NULL COMMENT '满足金额', 44 | `mztj` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '满足条件', 45 | PRIMARY KEY (`yhqid`) USING BTREE 46 | ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 47 | 48 | -- ---------------------------- 49 | -- Table structure for dish 50 | -- ---------------------------- 51 | DROP TABLE IF EXISTS `dish`; 52 | CREATE TABLE `dish` ( 53 | `dish_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜的主键', 54 | `dish_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜名', 55 | `dish_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜的路径', 56 | `hot_status` int(11) NULL DEFAULT NULL COMMENT '1==不辣 2==微辣 3==中辣 4==超辣', 57 | `praise_times` int(11) NULL DEFAULT NULL COMMENT '点赞次数', 58 | `is_sign` int(11) NULL DEFAULT NULL COMMENT '0==不是招牌 1==招牌', 59 | `is_new_dish` int(11) NULL DEFAULT NULL COMMENT '0==不是新品 1=新品', 60 | `sales_volume` int(11) NULL DEFAULT NULL COMMENT '菜的销量', 61 | `dish_price` double(10, 2) NULL DEFAULT NULL COMMENT '菜的价格', 62 | `dish_type` int(11) NULL DEFAULT NULL COMMENT '1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水', 63 | `dish_description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜的描述', 64 | PRIMARY KEY (`dish_id`) USING BTREE 65 | ) ENGINE = InnoDB AUTO_INCREMENT = 61 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 66 | 67 | -- ---------------------------- 68 | -- Table structure for dish_type 69 | -- ---------------------------- 70 | DROP TABLE IF EXISTS `dish_type`; 71 | CREATE TABLE `dish_type` ( 72 | `type_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜的类型主键', 73 | `dish_type` int(11) NULL DEFAULT NULL COMMENT '1==热销 2==新品3==锅底4==蔬菜5==肉类6==冷菜7==酒水', 74 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '种类名字', 75 | PRIMARY KEY (`type_id`) USING BTREE 76 | ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 77 | 78 | -- ---------------------------- 79 | -- Table structure for my_coupon 80 | -- ---------------------------- 81 | DROP TABLE IF EXISTS `my_coupon`; 82 | CREATE TABLE `my_coupon` ( 83 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户主键', 84 | `open_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '小程序openid', 85 | `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户昵称', 86 | `yhqid` int(11) NULL DEFAULT NULL COMMENT '优惠券id', 87 | `create_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间', 88 | `update_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新时间', 89 | `end_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '失效时间', 90 | `is_delete` int(255) NULL DEFAULT NULL COMMENT '0==删除 1==显示', 91 | PRIMARY KEY (`id`) USING BTREE, 92 | INDEX `open_id`(`open_id`) USING BTREE 93 | ) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 94 | 95 | -- ---------------------------- 96 | -- Table structure for res_table 97 | -- ---------------------------- 98 | DROP TABLE IF EXISTS `res_table`; 99 | CREATE TABLE `res_table` ( 100 | `table_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '桌子主键', 101 | `max_seating` int(11) NOT NULL, 102 | `table_status` int(11) NOT NULL, 103 | PRIMARY KEY (`table_id`) USING BTREE 104 | ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 105 | 106 | -- ---------------------------- 107 | -- Table structure for reserve 108 | -- ---------------------------- 109 | DROP TABLE IF EXISTS `reserve`; 110 | CREATE TABLE `reserve` ( 111 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '预约主键', 112 | `open_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '小程序openId', 113 | `user_id` int(11) NULL DEFAULT NULL COMMENT '用户id', 114 | `table_id` int(11) NULL DEFAULT NULL COMMENT '桌子id', 115 | `reserve_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '预约号码', 116 | `reserve_status` int(11) NULL DEFAULT NULL COMMENT '0==失效 1==预约 2== 等待 3==无法预约', 117 | `reserve_date` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '预约时间', 118 | `create_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间', 119 | `update_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新时间', 120 | `is_delete` int(11) NULL DEFAULT 1 COMMENT '0==删除 1==显示', 121 | PRIMARY KEY (`id`) USING BTREE 122 | ) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 123 | 124 | -- ---------------------------- 125 | -- Table structure for shop_cart 126 | -- ---------------------------- 127 | DROP TABLE IF EXISTS `shop_cart`; 128 | CREATE TABLE `shop_cart` ( 129 | `shop_cart_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '购物车主键', 130 | `balance_id` int(11) NULL DEFAULT NULL COMMENT '订单主键', 131 | `dish_id` int(11) NULL DEFAULT NULL COMMENT '菜单主键', 132 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜名', 133 | `price` double(10, 2) NULL DEFAULT NULL COMMENT '单价', 134 | `detail` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', 135 | `count` int(11) NULL DEFAULT NULL COMMENT '购买数量', 136 | `create_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间', 137 | `update_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修改时间', 138 | PRIMARY KEY (`shop_cart_id`) USING BTREE 139 | ) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 140 | 141 | SET FOREIGN_KEY_CHECKS = 1; 142 | -------------------------------------------------------------------------------- /ResSpringBoot/restaurant/src/main/java/com/wx/restaurant/util/HttpRequest.java: -------------------------------------------------------------------------------- 1 | package com.wx.restaurant.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.DataOutputStream; 5 | import java.io.IOException; 6 | import java.io.InputStreamReader; 7 | import java.net.HttpURLConnection; 8 | import java.net.URL; 9 | import java.util.Map; 10 | 11 | /** 12 | * @param 13 | * @author Joe.Cai 14 | * @date 2018/6/27 9:35 15 | */ 16 | 17 | 18 | public class HttpRequest { 19 | 20 | // ;charset=utf-8 必须要,不然会出现乱码 21 | /** 22 | * 表单数据
23 | *
24 | * 在发送前编码所有字符(默认)
25 | *
26 | * application/x-www-form-urlencoded;charset=utf-8 27 | */ 28 | public static String CONTENT_TYPE_FORM_URLENCODED = "application/x-www-form-urlencoded;charset=utf-8"; 29 | 30 | /** 31 | * 表单数据
32 | *
33 | * 不对字符编码。在使用包含文件上传控件的表单时,必须使用该值
34 | *
35 | * multipart/form-data;charset=utf-8 36 | */ 37 | public static String CONTENT_TYPE_FORM_DATA = "multipart/form-data;charset=utf-8"; 38 | 39 | /** 40 | * text/plain;charset=utf-8 41 | */ 42 | public static String CONTENT_TYPE_PLAIN = "text/plain;charset=utf-8"; 43 | /** 44 | * application/json;charset=utf-8 45 | */ 46 | public static String CONTENT_TYPE_JSON = "application/json;charset=utf-8"; 47 | 48 | /** 49 | * @Name: post。 50 | * @Description: 发送post请求,并返回响应数据。 51 | * @Parameters: URL,要访问的url。 52 | * @Parameters: parms,访问参数,Map形式。 53 | * @Return: String,响应数据。 54 | */ 55 | public static String post(String URL, Map params) { 56 | StringBuilder parm = new StringBuilder(); 57 | if (params != null && !params.isEmpty()) { 58 | for (Map.Entry entry : params.entrySet()) { 59 | parm.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); 60 | } 61 | } 62 | return post(URL, parm.toString()); 63 | } 64 | 65 | /** 66 | * @Name: post。 67 | * @Description: 发送post请求,并返回响应数据。 68 | * @Parameters: URL,要访问的url。 69 | * @Parameters: parm,访问参数。 70 | * @Return: String,响应数据。 71 | */ 72 | public static String post(String URL, String parm) { 73 | 74 | HttpURLConnection conn = null; 75 | // 数据输出流,输出参数信息 76 | DataOutputStream dataOut = null; 77 | // 数据输入流,处理服务器响应数据 78 | BufferedReader dataIn = null; 79 | 80 | try { 81 | java.net.URL url = new URL(URL); 82 | 83 | // 将url以open方法返回的urlConnection连接强转为HttpURLConnection连接(标识一个url所引用的远程对象连接) 84 | // 此时cnnection只是为一个连接对象,待连接中 85 | conn = (HttpURLConnection) url.openConnection(); 86 | 87 | // 设置连接输出流为true,默认false (post请求是以流的方式隐式的传递参数) 88 | conn.setDoOutput(true); 89 | // 设置连接输入流为true 90 | conn.setDoInput(true); 91 | // 设置请求方式为post 92 | conn.setRequestMethod("POST"); 93 | // post请求缓存设为false 94 | conn.setUseCaches(false); 95 | // 设置该HttpURLConnection实例是否自动执行重定向 96 | conn.setInstanceFollowRedirects(true); 97 | 98 | // 设置内容的类型,设置为经过urlEncoded编码过的from参数 99 | conn.setRequestProperty("Content-Type", HttpRequest.CONTENT_TYPE_FORM_URLENCODED); 100 | conn.setRequestProperty("accept", "*/*"); 101 | // conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; 102 | // MSIE 6.0; Windows NT 5.1;SV1)"); 103 | 104 | // 建立连接 105 | // (请求未开始,直到connection.getInputStream()方法调用时才发起,以上各个参数设置需在此方法之前进行) 106 | conn.connect(); 107 | 108 | // 创建输入输出流,用于往连接里面输出携带的参数,(输出内容为?后面的内容) 109 | dataOut = new DataOutputStream(conn.getOutputStream()); 110 | // 将参数输出到连接 111 | dataOut.writeBytes(parm != null ? parm : ""); 112 | // 输出完成后刷新并关闭流 113 | dataOut.flush(); 114 | 115 | //输出连接信息,实际使用时去掉 116 | outConnInfo(conn, url); 117 | 118 | // 连接发起请求,处理服务器响应 (从连接获取到输入流并包装为bufferedReader) 119 | dataIn = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); 120 | String line; 121 | // 用来存储响应数据 122 | StringBuilder sb = new StringBuilder(); 123 | // 循环读取流 124 | while ((line = dataIn.readLine()) != null) { 125 | sb.append(line).append(System.getProperty("line.separator")); 126 | } 127 | return sb.toString(); 128 | 129 | } catch (Exception e) { 130 | e.printStackTrace(); 131 | } finally { 132 | try { 133 | // 重要且易忽略步骤 (关闭流,切记!) 134 | if (dataOut != null) { 135 | dataOut.close(); 136 | } 137 | if (dataIn != null) { 138 | dataIn.close(); 139 | } 140 | // 销毁连接 141 | if (conn != null) { 142 | conn.disconnect(); 143 | } 144 | } catch (IOException e) { 145 | e.printStackTrace(); 146 | } 147 | } 148 | return null; 149 | } 150 | 151 | /** 152 | * @Name: get。 153 | * @Description: 发送get请求,并返回响应数据。 154 | * @Parameters: URL,要访问的url。 155 | * @Return: String,响应数据。 156 | * @Author: PeiFeng 157 | * @Version: V1.00 158 | * @Create Date: 2017-8-8 159 | */ 160 | public static String get(String URL) { 161 | 162 | HttpURLConnection conn = null; 163 | BufferedReader dataIn = null; 164 | 165 | try { 166 | // 把字符串转换为URL请求地址 167 | URL url = new URL(URL); 168 | // 打开连接 169 | conn = (HttpURLConnection) url.openConnection(); 170 | // 连接会话 171 | conn.connect(); 172 | // 获取输入流 173 | dataIn = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); 174 | String line; 175 | StringBuilder sb = new StringBuilder(); 176 | while ((line = dataIn.readLine()) != null) {// 循环读取流 177 | sb.append(line); 178 | } 179 | return sb.toString(); 180 | 181 | } catch (Exception e) { 182 | e.printStackTrace(); 183 | } finally { 184 | try { 185 | // 重要且易忽略步骤 (关闭流,切记!) 186 | if (dataIn != null) { 187 | dataIn.close(); 188 | } 189 | // 销毁连接 190 | if (conn != null) { 191 | conn.disconnect(); 192 | } 193 | } catch (IOException e) { 194 | e.printStackTrace(); 195 | } 196 | } 197 | return null; 198 | } 199 | 200 | /** 201 | * 输出连接信息 202 | */ 203 | private static void outConnInfo(HttpURLConnection conn, URL url) throws IOException { 204 | // url与url = conn.getURL()是等价的 205 | System.out.println("conn.getResponseCode():" + conn.getResponseCode()); 206 | System.out.println("conn.getURL():" + conn.getURL()); 207 | System.out.println("conn.getRequestMethod():" + conn.getRequestMethod()); 208 | System.out.println("conn.getContentType():" + conn.getContentType()); 209 | System.out.println("conn.getReadTimeout():" + conn.getReadTimeout()); 210 | System.out.println("conn.getResponseMessage():" + conn.getResponseMessage()); 211 | System.out.println("url.getDefaultPort():" + url.getDefaultPort()); 212 | System.out.println("url.getFile():" + url.getFile()); 213 | System.out.println("url.getHost():" + url.getHost()); 214 | System.out.println("url.getPath():" + url.getPath()); 215 | System.out.println("url.getPort():" + url.getPort()); 216 | System.out.println("url.getProtocol():" + url.getProtocol()); 217 | System.out.println("url.getQuery():" + url.getQuery()); 218 | System.out.println("url.getRef():" + url.getRef()); 219 | System.out.println("url.getUserInfo():" + url.getUserInfo()); 220 | } 221 | } 222 | --------------------------------------------------------------------------------