12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package manage
- import (
- "log"
- sutil "sfbase/utils"
- "sfis/utils"
- "testing"
- "time"
- )
- /*var (
- product1 = &model.Product{
- BaseModel: model.BaseModel{ID: 1003},
- Name: "行业招标数据",
- Path: "/path1",
- UnitPrice: 50, //单价精确到分 5毛
- MinUnit: 1, //最小单位1,即 5毛/条
- ProductType: 1, //产品类型 0-按次 1-按条
- TestNum: 100,
- }
- product2 = &model.Product{
- Name: "中国移动招标数据",
- Path: "/path2",
- UnitPrice: 1500, //单价精确到分 15快
- MinUnit: 1, //最小单位1,即 15快/次
- ProductType: 0, //产品类型 0-按次 1-按条
- TestNum: 500,
- }
- )*/
- func init() {
- //todo init connection db operation
- }
- func Test_CreateUser(t *testing.T) {
- //log.Println("devUserCreate testing......")
- appID := utils.GetAppID(time.Now().Unix())
- secretKey := sutil.GetComplexRandom(8, 3, 5)
- log.Printf("create successful appID:[%s],secretKey:[%s]", appID, secretKey)
- //创建用户、给用户开通接口产品时候有以下几种情况
- //1.线上给账户充值10000块(user_account),不去实际购买产品,无购买记录,用户产品表无剩余量(left_num为0).此时又分两种情况
- //1.1 按次扣账户余额
- //1.2 按量扣账户余额
- //appID := ""
- //tradeMoney := 1 * 100 * 10000 //充值1万块钱
- }
- func chooseUserProduct(appID string, tradeMoney int) {
- }
|