Android之APP更新(通过接口更新)

文章目录

  • 前言
  • 一、效果图
  • 二、实现步骤
    • 1.AndroidManifest权限申请
    • 2.activity实现
    • 3.有版本更新弹框UpdateappUtilDialog
    • 4.下载弹框DownloadAppUtils
    • 5.弹框背景图
  • 总结


前言

对于做Android的朋友来说,APP更新功能再常见不过了,因为平台更新审核时间较长,所以现在很多都会通过接口更新,这里就记录一下吧,欢迎各位讨论。


一、效果图

在这里插入图片描述
在这里插入图片描述

二、实现步骤

1.AndroidManifest权限申请

    <!--外置存储卡写入权限--><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /><!--请求安装APK的权限--><uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /><!--读取删除SD卡权限--><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /><!--修改删除SD卡权限--><uses-permissionandroid:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"tools:ignore="ProtectedPermissions" /><uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />//application标签下加如下代码<!-- 安卓7.0安装时需要,拍照需要的临时权限 --><providerandroid:name="androidx.core.content.FileProvider"android:authorities="这里是applicationId也就是包名.fileprovider"android:exported="false"android:grantUriPermissions="true"><meta-dataandroid:name="android.support.FILE_PROVIDER_PATHS"android:resource="@xml/provider_paths" /></provider>//这里的provider_paths文件放在xml文件下,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<paths><!--拍照需要的路径--><external-pathname="comxf.activity.provider.download"path="." /><external-files-path name="extfiles" path="autoupdatecache/" /><external-cache-path name="extcachs" path="autoupdatecache/" /><cache-path name="intcachs" path="autoupdatecache/" /><paths><external-path path="" name="download"/></paths></paths>

2.activity实现

1.通过接口获取Javabean对象

    public Integer id;public String version_name;//App版本名public Integer version_code;//版本编号public String content;//版本更新内容public String is_must_update;//是否需要强更新(0:否,1:是)public String file_url;//app包的下载地址@Overridepublic String toString() {return "VersionUpgradeBean{" +"id=" + id +", version_name='" + version_name + '\'' +", version_code=" + version_code +", content='" + content + '\'' +", is_must_update='" + is_must_update + '\'' +", file_url='" + file_url + '\'' +'}';}

