day16_购物车(添加购物车,购物车列表查询,删除购物车商品,更新选中商品状态,完成购物车商品的全选,清空购物车)

文章目录

  • 购物车模块
  • 1 需求说明
  • 2 环境搭建
  • 3 添加购物车
    • 3.1 需求说明
    • 3.2 远程调用接口开发
      • 3.2.1 ProductController
      • 3.2.2 ProductService
    • 3.3 openFeign接口定义
      • 3.3.1 环境搭建
      • 3.3.2 接口定义
      • 3.3.3 降级类定义
    • 3.4 业务后端接口开发
      • 3.4.1 添加依赖
      • 3.4.2 修改启动类
      • 3.4.3 CartInfo
      • 3.4.4 CartController
      • 3.4.5 CartService
      • 3.4.6 修改配置文件
      • 3.4.7 服务网关配置
  • 4 购物车列表查询
    • 4.1 需求说明
    • 4.2 后端接口
      • 4.2.1 CartController
      • 4.2.2 CartService
  • 5 删除购物车商品
    • 5.1 需求说明
    • 5.2 后端接口
      • 5.2.1 CartController
      • 5.2.2 CartService
  • 6 更新选中商品状态
    • 6.1 需求说明
    • 6.2 后端接口
      • 6.2.1 CartController
      • 6.2.2 CartService
  • 7 完成购物车商品的全选
    • 7.1 需求说明
    • 7.2 后端接口
      • 7.2.1 CartController
      • 7.2.2 CartService
  • 8 清空购物车
    • 8.1 需求说明
    • 8.2 后端接口
      • 8.2.1 CartController
      • 8.2.2 CartService

购物车模块

1 需求说明

购物车模块存储顾客所选的的商品,记录下所选商品,当用户决定购买时,用户可以选择决定购买的商品进入结算页面。

购物车模块功能说明:

1、添加商品到购物车

2、查询购物车列表数据

3、删除购物车商品数据

4、更新选中商品状态

5、完成购物车商品的全选

6、清空购物车商品数据

数据存储:为了提高对购物车数据操作的性能,可以使用Redis【HASH】存储购物车数据。

页面效果:

在这里插入图片描述

2 环境搭建

创建一个独立模块(service-cart)来完成购物车的相关功能。

步骤如下:

1、在spzx-service模块下创建一个service-cart模块,并加入如下的依赖:

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>

</dependencies>

2、准备application.yml、application-dev.yml、logback-spring.xml文件。文件内容如下所示:

# application.yml
spring:
  profiles:
    active: dev
    
# application-dev.yml
server:
  port: 8513

spring:
  application:
    name: service-cart
  cloud:
    nacos:
      discovery:
        server-addr: 192.168.136.142:8848
    sentinel:
      transport:
        dashboard: localhost:8080
  data:
    redis:
      host: 192.168.136.142
      port: 6379
      password: 1234

logback-spring.xml修改输出路径:

<property name="log.path" value="D://work//service-cart//logs" />

3、创建启动类

// com.atguigu.spzx.cart;
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)  // 排除数据库的自动化配置,Cart微服务不需要访问数据库
public class CartApplication {

    public static void main(String[] args) {
        SpringApplication.run(CartApplication.class , args) ;
    }

}

3 添加购物车

3.1 需求说明

需求如下所示:

1、商品详情页加入购物车

2、加入购物车必须登录

加入购物车功能如图所示:

在这里插入图片描述

查看接口文档:

添加购物车接口地址及返回结果

get api/order/cart/auth/addToCart/{skuId}/{skuNum}
返回结果:
{
    "code": 200,
    "message": "操作成功",
    "data": null
}

注意:购物车页面加减商品数量与商品详情页加入购物车是同一个接口

请求响应流程如下所示:

在这里插入图片描述

3.2 远程调用接口开发

在service-product微服务中提供一个远程调用接口,根据skuId查询ProductSku数据,操作模块:service-product。

