【HarmonyOS NEXT星河版开发实战】天气查询APP

目录

前言

界面效果展示

首页

添加和删除 

界面构建讲解

1. 获取所需数据

 2. 在编译器中准备数据

 3. index页面代码讲解

  3.1 导入模块:

 3.2 定义组件:

3.3 定义状态变量:

3.4  定义Tabs控制器:

3.5 定义按钮样式:

 3.6 页面显示时触发的方法:

 3.7 获取数据的方法:

3.8  初始化数据的方法:

 3.9 构建UI:

4. AddCity页面代码讲解

   4.1 导入模块:

   4.2 定义组件:

   4.3 定义状态变量:

   4.4 接受数据的载体:

   4.5 页面显示时触发的方法:

   4.6 构建UI:

 5. getWeather页面代码讲解

  5.1 导入模块:

  5.2 定义类:

  5.3 定义方法 getWeather:

  5.4 定义方法 getWeathers:

  5.5 实例化并导出类:

全套源代码展示

AddCity 

Index

getWeather

casts

cityView

forecasts

WeatherModel


 

个人主页→VON

收录专栏→鸿蒙综合案例开发​​​​​

代码及其图片资源会发布于gitee上面(已发布)

gitee地址icon-default.png?t=N7T8https://gitee.com/wang-xin-jie234/harmony-os

 

​ 

前言

基础部分如今已经学完,可能有些东西并不是太了解,在练习实战项目的过程中也是一个不断学习的过程,因为实战项目复杂代码量较大,所以写的时候要及其认真,一个小的错误可能会花费几小时的时间去寻找bug。所以在学习的过程中要十分严谨,希望大家可以跟着我的思路独自完成天气查询app这一项目。

界面效果展示

首页

 首页包括添加删除天气的功能,还有近五天天气的展示,以及温度的展示。

添加和删除 

 

添加城市列表是本地进行导入的,如果有需要可以将想要的城市自行导入进去,添加完城市点击完成会跳转到首页进行渲染展示。删除功能,点击确定的时候改城市的信息会被删除。 

界面构建讲解

1. 获取所需数据

因为天气的数据需要我们联网去获取,所以要去调用天气的API。

我这里用的是高德开放平台,没有注册过的要先进行账号的注册。

注:必须要进行账号注册,后面要用到我们个人的Key值,每个用户都不一样。 

拿到key之后在浏览器上输入服务示例+key+extensions=all 

 2. 在编译器中准备数据

​ 

 3. index页面代码讲解

  3.1 导入模块

import getweatherutil from '../util/getWeather'
import { cityView } from '../view/cityView'
import {WeatherModel} from '../view/WeatherModel'
import router from '@ohos.router'

 3.2 定义组件

@Entry
@Component
struct Index {

3.3 定义状态变量:

// 城市代码集合
@State cityCoeList: number[] = [110000, 120000]
// 城市名字集合
@State cityNameList: string[] = []
// 城市信息集合
@State cityWeatherList: Array<WeatherModel> = []
// 当前城市索引
@State cityIndex: number = 0

3.4  定义Tabs控制器:

tabController: TabsController = new TabsController()

3.5 定义按钮样式

@Builder tabBuild(index: number) {Circle({ width: 10, height: 10 }).fill(this.cityIndex === index ? Color.White : Color.Gray).opacity(0.4)
}

