10 2023 档案

摘要:在前后端分离的架构中,允许跨域请求是一个很重要的设置。SpringBoot项目中允许跨域请求比较简单,只需要我们定义好配置类即可。 在com.example.emos.api.config包里面创建CorsConfig类,然后设置允许跨域请求。 package com.example.emos.ap 阅读全文
posted @ 2023-10-31 23:51 sgj191024 阅读(447) 评论(0) 推荐(0) 编辑
摘要:依赖 <!--核心库--> <dependency> <groupId>cn.dev33</groupId> <artifactId>sa-token-spring-boot-starter</artifactId> <version>1.20.0</version> </dependency> < 阅读全文
posted @ 2023-10-31 22:51 sgj191024 阅读(61) 评论(0) 推荐(0) 编辑
摘要:二、实现异步发送邮件 在SpringBoot项目中开启异步多线程非常简单,只需要下面几个步骤即可。 在主类上面开启@EnableAsync注解 …… @EnableAsync public class EmosWxApiApplication { …… @Configuration public c 阅读全文
posted @ 2023-10-25 01:05 sgj191024 阅读(122) 评论(0) 推荐(0) 编辑
摘要:String path = "C:\\Users\\86175\\Desktop\\ss.txt"; try { // 创建FileReader对象来读取文件 FileReader fileReader = new FileReader(path); // 创建BufferedReader对象来读取 阅读全文
posted @ 2023-10-19 23:08 sgj191024 阅读(72) 评论(0) 推荐(0) 编辑
摘要:创建空的excel import pandas as pd # 表示excel的sheet页 df = pd.DataFrame() df.to_excel("D:/pycode/output/output.xlsx") df = pd.DataFrame({"ID":[1,2,3],"Name": 阅读全文
posted @ 2023-10-16 01:00 sgj191024 阅读(117) 评论(0) 推荐(0) 编辑
摘要:def add(x,y): return x + y sum = add(3,5) #print(sum) dict = {"add":add} sum1 = dict.get("add")(4,6) 通过传参把列表list传进去,在调用的方法中添加元素,原来的列表list也就成功添加了元素 def 阅读全文
posted @ 2023-10-15 21:43 sgj191024 阅读(21) 评论(0) 推荐(0) 编辑
摘要:一、Emos系统的常量数据 在sys_config数据表中保存了Emos系统的常量配置信息,其中就包括了考勤部分的常量信息。例如每天上班考勤从几点开始,截止到几点。下班考勤从几点开始,几点结束。 因为这些常量信息跟考勤模块息息相关,所以我们要编写Java代码,在SpringBoot项目启动的时候,就 阅读全文
posted @ 2023-10-14 17:28 sgj191024 阅读(168) 评论(0) 推荐(0) 编辑
摘要:public class QueueTest { public static void main(String[] args) { Queue<Integer> queue = new LinkedList<>(); queue.add(10); queue.add(12); // 获取第一个元素 阅读全文
posted @ 2023-10-12 22:01 sgj191024 阅读(4) 评论(0) 推荐(0) 编辑
摘要:RBAC的基本思想是,对系统操作的各种权限不是直接授予具体的用户,而是在用户集合与权限集合之间建立一个角色集合。每一种角色对应一组相应的权限。一旦用户被分配了适当的角色后,该用户就拥有此角色的所有操作权限。这样做的好处是,不必在每次创建用户时都进行分配权限的操作,只要分配用户相应的角色即可,而且角色 阅读全文
posted @ 2023-10-12 01:00 sgj191024 阅读(79) 评论(0) 推荐(0) 编辑
摘要:private String getOpenId(String code){ String url = "https://api.weixin.qq.com/sns/jscode2session"; HashMap map = new HashMap(); map.put("appid", appI 阅读全文
posted @ 2023-10-11 23:08 sgj191024 阅读(37) 评论(0) 推荐(0) 编辑
摘要:<insert id="insert" parameterType="HashMap"> INSERT INTO tb_user SET <if test="openId!=null"> open_id = #{openId}, </if> <if test="nickname!=null"> ni 阅读全文
posted @ 2023-10-11 22:42 sgj191024 阅读(22) 评论(0) 推荐(0) 编辑
摘要:二、创建小程序工程 在HBuilderX上面,创建emos-wx项目 在manifest.json文件中填写你自己注册下来小程序AppID 启动微信开发者工具,并且扫码登陆 选择运行微信小程序 三、uni-app框架简介 阅读全文
posted @ 2023-10-06 21:48 sgj191024 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Shiro靠什么做认证与授权的? Shiro可以利用HttpSession或者Redis存储用户的登陆凭证,以及角色或者身份信息。然后利用过滤器(Filter),对每个Http请求过滤,检查请求对应的HttpSession或者Redis中的认证与授权信息。如果用户没有登陆,或者权限不够,那么Shir 阅读全文
posted @ 2023-10-06 19:29 sgj191024 阅读(277) 评论(0) 推荐(0) 编辑
摘要:原理是保存数据时对数据转义,把一些script的标签比如< >给去掉了,这些脚本就不能执行了 因为Hutool工具包带有XSS转义的工具类,所以我们要导入Hutool,然后利用Servlet规范提供的请求包装类,定义数据转义功能。 <dependency> <groupId>cn.hutool</g 阅读全文
posted @ 2023-10-06 11:32 sgj191024 阅读(70) 评论(0) 推荐(0) 编辑
摘要:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> validation库在做后端验证的时候,要求 阅读全文
posted @ 2023-10-06 09:43 sgj191024 阅读(9) 评论(0) 推荐(0) 编辑
摘要:修改pom.xml文件,添加依赖库。Apache的httpcomponents库里面的HttpStatus类封装了很多状态码,所以我们在Web返回对象中封装状态吗,可以用到这些状态码。 <dependency> <groupId>org.apache.httpcomponents</groupId> 阅读全文
posted @ 2023-10-06 01:07 sgj191024 阅读(4) 评论(0) 推荐(0) 编辑
摘要:继承runtimeexception可以不处理异常: package com.example.emos.wx.exception; import lombok.Data; @Data public class EmosException extends RuntimeException{ priva 阅读全文
posted @ 2023-10-05 21:55 sgj191024 阅读(2) 评论(0) 推荐(0) 编辑
摘要:修改yml文件: mybatis: mapper-locations: classpath*:mapper/*.xml type-aliases-package: com.example.emos.wx.db.pojo configuration: log-impl: org.apache.ibat 阅读全文
posted @ 2023-10-05 21:19 sgj191024 阅读(6) 评论(0) 推荐(0) 编辑
摘要:配置tomcat: server: tomcat: uri-encoding: UTF-8 threads: max: 200 min-spare: 30 connection-timeout: 5000ms port: 8080 servlet: context-path: /emos-wx-ap 阅读全文
posted @ 2023-10-05 20:35 sgj191024 阅读(72) 评论(0) 推荐(0) 编辑
摘要:1.创建项目:scrapy startproject dushuproject 2.跳转到spiders路径 cd\dushuproject\dushuproject\spiders 3.创建爬虫类:scrapy genspider read www.dushu.com import scrapy 阅读全文
posted @ 2023-10-05 16:30 sgj191024 阅读(3) 评论(0) 推荐(0) 编辑
摘要:import scrapy import json class TransferpostSpider(scrapy.Spider): name = 'transferPost' allowed_domains = ['fanyi.baidu.com'] # start_urls = ['http:/ 阅读全文
posted @ 2023-10-05 16:12 sgj191024 阅读(4) 评论(0) 推荐(0) 编辑
摘要:settings.py DB_HOST = 'localhost' DB_PORT = 3306 DB_USER = 'root' DB_PWD = '1234' DB_NAME = 'guli' DB_CHARSET = 'utf8' # Configure item pipelines # Se 阅读全文
posted @ 2023-10-05 15:23 sgj191024 阅读(4) 评论(0) 推荐(0) 编辑
摘要:movie.py import scrapy from movieProject.items import MovieprojectItem class MovieSpider(scrapy.Spider): name = 'movie' allowed_domains = ['www.ygdy8. 阅读全文
posted @ 2023-10-05 09:48 sgj191024 阅读(49) 评论(0) 推荐(0) 编辑
摘要:def parse(self, response): print('当当网') li = response.xpath('//ul[@id="component_59"]/li') #src,name,price有个共同的父元素li,但是对于第一个li,没有data-original,所以遍历根据l 阅读全文
posted @ 2023-10-04 16:13 sgj191024 阅读(3) 评论(0) 推荐(0) 编辑
摘要:1.创建scrapy项目: 终端输入 scrapy startproject 项目名称 在spiders文件夹下创建py文件 scrapy genspider baidu http://www.baidu.com settings.py ROBOTSTXT_OBEY = False 4.运行爬虫文件 阅读全文
posted @ 2023-10-04 00:53 sgj191024 阅读(8) 评论(0) 推荐(0) 编辑
摘要:import requests from lxml import etree import urllib.request url = 'https://so.gushiwen.cn/user/login.aspx?from=http://so.gushiwen.cn/user/collect.asp 阅读全文
posted @ 2023-10-03 12:15 sgj191024 阅读(7) 评论(0) 推荐(0) 编辑
摘要:import requests url = 'http://www.baidu.com' res = requests.get(url)# 去除响应的乱码问题 res.encoding = 'utf-8' print(res.text) 3.response的属性以及类型 类型 :models.Re 阅读全文
posted @ 2023-10-03 00:43 sgj191024 阅读(15) 评论(0) 推荐(0) 编辑
摘要:from selenium import webdriver path = 'chromedriver.exe' broswer = webdriver.Chrome(path) url = 'http://www.baidu.com' broswer.get(url) 元素定位: 1.find_e 阅读全文
posted @ 2023-10-02 02:17 sgj191024 阅读(38) 评论(0) 推荐(0) 编辑
摘要:import urllib.request from lxml import etree # https://sc.chinaz.com/tupian/siwameinvtupian.html url = 'https://sc.chinaz.com/tupian/siwameinvtupian_2 阅读全文
posted @ 2023-10-01 17:01 sgj191024 阅读(40) 评论(0) 推荐(0) 编辑
摘要:from lxml import etree # 获取本地文件 tree = etree.parse('bendi.html') print(tree) # /表示子元素,//表示子孙后代元素 li = tree.xpath('//body/ul/li') print(li) print(len(l 阅读全文
posted @ 2023-10-01 00:49 sgj191024 阅读(5) 评论(0) 推荐(0) 编辑