3.2.1 ProductController

表现层代码:

@Operation(summary = "获取商品sku信息")
@GetMapping("getBySkuId/{skuId}")
public Result<ProductSku> getBySkuId(@Parameter(name = "skuId", description = "商品skuId", required = true) @PathVariable Long skuId) {
    ProductSku productSku = productService.getBySkuId(skuId);
    return Result.build(productSku , ResultCodeEnum.SUCCESS) ;
}

3.2.2 ProductService

业务层代码实现:

//业务接口
ProductSku getBySkuId(Long skuId);

//业务接口实现
@Override
public ProductSku getBySkuId(Long skuId) {
    return productSkuMapper.getById(skuId);
}

启动service-product微服务进行测试。

3.3 openFeign接口定义

3.3.1 环境搭建

步骤如下所示:

1、spzx-service-client模块创建:在spzx-parent下面创建该子模块spzx-service-client,并导入如下依赖:

<dependencies>

    <dependency>
        <groupId>com.atguigu.spzx</groupId>
        <artifactId>common-util</artifactId>
        <version>1.0-SNAPSHOT</version>
        <scope>provided </scope>
    </dependency>

    <dependency>
        <groupId>com.atguigu.spzx</groupId>
        <artifactId>spzx-model</artifactId>
        <version>1.0-SNAPSHOT</version>
        <scope>provided </scope>
    </dependency>

    <!-- openfeign依赖 -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>

    <!-- loadbalancer依赖 -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-loadbalancer</artifactId>
    </dependency>

</dependencies>

注意:删除src目录

2、service-product-client模块创建:在spzx-service-client下面创建该子模块

3.3.2 接口定义

在service-product-client定义针对service-product微服务的远程调用接口,如下所示:

// com.atguigu.spzx.feign.product;
@FeignClient(value = "service-product")
public interface ProductFeignClient {

    @GetMapping("/api/product/getBySkuId/{skuId}")
    public abstract Result<ProductSku>  getBySkuId(@PathVariable Long skuId) ;

}

3.3.3 降级类定义

针对该远程调用接口提供一个降级类,一旦远程调用接口调用发生异常以后执行降级逻辑。

步骤:

1、定义一个类实现ProductFeignClient接口

// com.atguigu.spzx.feign.product.fallback
@Slf4j
public class ProductFeignClientFallback implements ProductFeignClient {

    @Override
    public Result<ProductSku> getBySkuId(Long skuId) {
        log.info("ProductFeignClientFallback...getBySkuId的方法执行了");
        return Result.build(null , ResultCodeEnum.SUCCESS) ;
    }

}

2、ProductFeignClient接口使用该降级类

@FeignClient(value = "service-product" , fallback = ProductFeignClientFallback.class)

3、将该接口通过Spring Boot的自动化配置原理,将其纳入到Spring容器中

在resources目录下创建一个MATE-INF/spring文件夹,在该文件夹下创建一个

org.springframework.boot.autoconfigure.AutoConfiguration.imports文件,文件的中的内容如下所示:

com.atguigu.spzx.feign.product.fallback.ProductFeignClientFallback

3.4 业务后端接口开发

操作模块:service-cart

3.4.1 添加依赖

在service-cart微服务中添加service-product-client接口的依赖:

<dependency>
    <groupId>com.atguigu.spzx</groupId>
    <artifactId>service-product-client</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

3.4.2 修改启动类

在启动类上添加对应的注解

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableFeignClients(basePackages = {
        "com.atguigu.spzx.feign.product"
})
@EnableUserWebMvcConfiguration
public class CartApplication {

    public static void main(String[] args) {
        SpringApplication.run(CartApplication.class , args) ;
    }

}

3.4.3 CartInfo

定义一个实体类来封装购物车中的商品数据(购物项数据),该实体类的定义依据:购物车列表页面需要展示的数据。如下所示:

