当前位置:网站首页>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)
边栏推荐
- Graphical relational database design ideas, this is too vivid
- The first artificial intelligence safety competition officially launched
- [硬核干货]由0到1,突破信息系统项目管理师(呕心沥血经验之谈)!!!
- Ali: How many methods are there for multi-threaded sequential operation?
- Software Testing Terminology - Scenario Testing
- New material under the plastic restriction order - polylactic acid (PLA)
- redis实现分布式锁的原理
- B站崩了,如果是你是那晚负责的开发人员你会怎么做?
- Pioneer in Distributed Systems - Leslie Lambert
- MySQL主从复制配置搭建,一步到位
猜你喜欢
随机推荐
The newcomer deleted data by mistake, and the team leader skillfully used MySQL master-slave replication to delay the recovery of losses
redis实现分布式锁的原理
idea内置翻译插件
(GGG)JWT
export , export default,import完整用法
Electron之初出茅庐——搭建环境并运行第一个程序
Electron日常学习笔记
Selenium02
PXE efficient mass network capacity
Linx常见目录&文件管理命令&VI编辑器使用 介绍
The calculation of the determinant of the matrix and its source code
The Geometric Meaning of Vector Cross Product and the Calculation of Modulus
《心智社会》—马文·明斯基
Upload file -- file type, picture type, document type, video type, compressed package type
DHCP principle and configuration
Rodrigues: vector representation of rotation matrices
万能js时间日期格式转换
CTO说不建议我使用SELECT * ,这是为什么?
从追赶到超越,国产软件大显身手
Station B collapsed, what would you do if you were the developer in charge that night?









