Bladeren bron

修改指针问题

xuzhiheng 4 jaren geleden
bovenliggende
commit
61254b7536
3 gewijzigde bestanden met toevoegingen van 9 en 8 verwijderingen
  1. 5 7
      src/client/client.go
  2. 1 1
      src/front/front.go
  3. 3 0
      src/web/templates/client/cuser_rule_create.html

+ 5 - 7
src/client/client.go

@@ -89,7 +89,6 @@ func (this *Client) PersonnelIndex() {
 				"data":            nil,
 				"recordsFiltered": 0,
 				"recordsTotal":    0,
-
 			})
 		}
 	} else {
@@ -102,14 +101,13 @@ func (this *Client) PersonnelIndex() {
 			entUserId, _ = strconv.Atoi(qu.SE.DecodeString(id))
 		}
 		entId := qu.IntAll(user["ent_id"])
-		leftNumData := JyMysql.FindOne("user_account", map[string]interface{}{"user_id":entUserId,"ent_id":entId},"left_num","")
-		var left int
-		if (*leftNumData)==nil{
-			left=0
+		leftNumData := JyMysql.FindOne("user_account", map[string]interface{}{"user_id": entUserId, "ent_id": entId}, "left_num", "")
+		left := 0
+		if leftNumData != nil && *leftNumData != nil {
+			left = int((*leftNumData)["left_num"].(int64))
 		}
-		left = int((*leftNumData)["left_num"].(int64))
 		this.T["left"] = left
-		this.Render("/client/personnelIndex.html",&this.T)
+		this.Render("/client/personnelIndex.html", &this.T)
 	}
 }
 

+ 1 - 1
src/front/front.go

@@ -496,7 +496,7 @@ func LoginCheck(f *Front, entId int, loginUser map[string]interface{}, userPhone
 		"username": (*entInfo)[0]["name"],
 	}
 	entMgoInfo, ok := MgoCus.FindOne("user", query)
-	if !ok || len(*entMgoInfo) == 0 {
+	if !ok || entMgoInfo == nil || len(*entMgoInfo) == 0 {
 		//	企业信息查询失败
 		f.ServeJson(map[string]interface{}{
 			"code":    0,

+ 3 - 0
src/web/templates/client/cuser_rule_create.html

@@ -24,6 +24,9 @@
                 </button>
                 <a class="btn btn-sm btn-instagram" onclick="produceData()"><i class="fa fa-fw fa-database fa-lg"></i>生成数据</a>
                 <button id="previewDatas" class="btn btn-warning btn-sm" onclick="previewData()"><i class="fa fa-fw fa-eye fa-lg"></i>数据预览</button>
+                <form style="display:none" id='uploadform' method='post'>
+                    <input type='file' name='xlsx' id='file'/>
+                </form>
             </small>
             <a class="btn btn-primary btn-sm" id="back" style="float: right"> 返回</a>
         </h1>