瀏覽代碼

过期已有权限解决

xuzhiheng 2 年之前
父節點
當前提交
d016487f02
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      service/service.go

+ 3 - 1
service/service.go

@@ -27,7 +27,6 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
 	if sourceData != nil && len(*sourceData) > 0 {
 		empower_count := common.IntAll((*sourceData)["empower_count"])
 		use_count := common.IntAll((*sourceData)["use_count"])
-		end_time := common.ObjToString((*sourceData)["end_time"])
 		if empower_count-use_count < len(UserArr) {
 			msg = "购买数量不足"
 			code = int64(-1)
@@ -37,9 +36,12 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
 				data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, "", "")
 				if data != nil && len(*data) > 0 {
 					dataStatus := common.IntAll((*data)["status"])
+					wait_empower_id := common.Int64All((*data)["wait_empower_id"])
 					if dataStatus == -1 {
 						ok = JyMysql.Update(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, map[string]interface{}{"wait_empower_id": this.WaitEmpowerId, "status": 1, "update_time": timeStr})
 					} else {
+						resdata := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": wait_empower_id}, "", "")
+						end_time := common.ObjToString((*resdata)["end_time"])
 						res, _ := time.ParseInLocation("2006-01-02 15:04:05", end_time, time.Local)
 						if res.Unix() > time.Now().Unix() {
 							msg = "人员已经拥有权限,请先删除原有权限"