// com.atguigu.spzx.model.entity.h5;
@Data
@Schema(description = "购物车实体类")
public class CartInfo extends BaseEntity {
   
   private static final long serialVersionUID = 1L;

   @Schema(description = "用户id")
   private Long userId;

   @Schema(description = "skuid")
   private Long skuId;

   @Schema(description = "放入购物车时价格")
   private BigDecimal cartPrice;

   @Schema(description = "数量")
   private Integer skuNum;

   @Schema(description = "图片文件")
   private String imgUrl;

   @Schema(description = "sku名称 (冗余)")
   private String skuName;

   @Schema(description = "isChecked")
   private Integer isChecked;
    
}

3.4.4 CartController

表现层代码:

@Tag(name = "购物车接口")
@RestController
@RequestMapping("api/order/cart")
public class CartController {

    @Autowired
    private CartService cartService;

    @Operation(summary = "添加购物车")
    @GetMapping("auth/addToCart/{skuId}/{skuNum}")
    public Result addToCart(@Parameter(name = "skuId", description = "商品skuId", required = true) @PathVariable("skuId") Long skuId,
                            @Parameter(name = "skuNum", description = "数量", required = true) @PathVariable("skuNum") Integer skuNum) {
        cartService.addToCart(skuId, skuNum);
        return Result.build(null, ResultCodeEnum.SUCCESS);
    }
}

3.4.5 CartService

业务层代码实现:

//业务接口
public interface CartService {
    void addToCart(Long skuId, Integer skuNum);
}

//业务接口实现
// com.atguigu.spzx.cart.service.impl;
import java.util.Date;

//业务接口实现
@Service
public class CartServiceImpl implements CartService {

    @Autowired
    private RedisTemplate<String , String> redisTemplate;

    @Autowired
    private ProductFeignClient productFeignClient;

    private String getCartKey(Long userId) {
        //定义key user:cart:userId
        return "user:cart:" + userId;
    }

    @Override
    public void addToCart(Long skuId, Integer skuNum) {

        // 获取当前登录用户的id
        Long userId = AuthContextUtil.getUserInfo().getId();
        String cartKey = getCartKey(userId);

        //获取缓存对象
        Object cartInfoObj = redisTemplate.opsForHash().get(cartKey, String.valueOf(skuId));
        CartInfo cartInfo = null ;
        if(cartInfoObj != null) {       //  如果购物车中有该商品,则商品数量 相加!
            cartInfo = JSON.parseObject(cartInfoObj.toString() , CartInfo.class) ;
            cartInfo.setSkuNum(cartInfo.getSkuNum() + skuNum);
            cartInfo.setIsChecked(1);
            cartInfo.setUpdateTime(new Date());
        }else {

            // 当购物车中没用该商品的时候,则直接添加到购物车!
            cartInfo = new CartInfo();

            // 购物车数据是从商品详情得到 {skuInfo}
            ProductSku productSku = productFeignClient.getBySkuId(skuId).getData() ;
            cartInfo.setCartPrice(productSku.getSalePrice());
            cartInfo.setSkuNum(skuNum);
            cartInfo.setSkuId(skuId);
            cartInfo.setUserId(userId);
            cartInfo.setImgUrl(productSku.getThumbImg());
            cartInfo.setSkuName(productSku.getSkuName());
            cartInfo.setIsChecked(1);
            cartInfo.setCreateTime(new Date());
            cartInfo.setUpdateTime(new Date());

        }

        // 将商品数据存储到购物车中
        redisTemplate.opsForHash().put(cartKey , String.valueOf(skuId) , JSON.toJSONString(cartInfo));
    }

}

3.4.6 修改配置文件

在配置文件application-dev.yml中添加如下配置,完成openFeign和sentinel的整合:

feign:
  sentinel:
    enabled: true

3.4.7 服务网关配置