2.获取到版本号后判断是否高于当前版本

  if (versionbean.version_code > MyApplication.getVersionCode(this@SetUpActivity)) {val myDialog = UpdateappUtilDialog()myDialog.initDialog(this@SetUpActivity, versionbean)myDialog.buttonClickEvent(object : UpdateappUtilDialog.DialogButtonClick {override fun cilckComfirmButton(view: View?) {myDialog.Dismiss()//6.0才用动态权限if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {if (ContextCompat.checkSelfPermission(this@SetUpActivity,Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {// 申请读写内存卡内容的权限ActivityCompat.requestPermissions(this@SetUpActivity, arrayOf(Manifest.permission.`WRITE_EXTERNAL_STORAGE`), 123)} else {//授权成功if (FileUtils.createOrExistsDir(NetConst.baseFileName)) {val mUpdateManger = DownloadAppUtils(this@SetUpActivity, versionbean.file_url, versionbean)mUpdateManger.checkUpdateInfo()}}} else {//授权成功if (FileUtils.createOrExistsDir(NetConst.baseFileName)) {val mUpdateManger = DownloadAppUtils(this@SetUpActivity, versionbean.file_url, versionbean)mUpdateManger.checkUpdateInfo()}}}override fun cilckCancleButton(view: View?) {//点击取消按钮myDialog.Dismiss()}})}

3.用户权限结果处理

  /*** todo 对用户权限授予结果处理** @param requestCode  权限要求码,即我们申请权限时传入的常量 如: TAKE_PHOTO_PERMISSION_REQUEST_CODE* @param permissions  保存权限名称的 String 数组,可以同时申请一个以上的权限* @param grantResults 每一个申请的权限的用户处理结果数组(是否授权)*/override fun onRequestPermissionsResult(requestCode: Int,permissions: Array<String?>,grantResults: IntArray) {super.onRequestPermissionsResult(requestCode, permissions, grantResults)when (requestCode) {123 -> {//授权成功if (FileUtils.createOrExistsDir(NetConst.baseFileName)) {val mUpdateManger = DownloadAppUtils(this@SetUpActivity, versionbean.file_url, versionbean)mUpdateManger.checkUpdateInfo()}}}}

3.有版本更新弹框UpdateappUtilDialog

1.util代码

/*** Created by :caoliulang* ❤* Creation time :2025/2/24* ❤* Function :更新app的Dialog*/
public class UpdateappUtilDialog {private TextView secondBtn, textvs;private ImageView tv_cancel;private AlertDialog alertDialog;private DialogButtonClick mClick;private TextView tv_desc;public interface DialogButtonClick {void cilckComfirmButton(View view);void cilckCancleButton(View view);}public void buttonClickEvent(DialogButtonClick bc) {if (bc != null) {mClick = bc;cilckEvent();}}public void initDialog(Context context, VersionUpgradeBean upbean) {alertDialog = new AlertDialog.Builder(context).create();alertDialog.show();alertDialog.setCancelable(false);//调用这个方法时,按对话框以外的地方不起作用。返回键 不作用
//        alertDialog.setCanceledOnTouchOutside(false);//调用这个方法时,按对话框以外的地方不起作用。返回键 有作用Window window = alertDialog.getWindow();window.setContentView(R.layout.fragment_update_app);window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));tv_desc = window.findViewById(R.id.tv_desc);tv_desc.setText(upbean.content);secondBtn = window.findViewById(R.id.tv_ok);textvs = window.findViewById(R.id.textvs);textvs.setText(upbean.version_name);tv_cancel = window.findViewById(R.id.tv_cancel);//1不强制更新  2 强制更新
//        if(upbean.getUpdateType().equals("2")){
//            firstBtn.setVisibility(View.GONE);
//        }//        //不关闭弹窗也能点击外部事件
//        alertDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);String isqg = upbean.is_must_update + "";if (isqg.equals("true")) {tv_cancel.setVisibility(View.GONE);} else {tv_cancel.setVisibility(View.VISIBLE);}}public void cilckEvent() {
//        if (firstBtn != null) {
//            firstBtn.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    alertDialog.dismiss();
//                    mClick.cilckCancleButton(v);
//                }
//            });secondBtn.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {
//                    alertDialog.dismiss();mClick.cilckComfirmButton(v);}});tv_cancel.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {mClick.cilckCancleButton(view);}});
//        }}public void Dismiss() {if (null != alertDialog) {alertDialog.dismiss();}}}

2.xml布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="#01000000"android:gravity="center"android:orientation="vertical"><RelativeLayoutandroid:layout_width="301dp"android:layout_height="400dp"android:orientation="vertical"><ImageViewandroid:id="@+id/iv_top"android:layout_width="match_parent"android:layout_height="match_parent"android:src="@mipmap/lib_update_app_top_bg" /><TextViewandroid:id="@+id/textname"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="16dp"android:layout_marginTop="55dp"android:text="@string/Newversionfound"android:textColor="#2e2e2e"android:textSize="18dp"android:textStyle="bold" /><TextViewandroid:id="@+id/textvs"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/textname"android:layout_marginLeft="16dp"android:layout_marginTop="5dp"android:text="1.0.0"android:textColor="#2e2e2e"android:textSize="16dp"android:textStyle="bold" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="210dp"android:layout_marginTop="180dp"android:orientation="vertical"><!--这个地方需要设置可以滚动--><ScrollViewandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"android:paddingTop="18dp"android:paddingBottom="5dp"android:scrollbars="none"><TextViewandroid:id="@+id/tv_desc"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginLeft="20dp"android:layout_marginRight="20dp"android:lineSpacingExtra="5dp"android:text="1.已知bug修复;\n2.新功能增加;\n3.性能优化;"android:textColor="@android:color/black"android:textSize="14dp" /></ScrollView><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginLeft="20dp"android:layout_marginRight="20dp"android:layout_marginBottom="20dp"android:orientation="horizontal"><TextViewandroid:id="@+id/tv_ok"android:layout_width="match_parent"android:layout_height="44dp"android:background="@drawable/jianbianlanse"android:gravity="center"android:text="@string/UPDATENOW"android:textColor="#ffffff"android:textSize="18dp" /></LinearLayout></LinearLayout></RelativeLayout><ImageViewandroid:id="@+id/tv_cancel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="15dp"android:src="@mipmap/ico_sjgb" /></LinearLayout>

4.下载弹框DownloadAppUtils

1.util代码如下

*** Created by :caoliulang** Creation time :2024/2/24** FunctionAPP更新下载*/
public class DownloadAppUtils {// 应用程序Contextpublic static Activity mContext;private static final String savePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "tdzr/Download/";// 保存apk的文件夹///storage/emulated/0/tdzr/Download/aidigital1.0.4.apkprivate static final String saveFileName = savePath + "aidigital" + MyApplication.versionname + ".apk";// 进度条与通知UI刷新的handler和msg常量private ProgressBar mProgress;private TextView text_progress, textvs;private static final int DOWN_UPDATE = 1;private static final int DOWN_OVER = 2;private static final int INT_NOT = 9;private String downlogdurl;//下载地址private int progress = 0;// 当前进度private Thread downLoadThread; // 下载线程private boolean interceptFlag = false;// 用户取消下载private AlertDialog dialog;private VersionUpgradeBean upbean;// 通知处理刷新界面的handler@SuppressLint("HandlerLeak")private Handler mHandler = new Handler() {@SuppressLint("HandlerLeak")@Overridepublic void handleMessage(Message msg) {switch (msg.what) {case DOWN_UPDATE:mProgress.setProgress(progress); //设置第一进度text_progress.setText(progress + "%");break;case DOWN_OVER:
//                    //1不强制更新  2 强制更新
//                    if(upbean.getUpdateType().equals("1")){
//                        dialog.dismiss();
//                    }dialog.dismiss();installApk();break;case INT_NOT:dialog.dismiss();FileUtils.deleteFile(saveFileName);//删除文件ToastUtils.showToast(mContext.getResources().getString(R.string.Networkconnectionfailed));break;}super.handleMessage(msg);}};public DownloadAppUtils(Activity context, String downlogdurl, VersionUpgradeBean upbean) {this.mContext = context;this.downlogdurl = downlogdurl;this.upbean = upbean;System.out.println("过来了--1");}// 显示更新程序对话框,供主程序调用public void checkUpdateInfo() {//判断本地是否存在已下载的apk(有bug)
//        if (FileUtils.isFileExists(saveFileName) == true) {
//            //安装
//            installApk();
//        } else {
//            //下载
//            showDownloadDialog();
//        }//判断本地是否存在已下载的apkif (FileUtils.isFileExists(saveFileName) == true) {//删除DeletFile.delete(savePath);}//下载showDownloadDialog();}//弹出更新进度条private void showDownloadDialog() {dialog = new AlertDialog.Builder(mContext).create();dialog.show();dialog.setCancelable(false);View viewt = View.inflate(mContext, R.layout.xiazai_two_dialog, null);Window window = dialog.getWindow();window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));dialog.setContentView(viewt);mProgress = viewt.findViewById(R.id.upprogressBar);text_progress = viewt.findViewById(R.id.text_progress);text_progress.setText("0%");textvs = viewt.findViewById(R.id.textvs);textvs.setText(upbean.version_name);ImageView tv_cancel = viewt.findViewById(R.id.tv_cancel);String isqg = upbean.is_must_update + "";if (isqg.equals("true")) {tv_cancel.setVisibility(View.GONE);} else {tv_cancel.setVisibility(View.VISIBLE);}tv_cancel.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {FileUtils.deleteFile(saveFileName);//删除文件dialog.dismiss();interceptFlag = true;}});downloadApk();}//安装apkprivate static void installApk() {File apkfile = new File(saveFileName);if (!apkfile.exists()) {return;}Intent intent = new Intent(Intent.ACTION_VIEW);//版本在7.0以上是不能直接通过uri访问的if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {// 由于没有在Activity环境下启动Activity,设置下面的标签intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//参数1 上下文, 参数2 Provider主机地址 和配置文件中保持一致   参数3  共享的文件Uri apkUri = FileProvider.getUriForFile(mContext, "这里是applicationId也就是包名.fileprovider", apkfile);//添加这一句表示对目标应用临时授权该Uri所代表的文件intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);intent.setDataAndType(apkUri, "application/vnd.android.package-archive");} else {intent.setDataAndType(Uri.fromFile(new File(saveFileName)),"application/vnd.android.package-archive");}mContext.startActivity(intent);}//下载apkprivate void downloadApk() {System.out.println("url打印:" + downlogdurl);downLoadThread = new Thread(mdownApkRunnable);downLoadThread.start();}private Runnable mdownApkRunnable = new Runnable() {@Overridepublic void run() {System.out.println("打印路径:" + saveFileName);URL url;try {url = new URL(downlogdurl);HttpURLConnection conn = (HttpURLConnection) url.openConnection();conn.setConnectTimeout(15000);  //设置连接超时为15sconn.setReadTimeout(15000);     //读取数据超时也是15sint code = conn.getResponseCode();System.out.println("code打印:" + code);if (code == 200) {conn.connect();int length = conn.getContentLength();InputStream ins = conn.getInputStream();if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {Toast.makeText(mContext, "SD卡不可用~", Toast.LENGTH_SHORT).show();return;}File file = new File(savePath);if (!file.exists()) {file.mkdir();}String apkFile = saveFileName;File ApkFile = new File(apkFile);if (!ApkFile.exists()) {ApkFile.createNewFile();}FileOutputStream outStream = new FileOutputStream(ApkFile);int count = 0;byte buf[] = new byte[1024];do {int numread = ins.read(buf);count += numread;int s = (int) (((float) count / length) * 100);if (progress != s) {progress = (int) (((float) count / length) * 100);// 下载进度mHandler.sendEmptyMessage(DOWN_UPDATE);}if (numread <= 0) {// 下载完成通知安装mHandler.sendEmptyMessage(DOWN_OVER);break;}outStream.write(buf, 0, numread);} while (!interceptFlag);// 点击取消停止下载outStream.close();ins.close();} else {mHandler.sendEmptyMessage(INT_NOT);}} catch (Exception e) {//这里报错因为路径不对,正确路径storage/emulated/0/tdzr/Download/aidigital1.0.4.apkSystem.out.println("code打印:---" + e.toString());mHandler.sendEmptyMessage(INT_NOT);}}};

2.下载弹框xml布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="#01000000"android:gravity="center"android:orientation="vertical"><RelativeLayoutandroid:layout_width="301dp"android:layout_height="400dp"android:orientation="vertical"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><ImageViewandroid:id="@+id/topimg"android:layout_width="match_parent"android:layout_height="match_parent"android:src="@mipmap/lib_update_app_top_bg" /><TextViewandroid:id="@+id/textname"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="16dp"android:layout_marginTop="55dp"android:text="@string/Newversionfound"android:textColor="#2E2E2E"android:textSize="18dp"android:textStyle="bold" /><TextViewandroid:id="@+id/textvs"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/textname"android:layout_marginLeft="16dp"android:layout_marginTop="5dp"android:text="1.0.0"android:textColor="#2E2E2E"android:textSize="16dp"android:textStyle="bold" /></RelativeLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="250dp"android:gravity="center_horizontal"android:orientation="vertical"><TextViewandroid:id="@+id/text_progress"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:text="0%"android:textColor="#2e2e2e"android:textSize="16dp"android:textStyle="bold" /><ProgressBarandroid:id="@+id/upprogressBar"style="@style/Base.Widget.AppCompat.ProgressBar.Horizontal"android:layout_width="match_parent"android:layout_height="18dp"android:layout_marginStart="15dp"android:layout_marginTop="15dp"android:layout_marginEnd="15dp"android:layout_marginBottom="15dp"android:max="100"android:progress="0"android:progressDrawable="@drawable/progressbar_h" /></LinearLayout></RelativeLayout><ImageViewandroid:id="@+id/tv_cancel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="15dp"android:src="@mipmap/ico_sjgb" />
</LinearLayout>

3.progressbar_h(在drawable下新建文件)

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:id="@android:id/background"android:gravity="center_vertical|fill_horizontal"><shape android:shape="rectangle"><size android:height="20dp" /><solid android:color="#E4E4E4" /><corners android:radius="10dp" /></shape></item><!--第二进度条--><itemandroid:id="@android:id/secondaryProgress"android:gravity="center_vertical|fill_horizontal"><scale android:scaleWidth="100%"><shape android:shape="rectangle"><size android:height="20dp" /><solid android:color="#E4E4E4" /><corners android:radius="10dp" /></shape></scale></item><!--第一进度条--><itemandroid:id="@android:id/progress"android:gravity="center_vertical|fill_horizontal"><scale android:scaleWidth="100%"><shape android:shape="rectangle"><size android:height="20dp" /><solid android:color="#217FFD" /><corners android:radius="10dp" /></shape></scale></item></layer-list>

5.弹框背景图

在这里插入图片描述


总结

其实这功能挺简单的,就是里面细节太多,首先AndroidManifest加权限,还要加provider,provider里面记得更改包名,下载util里面的报名也是一样。其次判断版本是否更新,最后更新下载安装即可,得吃。

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

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

相关文章

PHP课程预约小程序源码

&#x1f4f1; 课程预约小程序&#xff1a;为您专属定制的便捷预约新体验 在这个快节奏的时代&#xff0c;我们深知每一位瑜伽爱好者、普拉提追随者以及培训机构管理者对高效、便捷服务的迫切需求。因此&#xff0c;我们匠心独运&#xff0c;推出了一款基于PHPUniApp框架开发的…

WebXR教学 02 配置开发环境

默认操作系统为Windows 1.VS Code VS Code 是一款轻量级、功能强大的代码编辑器&#xff0c;适用于多种编程语言。 下载 步骤 1&#xff1a;访问 VS Code 官方网站 打开浏览器&#xff08;如 Chrome、Edge 等&#xff09;。 在地址栏输入以下网址&#xff1a; https://code.v…

unity学习51:所有UI的父物体:canvas画布

目录 1 下载资源 1.1 在window / Asset store下下载一套免费的UI资源 1.2 下载&#xff0c;导入import 1.3 导入后在 project / Asset下面可以看到 2 画布canvas&#xff0c;UI的父物体 2.1 创建canvas 2.1.1 画布的下面是 event system是UI相关的事件系统 2.2 canvas…

JavaWeb开发入门:从前端到后端的完整流程解析

一、JavaWeb简介 1、C/S 客户端/服务器结构 2、B/S&#xff08;Browser/Server&#xff0c;浏览器/服务器&#xff09;结构 二、开发环境搭建 1. 安装Tomcat--一个小型的web容器。 2. 在eclipse中配置tomcat创建项目 三、JavaWeb开发流程 1. 前端页面设计 2. 后端逻辑…

Linux 常见命令全解析

一、文件操作命令 1. ls ls是列出目录内容的命令。简单输入ls&#xff0c;会展示当前目录下的文件和目录列表。想要获取更详细的信息&#xff0c;比如文件权限、所有者、大小、修改时间等&#xff0c;使用ls -l。若要显示所有文件&#xff0c;包括以点&#xff08;.&#xff…

unordered_set和unordered_map的使用

Hello&#xff0c;今天我来为大家介绍一下前几年才刚刚新出的两个容器——unordered_map和unordered_set&#xff0c;这两个容器属于是map系列和set系列中的一种&#xff0c;和map/set不同的是它们的底层&#xff0c;map/set的底层是红黑树&#xff0c;而unordered_map/unorder…

【每日八股】计算机网络篇(一):概述

OSI 的 7 层网络模型&#xff1f; OSI&#xff08;Open Systems Interconnection&#xff0c;开放互联系统&#xff09;是由国际标准化组织&#xff08;ISO&#xff09;提出的一种网络通信模型。 自上而下&#xff0c;OSI 可以被分为七层&#xff0c;分别是&#xff1a;应用层…

DeepSeek 提示词:高效的提示词设计

&#x1f9d1; 博主简介&#xff1a;CSDN博客专家&#xff0c;历代文学网&#xff08;PC端可以访问&#xff1a;https://literature.sinhy.com/#/?__c1000&#xff0c;移动端可微信小程序搜索“历代文学”&#xff09;总架构师&#xff0c;15年工作经验&#xff0c;精通Java编…

HarmonyOS简

文章为官方教程以及自己的部分理解&#xff0c;用于上下班的查看学习。官方视频教程地址&#xff1a;HarmonyOS应用开发者基础认证-华为开发者学堂 (huawei.com) 应用发开的机遇、挑战和趋势 带来的问题 问题&#xff1a;万物互联&#xff0c;智能设备从几十亿手机拓展到数百…

conda 基本命令

1、查询当前所有的环境 conda env list 2、创建虚拟环境 conda create -n 环境名 [pythonpython版本号] 其中[pythonpython版本号]可以不写 conda create -n test python3.12 我们输入conda env list看到我们的环境创建成功了&#xff0c;但是发现他是创建在我们默认的C盘的…

PythonWeb开发框架—Django之DRF框架的使用详解

1.安装依赖包 pip install djangorestframework 2.配置应用 在settings.py中的INSTALLED_APPS中添加rest_framework应用 3.创建序列化器 序列化器是用来操作models的 第一步&#xff1a;定义models ##models.pyfrom django.db import models# Create your models here.cl…

硬件加速与技术创新双轮驱动:DeepSeek和ChatGPT性能进阶的未来蓝图

&#x1f381;个人主页&#xff1a;我们的五年 &#x1f50d;系列专栏&#xff1a;Linux网络编程 &#x1f337;追光的人&#xff0c;终会万丈光芒 &#x1f389;欢迎大家点赞&#x1f44d;评论&#x1f4dd;收藏⭐文章 ​ Linux网络编程笔记&#xff1a; https://blog.cs…

让子弹飞的DeepSeek火锅诗和《软件方法》

DDD领域驱动设计批评文集 做强化自测题获得“软件方法建模师”称号 《软件方法》各章合集 我在知乎上面看到了这样的一个问题&#xff1a;DeepSeek写出过哪些惊艳的诗词&#xff1f; 有一位答主讲了他以《让子弹飞》作为素材让DeepSeek写诗的故事&#xff1a;要有风&#xf…

输入搜索、分组展示选项、下拉选取,el-select 实现:即输入关键字检索,返回分组选项,选取跳转到相应内容页 —— VUE 项目-全局模糊检索

后端数据代码写于下一篇&#xff1a;输入搜索、分组展示选项、下拉选取&#xff0c;全局跳转页&#xff0c;el-select 实现 —— 后端数据处理代码&#xff0c;抛砖引玉展思路 【效果图】&#xff1a;分组展示选项 >【提供界面操作体验】 【录制效果视频展示】&#xff1a…

【Linux】初识进程概念与 fork 函数的应用

Linux相关知识点可以通过点击以下链接进行学习一起加油&#xff01;初识指令指令进阶权限管理yum包管理与vim编辑器GCC/G编译器make与Makefile自动化构建GDB调试器与Git版本控制工具Linux下进度条冯诺依曼体系与计算机系统架构 进程是操作系统中资源分配和调度的核心单位&#…

【linux】自主shell编写

&#x1f525;个人主页&#xff1a;Quitecoder &#x1f525;专栏&#xff1a;linux笔记仓 目录 01.输出命令行02.获取用户命令字符串03.命令行字符串分割04.执行命令05.细节修改检查是否为内建命令 完整代码&#xff1a; 01.输出命令行 完成对一个shell 的编写&#xff0c;首…

小程序高度问题背景scss

不同的机型&#xff0c;他的比例啥的都会不一样&#xff0c;同样的rpx也会有不同的效果。所以这里选择了取消高度。 <view class"box-border" :style"{padding-top: ${navHeight}px,}"><!-- 已登录 --><view v-if"userStore.userInfo&…

DeepSeek 15天指导手册——从入门到精通 PDF(附下载)

DeepSeek使用教程系列--DeepSeek 15天指导手册——从入门到精通pdf下载&#xff1a; https://pan.baidu.com/s/1PrIo0Xo0h5s6Plcc_smS8w?pwd1234 提取码: 1234 或 https://pan.quark.cn/s/2e8de75027d3 《DeepSeek 15天指导手册——从入门到精通》以系统化学习路径为核心&…

element-ui的组件使用

1. 安装 Element UI&#xff08;在文件夹最上面输入cmd进入dos窗口&#xff0c;然后输入安装指令 npm install element-ui --save&#xff09; 2.在main.js文件全局引入(main.js文件负责 全局注册 )&#xff0c;在该文件注册的所有组件在其他文件都能直接调用&#xff0c;一般…

List的模拟实现(2)

前言 上一节我们讲解了list的基本功能&#xff0c;那么本节我们就结合底层代码来分析list是怎么实现的&#xff0c;那么废话不多说&#xff0c;我们正式进入今天的学习&#xff1a;&#xff09; List的底层结构 我们先来看一下list的底层基本结构&#xff1a; 这里比较奇怪的…