fuwencai 4 жил өмнө
parent
commit
0e79d7cbd8
1 өөрчлөгдсөн 4 нэмэгдсэн , 5 устгасан
  1. 4 5
      src/front/front.go

+ 4 - 5
src/front/front.go

@@ -122,7 +122,7 @@ func (f *Front) Login() {
 		log.Println("验证码验证通过")
 		// 3. 验证用户导出权限  确认认用户是否有数据导出权限
 		loginUser := JyMysql.SelectBySql("select id, name,ent_id,phone,export_power,name from entniche_user where phone=? and export_power=1", phone)
-		if len(*loginUser) == 0 {
+		if loginUser==nil ||len(*loginUser) == 0 {
 			log.Println("该用户无数据导出权限")
 			f.ServeJson(map[string]interface{}{
 				"code":    0,
@@ -168,7 +168,7 @@ func (f *Front) ChooseEnt() {
 		log.Println(entId)
 		// 2. 确认该手机号有数据导出权限
 		loginUser := JyMysql.SelectBySql("select id, name,ent_id,phone,export_power,name from entniche_user where phone=? and export_power=1 and ent_id=?", info["phone"], qu.IntAll(entId))
-		if len(*loginUser) == 0 {
+		if loginUser==nil||len(*loginUser) == 0 {
 			f.ServeJson(map[string]interface{}{
 				"code":    0,
 				"status":  false,
@@ -184,7 +184,6 @@ func (f *Front) ChooseEnt() {
 		f.T["ent_info"] = rs
 		f.Render("choose_ent.html", &f.T)
 	}
-
 }
 func (f *Front) Index() {
 	defer qu.Catch()
@@ -474,7 +473,7 @@ func LoginCheck(f *Front, entId int, loginUser map[string]interface{}, userPhone
 	log.Println(entId)
 	isExist, _ := Mgo.FindOne("datatag_export_config", query2)
 	log.Println(isExist)
-	if len(*isExist) == 0 {
+	if isExist==nil||len(*isExist) == 0 {
 		f.ServeJson(map[string]interface{}{
 			"code":    0,
 			"status":  false,
@@ -484,7 +483,7 @@ func LoginCheck(f *Front, entId int, loginUser map[string]interface{}, userPhone
 	}
 	// 3. 查询企业管理员信息及手机号
 	entInfo := JyMysql.SelectBySql("select phone,name from entniche_info WHERE id = ?", entId)
-	if len(*entInfo) == 0 {
+	if entInfo==nil||len(*entInfo) == 0 {
 		f.ServeJson(map[string]interface{}{
 			"code":    0,
 			"status":  false,