Browse Source

AdOver 添加返回

chendeng 2 years ago
parent
commit
5533800fc9
2 changed files with 4 additions and 0 deletions
  1. 1 0
      controllers/user.go
  2. 3 0
      server/user.go

+ 1 - 0
controllers/user.go

@@ -717,6 +717,7 @@ func (U *UserController) AdOver(g *gin.Context) {
 	playerMsg := U.C.GetGameMsg2(openid, U.LuckUplind)
 	if playerMsg.UserMsg != nil {
 		U.C.AdOver(playerMsg)
+		g.JSON(200, back)
 	} else {
 		back.Code = errorcode.AccountIsExist
 		back.Data = "未查询到用户"

+ 3 - 0
server/user.go

@@ -60,6 +60,9 @@ func (U *UserServer) GetUserById(uid int) *models.User {
 
 func (U *UserServer) GetUserBalance(Openid string) float32 {
 	data := U.UserSer.GetUserMsg(Openid)
+	if data == nil {
+		return 0
+	}
 	return data.Balance
 }