|
@@ -2,7 +2,6 @@ package entity
|
|
|
|
|
|
import (
|
|
|
"database/sql"
|
|
|
- "log"
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
@@ -69,7 +68,7 @@ func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, ac
|
|
|
on (a.appid=? and a.account_id=? and a.status=1 and b.appid=? and b.goods_code=? and b.spec_id=? and a.function_code=b.function_code)
|
|
|
inner join base_function c on (c.appid=? and c.status=1 and c.power_type=1 and c.code=a.function_code)
|
|
|
set a.status=0,update_time=?`, appid, account_id, appid, goods_code, goods_spec_id, appid, NowFormat(Date_Full_Layout)) > -1
|
|
|
- power_values, empower_values, wait_empower_values := []interface{}{}, []interface{}{}, []interface{}{}
|
|
|
+ power_values, wait_empower_values := []interface{}{}, []interface{}{}
|
|
|
if start_time == "" {
|
|
|
start_time = NowFormat(Date_Full_Layout)
|
|
|
}
|
|
@@ -126,11 +125,7 @@ func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, ac
|
|
|
power_values = append(power_values, use_count, surplus_count, v.Limit_strategy, v.Strategy_count, 1, start_time, start_time)
|
|
|
//
|
|
|
if v.Power_type == 2 {
|
|
|
- if v.Power_count == -1 && Base_ent_empower.Count(appid, v.Function_code, ent_id) == 0 {
|
|
|
- empower_values = append(empower_values, appid, ent_id, 0, v.Function_code, start_time)
|
|
|
- } else if v.Power_count > 0 {
|
|
|
- wait_empower_values = append(wait_empower_values, appid, v.Id, v.Function_code, ent_id, start_time, end_time, use_count, v.Power_count, v.Limit_strategy, start_time)
|
|
|
- }
|
|
|
+ wait_empower_values = append(wait_empower_values, appid, v.Id, v.Function_code, ent_id, start_time, end_time, use_count, v.Power_count, v.Limit_strategy, start_time)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -140,17 +135,11 @@ func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, ac
|
|
|
}
|
|
|
v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_power", []string{"appid", "goods_spec_power_id", "function_code", "power_type", "account_id", "start_time", "end_time", "use_count", "surplus_count", "limit_strategy", "strategy_count", "status", "create_time", "update_time"}, power_values)
|
|
|
ok2 := true
|
|
|
- if len(empower_values) > 0 {
|
|
|
- v3, v4 := Mysql_BaseService.InsertBatchByTx(tx, "base_ent_empower", []string{"appid", "ent_id", "ent_user_id", "function_code", "create_time"}, empower_values)
|
|
|
- ok2 = v3 > 0 && v4 > 0
|
|
|
- }
|
|
|
- ok3 := true
|
|
|
if len(wait_empower_values) > 0 {
|
|
|
v5, v6 := Mysql_BaseService.InsertBatchByTx(tx, "base_ent_wait_empower", []string{"appid", "goods_spec_power_id", "function_code", "ent_id", "start_time", "end_time", "use_count", "empower_count", "limit_strategy", "create_time"}, wait_empower_values)
|
|
|
- ok3 = v5 > 0 && v6 > 0
|
|
|
+ ok2 = v5 > 0 && v6 > 0
|
|
|
}
|
|
|
- log.Println(ok1 && ok2 && v1 > 0 && v2 > 0 && ok3)
|
|
|
- return ok1 && ok2 && v1 > 0 && v2 > 0 && ok3
|
|
|
+ return ok1 && ok2 && v1 > 0 && v2 > 0
|
|
|
})
|
|
|
}
|
|
|
|