在spzx-server-gateway微服务网关中配置service-cart微服务的路由规则:

spring:
  cloud:
    gateway:
      routes:
        - id: service-cart
          uri: lb://service-cart
          predicates:
            - Path=/api/order/cart/**

启动服务进行测试。

4 购物车列表查询

4.1 需求说明

当用户在商品详情页面点击购物车按钮的时候,那么此时就需要将当前登录用户的所对应的所有的购物车数据在购物车页面展出出来。如下图所示:

在这里插入图片描述

查看接口文档:

购物车列表接口地址及返回结果

get api/order/cart/auth/cartList
返回结果:
{
    "code": 200,
    "message": "操作成功",
    "data": [
        {
            "id": null,
            "createTime": "2023-06-13 10:27:30",
            "updateTime": "2023-06-13 11:21:23",
            "isDeleted": null,
            "userId": 1,
            "skuId": 5,
            "cartPrice": 1999.00,
            "skuNum": 2,
            "imgUrl": "http://139.198.127.41:9000/spzx/20230525/665832167-1_u_1.jpg",
            "skuName": "小米 红米Note10 5G手机 颜色:黑色 内存:8G",
            "isChecked": 1
        },
        ...
    ]
}

4.2 后端接口

4.2.1 CartController

表现层代码:

@Operation(summary = "查询购物车")
@GetMapping("auth/cartList")
public Result<List<CartInfo>> cartList() {
    List<CartInfo> cartInfoList = cartService.getCartList();
    return Result.build(cartInfoList, ResultCodeEnum.SUCCESS);
}

4.2.2 CartService

业务层代码实现:

//业务接口
List<CartInfo> getCartList();

//业务接口实现
@Override
public List<CartInfo> getCartList() {

        // 获取当前登录的用户信息
        Long userId = AuthContextUtil.getUserInfo().getId();
        String cartKey = this.getCartKey(userId);

        // 获取数据
        List<Object> cartInfoList = redisTemplate.opsForHash().values(cartKey);

        if (!CollectionUtils.isEmpty(cartInfoList)) {
            List<CartInfo> infoList = cartInfoList.stream().map(cartInfoJSON -> JSON.parseObject(cartInfoJSON.toString(), CartInfo.class))
                    .sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime()))
                    .collect(Collectors.toList());
            return infoList ;
        }

        return new ArrayList<>() ;
    }

5 删除购物车商品

5.1 需求说明

删除功能如图所示:

在这里插入图片描述

查看接口文档:

删除购物车商品接口地址及返回结果

get api/order/cart/auth/deleteCart/{skuId}
返回结果:
{
    "code": 200,
    "message": "操作成功",
    "data": null
}

5.2 后端接口

5.2.1 CartController

表现层代码:

@Operation(summary = "删除购物车商品")
@DeleteMapping("auth/deleteCart/{skuId}")
public Result deleteCart(@Parameter(name = "skuId", description = "商品skuId", required = true) @PathVariable("skuId") Long skuId) {
    cartService.deleteCart(skuId);
    return Result.build(null, ResultCodeEnum.SUCCESS);
}

5.2.2 CartService

业务层代码实现:

//业务接口
void deleteCart(Long skuId);

//业务接口实现
@Override
public void deleteCart(Long skuId) {

    // 获取当前登录的用户数据
    Long userId = AuthContextUtil.getUserInfo().getId();
    String cartKey = getCartKey(userId);

    //获取缓存对象
    redisTemplate.opsForHash().delete(cartKey  ,String.valueOf(skuId)) ;
}

6 更新选中商品状态

6.1 需求说明

更新选中商品状态功能如图所示:

在这里插入图片描述

查看接口文档:

更新选中商品状态接口地址及返回结果

get api/order/cart/auth/checkCart/{skuId}/{isChecked}
返回结果:
{
    "code": 200,
    "message": "操作成功",
    "data": null
}

6.2 后端接口

6.2.1 CartController

表现层代码:

@Operation(summary="更新购物车商品选中状态")
@GetMapping("/auth/checkCart/{skuId}/{isChecked}")
public Result checkCart(@Parameter(name = "skuId", description = "商品skuId", required = true) @PathVariable(value = "skuId") Long skuId,
                        @Parameter(name = "isChecked", description = "是否选中 1:选中 0:取消选中", required = true) @PathVariable(value = "isChecked") Integer isChecked) {
    cartService.checkCart(skuId, isChecked);
    return Result.build(null, ResultCodeEnum.SUCCESS);
}

6.2.2 CartService

业务层代码实现:

//业务接口
void checkCart(Long skuId, Integer isChecked);

//业务接口实现
@Override
public void checkCart(Long skuId, Integer isChecked) {

    // 获取当前登录的用户数据
    Long userId = AuthContextUtil.getUserInfo().getId();
    String cartKey = this.getCartKey(userId);

    Boolean hasKey = redisTemplate.opsForHash().hasKey(cartKey, String.valueOf(skuId));
    if(hasKey) {
        String cartInfoJSON = redisTemplate.opsForHash().get(cartKey, String.valueOf(skuId)).toString();
        CartInfo cartInfo = JSON.parseObject(cartInfoJSON, CartInfo.class);
        cartInfo.setIsChecked(isChecked);
        redisTemplate.opsForHash().put(cartKey , String.valueOf(skuId) , JSON.toJSONString(cartInfo));
    }

}

7 完成购物车商品的全选

7.1 需求说明

更新购物车商品全部选中状态功能如图所示:

在这里插入图片描述

查看接口文档:

更新购物车商品全部选中状态接口地址及返回结果

get api/order/cart/auth/allCheckCart/{isChecked}
返回结果:
{
    "code": 200,
    "message": "操作成功",
    "data": null
}

7.2 后端接口

7.2.1 CartController

表现层代码:

@Operation(summary="更新购物车商品全部选中状态")
@GetMapping("/auth/allCheckCart/{isChecked}")
public Result allCheckCart(@Parameter(name = "isChecked", description = "是否选中 1:选中 0:取消选中", required = true) @PathVariable(value = "isChecked") Integer isChecked){
    cartService.allCheckCart(isChecked);
    return Result.build(null, ResultCodeEnum.SUCCESS);
}

7.2.2 CartService

业务层代码实现:

//业务接口
void allCheckCart(Integer isChecked);

//业务接口实现
public void allCheckCart(Integer isChecked) {

    // 获取当前登录的用户数据
    Long userId = AuthContextUtil.getUserInfo().getId();
    String cartKey = getCartKey(userId);

    // 获取所有的购物项数据
    List<Object> objectList = redisTemplate.opsForHash().values(cartKey);
    if(!CollectionUtils.isEmpty(objectList)) {
        objectList.stream().map(cartInfoJSON -> {
            CartInfo cartInfo = JSON.parseObject(cartInfoJSON.toString(), CartInfo.class);
            cartInfo.setIsChecked(isChecked);
            return cartInfo ;
        }).forEach(cartInfo -> redisTemplate.opsForHash().put(cartKey , String.valueOf(cartInfo.getSkuId()) , JSON.toJSONString(cartInfo)));

    }
}

8 清空购物车

8.1 需求说明

清空购物车功能如图所示:

在这里插入图片描述

查看接口文档:

清空购物车接口地址及返回结果

get api/order/cart/auth/clearCart
返回结果:
{
    "code": 200,
    "message": "操作成功",
    "data": null
}

8.2 后端接口

8.2.1 CartController

表现层代码:

@Operation(summary="清空购物车")
@GetMapping("/auth/clearCart")
public Result clearCart(){
    cartService.clearCart();
    return Result.build(null, ResultCodeEnum.SUCCESS);
}

8.2.2 CartService

业务层代码实现:

//业务接口
void clearCart();

//业务接口实现
@Override
public void clearCart() {
    Long userId = AuthContextUtil.getUserInfo().getId();
    String cartKey = getCartKey(userId);
    redisTemplate.delete(cartKey);
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/447241.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

MyBatisPlus理解

MyBatisPlus是mybatis的增强&#xff0c;mybatis是数据库持久化的框架&#xff0c;但mybatisplus并不是替代mybatis&#xff0c;而是相辅相成的关系 MyBatisPlus不会对以前使用mybatis开发的项目进行影响&#xff0c;引入后仍然正常运行。 使用方法&#xff1a; 1.在引入了对…

[力扣 Hot100]Day48 路径总和 III

题目描述 给定一个二叉树的根节点 root &#xff0c;和一个整数 targetSum &#xff0c;求该二叉树里节点值之和等于 targetSum 的 路径 的数目。 路径 不需要从根节点开始&#xff0c;也不需要在叶子节点结束&#xff0c;但是路径方向必须是向下的&#xff08;只能从父节点到…

再谈 Cookie 和 Session

文章目录 1. 核心方法&#xff1a;HttpServletRequest 类中HttpServletResponse 类中HttpSession类中Cookie类中 2.实现登录界面 Cookie 是浏览器在本地持久化存储数据的一种机制。 Cookie 的数据从哪里来&#xff1f; 是服务器返回给浏览器的。 Cookie 的数据长什么啥样&#…

Chapter20-Ideal gases-CIE课本要点摘录、总结

20.1 Particles of a gas Brownian motion Fast modules 速率的数值大概了解下&#xff1a; average speed of the molecules:400m/s speed of sound:approximately 330m/s at STP&#xff08;standard temperature and pressure&#xff09; Standard Temperature and Pres…

不同路径 不同路径 II 整数拆分

62.不同路径 力扣题目链接(opens new window) 一个机器人位于一个 m x n 网格的左上角 &#xff08;起始点在下图中标记为 “Start” &#xff09;。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角&#xff08;在下图中标记为 “Finish” &#xff09;。…

标准不锈钢电阻-栅极电阻器的设计方案

EAK不锈钢栅极电阻器 可靠的不锈钢电阻元件和端子 所有装置均为三重绝缘&#xff0c;适用于 1000V 交流或直流 标准电网电阻器有现货&#xff0c;可减少代价高昂的停机时间 在很宽的温度范围内具有稳定的耐受性 高功率可节省空间、重量和成本 标准 26.5 英寸尺寸&#xf…

PDF24 Creator PDF工具箱 v11.17.0

软件介绍 可将大部分文件转成pdf格式的免费软件&#xff0c;安装好后会在你的打印机里看到一个叫PDF24的虚拟打印机&#xff0c;你可将要转成pdf格式的文件打印时选虚拟打印机PDF24&#xff0c;也可以直接将文件以拖拉方式拉进这软件的主视窗编辑区里&#xff0c;它会自动转成…

OD_2024_C卷_200分_6、六_连续出牌数量【JAVA】【回溯算法】

题目描述 package odjava;import java.util.Arrays; import java.util.Scanner;public class 六_连续出牌数量 {// 定义扑克牌类static class Card {int num; // 牌号char color; // 花色public Card(int num, String color) {this.num num;this.color color.charAt(0); // 取…

Liinux——(网络)socket编程

预备知识 源IP地址和目的IP地址 在IP数据包头部中, 有两个IP地址, 分别叫做源IP地址, 和目的IP地址 认识端口号 端口号(port)是传输层协议的内容. 端口号是一个2字节16位的整数;端口号用来标识一个进程, 告诉操作系统, 当前的这个数据要交给哪个进程来处理;IP地址 端口号能…

js【详解】DOM

文档对象模型&#xff08;Document Object Model&#xff0c;简称DOM&#xff09; DOM 是哪种数据结构 &#xff1f; DOM 的本质是浏览器通过HTML代码解析出来的一棵 树。 操作 DOM 常用的 API 有哪些 &#xff1f; 获取 DOM 节点 //方式 1&#xff1a;通过【id】获取&#xf…

每日学习笔记:C++ STL 的队列Deque

定义 内存模型 Deque与Vector比较 操作函数 运用实例

每日OJ题_牛客HJ73 计算日期到天数转换(IO型OJ)

目录 牛客HJ73 计算日期到天数转换 解析代码 牛客HJ73 计算日期到天数转换 计算日期到天数转换_牛客题霸_牛客网 解析代码 #include <iostream> using namespace std; int main() {int year 0, month 0, day 0, sum 0;cin >> year >> month >>…

文本向量评测MTEB和C-MTEB

文章目录 简介MTEBC-MTEB参考资料 简介 MTEB(Massive Text Embedding Benchmark)是目前评测文本向量很重要的一个参考&#xff0c;其榜单也是各大文本向量模型用来展示与其他向量模型强弱的一个竞技台。 C-MTEB则是专门针对中文文本向量的评测基准。 MTEB MTEB的目的是为了…

esp32 GDEH0154D67屏幕调试

官方资料 说明手册&#xff1a;GDEH0154D67specf3d5.pdf (e-paper-display.cn) 官网&#xff1a;1.54寸黑白单色电子纸显示屏 200x200分辨率电子墨水屏 GDEH0154D67,黑白电子纸屏,电子墨水屏-大连佳显 (e-paper-display.cn) 驱动代码来源&#xff1a;桌面小屏幕实战课程资料…

面向对象的编程语言是什么意思?——跟老吕学Python编程

面向对象的编程语言是什么意思&#xff1f;——跟老吕学Python编程 面向对象是什么意思&#xff1f;面向对象的定义面向对象的早期发展面向对象的背景1.审视问题域的视角2.抽象级别3.封装体4.可重用性 面向对象的特征面向对象的开发方法面向对象程序设计基本思想实现 面向对象的…

机器学习周报第32周

目录 摘要Abstract一、文献阅读1.论文标题2.论文摘要3.论文背景4.论文方案4.1 多视角自注意力网络4.2 距离感知4.3 方向信息4.4 短语模式 二、self-attention 摘要 本周学习了多视角自注意力网络&#xff0c;在统一的框架下联合学习输入句子的不同语言学方面。具体来说&#x…

Node 旧淘宝源 HTTPS 过期处理

今天拉取老项目更新依赖&#xff0c;出现 urlshttps%3A%2F%2Fregistry.npm.taobao.org%2Fegg-logger%2Fdownload%2Fegg-logger-2.6.1.tgz: certificate has expired 类似报错。即使删除 node_modules 重新安装&#xff0c;问题依然无法解决。 一、问题演示 二、原因分析 1、淘…

子类和父类在同一包中的继承性

同一包中的继承性 继承非private的成员变量&#xff1b; 继承private的方法&#xff1b; 继承的成员变量或方法的访问权限保持不变。

elasticsearch 深度分页查询 Search_after(图文教程)

Search_after使用 一. 简介二. 不带PIT的search_after查询2.1 构造数据2.2 search_after分页查询2.2 问题 三. 带PIT的search_after查询3.1 构建第一次查询条件3.2 进行下一页查询3.3 删除PIT 四.参考文章 前言 这是我在这个网站整理的笔记,有错误的地方请指出&#xff0c;关注…

【JS】APIs:事件流、事件委托、其他事件、页面尺寸、日期对象与节点操作

1 事件流 捕获阶段&#xff1a;从父到子 冒泡阶段&#xff1a;从子到父 1.1 事件捕获 <body> <div class"fa"><div class"son"></div> </div> <script>const fadocument.querySelector(.fa);const sondocument.qu…
最新文章