当前位置:网站首页>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)
边栏推荐
- 让百度地图生成器里的“标注”内容展开--解决方案
- When does MySQL use table locks and when does it use row locks?
- STL源码剖析:class template explicit specialization代码测试和理解
- debian vsftpd + ssl
- 向量叉乘的几何意义及其模的计算
- 人工肌肉智能材料新突破
- window.open()的用法,js打开新窗体
- Multithreading basics (multithreaded memory, security, communication, thread pools and blocking queues)
- Selenium02
- Electron使用romote报错 : Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
猜你喜欢

No, the Log4j vulnerability hasn't been fully fixed yet?

DHCP principle and configuration

New breakthrough in artificial muscle smart materials

万能js时间日期格式转换

大飞机C919都用了哪些新材料?

Test Development Engineer Growth Diary 001 - Some Introduction to Agile Testing, CI/CD/CT, DecOps

向量三重积的等式推导证明

限塑令下的新材料——聚乳酸(PLA)

Electron之初出茅庐——搭建环境并运行第一个程序

@Bean 与 @Component 用在同一个类上,会怎样?
随机推荐
MongoDB - query
MySQL什么时候用表锁,什么时候用行锁?
Station B collapsed, what would you do if you were the developer in charge that night?
LVM和磁盘配额
Go语学习笔记 - gorm使用 - 数据库配置、表新增 Web框架Gin(七)
Huawei released "ten inventions", including computing, intelligent driving and other new fields
万能js时间日期格式转换
As a test leader, examine several aspects of job candidates
PXE高效批量网络装机
Ali Ermian: How many cluster solutions does Redis have?I answered 4
“AI教练”请进家,家庭智能健身蓬勃发展
Data types of Redis6
Graphical relational database design ideas, this is too vivid
Distance calculation from space vertex to straight line and its source code
学生成绩管理系统(C语言)
Polygon 3D(三维平面多边形)的法向量的计算(MeshLab默认的计算)
AI can identify race from X-rays, but no one knows why
头条二面:MySQL中有几种常见的 SQL 错误用法?
图解关系数据库设计思想,这也太形象了
roslyn folder under bin folder