Transfer 转让书籍.
()
| 380 | |
| 381 | // Transfer 转让书籍. |
| 382 | func (this *BookController) Transfer() { |
| 383 | |
| 384 | account := this.GetString("account") |
| 385 | if account == "" { |
| 386 | this.JsonResult(6004, "接受者账号不能为空") |
| 387 | } |
| 388 | |
| 389 | member, err := models.NewMember().FindByAccount(account) |
| 390 | if err != nil { |
| 391 | logs.Error("FindByAccount => ", err) |
| 392 | this.JsonResult(6005, "接受用户不存在") |
| 393 | } |
| 394 | |
| 395 | if member.Status != 0 { |
| 396 | this.JsonResult(6006, "接受用户已被禁用") |
| 397 | } |
| 398 | |
| 399 | if member.MemberId == this.Member.MemberId { |
| 400 | this.JsonResult(6007, "不能转让给自己") |
| 401 | } |
| 402 | |
| 403 | bookResult, err := this.IsPermission() |
| 404 | if err != nil { |
| 405 | this.JsonResult(6001, err.Error()) |
| 406 | } |
| 407 | |
| 408 | err = models.NewRelationship().Transfer(bookResult.BookId, this.Member.MemberId, member.MemberId) |
| 409 | if err != nil { |
| 410 | logs.Error("Transfer => ", err) |
| 411 | this.JsonResult(6008, err.Error()) |
| 412 | } |
| 413 | |
| 414 | this.JsonResult(0, "ok") |
| 415 | } |
| 416 | |
| 417 | // 上传书籍封面. |
| 418 | func (this *BookController) UploadCover() { |
nothing calls this directly
no test coverage detected