123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package project
- import (
- "sfis/db"
- "sfis/lock"
- "sfis/model"
- "sfis/service"
- "testing"
- )
- var (
- projectNameArray = []string{"河南大学", "工程建设", "医疗器械"}
- winnerArray = []string{""}
- zbRqArray = []string{""}
- )
- func Test_ProjectInterface(t *testing.T) {
- appID := "sfPQRYRQMAAwcGBwYBCgcA"
- //userName := "赛博英杰"
- productID := 1003
- lock.MainLock.Lock()
- userLock := lock.UserLockMap[appID]
- lock.MainLock.Unlock()
- userLock.Lock()
- userProduct := &model.UserProduct{}
- db.GetSFISDB().First(userProduct, &model.UserProduct{AppID: appID, ProductID: productID})
- check(&lock.LeftNumCost{
- AppID: appID,
- ProductID: productID,
- LeftNum: userProduct.LeftNum,
- ProductType: 0,
- DataNumLimitOneTimes: userProduct.DataNumLimitOneTimes,
- GetData1: func() (i interface{}, i2 int, err error) {
- return service.ProjectListData("", "", "", false)
- },
- })
- }
- func check(cost1 lock.Cost) {
- if b := cost1.Before(); b {
- data, status, _ := cost1.GetData()
- if data != nil {
- data := data.([]map[string]interface{})
- if len(data) > 0 {
- cost1.Deduction()
- cost1.After()
- }
- }
- }
- }
|