|
@@ -44,7 +44,7 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
|
|
sourceData := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": this.WaitEmpowerId}, "", "")
|
|
sourceData := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": this.WaitEmpowerId}, "", "")
|
|
if sourceData != nil && len(*sourceData) > 0 {
|
|
if sourceData != nil && len(*sourceData) > 0 {
|
|
empower_count := common.IntAll((*sourceData)["empower_count"])
|
|
empower_count := common.IntAll((*sourceData)["empower_count"])
|
|
- use_count := common.IntAll((*sourceData)["use_count"])
|
|
|
|
|
|
+ use_count := int(JyMysql.CountBySql(`select count(1) as count from entniche_power where wait_empower_id=? and status=1`, this.WaitEmpowerId))
|
|
if empower_count-use_count < len(UserArr) {
|
|
if empower_count-use_count < len(UserArr) {
|
|
msg = "购买数量不足"
|
|
msg = "购买数量不足"
|
|
code = int64(-1)
|
|
code = int64(-1)
|
|
@@ -77,7 +77,6 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
|
|
"create_time": timeStr,
|
|
"create_time": timeStr,
|
|
"update_time": timeStr,
|
|
"update_time": timeStr,
|
|
})
|
|
})
|
|
- JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count + 1 where id = ?`, this.WaitEmpowerId)
|
|
|
|
addPower(this.WaitEmpowerId, entUserId, this.EntId)
|
|
addPower(this.WaitEmpowerId, entUserId, this.EntId)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -254,7 +253,6 @@ func delPower(id int64) {
|
|
if data != nil && len(*data) > 0 {
|
|
if data != nil && len(*data) > 0 {
|
|
waitEmpowerId := common.Int64All((*data)["wait_empower_id"])
|
|
waitEmpowerId := common.Int64All((*data)["wait_empower_id"])
|
|
entUserId := common.IntAll((*data)["ent_user_id"])
|
|
entUserId := common.IntAll((*data)["ent_user_id"])
|
|
- JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count - 1 where id = ? and use_count > 0`, waitEmpowerId)
|
|
|
|
identity := getPositionId(entUserId)
|
|
identity := getPositionId(entUserId)
|
|
eOData := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
|
|
eOData := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
|
|
if eOData != nil && len(*eOData) > 0 {
|
|
if eOData != nil && len(*eOData) > 0 {
|