当前位置:网站首页>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)
边栏推荐
猜你喜欢
随机推荐
【MySQL】MySQL中如何实现分页操作
Multithreading basics (multithreaded memory, security, communication, thread pools and blocking queues)
Bull: remove common characters
The CTO said I was not advised to use SELECT *, why is that?
MongoDB - query
DHCP principle and configuration
Linx common directory & file management commands & VI editor usage introduction
舒尔补(schur completement)
window.open()的用法,js打开新窗体
Process and Scheduled Task Management
Selenium02
这个终端连接工具,碾压Xshell
Go语学习笔记 - gorm使用 - 数据库配置、表新增 Web框架Gin(七)
Test development engineer diary 002 - starting from 0 interface automation
As a test leader, examine several aspects of job candidates
Selenium01
Headline 2: there are several kinds of common SQL errors in MySQL usage?
redis实现分布式锁的原理
空间顶点到直线的距离计算及其源码
Advanced multi-threading (CountDownLatch, deadlock, thread-safe collection class)









