当前位置:网站首页>go : go gin返回JSON数据
go : go gin返回JSON数据
2022-07-30 05:51:00 【行人已】
吃别人吃不了的苦,忍别人受不了的气,付出比别人更多的,才会享受的比别人更多 !!!
具体代码在: https://gitee.com/hjx_RuGuoYunZhiDao/strom-huang-go/tree/master/go_web_gin
1、其他写在前面
其他代码可以参考我上一篇文章:https://blog.csdn.net/bei_FengBoby/article/details/124847078
2、gin返回Json代码
Bool := IsExistUser(name)
var r = &result.R{
}
if Bool {
//核对密码
b := IsExistPwd(name, password)
if !b {
r.Code = 500
r.Msg = "用户不存在"
} else {
r.Code = 200
r.Msg = "欢迎"
}
} else {
r.Code = 500
r.Msg = "用户不存在"
}
//主要是这里-----------------
c.JSON(http.StatusOK, r)
边栏推荐
- STL source code analysis: conceptual understanding of iterators, and code testing.
- Boot process and service control
- Electron之初出茅庐——搭建环境并运行第一个程序
- 《心智社会》—马文·明斯基
- 2020 数学建模之旅
- uniapp中canvas与v-if更“配”
- 上传文件--文件类型大全,图片类型,文档类型,视频类型,压缩包类型
- 阿里二面:Sentinel vs Hystrix 对比,如何选择?
- DNS domain name resolution services
- Ali two sides: Sentinel vs Hystrix comparison, how to choose?
猜你喜欢

DNS domain name resolution services

相机坐标系,世界坐标系,像素坐标系三者转换,以及OPENGLDEFocal Length和Opengl 的 Fov转换

Redis 如何实现防止超卖和库存扣减操作?

如何理解普吕克坐标(几何理解)

LVM and disk quotas

Let the "label" content in Baidu map generator expand--solution

Camera coordinate system, world coordinate system, pixel coordinate system conversion, and Fov conversion of OPENGLDEFocal Length and Opengl

Go语学习笔记 - gorm使用 - 数据库配置、表新增 Web框架Gin(七)

As a test leader, examine several aspects of job candidates

idea built-in translation plugin
随机推荐
Selenium02
Huawei released "ten inventions", including computing, intelligent driving and other new fields
STL源码剖析:bound friend template friend代码测试和理解
iptables命令
RAID disk array
Network Protocol 03 - Routing and NAT
Playing script killing with AI: actually more involved than me
Required request body is missing problem solving
新人误删数据,组长巧用MySQL主从复制延迟挽回损失
@Bean 与 @Component 用在同一个类上,会怎样?
空间顶点到直线的距离计算及其源码
Camera coordinate system, world coordinate system, pixel coordinate system conversion, and Fov conversion of OPENGLDEFocal Length and Opengl
Linx常见目录&文件管理命令&VI编辑器使用 介绍
MySQL什么时候用表锁,什么时候用行锁?
Process and Scheduled Task Management
图解关系数据库设计思想,这也太形象了
Proftpd配置文件
MySQL master-slave replication configuration construction, one step in place
The first artificial intelligence safety competition officially launched
空间顶点到平面的距离计算的证明及其源码