(c *gin.Context)
| 347 | } |
| 348 | |
| 349 | func TransferAffQuota(c *gin.Context) { |
| 350 | id := c.GetInt("id") |
| 351 | user, err := model.GetUserById(id, true) |
| 352 | if err != nil { |
| 353 | common.ApiError(c, err) |
| 354 | return |
| 355 | } |
| 356 | tran := TransferAffQuotaRequest{} |
| 357 | if err := c.ShouldBindJSON(&tran); err != nil { |
| 358 | common.ApiError(c, err) |
| 359 | return |
| 360 | } |
| 361 | err = user.TransferAffQuotaToQuota(tran.Quota) |
| 362 | if err != nil { |
| 363 | c.JSON(http.StatusOK, gin.H{ |
| 364 | "success": false, |
| 365 | "message": "划转失败 " + err.Error(), |
| 366 | }) |
| 367 | return |
| 368 | } |
| 369 | c.JSON(http.StatusOK, gin.H{ |
| 370 | "success": true, |
| 371 | "message": "划转成功", |
| 372 | }) |
| 373 | } |
| 374 | |
| 375 | func GetAffCode(c *gin.Context) { |
| 376 | id := c.GetInt("id") |
nothing calls this directly
no test coverage detected