|
@@ -40,20 +40,22 @@ func (b *base_power) OpenPower(appid, goods_code string, user_id, ent_id int64,
|
|
//企业互斥的功能失效掉
|
|
//企业互斥的功能失效掉
|
|
if ent_id > 0 {
|
|
if ent_id > 0 {
|
|
ok1 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_function b
|
|
ok1 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_function b
|
|
- on (a.appid=? and a.power_type=2 and a.power_ofid=? and b.appid=? and a.goods_code=? and a.function_code=b.function_code)
|
|
|
|
- inner join base_function c on (c.appid=? and c.status=1 and power_type=1 and code=a.function_code)
|
|
|
|
- set a.status=0`, appid, ent_id, appid, goods_code) > -1
|
|
|
|
|
|
+ on (a.appid=? and a.power_type=2 and a.power_ofid=? and b.appid=? and b.goods_code=? 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`, appid, ent_id, appid, goods_code, appid) > -1
|
|
}
|
|
}
|
|
//用户互斥的功能失效掉
|
|
//用户互斥的功能失效掉
|
|
if user_id > 0 {
|
|
if user_id > 0 {
|
|
ok2 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_function b
|
|
ok2 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_function b
|
|
- on (a.appid=? and a.power_type=2 and a.power_ofid=? and b.appid=? and a.goods_code=? and a.function_code=b.function_code)
|
|
|
|
- inner join base_function c on (c.appid=? and c.status=1 and power_type=1 and code=a.function_code)
|
|
|
|
- set a.status=0`, appid, user_id, appid, goods_code) > -1
|
|
|
|
|
|
+ on (a.appid=? and a.power_type=2 and a.power_ofid=? and b.appid=? and b.goods_code=? 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`, appid, user_id, appid, goods_code, appid) > -1
|
|
}
|
|
}
|
|
power_values, empower_values := []interface{}{}, []interface{}{}
|
|
power_values, empower_values := []interface{}{}, []interface{}{}
|
|
for _, v := range *bgfs {
|
|
for _, v := range *bgfs {
|
|
- if v.Base_function.Haspower == 0 {
|
|
|
|
|
|
+ if v.Base_function == nil {
|
|
|
|
+ continue
|
|
|
|
+ } else if v.Base_function.Haspower == 0 {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
power_values = append(power_values, appid, v.Function_code, v.Power_type)
|
|
power_values = append(power_values, appid, v.Function_code, v.Power_type)
|
|
@@ -81,7 +83,7 @@ func (b *base_power) OpenPower(appid, goods_code string, user_id, ent_id int64,
|
|
logx.Error(appid, goods_code, user_id, ent_id, "没有找到需要开通的权益")
|
|
logx.Error(appid, goods_code, user_id, ent_id, "没有找到需要开通的权益")
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_power", []string{"appid", "function_code", "power_type", "power_ofid", "start_time", "end_time", "count", "limit_strategy", "strategy_count", "status", "create_time"}, power_values)
|
|
|
|
|
|
+ v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_power", []string{"appid", "function_code", "power_type", "power_ofid", "start_time", "end_time", "use_count", "limit_strategy", "strategy_count", "status", "create_time"}, power_values)
|
|
ok3 := true
|
|
ok3 := true
|
|
if len(empower_values) > 0 {
|
|
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)
|
|
v3, v4 := Mysql_BaseService.InsertBatchByTx(tx, "base_ent_empower", []string{"appid", "ent_id", "ent_user_id", "function_code", "create_time"}, empower_values)
|