作者 linmadan

添加素币兑换接口,修复错误提示bug

@@ -61,3 +61,11 @@ func CreateAcceptanceTaskService(options map[string]interface{}) (service.Accept @@ -61,3 +61,11 @@ func CreateAcceptanceTaskService(options map[string]interface{}) (service.Accept
61 } 61 }
62 return domainService.NewAcceptanceTaskService(transactionContext) 62 return domainService.NewAcceptanceTaskService(transactionContext)
63 } 63 }
  64 +
  65 +func CreateExchangeSuMoneyService(options map[string]interface{}) (service.ExchangeSuMoneyService, error) {
  66 + var transactionContext *pgTransaction.TransactionContext
  67 + if value, ok := options["transactionContext"]; ok {
  68 + transactionContext = value.(*pgTransaction.TransactionContext)
  69 + }
  70 + return domainService.NewExchangeSuMoneyService(transactionContext)
  71 +}
@@ -11,7 +11,7 @@ type ExchangeSuMoneyCommand struct { @@ -11,7 +11,7 @@ type ExchangeSuMoneyCommand struct {
11 Uid int64 `json:"uid" valid:"Required"` 11 Uid int64 `json:"uid" valid:"Required"`
12 // 素币值 12 // 素币值
13 SuMoney float64 `json:"suMoney" valid:"Required"` 13 SuMoney float64 `json:"suMoney" valid:"Required"`
14 - // 操作人UID(默认为系统操作) 14 + // 操作人UID
15 Operator int64 `json:"operator,omitempty"` 15 Operator int64 `json:"operator,omitempty"`
16 // 兑换描述 16 // 兑换描述
17 ExchangeDescription string `json:"exchangeDescription" valid:"Required"` 17 ExchangeDescription string `json:"exchangeDescription" valid:"Required"`
@@ -11,6 +11,8 @@ type SearchSuMoneyTransactionRecordCommand struct { @@ -11,6 +11,8 @@ type SearchSuMoneyTransactionRecordCommand struct {
11 Uid int64 `json:"uid" valid:"Required"` 11 Uid int64 `json:"uid" valid:"Required"`
12 // 记录类型(1兑换,2任务奖励) 12 // 记录类型(1兑换,2任务奖励)
13 RecordType int `json:"recordType" valid:"Required"` 13 RecordType int `json:"recordType" valid:"Required"`
  14 + // 操作人UID
  15 + Operator int64 `json:"operator,omitempty"`
14 // 查询偏离量 16 // 查询偏离量
15 Offset int `json:"offset,omitempty"` 17 Offset int `json:"offset,omitempty"`
16 // 查询限制 18 // 查询限制
@@ -2,8 +2,11 @@ package service @@ -2,8 +2,11 @@ package service
2 2
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
  5 + "github.com/linmadan/egglib-go/utils/tool_funs"
5 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory" 6 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
6 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" 7 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command"
  8 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  9 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/service"
7 ) 10 )
8 11
9 // 素币服务 12 // 素币服务
@@ -25,10 +28,22 @@ func (suMoneyService *SuMoneyService) ExchangeSuMoney(exchangeSuMoneyCommand *co @@ -25,10 +28,22 @@ func (suMoneyService *SuMoneyService) ExchangeSuMoney(exchangeSuMoneyCommand *co
25 defer func() { 28 defer func() {
26 transactionContext.RollbackTransaction() 29 transactionContext.RollbackTransaction()
27 }() 30 }()
28 - if err := transactionContext.CommitTransaction(); err != nil {  
29 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 31 + var exchangeSuMoneyService service.ExchangeSuMoneyService
  32 + if value, err := factory.CreateExchangeSuMoneyService(map[string]interface{}{
  33 + "transactionContext": transactionContext,
  34 + }); err != nil {
  35 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  36 + } else {
  37 + exchangeSuMoneyService = value
  38 + }
  39 + if task, err := exchangeSuMoneyService.Exchange(exchangeSuMoneyCommand.Uid, exchangeSuMoneyCommand.Operator, exchangeSuMoneyCommand.SuMoney, exchangeSuMoneyCommand.ExchangeDescription); err != nil {
  40 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  41 + } else {
  42 + if err := transactionContext.CommitTransaction(); err != nil {
  43 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  44 + }
  45 + return task, nil
30 } 46 }
31 - return nil, nil  
32 } 47 }
33 48
34 // 搜索素币事务记录 49 // 搜索素币事务记录
@@ -46,10 +61,25 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon @@ -46,10 +61,25 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon
46 defer func() { 61 defer func() {
47 transactionContext.RollbackTransaction() 62 transactionContext.RollbackTransaction()
48 }() 63 }()
49 - if err := transactionContext.CommitTransaction(); err != nil {  
50 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 64 + var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
  65 + if value, err := factory.CreateSuMoneyTransactionRecordRepository(map[string]interface{}{
  66 + "transactionContext": transactionContext,
  67 + }); err != nil {
  68 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  69 + } else {
  70 + suMoneyTransactionRecordRepository = value
  71 + }
  72 + if count, suMoneyTransactionRecords, err := suMoneyTransactionRecordRepository.Find(tool_funs.SimpleStructToMap(searchSuMoneyTransactionRecordCommand)); err != nil {
  73 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  74 + } else {
  75 + if err := transactionContext.CommitTransaction(); err != nil {
  76 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  77 + }
  78 + return map[string]interface{}{
  79 + "count": count,
  80 + "suMoneyTransactionRecords": suMoneyTransactionRecords,
  81 + }, nil
51 } 82 }
52 - return nil, nil  
53 } 83 }
54 84
55 func NewSuMoneyService(options map[string]interface{}) *SuMoneyService { 85 func NewSuMoneyService(options map[string]interface{}) *SuMoneyService {
@@ -338,7 +338,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -338,7 +338,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
338 if value, err := factory.CreateTaskDao(map[string]interface{}{ 338 if value, err := factory.CreateTaskDao(map[string]interface{}{
339 "transactionContext": transactionContext, 339 "transactionContext": transactionContext,
340 }); err != nil { 340 }); err != nil {
341 - return nil, err 341 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
342 } else { 342 } else {
343 taskDao = value 343 taskDao = value
344 } 344 }
@@ -346,7 +346,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -346,7 +346,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
346 if value, err := factory.CreateEmployeeRepository(map[string]interface{}{ 346 if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
347 "transactionContext": transactionContext, 347 "transactionContext": transactionContext,
348 }); err != nil { 348 }); err != nil {
349 - return nil, err 349 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
350 } else { 350 } else {
351 employeeRepository = value 351 employeeRepository = value
352 } 352 }
@@ -354,10 +354,10 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -354,10 +354,10 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
354 "uid": createTaskCommand.Sponsor, 354 "uid": createTaskCommand.Sponsor,
355 }) 355 })
356 if err != nil { 356 if err != nil {
357 - return nil, err 357 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
358 } 358 }
359 if sponsor == nil { 359 if sponsor == nil {
360 - return nil, fmt.Errorf("无效的发布者") 360 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者")
361 } 361 }
362 newTask := &domain.Task{ 362 newTask := &domain.Task{
363 TaskStatus: domain.TASK_STATUS_UNRELEASED, 363 TaskStatus: domain.TASK_STATUS_UNRELEASED,
@@ -390,7 +390,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -390,7 +390,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
390 } else { 390 } else {
391 if createTaskCommand.TaskType == domain.TASK_TYPE_BID { 391 if createTaskCommand.TaskType == domain.TASK_TYPE_BID {
392 if err := taskDao.AddBidInfo(task.TaskId, createTaskCommand.BidStartTime, createTaskCommand.BidEndTime); err != nil { 392 if err := taskDao.AddBidInfo(task.TaskId, createTaskCommand.BidStartTime, createTaskCommand.BidEndTime); err != nil {
393 - return nil, err 393 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
394 } 394 }
395 } 395 }
396 if err := transactionContext.CommitTransaction(); err != nil { 396 if err := transactionContext.CommitTransaction(); err != nil {
  1 +package service
  2 +
  3 +import "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  4 +
  5 +type ExchangeSuMoneyService interface {
  6 + Exchange(uid int64, operatorUid int64, suMoney float64, recordDescription string) (*domain.SuMoneyTransactionRecord, error)
  7 +}
  1 +package domain_service
  2 +
  3 +import (
  4 + "fmt"
  5 + coreDomain "github.com/linmadan/egglib-go/core/domain"
  6 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  7 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  8 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao"
  9 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/repository"
  10 + "time"
  11 +)
  12 +
  13 +type ExchangeSuMoneyService struct {
  14 + coreDomain.BaseEventPublisher
  15 + transactionContext *pgTransaction.TransactionContext
  16 +}
  17 +
  18 +func (service *ExchangeSuMoneyService) Exchange(uid int64, operatorUid int64, suMoney float64, recordDescription string) (*domain.SuMoneyTransactionRecord, error) {
  19 + var employeeRepository domain.EmployeeRepository
  20 + var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
  21 + var employeeDao *dao.EmployeeDao
  22 + if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil {
  23 + return nil, err
  24 + } else {
  25 + employeeRepository = repository
  26 + }
  27 + if repository, err := repository.NewSuMoneyTransactionRecordRepository(service.transactionContext); err != nil {
  28 + return nil, err
  29 + } else {
  30 + suMoneyTransactionRecordRepository = repository
  31 + }
  32 + if dao, err := dao.NewEmployeeDao(service.transactionContext); err != nil {
  33 + return nil, err
  34 + } else {
  35 + employeeDao = dao
  36 + }
  37 + employee, err := employeeRepository.FindOne(map[string]interface{}{
  38 + "uid": uid,
  39 + })
  40 + if err != nil {
  41 + return nil, err
  42 + }
  43 + if employee == nil {
  44 + return nil, fmt.Errorf("无效的兑换者")
  45 + }
  46 + operator, err := employeeRepository.FindOne(map[string]interface{}{
  47 + "uid": operatorUid,
  48 + })
  49 + if err != nil {
  50 + return nil, err
  51 + }
  52 + if operator == nil {
  53 + return nil, fmt.Errorf("无效的操作者")
  54 + }
  55 + if employee.SuMoney < suMoney {
  56 + return nil, fmt.Errorf("当前素币不足")
  57 + }
  58 + suMoneyTransactionRecord := &domain.SuMoneyTransactionRecord{
  59 + RecordType: domain.SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE,
  60 + Employee: employee.EmployeeInfo,
  61 + SuMoney: suMoney,
  62 + Operator: operator.EmployeeInfo,
  63 + RecordDescription: recordDescription,
  64 + CreateTime: time.Now(),
  65 + }
  66 + if err := employeeDao.TransferSuMoney(employee.EmployeeInfo.Uid, suMoney); err != nil {
  67 + return nil, err
  68 + }
  69 + if suMoneyTransactionRecord, err := suMoneyTransactionRecordRepository.Save(suMoneyTransactionRecord); err != nil {
  70 + return nil, err
  71 + } else {
  72 + return suMoneyTransactionRecord, nil
  73 + }
  74 +}
  75 +
  76 +func NewExchangeSuMoneyService(transactionContext *pgTransaction.TransactionContext) (*ExchangeSuMoneyService, error) {
  77 + if transactionContext == nil {
  78 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  79 + } else {
  80 + return &ExchangeSuMoneyService{
  81 + transactionContext: transactionContext,
  82 + }, nil
  83 + }
  84 +}
@@ -66,8 +66,14 @@ func (repository *SuMoneyTransactionRecordRepository) Find(queryOptions map[stri @@ -66,8 +66,14 @@ func (repository *SuMoneyTransactionRecordRepository) Find(queryOptions map[stri
66 var suMoneyTransactionRecordModels []*models.SuMoneyTransactionRecord 66 var suMoneyTransactionRecordModels []*models.SuMoneyTransactionRecord
67 suMoneyTransactionRecords := make([]*domain.SuMoneyTransactionRecord, 0) 67 suMoneyTransactionRecords := make([]*domain.SuMoneyTransactionRecord, 0)
68 query := tx.Model(&suMoneyTransactionRecordModels) 68 query := tx.Model(&suMoneyTransactionRecordModels)
69 - if employeeUid, ok := queryOptions["employeeUid"]; ok && (employeeUid != int64(0)) {  
70 - query = query.Where(`task.employee @> '{"uid":?}'`, employeeUid) 69 + if uid, ok := queryOptions["uid"]; ok && (uid != int64(0)) {
  70 + query = query.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid)
  71 + }
  72 + if recordType, ok := queryOptions["recordType"]; ok && (recordType != 0) {
  73 + query = query.Where(`su_money_transaction_record.record_type = ?`, recordType)
  74 + }
  75 + if operator, ok := queryOptions["operator"]; ok && (operator != int64(0)) {
  76 + query = query.Where(`su_money_transaction_record.operator @> '{"uid":?}'`, operator)
71 } 77 }
72 if offset, ok := queryOptions["offset"]; ok { 78 if offset, ok := queryOptions["offset"]; ok {
73 offset := offset.(int) 79 offset := offset.(int)
  1 +package controllers
  2 +
  3 +import (
  4 + "encoding/json"
  5 +
  6 + "github.com/astaxie/beego"
  7 + "github.com/linmadan/egglib-go/web/beego/utils"
  8 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command"
  9 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service"
  10 +)
  11 +
  12 +type SuMoneyController struct {
  13 + beego.Controller
  14 +}
  15 +
  16 +func (controller *SuMoneyController) ExchangeSuMoney() {
  17 + suMoneyService := service.NewSuMoneyService(nil)
  18 + exchangeSuMoneyCommand := &command.ExchangeSuMoneyCommand{}
  19 + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exchangeSuMoneyCommand)
  20 + data, err := suMoneyService.ExchangeSuMoney(exchangeSuMoneyCommand)
  21 + var response utils.JsonResponse
  22 + if err != nil {
  23 + response = utils.ResponseError(controller.Ctx, err)
  24 + } else {
  25 + response = utils.ResponseData(controller.Ctx, data)
  26 + }
  27 + controller.Data["json"] = response
  28 + controller.ServeJSON()
  29 +}
  30 +
  31 +func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() {
  32 + suMoneyService := service.NewSuMoneyService(nil)
  33 + searchSuMoneyTransactionRecordCommand := &command.SearchSuMoneyTransactionRecordCommand{}
  34 + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), searchSuMoneyTransactionRecordCommand)
  35 + data, err := suMoneyService.SearchSuMoneyTransactionRecord(searchSuMoneyTransactionRecordCommand)
  36 + var response utils.JsonResponse
  37 + if err != nil {
  38 + response = utils.ResponseError(controller.Ctx, err)
  39 + } else {
  40 + response = utils.ResponseData(controller.Ctx, data)
  41 + }
  42 + controller.Data["json"] = response
  43 + controller.ServeJSON()
  44 +}
@@ -2,6 +2,7 @@ package controllers @@ -2,6 +2,7 @@ package controllers
2 2
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
  5 + "fmt"
5 6
6 "github.com/astaxie/beego" 7 "github.com/astaxie/beego"
7 "github.com/linmadan/egglib-go/web/beego/utils" 8 "github.com/linmadan/egglib-go/web/beego/utils"
@@ -156,6 +157,7 @@ func (controller *TaskController) CreateTask() { @@ -156,6 +157,7 @@ func (controller *TaskController) CreateTask() {
156 data, err := taskService.CreateTask(createTaskCommand) 157 data, err := taskService.CreateTask(createTaskCommand)
157 var response utils.JsonResponse 158 var response utils.JsonResponse
158 if err != nil { 159 if err != nil {
  160 + fmt.Println(err.Error())
159 response = utils.ResponseError(controller.Ctx, err) 161 response = utils.ResponseError(controller.Ctx, err)
160 } else { 162 } else {
161 response = utils.ResponseData(controller.Ctx, data) 163 response = utils.ResponseData(controller.Ctx, data)
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/astaxie/beego"
  5 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego/controllers"
  6 +)
  7 +
  8 +func init() {
  9 + beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney")
  10 + beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord")
  11 +}
  1 +package su_money
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + "github.com/go-pg/pg"
  8 + . "github.com/onsi/ginkgo"
  9 + . "github.com/onsi/gomega"
  10 + pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
  11 +)
  12 +
  13 +var _ = Describe("素币兑换", func() {
  14 + var suMoneyTransactionRecordId int64
  15 + BeforeEach(func() {
  16 + _, err := pG.DB.QueryOne(
  17 + pg.Scan(&suMoneyTransactionRecordId),
  18 + "INSERT INTO su_money_transaction_records (su_money_transaction_record_id, record_type, employee, su_money, operator, record_description, create_time) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id",
  19 + "testSuMoneyTransactionRecordId", "testRecordType", "testEmployee", "testSuMoney", "testOperator", "testRecordDescription", "testCreateTime")
  20 + Expect(err).NotTo(HaveOccurred())
  21 + })
  22 + Describe("素币兑换", func() {
  23 + Context("", func() {
  24 + It("", func() {
  25 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  26 + body := map[string]interface{}{
  27 + "uid": "int64",
  28 + "suMoney": "float64",
  29 + "operator": "int64",
  30 + "exchangeDescription": "string",
  31 + }
  32 + httpExpect.POST("/su-money/exchange").
  33 + WithJSON(body).
  34 + Expect().
  35 + Status(http.StatusOK).
  36 + JSON().
  37 + Object().
  38 + ContainsKey("code").ValueEqual("code", 0).
  39 + ContainsKey("msg").ValueEqual("msg", "ok").
  40 + ContainsKey("data").Value("data").Object()
  41 + })
  42 + })
  43 + })
  44 + AfterEach(func() {
  45 + _, err := pG.DB.Exec("DELETE FROM su_money_transaction_records WHERE true")
  46 + Expect(err).NotTo(HaveOccurred())
  47 + })
  48 +})
  1 +package su_money
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  5 + "net/http"
  6 + "time"
  7 +
  8 + "github.com/gavv/httpexpect"
  9 + "github.com/go-pg/pg"
  10 + . "github.com/onsi/ginkgo"
  11 + . "github.com/onsi/gomega"
  12 + pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
  13 +)
  14 +
  15 +var _ = Describe("搜索素币事务记录", func() {
  16 + var suMoneyTransactionRecordId int64
  17 + BeforeEach(func() {
  18 + _, err := pG.DB.QueryOne(
  19 + pg.Scan(&suMoneyTransactionRecordId),
  20 + "INSERT INTO su_money_transaction_records (id, record_type, employee, su_money, operator, record_description, create_time) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id",
  21 + 1, 1, &domain.EmployeeInfo{
  22 + Uid: 2499036607974745088,
  23 + }, 100.00, &domain.EmployeeInfo{
  24 + Uid: 2499036607974745099,
  25 + }, "testRecordDescription", time.Now())
  26 + Expect(err).NotTo(HaveOccurred())
  27 + })
  28 + Describe("搜索素币事务记录", func() {
  29 + Context("指定搜索条件", func() {
  30 + It("返回搜索结果", func() {
  31 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  32 + body := map[string]interface{}{
  33 + "uid": 2499036607974745088,
  34 + "recordType": 1,
  35 + "operator": 2499036607974745099,
  36 + "offset": 0,
  37 + "limit": 20,
  38 + }
  39 + httpExpect.POST("/su-money/search-su-money-transaction-record").
  40 + WithJSON(body).
  41 + Expect().
  42 + Status(http.StatusOK).
  43 + JSON().
  44 + Object().
  45 + ContainsKey("code").ValueEqual("code", 0).
  46 + ContainsKey("msg").ValueEqual("msg", "ok").
  47 + ContainsKey("data").Value("data").Object()
  48 + })
  49 + })
  50 + })
  51 + AfterEach(func() {
  52 + _, err := pG.DB.Exec("DELETE FROM su_money_transaction_records WHERE true")
  53 + Expect(err).NotTo(HaveOccurred())
  54 + })
  55 +})
  1 +package su_money
  2 +
  3 +import (
  4 + "net/http"
  5 + "net/http/httptest"
  6 + "testing"
  7 +
  8 + "github.com/astaxie/beego"
  9 + . "github.com/onsi/ginkgo"
  10 + . "github.com/onsi/gomega"
  11 + _ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
  12 + _ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego"
  13 +)
  14 +
  15 +func TestSuMoney(t *testing.T) {
  16 + RegisterFailHandler(Fail)
  17 + RunSpecs(t, "Beego Port SuMoney Correlations Test Case Suite")
  18 +}
  19 +
  20 +var handler http.Handler
  21 +var server *httptest.Server
  22 +
  23 +var _ = BeforeSuite(func() {
  24 + handler = beego.BeeApp.Handlers
  25 + server = httptest.NewServer(handler)
  26 +})
  27 +
  28 +var _ = AfterSuite(func() {
  29 + server.Close()
  30 +})