xuzhiheng 4 years ago
parent
commit
da2ff99825
2 changed files with 6 additions and 3 deletions
  1. 5 2
      static/templates/login.html
  2. 1 1
      utils/cost_by_left_num.go

+ 5 - 2
static/templates/login.html

@@ -260,8 +260,11 @@
                 async: false,
                 data: param,
                 success: function (r) {
-
-                    alert(JSON.stringify(r))
+                    if (r){
+                        alert(JSON.stringify(r))
+                    }else{
+                        alert("操作成功")
+                    }
                 }
             })
         }

+ 1 - 1
utils/cost_by_left_num.go

@@ -124,7 +124,7 @@ func after(productType int, dataLen int, userProduct *model.UserProduct, statusC
 			orderAfter := userProduct.LeftNum - dataLen
 			nowStr := time.Now().Local().Format("2006-01-02 15:04:05")
 			//扣费
-			err := tx.Exec("update user_product set left_num = IF(`left_num`<1, 0, `left_num`-?),update_at = ? WHERE `app_id` = ? and product_id=?", nowStr, dataLen, appID, productID).Error
+			err := tx.Exec("update user_product set left_num = IF(`left_num`<1, 0, `left_num`-?),update_at = ? WHERE `app_id` = ? and product_id=?", dataLen, nowStr, appID, productID).Error
 			if err != nil {
 				log.Printf("appID:[%s],productID:[%d] execute cost money error:[%v]", appID, productID, err)
 				tx.Rollback()