dotnetcore vue+elementUI 前后端分离架二(后端篇)
前言
最近几年前后端分离架构大行其道,而且各种框架也是层出不穷。本文通过dotnetcore +vue 来介绍 前后端分离架构实战。
涉及的技术栈
服务端技术
mysql
本项目使用mysql 作为持久化层
本项目采用了 mysql 的示例 employees 数据库, 需要的朋友可以自行下载 。
http://www3.ntu.edu.sg/home/ehchua/programming/sql/SampleDatabases.html
orm
dapper 短小精悍,被称为orm中的瑞士军刀。作者之前使用EF 比较多,总感觉 EF 对一些复杂查询需要原生sql支持的不是那么好,EF 生成sql 不好控制,涉及对性能要求比较高的地方,优化起来不够理想。作者在最近的几个项目中接触到dapper,它对原生sql查询支持的相当给力,使用起来也比较简便,感觉真是爱不释手,嘿嘿。。。
https://github.com/StackExchange/Dapper架构
服务端整体架构采用仓储模式
Repository是一个独立的层,介于领域层与数据映射层(数据访问层)之间。它的存在让领域层感觉不到数据访问层的存在,它提供一个类似集合的接口提供给领域层进行领域对象的访问。Repository是仓库管理员,领域层需要什么东西只需告诉仓库管理员,由仓库管理员把东西拿给它,并不需要知道东西实际放在哪。
此处照搬了dudu同学对仓储模式的理解。
仓储模式的好处:领域依赖接口与DB进行交互,解除了二者之间的耦合,如果更换orm,DB层,采用这种模式,更换的代价最低。
前端技术
整体上SPA 结构
Vue:
渐进式 JavaScript 框架.
三大特点:易用,灵活, 高效。
详细信息见 https://cn.vuejs.org/VueRouter
vue-router是Vue.js官方的路由插件,它和vue.js是深度集成的,适合用于构建单页面应用。vue的单页面应用是基于路由和组件的,路由用于设定访问路径,并将路径和组件映射起来。传统的页面应用,是用一些超链接来实现页面切换和跳转的。在vue-router单页面应用中,则是路径之间的切换,也就是组件的切换。
axios
axios 开始崛起, 是一个基于Promise 用于浏览器和 nodejs 的 HTTP 客户端。
ElementUI
网站快速成型工具
Element,一套为开发者、设计师和产品经理准备的基于 Vue 2.0 的桌面端组件库
详细信息见 http://element-cn.eleme.io/#/zh-CN
服务端项目结构
服务端代码地址:https://github.com/hbb0b0/Hbb0b0.CMS/tree/master/Hbb0b0.CMS.WebAPI
摘取部分类予以说明。
CMS.Common
通用工具的封装
配置工具类
DB配置
Cors配置
WebApi配置
DB工具类
DapperContext
IRespository
ResponsitoryBase
包含获取列表,获取分页列表,增删改的通用操作的封装
SimpleCRUD
github上对Dapper的进一步分装
消息
数据转换
entity --> Dto
DTObase
PageList
CMS.DTO
返回给前端的数据对象,隔离DB model变化直接映射前端对象,使View与Model解耦。
CMS.Model
DB 中的表映射到 Model
CMS.IResponsity
DB 操作接口
CMS.Responsity
DB 操作接口的实现
CMS.IService
Serive接口,可以供给第三方调用,也是第三方调用的规范,同时也约束着服务实现。
目前提供给API层调用。
CMS.Service
Serive接口的实现
CMS.API
以WebAPI 形式提供给前台调用,并不是严格按照 WebApi 规范 post,get,put,delete 调用.使用了 core中的 mvc 方式。
- CMS.API 调用 IService 接口
- CMS.Service 调用 IResponsitory接口
- 各接口与实现之间通过Core中的构造函数注入方式联接
服务端代码说明:
- 配置
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Information"
}
},
"Console": {
"LogLevel": {
"Default": "Information"
}
}
},
"WebAPI": {
"DB": {
"ConnectionString": "server=localhost;database=employees;uid=root;pwd=sqlsa;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True;",
"ReadingConnectionString": "server=localhost;database=employees;uid=root;pwd=sqlsa;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True;",
"WritingConnectionString": "server=localhost;database=employees;uid=root;pwd=sqlsa;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True;"
},
"Cors": {
"Name": "CMSCorsConfig",
"Original": "http://localhost:8080"
}
}
}
API
Startup
- 配置读取与接口实现配置
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CMS.Common;
using CMS.Common.Config;
using CMS.Common.DB;
using CMS.IRepository;
using CMS.IService;
using CMS.Repository;
using CMS.Service;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace CMS.WebApi
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
//序列化设置
.AddJsonOptions(options =>
{
//忽略循环引用
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
//不使用驼峰样式的key
//options.SerializerSettings.ContractResolver = new DefaultContractResolver();
//设置时间格式
options.SerializerSettings.DateFormatString = "yyyy-MM-dd hh:mm:ss";
}
);
services.AddOptions();
//读取配置
services.Configure<WebApiOption>(Configuration.GetSection("WebAPI"));
IServiceProvider serviceProvider = services.BuildServiceProvider();
//获取配置
WebApiOption config = serviceProvider.GetService<IOptions<WebApiOption>>().Value;
//Cors配置
AddCorsService(services,config);
//DB Service
AddDBService(services,config);
}
/// <summary>
/// AddDBService
/// </summary>
/// <param name="services"></param>
/// <param name="config"></param>
private void AddDBService(IServiceCollection services,WebApiOption config)
{
//设置全局配置
services.AddSingleton<IDapperContext>(_ => new DapperContext(
config
));
services.AddScoped<IDepartmentRep, DepartmentRep>();
services.AddScoped<IDepartmentService, DepartmentService>();
services.AddScoped<IEmployeeRep, EmployeeRep>();
services.AddScoped<IEmployeeService, EmployeeService>();
services.AddScoped<ITitleRep, TitleRep>();
services.AddScoped<ISalaryRep, SalaryRep>();
}
/// <summary>
/// AddCorsService
/// </summary>
/// <param name="services"></param>
/// <param name="config"></param>
private void AddCorsService(IServiceCollection services, WebApiOption config)
{
//添加cors 服务
services.AddCors(options =>
options.AddPolicy(WebApiOption.CORS_POLICY_NAME, p => p.WithOrigins(config.Cors.Original)
.AllowAnyMethod().AllowAnyHeader()));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}/{no?}",
defaults: new { controller = "Home", action = "Index" });
});
//配置Cors
app.UseCors(WebApiOption.CORS_POLICY_NAME);
}
}
}
- ControllerBase
using CMS.Common.Config;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CMS.WebApi.Common
{
[Route("api/[controller]")]
[EnableCors(WebApiOption.CORS_POLICY_NAME)]
public abstract class BaseController: Controller
{
protected readonly ILogger m_Logger;
public BaseController(ILogger<BaseController> logger)
{
m_Logger = logger;
}
}
}
- EmployeeController
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CMS.Common;
using CMS.Common.Config;
using CMS.Common.Message;
using CMS.DTO;
using CMS.Entity;
using CMS.IService;
using CMS.WebApi.Common;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
namespace CMS.WebApi.Controllers
{
public class EmployeeController : BaseController
{
private DBOption m_CmsOptions;
private IEmployeeService m_Service;
public EmployeeController(IOptions<DBOption> option, IEmployeeService employeeService, ILogger<EmployeeController> logger) : base(logger)
{
this.m_CmsOptions = option.Value;
m_Service = employeeService;
}
[Route("[action]/{pageNumber}/{rowsPerPage}")]
[HttpGet]
public ReponseMessage<PagedList<EmployeeDTO>> GetPagedList(int pageNumber, int rowsPerPage)
{
var result = m_Service.GetPagedList(pageNumber, rowsPerPage);
return m_Service.GetPagedList(pageNumber, rowsPerPage);
}
[Route("[action]")]
[HttpPost]
public ReponseMessage<PagedList<EmployeeDTO>> Query([FromBody]QueryCondition<EmployeeQuery> condition)
{
var result = m_Service.Query(condition);
m_Logger.LogInformation("GetPagedList:{0}", JsonConvert.SerializeObject(result));
return result;
}
[Route("[action]/{no}")]
[HttpGet]
public ReponseMessage<EmployeeDetailDto> GetDetail(string no)
{
var result = m_Service.GetDetail(no);
return result;
}
[Route("[action]")]
[HttpPost]
public ReponseMessage<int> Add([FromBody]EmployeeDTO dto)
{
var result = m_Service.Add(dto);
return result;
}
[Route("[action]/{empNo}")]
[HttpPost]
public ReponseMessage<int> Delete(int empNo)
{
var result = m_Service.Delete(empNo);
return result;
}
[Route("[action]/")]
[HttpPost]
public ReponseMessage<int> Update([FromBody]EmployeeDTO dto)
{
var result = m_Service.Update(dto);
return result;
}
}
}
- IService
using CMS.Common;
using CMS.Common.Message;
using CMS.DTO;
using CMS.Entity;
using CMS.Model;
using System;
using System.Collections.Generic;
namespace CMS.IService
{
public interface IEmployeeService
{
ReponseMessage<PagedList<EmployeeDTO>> GetPagedList(int pageNumber, int rowsPerPage);
ReponseMessage<PagedList<EmployeeDTO>> Query(QueryCondition<EmployeeQuery> condition);
ReponseMessage<EmployeeDetailDto> GetDetail(string emp_no);
ReponseMessage<int> Add(EmployeeDTO dto);
ReponseMessage<int> Update(EmployeeDTO dto);
ReponseMessage<int> Delete(int emp_No);
}
}
- Service 实现
using CMS.Common;
using CMS.Common.Message;
using CMS.DTO;
using CMS.Entity;
using CMS.IRepository;
using CMS.IService;
using CMS.Model;
using CMS.Utility;
using Dapper;
using System;
using System.Collections.Generic;
using System.Linq;
namespace CMS.Service
{
public class EmployeeService : IEmployeeService
{
private IEmployeeRep m_Rep;
private ITitleRep m_TitleRep;
private ISalaryRep m_SalaryRep;
public EmployeeService(IEmployeeRep rep,ITitleRep titleRep, ISalaryRep salaryRep)
{
m_Rep = rep;
m_TitleRep = titleRep;
m_SalaryRep = salaryRep;
}
public ReponseMessage<EmployeeDetailDto> GetDetail(string emp_no)
{
ReponseMessage<EmployeeDetailDto> result = new ReponseMessage<EmployeeDetailDto>();
EmployeeDetailDto data = new EmployeeDetailDto();
var emp = m_Rep.Get(emp_no);
data.Info = emp.JTransformTo<EmployeeDTO>();
var titleList = m_TitleRep.GetList(string.Format($"where emp_no = {emp_no}"));
var salaryList = m_SalaryRep.GetList(string.Format($"where emp_no = {emp_no} order by from_date "));
result.Data = data;
result.IsSuccess = true;
if (titleList != null)
{
result.Data.TitleList = titleList.JTransformTo<TitleDto>();
}
if (salaryList!=null)
{
result.Data.SalaryList = salaryList.JTransformTo<SalaryDto>();
}
return result;
}
public ReponseMessage<PagedList<EmployeeDTO>> GetPagedList(int pageNumber, int rowsPerPage)
{
int total = 0;
ReponseMessage<PagedList<EmployeeDTO>> result = new ReponseMessage<PagedList<EmployeeDTO>>();
result.Data = new PagedList<EmployeeDTO>();
var modelResult= m_Rep.GetPagedList(pageNumber, rowsPerPage, null, null, out total);
result.Data.TotalCount = total;
result.Data.Items=modelResult.Items.JTransformTo<EmployeeDTO>();
result.IsSuccess = true;
return result;
}
public ReponseMessage<PagedList<EmployeeDTO>> Query(QueryCondition<EmployeeQuery> condition)
{
ReponseMessage<PagedList<EmployeeDTO>> result = new ReponseMessage<PagedList<EmployeeDTO>>();
result.Data = new PagedList<EmployeeDTO>();
var modelResult = m_Rep.Query(condition);
result.Data.TotalCount = modelResult.TotalCount;
if (modelResult.TotalCount > 0)
{
result.Data.Items = modelResult.TotalCount>0 ? modelResult.Items.JTransformTo<EmployeeDTO>():new List<EmployeeDTO>();
}
result.IsSuccess = true;
return result;
}
public ReponseMessage<int> Add(EmployeeDTO dto)
{
ReponseMessage<int> result = new ReponseMessage<int>();
if (dto==null )
{
result.IsSuccess = false;
result.MessageInfo = new MessageInfo() { ErrorCode = -1, Message ="无效的参数" };
}
EmployeeModel entitity = dto.JTransformTo<EmployeeModel>();
int? opResult = m_Rep.CustomerAdd(entitity);
if(opResult.HasValue && opResult>0)
{
result.IsSuccess = true;
result.Data = opResult.Value;
}
return result;
}
public ReponseMessage<int> Update(EmployeeDTO dto)
{
ReponseMessage<int> result = new ReponseMessage<int>();
if (dto == null)
{
result.IsSuccess = false;
result.MessageInfo = new MessageInfo() { ErrorCode = -1, Message = "无效的参数" };
}
EmployeeModel entitity = dto.JTransformTo<EmployeeModel>();
int? opResult = m_Rep.Update(entitity);
if (opResult.HasValue && opResult > 0)
{
result.IsSuccess = true;
result.Data = opResult.Value;
}
return result;
}
public ReponseMessage<int> Delete(int empNo)
{
ReponseMessage<int> result = new ReponseMessage<int>();
int? opResult = m_Rep.Delete(empNo);
if (opResult.HasValue && opResult ==1)
{
result.IsSuccess = true;
result.Data = opResult.Value;
}
return result;
}
}
}
- IResponsitory
using CMS.Common;
using CMS.Common.DB;
using CMS.DTO;
using CMS.Entity;
using CMS.Model;
using System;
using System.Collections.Generic;
using System.Text;
namespace CMS.IRepository
{
public interface IEmployeeRep: IRepository<EmployeeModel>
{
PagedList<EmployeeDTO> Query(QueryCondition<EmployeeQuery> query);
int? Add(EmployeeModel entity);
int? CustomerAdd(EmployeeModel entity);
int? Delete(int empNo);
int? Update(EmployeeModel entity);
}
}
-Responsitory 实现
using CMS.Common;
using CMS.Common.DB;
using CMS.DTO;
using CMS.IRepository;
using CMS.Model;
using System;
using System.Collections.Generic;
using System.Text;
using Dapper;
namespace CMS.Repository
{
public class EmployeeRep : ReponsitoryBase, IEmployeeRep
{
private static object m_sync_Object = new object();
public EmployeeRep(IDapperContext dapper) : base(dapper)
{
}
public int? Add(EmployeeModel entity)
{
return this.Insert(entity);
}
new public int? Update(EmployeeModel entity)
{
return base.Update(entity);
}
public int? CustomerAdd(EmployeeModel entity)
{
int cmdResult = -1;
using (var connection = this.GetWritingConnection())
{
var sql = new StringBuilder(" set @maxNo=(select max(emp_no)+1 from employees) ;");
sql.AppendLine("insert into employees(emp_no,first_name,last_name,gender,birth_date,hire_date) values(@maxNo,@first_name,@last_name,@gender,@birth_date,@hire_date); ");
sql.AppendLine("select @maxNo;");
cmdResult = connection.ExecuteScalar<int>(sql.ToString(), entity);
}
return cmdResult;
}
public int? Delete(int empNo)
{
int cmdResult = -1;
using (var connection = this.GetWritingConnection())
{
cmdResult = connection.Execute("delete from employees where emp_no = @emp_no ;", new { emp_no = empNo });
}
return cmdResult;
}
public PagedList<EmployeeDTO> Query(QueryCondition<EmployeeQuery> query)
{
PagedList<EmployeeDTO> pagedList = new PagedList<EmployeeDTO>();
#region sql
var sql = new StringBuilder("SELECT SQL_CALC_FOUND_ROWS * from employees ");
#endregion
sql.AppendLine(" Where 1=1");
if (!string.IsNullOrEmpty(query.Param.First_Name))
{
sql.AppendLine(string.Format(" and First_Name like '{0}'", query.GetLikeValue(query.Param.First_Name)));
}
if (!string.IsNullOrEmpty(query.Param.Last_Name))
{
sql.AppendLine(string.Format(" and last_Name like '{0}'", query.GetLikeValue(query.Param.Last_Name)));
}
if (!string.IsNullOrEmpty(query.Param.Emp_No))
{
sql.AppendLine(string.Format(" and emp_no = @Emp_No"));
}
if (!string.IsNullOrEmpty(query.Param.Gender))
{
sql.AppendLine(string.Format(" and gender = @Gender"));
}
DateTime? hire_date_start = null;
DateTime? hire_date_end = null;
if (query.Param.Hire_Date_Range != null)
{
if (query.Param.Hire_Date_Range[0].HasValue)
{
hire_date_start = query.Param.Hire_Date_Range[0];
sql.AppendLine(string.Format(" and hire_date >= @Hire_Date_Range_Start"));
}
if (query.Param.Hire_Date_Range[1].HasValue)
{
hire_date_end = query.Param.Hire_Date_Range[1];
sql.AppendLine(string.Format(" and hire_date <= @Hire_Date_Range_End"));
}
}
DateTime? birth_date_start = null;
DateTime? birth_date_end = null;
if (query.Param.Birth_Date_Range != null)
{
if (query.Param.Birth_Date_Range[0].HasValue)
{
birth_date_start = query.Param.Birth_Date_Range[0];
sql.AppendLine(string.Format(" and birth_date >= @Birth_Date_Range_Start"));
}
if (query.Param.Birth_Date_Range[1].HasValue)
{
birth_date_end = query.Param.Birth_Date_Range[1];
sql.AppendLine(string.Format(" and birth_date <= @Birth_Date_Range_End"));
}
}
sql.AppendLine(" order by emp_no desc");
sql.AppendLine($" LIMIT {(query.pageInfo.PageIndex - 1) * query.pageInfo.PageSize},{query.pageInfo.PageSize}");
sql.Append(";");
using (var connection = this.GetReadingConnection())
{
var result = connection.Query<EmployeeDTO>(sql.ToString(),
new
{
Emp_No = query.Param.Emp_No,
Hire_Date_Range_Start = hire_date_start,
Hire_Date_Range_End = hire_date_end,
Birth_Date_Range_Start = birth_date_start,
Birth_Date_Range_End = birth_date_end,
Gender = query.Param.Gender
}).AsList();
pagedList.Items = result;
pagedList.TotalCount = connection.ExecuteScalar<int>("SELECT FOUND_ROWS();");
}
return pagedList;
}
}
}
目前测试 empoyee 30万条分页数据大致在400ms左右
dotnetcore vue+elementUI 前后端分离架二(后端篇)的更多相关文章
- dotnetcore+vue+elementUI 前后端分离 三(前端篇)
说明: 本项目使用了 mysql employees数据库,使用了vue + axois + element UI 2.0 ,演示了 单页程序 架构 ,vue router 的使用,axois 使用, ...
- Flask + vue 前后端分离的 二手书App
一个Flask + vue 前后端分离的 二手书App 效果展示: https://blog.csdn.net/qq_42239520/article/details/88534955 所用技术清单 ...
- .netcore+vue+elementUI 前后端分离---支持前端、后台业务代码扩展的快速开发框架
框架采用.NetCore + Vue前后端分离,并且支持前端.后台代码业务动态扩展,框架内置了一套有着20多种属性配置的代码生成器,可灵活配置生成的代码,代码生成器界面配置完成即可生成单表(主表)的增 ...
- 前后端分离项目获取后端跨控制器获取不到session
最近做前后端分离项目(.net core web api +vue)时,后台跨控制器不能获取到session.由于配置的是共享的session.本来以为是共享session出了问题,就在共享sess ...
- nginx反向代理前后端分离项目(后端多台)
目前软件架构都比较流行前后端分离,前后端的分离也实现了前后端架构的分离,带来的好处 —— 整个项目的开发权重往前移,实现真正的前后端解耦,动态资源和静态资源分离,提高了性能和扩展性. 通常Spring ...
- 关于flask(前后端分离)的后端开发的小白笔记整理(含postman,jwt,json,SQLAlchemy等)
首先是提醒自己的一些唠嗑: 学会劳逸结合,文档看累了可以看视频,动手操作很关键,遇到问题先动脑子冷静地想,不要跟着步骤都不带脑子,想不出来了再查一查!有时候打出来的代码很虚,但是实践不花钱,实践出真知 ...
- 工作中vue项目前后端分离,调用后端本地接口出现跨域问题的完美解决
在我们实际开发中,选择不错的前端框架可以为我们省掉很多时间,当然,有时我们也会遇到很多坑. 最近在做vue项目时就遇到了跨域问题,一般来说,出现跨域我们第一反应使用jsonp,但是这个只支持get请求 ...
- Springboot前后端分离中,后端拦截器拦截后,前端没有对应的返回码可以判断
项目登录流程如下 用户进入前端登录界面,输入账号密码等,输入完成之后前端发送请求到后端(拦截器不会拦截登录请求),后端验证账号密码等成功之后生成Token并存储到数据库,数据库中包含该Token过期时 ...
- Vue.js 源码分析(十二) 基础篇 组件详解
组件是可复用的Vue实例,一个组件本质上是一个拥有预定义选项的一个Vue实例,组件和组件之间通过一些属性进行联系. 组件有两种注册方式,分别是全局注册和局部注册,前者通过Vue.component() ...
随机推荐
- flex弹性布局语法介绍及使用
一.语法介绍 Flex布局(弹性布局) ,一种新的布局解决方案 可简单.快速的实现网页布局 目前市面浏览器已全部支持1.指定容器为flex布局 display: flex; Webkit内核的浏览器, ...
- bootstrap媒体查询
Bootstrap 中的媒体查询允许您基于视口大小移动.显示并隐藏内容.下面的媒体查询在 LESS 文件中使用,用来创建 Bootstrap 网格系统中的关键的分界点阈值. /* 超小设备(手机,小于 ...
- OpenCascade Ruled Surface
OpenCascade Ruled Surface eryar@163.com Abstract. A ruled surface is formed by moving a line connect ...
- Java学习笔记11---静态成员变量、静态代码块、成员变量及构造方法的初始化或调用顺序
当创建一个对象时,各种成员变量及构造方法的初始化或调用顺序是怎样的呢? (1).如果类尚未加载,则先初始化静态成员变量和静态代码块,再初始化成员变量,最后调用相应的构造方法: (2).如果类已经加载过 ...
- windows 连接Linux
服务器:阿里云 ecs 从 Windows 环境远程登录 Linux 实例 远程登录软件的用法大同小异.本文档以 Putty 为例,介绍如何远程登录实例.Putty 操作简单.免费.免安装, 下载地址 ...
- MYSQL:python 3.x连接数据库的方式
我们想要在我们的mython程序中使用mysql,首先需要安装pymysql模块,安装方式可以使用cmd命令安装, pip3.x install pymysql 首先在我们连接数据库之前先创建一个us ...
- React Native分享第三方遇到的问题
这几天做APP的分享,好多东西都不懂,踩了好多坑,所幸现在做好了,开心^_^ 时间紧,随便记一下先. 1.签名文件要和各平台的签名一致 2.新浪微博和微信的分享要打包之后,加上签名了才可以(我一直不知 ...
- Elastic Stack之kibana入门
为了解决公司的项目在集群环境下查找日志不便的问题,我在做过简单调研后,选用Elastic公司的Elastic Stack产品作为我们的日志收集,存储,分析工具. Elastic Stack是ELK(E ...
- JavaScript闭包的深入理解
闭包算是javascript中一个比较难理解的概念,想要深入理解闭包的原理,首先需要搞清楚其他几个概念: 一.栈内存和堆内存 学过C/C++的同学可能知道,计算机系统将内存分为栈和堆两部分(大学的基础 ...
- CTF---密码学入门第四题 困在栅栏里的凯撒
困在栅栏里的凯撒分值:10 来源: 北邮天枢战队 难度:易 参与人数:4531人 Get Flag:2124人 答题人数:2285人 解题通过率:93% 小白发现了一段很6的字符:NlEyQd{sef ...