Flask+微信小程序实现Login+Profile

Python代码

首先flask的session用不了,只能用全局变量来实现。

import pymysql
from flask import Flask, request, jsonify, session
from flask_cors import CORS
from flask import make_responseapp = Flask(__name__)
CORS(app, supports_credentials=True)  # 允许带上凭据(cookies)app.secret_key = 'your_secret_key' # 数据库配置
db_config = {'host': 'localhost','user': 'root','password': '123456','database': 'pet','charset': 'utf8mb4'
}current_user_id = None@app.route('/login', methods=['POST'])
def login():global current_user_id  # 声明使用全局变量data = request.get_json()username = data.get('username')password = data.get('password')connection = pymysql.connect(**db_config)try:with connection.cursor() as cursor:sql = "SELECT * FROM users WHERE username=%s AND password=%s"cursor.execute(sql, (username, password))result = cursor.fetchone()if result:current_user_id = result[0]  # 设置全局变量print(f"User ID set globally: {current_user_id}")return jsonify({'message': '登录成功', 'status': 'success', 'data': {'id': current_user_id, 'username': result[1]}})else:return jsonify({'message': '登录失败', 'status': 'fail'}), 401finally:connection.close()@app.route('/register', methods=['POST'])
def register():data = request.get_json()print("Received data:", data)  # 打印接收到的数据username = data.get('username')password = data.get('password')# 检查用户名和密码是否提供if not username or not password:return jsonify({'message': '用户名和密码不能为空', 'status': 'fail'}), 400connection = pymysql.connect(**db_config)try:with connection.cursor() as cursor:# 查询数据库以检查用户名是否已存在sql_check = "SELECT * FROM users WHERE username=%s"cursor.execute(sql_check, (username,))result = cursor.fetchone()if result:return jsonify({'message': '用户名已存在', 'status': 'fail'}), 400# 插入新用户sql_insert = "INSERT INTO users (username, password) VALUES (%s, %s)"cursor.execute(sql_insert, (username, password))connection.commit()return jsonify({'message': '注册成功', 'status': 'success'}), 201except pymysql.MySQLError as db_err:return jsonify({'message': '数据库错误', 'status': 'fail', 'error': str(db_err)}), 500except Exception as e:return jsonify({'message': '注册失败', 'status': 'fail', 'error': str(e)}), 500finally:connection.close()  # 确保连接在完成后关闭@app.route('/profile', methods=['GET'])
def profile():global current_user_id  # 声明使用全局变量if current_user_id is None:return jsonify({'message': '未登录', 'status': 'fail'}), 401# 查询用户信息connection = pymysql.connect(**db_config)try:with connection.cursor() as cursor:sql = "SELECT username, nickname, phone, email FROM users WHERE id=%s"cursor.execute(sql, (current_user_id,))result = cursor.fetchone()if result:user_data = {"username": result[0],"nickname": result[1],"phone": result[2],"email": result[3]}return jsonify({'message': '获取成功', 'status': 'success', 'data': user_data})else:return jsonify({'message': '用户未找到', 'status': 'fail'}), 404finally:connection.close()#==========================发布笔记===============================
@app.route('/post_note', methods=['POST'])
def post_note():global current_user_idif current_user_id is None:return jsonify({'message': '未登录', 'status': 'fail'}), 401data = request.get_json()print(data)content = data.get('content')if not content:return jsonify({'message': '笔记内容不能为空', 'status': 'fail'}), 400connection = pymysql.connect(**db_config)try:with connection.cursor() as cursor:sql_insert = "INSERT INTO notes (user_id, content) VALUES (%s, %s)"cursor.execute(sql_insert, (current_user_id, content))connection.commit()return jsonify({'message': '发布成功', 'status': 'success'}), 201except pymysql.MySQLError as db_err:return jsonify({'message': '数据库错误', 'status': 'fail', 'error': str(db_err)}), 500finally:connection.close()# ========================== 获取笔记和评论 ===========================
@app.route('/get_note/<int:note_id>', methods=['GET'])
def get_note(note_id):connection = pymysql.connect(**db_config)try:with connection.cursor() as cursor:# 获取笔记sql_get_note = "SELECT content, created_at FROM notes WHERE id=%s"cursor.execute(sql_get_note, (note_id,))note = cursor.fetchone()if not note:return jsonify({'message': '笔记未找到', 'status': 'fail'}), 404# 获取评论sql_get_comments = "SELECT user_id, comment, created_at FROM comments WHERE note_id=%s"cursor.execute(sql_get_comments, (note_id,))comments = cursor.fetchall()return jsonify({'message': '获取成功','status': 'success','data': {'content': note[0],'comments': [{'user_id': comment[0], 'comment': comment[1], 'created_at': comment[2]}for comment in comments]}})except pymysql.MySQLError as db_err:return jsonify({'message': '数据库错误', 'status': 'fail', 'error': str(db_err)}), 500finally:connection.close()# ========================== 提交评论 ================================
@app.route('/post_comment', methods=['POST'])
def post_comment():data = request.get_json()note_id = data.get('note_id')comment = data.get('comment')user_id = data.get('user_id')if not note_id or not comment or not user_id:return jsonify({'message': '笔记ID、评论内容和用户ID不能为空', 'status': 'fail'}), 400connection = pymysql.connect(**db_config)try:with connection.cursor() as cursor:# 检查笔记是否存在sql_check_note = "SELECT id FROM notes WHERE id=%s"cursor.execute(sql_check_note, (note_id,))note_exists = cursor.fetchone()if not note_exists:return jsonify({'message': '笔记不存在', 'status': 'fail'}), 404# 插入评论sql_insert_comment = "INSERT INTO comments (note_id, user_id, comment) VALUES (%s, %s, %s)"cursor.execute(sql_insert_comment, (note_id, user_id, comment))connection.commit()return jsonify({'message': '评论成功', 'status': 'success'}), 201except pymysql.MySQLError as db_err:return jsonify({'message': '数据库错误', 'status': 'fail', 'error': str(db_err)}), 500finally:connection.close()#========================all_notes====展示全部笔记====================
@app.route('/get_notes', methods=['GET'])
def get_notes():connection = pymysql.connect(**db_config)try:with connection.cursor() as cursor:sql = "SELECT id, content, user_id FROM notes"  # 假设你有一个 'notes' 表存储笔记和用户IDcursor.execute(sql)notes = cursor.fetchall()notes_list = [{'id': note[0], 'content': note[1], 'user_id': note[2]} for note in notes]return jsonify({'message': '获取成功', 'status': 'success', 'data': {'notes': notes_list}})except pymysql.MySQLError as db_err:return jsonify({'message': '数据库错误', 'status': 'fail', 'error': str(db_err)}), 500finally:connection.close()if __name__ == '__main__':app.run()