 3.6 页面显示时触发的方法

onPageShow() {let params = router.getParams()if (params !== null) {this.cityCoeList = params['codes']// 清空所有数据this.cityWeatherList = []this.cityNameList = []this.initDate()}
}

 3.7 获取数据的方法

aboutToAppear() {this.initDate()
}

3.8  初始化数据的方法

async initDate() {let result: Array<WeatherModel> = await getweatherutil.getWeathers(this.cityCoeList)for (let i = 0; i < result.length; i++) {// 城市天气let ACityWeather = new WeatherModel()ACityWeather = result[i]this.cityWeatherList.push(ACityWeather)// 城市名称let cityname = result[i].forecasts[0].citythis.cityNameList.push(cityname)}
}

 3.9 构建UI

build() {Column() {Row() {Button('添加').fontSize(25).fontColor(Color.Gray).backgroundColor('#00ffffff').onClick(() => {router.pushUrl({url: "pages/AddCity",params: {codes: this.cityCoeList,names: this.cityNameList}})})Text(this.cityNameList[this.cityIndex]).fontSize(40).fontColor(Color.Orange)Button('删除').fontSize(25).fontColor(Color.Gray).backgroundColor('#00ffffff').onClick(() => {AlertDialog.show({title: '删除',message: `你确定要删除${this.cityNameList[this.cityIndex]}吗?`,confirm: {value: '确定',action: () => {this.cityNameList = this.cityNameList.filter(item => item !== this.cityNameList[this.cityIndex])this.cityCoeList = this.cityCoeList.filter(item => item !== this.cityCoeList[this.cityIndex])this.cityWeatherList = this.cityWeatherList.filter(item => item !== this.cityWeatherList[this.cityIndex])}}})})}.width('100%').height('10%').justifyContent(FlexAlign.SpaceBetween)Tabs({ barPosition: BarPosition.Start, controller: this.tabController }) {ForEach(this.cityWeatherList, (cityWeather: WeatherModel) => {TabContent() {cityView({ casts: cityWeather.forecasts[0].casts })}.tabBar(this.tabBuild(this.cityWeatherList.findIndex((obj => obj === cityWeather))))})}.barWidth(40).barHeight(40).onChange((index: number) => {this.cityIndex = index})}.width('100%').height('100%').backgroundImage($r('app.media.weather_background')).backgroundImageSize({ width: '100%', height: '100%' }).backgroundImagePosition({ x: 0, y: 0 })
}

4. AddCity页面代码讲解

   4.1 导入模块

import router from '@ohos.router'

   4.2 定义组件

@Entry
@Component
struct AddCity {

   4.3 定义状态变量

// 所有城市的代码列表
@State AllCityCodeList: Array<number> = [410100, 410200, 410300, 410400, 410500, 410600, 410700, 410800, 410900, 411000, 411200, 411300, 411400, 411500, 411600, 411700
]
// 所有城市的名称列表
@State AllCityNameList: Array<string> = ['郑州市', '开封市', '洛阳市', '平顶山市', '安阳市', '鹤壁市', '新乡市', '焦作市', '濮阳市', '许昌市', '三门峡市', '南阳市', '商丘市', '信阳市', '周口市', '驻马店市'
]

   4.4 接受数据的载体

@State cityCodeList: number[] = []
@State cityNameList: string[] = []

   4.5 页面显示时触发的方法

onPageShow() {let param = router.getParams()this.cityCodeList = param['codes']this.cityNameList = param['names']
}

   4.6 构建UI

build() {Column() {Row() {Text('添加城市列表').fontSize(35).fontColor(Color.White)Blank()Button('完成').fontSize(26).backgroundColor("").onClick(() => {router.back({url: 'pages/Index',params: {codes: this.cityCodeList,names: this.AllCityNameList}})})}.height('10%').width('95%')Column() {List() {ForEach(this.AllCityNameList, (name: string) => {ListItem() {if (this.cityNameList.includes(name)) {Column() {Row() {Text(name).fontSize(35).fontColor(Color.White).width('60%').margin({ top: 20, left: 30 })Blank()Text('已添加').backgroundColor('').fontSize(18).margin({ top: 5 }).opacity(0.8)}.width('100%')Blank()Divider().strokeWidth(5)}.height(90).width('100%').margin({ top: 20 }).backgroundColor('#ff4a93c6')} else {Column() {Row() {Text(name).fontSize(35).fontColor(Color.White).width('60%').margin({ top: 20, left: 30 })Blank()Button('添加').margin({ right: 5 }).backgroundColor("").onClick(() => {// 根据name来获取索引let index = this.AllCityNameList.findIndex(obj => obj === name)// 根据索引获取城市编码let cityCode: number = this.AllCityCodeList[index]// 将城市编码加入列表this.cityCodeList.push(cityCode)this.cityNameList.push(name)})}.width('100%')Blank()Divider().strokeWidth(5)}.height(90).width('100%').margin({ top: 20 })}}})}}}.width('100%').height('100%').backgroundImage($r('app.media.weather_background')).backgroundImageSize({ width: '100%', height: '100%' }).backgroundImagePosition({ x: 0, y: 0 })
}

 5. getWeather页面代码讲解

  5.1 导入模块

import { WeatherModel } from '../view/WeatherModel'
import http from '@ohos.net.http'

  5.2 定义类

class getWeatherUtil {

  5.3 定义方法 getWeather

// 发送一个url,返回对应的数据
getWeather(cityCode: number): Promise<WeatherModel> {return new Promise<WeatherModel>((resolve, reject) => {let request = http.createHttp()let url = `https://restapi.amap.com/v3/weather/weatherInfo?city=${cityCode}&key=57b5118aed53d7a188874fc44256a0b8&extensions=all`let result = request.request(url)result.then((res) => {if (res.responseCode === 200) {console.log(res.result.toString());resolve(JSON.parse(res.result.toString()))}}).catch((err) => {console.log(err)reject(err)})})
}

  5.4 定义方法 getWeathers

// 直接发送多个url结果一并返回
async getWeathers(cityCodes: Array<number>): Promise<Array<WeatherModel>> {let promises: Array<Promise<WeatherModel>> = []let weatherModels: Array<WeatherModel> = []for (let i = 0; i < cityCodes.length; i++) {promises.push(this.getWeather(cityCodes[i]))}await Promise.all(promises).then(result => {for (const element of result) {console.log(element.forecasts[0].city)}weatherModels = result}).catch((err) => {console.log(err)})return weatherModels
}

  5.5 实例化并导出类

let getweatherutil = new getWeatherUtil()
export default getweatherutil as getWeatherUtil

 getWeather  方法

  • 该方法接受一个城市代码 cityCode,并返回一个 Promise<WeatherModel>
  • 创建一个 HTTP 请求对象 request
  • 构建请求 URL,包含城市代码和 API 密钥。
  • 发送 HTTP 请求并处理响应。
  • 如果响应码为 200,解析响应结果并返回 WeatherModel 对象。
  • 如果发生错误,捕获并记录错误。

 getWeat hers 方法

  • 该方法接受一个城市代码数组 cityCodes,并返回一个 Promise<Array<WeatherModel>>
  • 创建一个空数组 promises 用于存储每个城市天气请求的 Promise。
  • 遍历 cityCodes,为每个城市代码调用 getWeather 方法,并将返回的 Promise 添加到 promises 数组中。
  • 使用 Promise.all 等待所有请求完成,并处理结果。
  • 遍历结果数组,记录每个城市的名称。
  • 将结果赋值给 weatherModels 数组并返回。
  • 如果发生错误,捕获并记录错误。

全套源代码展示

AddCity 

import router from '@ohos.router'@Entry
@Component
struct AddCity {@State AllCityCodeList:Array<number>=[410100,410200,410300,410400,410500,410600,410700,410800,410900,411000,411200,411300,411400,411500,411600,411700]@State AllCityNameList:Array<string>=['郑州市','开封市','洛阳市','平顶山市','安阳市','鹤壁市','新乡市','焦作市','濮阳市','许昌市','三门峡市','南阳市','商丘市','信阳市','周口市','驻马店市']// 接受数据的载体@State cityCodeList:number[]=[]@State cityNameList:string[]=[]onPageShow(){let param=router.getParams()this.cityCodeList=param['codes']this.cityNameList=param['names']}build() {Column(){Row(){Text('添加城市列表').fontSize(35).fontColor(Color.White)Blank()Button('完成').fontSize(26).backgroundColor("").onClick(()=>{router.back({url:'pages/Index',params:{codes:this.cityCodeList,names:this.AllCityNameList}})})}.height('10%').width('95%')Column(){List(){ForEach(this.AllCityNameList,(name:string)=>{ListItem(){if(this.cityNameList.includes(name)){Column(){Row(){Text(name).fontSize(35).fontColor(Color.White).width('60%').margin({top:20,left:30})Blank()Text('已添加').backgroundColor('').fontSize(18).margin({top:5}).opacity(0.8)}.width('100%')Blank()Divider().strokeWidth(5)}.height(90).width('100%').margin({top:20}).backgroundColor('#ff4a93c6')}else{Column(){Row(){Text(name).fontSize(35).fontColor(Color.White).width('60%').margin({top:20,left:30})Blank()Button('添加').margin({right:5}).backgroundColor("").onClick(()=>{// 根据name来获取索引let index=this.AllCityNameList.findIndex(obj=>obj===name)// 根据索引获取城市编码let cityCode:number=this.AllCityCodeList[index]// 将城市编码加入列表this.cityCodeList.push(cityCode)this.cityNameList.push(name)})}.width('100%')Blank()Divider().strokeWidth(5)}.height(90).width('100%').margin({top:20})}}})}}}.width('100%').height('100%').backgroundImage($r('app.media.weather_background')).backgroundImageSize({width:'100%',height:'100%'}).backgroundImagePosition({x:0,y:0})}
}

Index

import getweatherutil from '../util/getWeather'
import { cityView } from '../view/cityView'
import {WeatherModel} from '../view/WeatherModel'
import router from '@ohos.router'@Entry
@Component
struct Index {// 城市代码集合@State cityCoeList:number[] =[110000,120000]// 城市名字集合@State cityNameList:string[]=[]// 城市信息集合@State cityWeatherList:Array<WeatherModel>=[]// 当前城市索引@State cityIndex:number=0tabController:TabsController=new TabsController()// 按钮样式@Builder tabBuild(index:number){Circle({width:10,height:10}).fill(this.cityIndex===index?Color.White:Color.Gray).opacity(0.4)}onPageShow(){let params=router.getParams()if(params!==null){this.cityCoeList=params['codes']// 清空所有数据this.cityWeatherList=[]this.cityNameList=[]this.initDate()}}// 获取数据aboutToAppear(){this.initDate()}// 初始化方法async initDate(){let result:Array<WeatherModel> =await getweatherutil.getWeathers(this.cityCoeList)for (let i = 0; i < result.length; i++) {// 城市天气let ACityWeather=new WeatherModel()ACityWeather=result[i]this.cityWeatherList.push(ACityWeather)// 城市名称let cityname=result[i].forecasts[0].citythis.cityNameList.push(cityname)}}build() {Column(){Row(){Button('添加').fontSize(25).fontColor(Color.Gray).backgroundColor('#00ffffff').onClick(()=>{router.pushUrl({url:"pages/AddCity",params:{codes:this.cityCoeList,names:this.cityNameList}})})Text(this.cityNameList[this.cityIndex]).fontSize(40).fontColor(Color.Orange)Button('删除').fontSize(25).fontColor(Color.Gray).backgroundColor('#00ffffff').onClick(()=>{AlertDialog.show({title:'删除',message:`你确定要删除${this.cityNameList[this.cityIndex]}吗?`,confirm:{value:'确定',action:()=>{this.cityNameList=this.cityNameList.filter(item=>item!==this.cityNameList[this.cityIndex])this.cityCoeList=this.cityCoeList.filter(item=>item!==this.cityCoeList[this.cityIndex])this.cityWeatherList=this.cityWeatherList.filter(item=>item!==this.cityWeatherList[this.cityIndex])}}})})}.width('100%').height('10%').justifyContent(FlexAlign.SpaceBetween)Tabs({barPosition:BarPosition.Start,controller:this.tabController}){ForEach(this.cityWeatherList,(cityWeather:WeatherModel)=>{TabContent(){cityView({casts:cityWeather.forecasts[0].casts})}.tabBar(this.tabBuild(this.cityWeatherList.findIndex((obj=>obj===cityWeather))))})}.barWidth(40).barHeight(40).onChange((index:number)=>{this.cityIndex=index})}.width('100%').height('100%').backgroundImage($r('app.media.weather_background')).backgroundImageSize({width:'100%',height:'100%'}).backgroundImagePosition({x:0,y:0})}
}

getWeather

import {WeatherModel} from '../view/WeatherModel'
import http from '@ohos.net.http'class getWeatherUtil{// 发送一个url,返回对应的数据getWeather(cityCode:number){return new Promise<WeatherModel>((resolve,reject)=>{let request=http.createHttp()let url=`https://restapi.amap.com/v3/weather/weatherInfo?city=${cityCode}&key=57b5118aed53d7a188874fc44256a0b8&extensions=all`let result=request.request(url)result.then((res)=>{if(res.responseCode===200){console.log(res.result.toString());resolve(JSON.parse(res.result.toString()))}}).catch((err)=>{console.log(err)})})}// 直接发送多个url结果一并返回async getWeathers(cityCodes:Array<number>){let promises:Array<Promise<WeatherModel>>=[]let weatherModels:Array<WeatherModel>=[]for (let i = 0; i < cityCodes.length; i++) {promises.push(this.getWeather(cityCodes[i]))}await Promise.all(promises).then(result=>{for(const element of result){console.log(element.forecasts[0].city)}weatherModels=result})return weatherModels}
}let getweatherutil=new getWeatherUtil()
export default getweatherutil as getWeatherUtil

casts

export class casts{date:stringdayweather:stringnightweather:stringdaytemp:numbernighttemp:numberdaywind:stringdaypower:stringdaytemp_float:numbernighttemp_float:number
}

cityView

import {casts} from '../view/casts'@Component
export struct cityView {// 获取数据// 城市天气数据casts:Array<casts>=[]@Builder weartherImage(weather:string){if(weather==='晴'){Image($r('app.media.sun')).width(23)}if(weather==='阴'){Image($r('app.media.cloudy')).width(30)}if(weather==='多云'){Image($r('app.media.cloudy')).width(30)}if(weather.includes('雨')){Image($r('app.media.rain')).width(30)}}// 展示数据build() {Column(){// 当天天气数据ForEach(this.casts,(cast:casts)=>{if(this.casts[0]===cast){// 展示天气所对应图片Row(){if(cast.dayweather==='晴'){Image($r('app.media.sun')).width(250)}if(cast.dayweather==='阴'){Image($r('app.media.cloudy')).width(250)}if(cast.dayweather==='多云'){Image($r('app.media.cloudy')).width(250)}if(cast.dayweather.includes('雨')){Image($r('app.media.rain')).width(300)}}Column(){// 温度天气Row(){Text(cast.dayweather).fontSize(30).fontColor(Color.White).fontWeight(700)Text("  "+cast.nighttemp+"°~"+cast.daytemp+"°").fontSize(30).fontColor(Color.White).fontWeight(700)}Row(){Text(cast.daywind+"风").fontSize(30).fontColor(Color.White).fontWeight(700)Text(cast.daypower+"级").fontSize(30).fontColor(Color.White).fontWeight(700)}}}})// 近期天气数据Column(){Text('近期天气查询').fontSize(26).margin({top:30,bottom:15})// 天气列表Row(){ForEach(this.casts,(cast:casts)=>{Column(){Text(cast.date.substring(5))this.weartherImage(cast.dayweather)Text(cast.daytemp.toString())Line().width(20).height(80).startPoint([10,0]).endPoint([10,70]).stroke(Color.Black).strokeWidth(3).strokeDashArray([10,3])this.weartherImage(cast.nightweather)Text(cast.nighttemp.toString())}.margin(5)})}}}.width('100%').height('100%')}
}

forecasts

import {casts} from '../view/casts'export class forecasts{city:stringadcode:numbercasts:Array<casts>
}

WeatherModel

import {forecasts} from './forecasts'export class WeatherModel{status:numbercount:numberinfocode:numberforecasts:Array<forecasts>=[]
}

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

idea debug功能演示线程安全问题

概述 用idea debug功能演示上一篇博客中提到的 本实现中的出队、入队的实现逻辑会不会有线程安全问题&#xff1f;如果有&#xff0c;怎么解决&#xff1f; 测试用例 package com.lovehena.datastructure.test;import com.lovehena.datastructure.ArrayQueue;/* * 测试 offer…

力扣每日一题【算法学习day.132】

前言 ###我做这类文章一个重要的目的还是记录自己的学习过程&#xff0c;我的解析也不会做的非常详细&#xff0c;只会提供思路和一些关键点&#xff0c;力扣上的大佬们的题解质量是非常非常高滴&#xff01;&#xff01;&#xff01; 习题 1.统计相似字符串对的数目 题目链…

C++操作符重载案例

在学习ZLToolKit源码时&#xff0c;发现代码中涉及好多运算符重载&#xff0c;因此对其做一下归类学习。 直接写一个代码案例如下&#xff1a; #include <iostream> #include <memory> #include <functional>// 定义类 A class A { public:A(int a) { _a a…

Kafka系列之:记录一次源头数据库刷数据,造成数据丢失的原因

Kafka系列之:记录一次源头数据库刷数据,造成数据丢失的原因 一、背景二、查看topic日志信息三、结论四、解决方法一、背景 源头数据库在很短的时间内刷了大量的数据,部分数据在hdfs丢失了 理论上debezium数据采集不会丢失,就需要排查数据链路某个节点是否有数据丢失。 数据…

爬虫小案例豆瓣电影top250(json格式)

1.json格式&#xff08;仅供学习参考&#xff09; import requests, json, jsonpathclass Start(object):# 类实例化时会执行def __init__(self):self.headers {user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.…

位运算实用技巧与LeetCode实战

位操作&#xff08;Bit Manipulation&#xff09;有很多有趣的技巧&#xff0c;其中一个比较著名的资源是 Bit Twiddling Hacks 网站&#xff0c;它收集了各种位操作的高阶玩法&#xff0c;网址是&#xff1a; http://graphics.stanford.edu/~seander/bithacks.html 不过&…

Android输入事件传递流程系统源码级解析

1. 硬件层到Linux内核 设备节点&#xff1a;触摸事件由内核驱动捕获&#xff0c;写入/dev/input/eventX。关键结构体&#xff1a;input_event&#xff08;包含时间戳、类型、代码、值&#xff09;。 2. Native层处理&#xff08;system_server进程&#xff09; 2.1 EventHub …

【云安全】云原生-Docker(六)Docker API 未授权访问

Docker API 未授权访问 是一个非常严重的安全漏洞&#xff0c;可能导致严重的安全风险。 什么是 Docker API &#xff1f; Docker API 是 Docker 容器平台提供的一组 RESTful API&#xff0c;用于与 Docker 守护程序进行通信和管理 Docker 容器。通过 Docker API&#xff0c;…

请说明C#中的List是如何扩容的?

在 C# 中&#xff0c;List<T>是一个动态数组&#xff0c;它会根据需要自动调整其容量以容纳更多的元素。 目录 1 扩容条件与扩容算法规则 2 总结 1 扩容条件与扩容算法规则 当你创建一个新的List<T>实例时&#xff0c;如果没有指定初始容量&#xff0c;它会使…

Screen Wonders for Mac v3.3.1 3D屏保应用 支持M、Intel芯片

应用介绍 Screen Wonders 是一款专为 macOS 设计的屏保应用&#xff0c;它提供了多种高质量的动态屏保选择&#xff0c;旨在为用户的屏幕增添美感和个性化元素。 如果你厌倦了桌面上静止的图片&#xff0c;如果你准备好迎接世界各地甚至平行宇宙的魔力&#xff0c;我们在这个…

Apache Struts RCE (CVE-2024-53677)

前言 对目前的Apache Struts RCE (CVE-2024-53677)的poc进行总结&#xff0c;由于只能单个ip验证&#xff0c;所以自己更改一下代码&#xff0c;实现&#xff1a;多线程读取url验证并保存&#xff0c;更改为中文解释 免责声明 请勿利用文章内的相关技术从事非法测试&#xf…

【R语言】绘图

一、散点图 散点图也叫X-Y图&#xff0c;它将所有的数据以点的形式展现在坐标系上&#xff0c;用来显示变量之间的相互影响程度。 ggplot2包中用来绘制散点图的函数是geom_point()&#xff0c;但在绘制前需要先用ggplot()函数指定数据集和变量。 下面用mtcars数据集做演示&a…

人工智能(AI)的不同维度分类

人工智能(AI)的分类 对机器学习进行分类的方式多种多样&#xff0c;可以根据算法的特性、学习方式、任务类型等不同维度进行分类这些分类都不是互斥的&#xff1a; 1、按数据模态不同:图像&#xff0c;文本&#xff0c;语音&#xff0c;多态等 2、按目标函数不同:判别式模型…

Java 大视界 -- Java 大数据未来十年的技术蓝图与发展愿景(95)

&#x1f496;亲爱的朋友们&#xff0c;热烈欢迎来到 青云交的博客&#xff01;能与诸位在此相逢&#xff0c;我倍感荣幸。在这飞速更迭的时代&#xff0c;我们都渴望一方心灵净土&#xff0c;而 我的博客 正是这样温暖的所在。这里为你呈上趣味与实用兼具的知识&#xff0c;也…

【网络安全 | 漏洞挖掘】账户接管+PII+原漏洞绕过

文章目录 前言正文前言 本文涉及的所有漏洞测试共耗时约三周,成果如下: 访问管理面板,成功接管目标列出的3000多家公司。 获取所有员工的真实指纹、机密文件及个人身份信息(PII)。 绕过KYC认证,成功接管电话号码。 绕过此前发现的漏洞。 正文 在测试目标时,我发现了一…

MySQL的Union和OR查询

这里写目录标题 **1. 创建表和索引****2. 编写 UNION 查询****3. 使用 EXPLAIN 分析查询****4. 分析 EXPLAIN 结果****可能的结果分析**&#xff1a; **5. 验证索引合并****总结****1. UNION 操作的分析****为什么使用临时表&#xff1f;** 2. OR 条件的分析为什么使用索引合并…

二叉排序树 -- AVL树 红黑树

手撕 – AVL树、红黑树 个人主页&#xff1a;顾漂亮 文章专栏&#xff1a;Java数据结构 文章目录 手撕 -- AVL树、红黑树1.AVL树1.1AVL树的概念1.2AVL树的性质1.3AVL树的实现 -- Java代码1.4AVL树的性能分析 2.红黑树2.1概念2.2红黑树的性质2.3红黑树的实现2.4AVL树和红黑树的比…

在 .NET 8/9 中使用 AppUser 进行 JWT 令牌身份验证

文章目录 一、引言二、什么是 JSON Web 令牌&#xff1f;三、什么是 JSON Web 令牌结构&#xff1f;四、设置 JWT 令牌身份验证4.1 创建新的 .NET 8 Web API 项目4.2 安装所需的 NuGet 软件包4.3 创建 JWT 配置模型4.4 将 JWT 配置添加到您的 appsettings.json 中4.5 为 Config…

问卷数据分析|SPSS实操之相关分析

皮尔逊还是斯皮尔曼的选取主要看数据的分布 当数据满足正态分布且具有线性关系时&#xff0c;用皮尔逊相关系数 当有一个不满住时&#xff0c;用斯皮尔曼相关系数 1. 选择分析--相关--双变量 2. 将Z1-Y2加入到变量中&#xff0c;选择皮尔逊 3. 此处为结果&#xff0c;可看我案…

自动化办公|xlwings生成图表

在日常的数据分析和报告生成中&#xff0c;Excel图表是一个非常重要的工具。它能够帮助我们直观地展示数据&#xff0c;发现数据中的规律和趋势。然而&#xff0c;手动创建和调整图表往往耗时且容易出错。幸运的是&#xff0c;借助Python的xlwings库&#xff0c;我们可以自动化…