浏览代码

增加 user_count 判断

xuzhiheng 2 年之前
父节点
当前提交
a15e364a4b
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      service/service.go

+ 1 - 1
service/service.go

@@ -443,7 +443,7 @@ func delPower(id int64) {
 	if data != nil && len(*data) > 0 {
 		waitEmpowerId := common.Int64All((*data)["wait_empower_id"])
 		entUserId := common.IntAll((*data)["ent_user_id"])
-		JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count - 1 where id = ?`, waitEmpowerId)
+		JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count - 1 where id = ? and use_count > 0`, waitEmpowerId)
 		eOData := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
 		if eOData != nil && len(*eOData) > 0 {
 			orderId := common.Int64All((*eOData)["order_id"])