微信小程序代码

Login

Page({data: {username: '',password: ''},onUsernameInput: function(e) {this.setData({username: e.detail.value});},onPasswordInput: function(e) {this.setData({password: e.detail.value});},login: function() {const { username, password } = this.data;if (!username || !password) {wx.showToast({title: '请输入账号和密码',icon: 'none'});return;}wx.request({url: 'http://127.0.0.1:5000/login',method: 'POST',data: {username,password},success: function(res) {if (res.statusCode === 200) {const data = res.data;wx.showToast({title: data.message,icon: data.status === 'success' ? 'success' : 'none'});if (data.status === 'success') {// 登录成功后,处理返回的数据const userData = data.data; // 获取数组数据console.log(userData); wx.redirectTo({url: '/pages/index/index' });// 这里可以根据需要进行进一步处理// 可以在这里进行页面跳转等操作}} else {wx.showToast({title: '登录失败',icon: 'none'});}},fail: function(err) {wx.showToast({title: '网络错误',icon: 'none'});console.error(err);}});},goToRegister: function() {wx.redirectTo({url: '/pages/register/register' // 修改为目标页面的路径});}
});
<view class="container"><view class="input-group"><input type="text" placeholder="请输入用户名" bindinput="onUsernameInput" /></view><view class="input-group"><input type="password" placeholder="请输入密码" bindinput="onPasswordInput" /></view><button bindtap="login">登录</button><button bindtap="goToRegister">注册</button> <!-- 添加注册按钮 -->
</view>
/* 样式文件 */
.container {display: flex;flex-direction: column;justify-content: center;align-items: center;height: 100vh;background-color: #f5f5f5;padding: 20px;
}.input-group {width: 100%;max-width: 300px;margin-bottom: 20px;
}input {width: 100%;padding: 10px;border: 1px solid #ccc;border-radius: 4px;font-size: 16px;
}button {width: 100%;max-width: 300px;padding: 10px;background-color: #007bff;color: white;border: none;border-radius: 4px;font-size: 16px;cursor: pointer;
}button:hover {background-color: #0056b3;
}

profile

Page({data: {username: '',nickname: '',phone: '',email: ''},goToIndex() {wx.navigateTo({url: '/pages/index/index',  // 笔记页面的路径});},onLoad: function() {wx.request({url: 'http://127.0.0.1:5000/profile',method: 'GET',success: (res) => {if (res.statusCode === 200) {const data = res.data.data;this.setData({username: data.username,nickname: data.nickname,phone: data.phone,email: data.email});} else {wx.showToast({title: res.data.message,icon: 'none'});}},fail: (err) => {wx.showToast({title: '网络错误',icon: 'none'});console.error(err);}});}
});
<view class="container"><view class="info-section"><view class="info-item"><text>用户名:</text><text>{{username}}</text></view><view class="info-item"><text>昵称:</text><text>{{nickname}}</text></view><view class="info-item"><text>电话:</text><text>{{phone}}</text></view><view class="info-item"><text>邮箱:</text><text>{{email}}</text></view></view><!-- 前往笔记页面的按钮 --><view class="button-section"><button bindtap="goToIndex">返回主页</button></view>
</view>
.container {padding: 20px;background-color: #f8f8f8; /* 背景颜色 */border-radius: 8px; /* 圆角 */box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* 阴影效果 */
}.info-section {margin-bottom: 20px; /* 下边距 */
}.info-item {margin-bottom: 15px; /* 每项的下边距 */padding: 10px; /* 内边距 */background-color: #ffffff; /* 每项的背景颜色 */border: 1px solid #e0e0e0; /* 边框颜色 */border-radius: 5px; /* 边框圆角 */display: flex; /* 使用flex布局 */justify-content: space-between; /* 子项两端对齐 */align-items: center; /* 垂直居中对齐 */
}.info-item text {color: #333333; /* 文本颜色 */font-size: 16px; /* 字体大小 */
}button {background-color: #007aff; /* 按钮背景颜色 */color: white; /* 按钮文本颜色 */padding: 10px 15px; /* 按钮内边距 */border: none; /* 无边框 */border-radius: 5px; /* 圆角 */font-size: 16px; /* 字体大小 */cursor: pointer; /* 鼠标悬停时的光标样式 */
}button:hover {background-color: #005bb5; /* 悬停时的背景颜色 */
}

register

Page({data: {username: '',password: ''},onUsernameInput: function(e) {this.setData({username: e.detail.value});},onPasswordInput: function(e) {this.setData({password: e.detail.value});},register: function() {const { username, password } = this.data;if (!username || !password) {wx.showToast({title: '请输入账号和密码',icon: 'none'});return;}wx.request({url: 'http://127.0.0.1:5000/register',method: 'POST',data: {username,password},success: function(res) {if (res.statusCode === 200) {const data = res.data;wx.showToast({title: data.message,icon: data.status === 'success' ? 'success' : 'none'});} else {wx.showToast({title: '注册失败',icon: 'none'});}},fail: function(err) {wx.showToast({title: '网络错误',icon: 'none'});console.error(err);}});}
});
<view class="container"><view class="input-group"><input type="text" placeholder="请输入用户名" bindinput="onUsernameInput" /></view><view class="input-group"><input type="password" placeholder="请输入密码" bindinput="onPasswordInput" /></view><button bindtap="register">注册</button>
</view>
/* 样式文件 */
.container {display: flex;flex-direction: column;justify-content: center;align-items: center;height: 100vh;background-color: #f5f5f5;padding: 20px;
}.input-group {width: 100%;max-width: 300px;margin-bottom: 20px;
}input {width: 100%;padding: 10px;border: 1px solid #ccc;border-radius: 4px;font-size: 16px;
}button {width: 100%;max-width: 300px;padding: 10px;background-color: #007bff;color: white;border: none;border-radius: 4px;font-size: 16px;cursor: pointer;
}button:hover {background-color: #0056b3;
}

index

Page({// 跳转到发布笔记页面goToPublishNote() {wx.navigateTo({url: '/pages/notes/notes', // 发布笔记页面的路径});},// 跳转到查看全部笔记页面goToAllNotes() {wx.navigateTo({url: '/pages/all_notes/all_notes', // 全部笔记页面的路径});},goToProfile() {wx.navigateTo({url: '/pages/profile/profile', // 全部笔记页面的路径});}
});
<view class="container"><button bindtap="goToPublishNote">发布笔记</button><button bindtap="goToAllNotes">查看全部笔记</button><button bindtap="goToProfile">进入个人页面</button>
</view>

all_notes

Page({data: {notes: [], // 笔记列表},// 页面加载时获取所有笔记onLoad() {this.fetchNotes();},// 获取笔记列表fetchNotes() {wx.request({url: 'http://127.0.0.1:5000/get_notes', // 获取笔记的后端接口method: 'GET',success: (res) => {if (res.data.status === 'success') {this.setData({ notes: res.data.data.notes });} else {wx.showToast({title: res.data.message,icon: 'none',});}},fail: () => {wx.showToast({title: '请求失败',icon: 'none',});},});},// 选择某个笔记时触发selectNote(event) {const noteId = event.currentTarget.dataset['noteId'];const userId = event.currentTarget.dataset['userId'];// 跳转到笔记详情页面,并传递noteId和userId作为参数wx.navigateTo({url: `/pages/note_detail/note_detail?noteId=${noteId}&userId=${userId}`,});},
});
<view class="note-list"><block wx:for="{{notes}}" wx:key="id"><view class="note-item" bindtap="selectNote" data-note-id="{{item.id}}" data-user-id="{{item.user_id}}"><text>笔记内容: {{item.content}}</text><text>用户ID: {{item.user_id}}</text></view></block>
</view>

notes

Page({data: {noteContent: '',        // 发布的笔记内容commentContent: '',     // 评论的内容notes: [],              // 笔记列表selectedNoteId: null,   // 选中的笔记IDcomments: []            // 当前笔记的评论列表},// 输入笔记内容onInputNote(event) {this.setData({noteContent: event.detail.value});},// 发布笔记postNote() {const { noteContent } = this.data;if (!noteContent) {wx.showToast({title: '笔记内容不能为空',icon: 'none'});return;}wx.request({url: 'http://127.0.0.1:5000/post_note',method: 'POST',data: {content: noteContent},success: (res) => {if (res.data.status === 'success') {wx.showToast({ title: '发布成功' });this.fetchNotes(); // 重新获取笔记列表this.setData({ noteContent: '' });} else {wx.showToast({ title: res.data.message, icon: 'none' });}}});},
});
<view class="container"><!-- 发布笔记区域 --><view class="post-note"><textarea placeholder="请输入笔记内容" bindinput="onInputNote" value="{{noteContent}}"></textarea><button bindtap="postNote">发布笔记</button></view>  
</view>
.container {padding: 20px;
}.post-note textarea, .post-note button {margin-bottom: 10px;width: 100%;
}.note-list {margin-top: 20px;
}.note-item {padding: 10px;background-color: #f5f5f5;margin-bottom: 10px;border-radius: 5px;
}.comment-list {margin-top: 20px;
}.comment-item {padding: 5px;background-color: #eee;margin-bottom: 5px;border-radius: 3px;
}

note_detail

Page({data: {noteId: null,userId: null,noteContent: '',comments: [],  // 评论列表newComment: '',  // 用户输入的新评论},onLoad(options) {const { noteId, userId } = options;this.setData({ noteId, userId });this.fetchNoteDetail(noteId);this.fetchComments(noteId);},// 根据noteId获取笔记详情fetchNoteDetail(noteId) {wx.request({url: `http://127.0.0.1:5000/get_note/${noteId}`,method: 'GET',success: (res) => {if (res.data.status === 'success') {this.setData({ noteContent: res.data.data.content });} else {wx.showToast({title: res.data.message,icon: 'none',});}},fail: () => {wx.showToast({title: '请求失败',icon: 'none',});},});},// 获取该笔记的评论fetchComments(noteId) {wx.request({url: `http://127.0.0.1:5000/get_comments/${noteId}`,  // 获取评论的接口method: 'GET',success: (res) => {if (res.data.status === 'success') {this.setData({ comments: res.data.data.comments });} else {wx.showToast({title: res.data.message,icon: 'none',});}},fail: () => {wx.showToast({title: '请求失败',icon: 'none',});},});},// 处理评论输入handleCommentInput(event) {this.setData({ newComment: event.detail.value });},// 提交评论submitComment() {if (!this.data.newComment.trim()) {wx.showToast({title: '请输入评论内容',icon: 'none',});return;}wx.request({url: 'http://127.0.0.1:5000/post_comment',method: 'POST',data: {note_id: this.data.noteId,comment: this.data.newComment,user_id: this.data.userId, // 假设使用userId代表发表评论的用户},success: (res) => {if (res.data.status === 'success') {wx.showToast({title: '评论成功',});// 评论成功后,重新获取评论列表this.fetchComments(this.data.noteId);this.setData({ newComment: '' });  // 清空输入框} else {wx.showToast({title: res.data.message,icon: 'none',});}},fail: () => {wx.showToast({title: '评论失败',icon: 'none',});},});},
});
<view class="note-detail"><text>笔记ID: {{noteId}}</text><text>用户ID: {{userId}}</text><text>笔记内容: {{noteContent}}</text><!-- 评论部分 --><view class="comments-section"><text>评论列表:</text><block wx:for="{{comments}}" wx:key="id"><view class="comment-item"><text>用户{{item.user_id}}: {{item.comment}}</text></view></block></view><!-- 新增评论输入框 --><view class="add-comment"><input type="text" placeholder="输入你的评论" value="{{newComment}}" bindinput="handleCommentInput" /><button bindtap="submitComment">提交评论</button></view>
</view>

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

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

相关文章

Docker学习和部署ry项目

文章目录 停止Docker重启设置开机自启执行docker ps命令&#xff0c;如果不报错&#xff0c;说明安装启动成功2.然后查看数据卷结果3.查看数据卷详情结果4.查看/var/lib/docker/volumes/html/_data目录可以看到与nginx的html目录内容一样&#xff0c;结果如下&#xff1a;5.进入…

理解:两横三纵 简述

理解&#xff1a;两横三纵 简述 下图:两横三纵-yellow色线分布图 时间&#xff1a;2013年12月提出的城市化战略格局 所谓“两横三纵”&#xff0c; 即以陆桥通道、沿长江通道为两条横轴&#xff0c; 以沿海、京哈京广、包昆通道为三条纵轴&#xff0c; 以主要的城市群地区为…

C#和数据库高级:虚方法

文章目录 一、抽象方法和抽象类中的思考1.1、回顾抽象方法的特点1.2、针对抽象方法问题的引出 二、虚方法的使用步骤2.1、虚方法重写方法的调用2.2、系统自带的虚方法2.3、重写Equals方法2.4、虚方法和抽象方法的比较 三、虚方法和抽象方法的联系3.1、ToString()方法的应用 一、…

SpringBoot技术栈:打造下一代网上租赁系统

第2章 关键技术简介 2.1 Java技术 Java是一种非常常用的编程语言&#xff0c;在全球编程语言排行版上总是前三。在方兴未艾的计算机技术发展历程中&#xff0c;Java的身影无处不在&#xff0c;并且拥有旺盛的生命力。Java的跨平台能力十分强大&#xff0c;只需一次编译&#xf…

Rust语言桌面应用开发GTK3 Gtk3-rs Glade

文章目录 GTK-RSGithub官网Rust 教程Rust 环境安装 GTK安装 Gladedemo.glade 文件完整示例 main.rs创建 Rust 项目Cargo.toml 文件main.rs 文件 编译运行GTK主题 GTK-RS gtk-rs 是一个用于在 Rust 编程语言中使用 GTK 图形用户界面工具包的库。GTK 是一个流行的跨平台 GUI 工具…

SqlAlchemy使用教程(七) 异步访问数据库

SqlAlchemy使用教程(一) 原理与环境搭建SqlAlchemy使用教程(二) 入门示例及编程步骤SqlAlchemy使用教程(三) CoreAPI访问与操作数据库详解SqlAlchemy使用教程(四) MetaData 与 SQL Express Language 的使用SqlAlchemy使用教程(五) ORM API 编程入门SqlAlchemy使用教程(六) – O…

CSS文本格式化

通过 CSS 中的文本属性您可以像操作 Word 文档那样定义网页中文本的字符间距、对齐方式、缩进等等&#xff0c;CSS 中常用的文本属性如下所示&#xff1a; text-align&#xff1a;设置文本的水平对齐方式&#xff1b;text-decoration&#xff1a;设置文本的装饰&#xff1b;te…

linux远程桌面:xrdp 安装失败

window 如何远程 Linux 桌面 安装xrdp yum install xrdpsystemctl start xrdp 如果找不到软件包&#xff0c;就安装epel源&#xff0c;最好改成国内镜像的 在 /etc/yum.repos.d/ 下创建epel.repo,内容如下 [epel] nameExtra Packages for Enterprise Linux 7 - $basearch …

实战OpenCV之形态学操作

基础入门 形态学操作是一种基于图像形状的处理方法,主要用于结构分析,比如:边缘检测、轮廓提取、噪声去除等。这些操作通常使用一个称为“结构元素”(Structuring Element)的核来进行,结构元素可以是任何形状,但最常见的有矩形和圆形。形态学操作的核心在于通过结构元素…

Python爬虫selenium框架基本使用

一、安装导入 使用包管理器安装 pip3 install selenium 二、WebDriver工具 要使用这个工具我们需要保证安装了一个浏览器的驱动器。 Python的WebDriver是一个用于自动化Web浏览器操作的工具&#xff0c;它属于Selenium的一部分&#xff0c;特别是Selenium 2.0及以后版本中…

【Kubernetes】常见面试题汇总(四十)

目录 93. Kubelet 与 kubeproxy 作用。Kubeproxy 的三种代理模式和各自的原理以及它们的区别。 特别说明&#xff1a; 题目 1-68 属于【Kubernetes】的常规概念题&#xff0c;即 “ 汇总&#xff08;一&#xff09;~&#xff08;二十二&#xff09;” 。 题目 69-113 属…

【拥抱AIGC】通义灵码扩展管理

通义灵码提供了扩展管理&#xff0c;支持自定义指令&#xff0c;满足企业编码场景的扩展诉求。 适用版本 企业标准版、企业专属版 通义灵码管理员、组织内全局管理员&#xff08;专属版&#xff09;在通义灵码控制台-扩展管理中&#xff0c;进行自定义指令的管理、查看自定义…

Unity2022.3.x各个版本bug集合及推荐稳定版本

最近升级到Unity2022&#xff0c;发现以下问题&#xff0c;仅作参考 2022.3.0f1 - 2022.3.6f1 粒子渲染到RenderTexture闪屏 https://issuetracker.unity3d.com/issues/android-vulkan-visualisation-corruption-occurs-when-rendering-particles-to-render-texture 2022.3.…

嵌入式必懂微控制器选型:STM32、ESP32、AVR与PIC的比较分析

目录 1 微控制器基础概述 1.1 微控制器基本概念 1.2 工作原理及架构 1.3 STM32、ESP32、AVR和PIC简介 2 微控制器性能比较分析 2.1 性能比较 2.2 功耗比较 2.3 功耗分析 2.4 外设接口对比 3 应用场景与选择策略 3.1 物联网应用场景 3.2 工业控制场景 3.3 智能家居场…

not exist 解决一对多 场景 条件过滤问题

场景&#xff1a; 现在存在一对多关系&#xff0c;蓝色的盒子装的篮球&#xff0c;黄的的盒子装的黄球&#xff0c; 黑色的盒子 &#xff08;模拟工作类似场景&#xff09; boxIdballId蓝盒ID-15蓝盒ID-16蓝盒ID-17黄盒ID-212黄盒ID-215黄盒ID-216黑盒ID-38黑盒ID-39 需求&a…

leetcode|刷算法 线段树原理以及模板

线段树出现的题目特征 线段树使用的题目。每次操作都要得到返回结果的。 比如 699. 掉落的方块 - 力扣&#xff08;LeetCode&#xff09; 2286. 以组为单位订音乐会的门票 - 力扣&#xff08;LeetCode&#xff09; 1845. 座位预约管理系统 - 力扣&#xff08;LeetCode&#…

关于Java中的List<User>如何进行深拷贝

联调中发现了一个很初级&#xff0c;但有容易被忽略的拷贝问题&#xff1a; 错误方式&#xff1a;List<User> us new ArrayList<>(); // name "张三"List<User> us1 new ArrayList<>(us);for (User u : us) {...u.setName("douzi&q…

【PHP陪玩系统源码】游戏陪玩系统app,陪玩小程序优势

陪玩系统开发运营级别陪玩成品搭建 支持二开源码交付&#xff0c;游戏开黑陪玩系统: 多客陪玩系统&#xff0c;游戏开黑陪玩&#xff0c;线下搭子&#xff0c;开黑陪玩系统 前端uniapp后端php&#xff0c;数据库MySQL 1、长时间的陪玩APP源码开发经验&#xff0c;始终坚持从客户…

Docker镜像命令和容器命令

目录 镜像命令 镜像命名规范 镜像操作命令 DockerHub拉取镜像 利用docker save将nginx镜像导出磁盘&#xff0c;然后再通过load加载回来 总结 容器命令介绍和案例 容器相关命令 案例&#xff1a;创建运行一个Nginx容器 总结 镜像命令 镜像命名规范 镜像名称一般分两…

uniapp框架中实现文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间

前言 uni-file-picker是uniapp中的一个文件选择器组件,用于选择本地文件并返回选择的文件路径或文件信息。该组件支持选择单个文件或多个文件,可以设置文件的类型、大小限制,并且可以进行文件预览。 提示:以下是本篇文章正文内容,下面案例可供参考 uni-file-picker组件具…