Selaa lähdekoodia

session中id改为int类型

fuwencai 4 vuotta sitten
vanhempi
commit
5441987115
1 muutettua tiedostoa jossa 7 lisäystä ja 7 poistoa
  1. 7 7
      src/front/front.go

+ 7 - 7
src/front/front.go

@@ -144,7 +144,7 @@ func (f *Front) Login() {
 			return
 
 		}
-		LoginCheck(f, strconv.Itoa(int((*loginUser)[0]["ent_id"].(int64))), (*loginUser)[0], phone)
+		LoginCheck(f, int((*loginUser)[0]["ent_id"].(int64)), (*loginUser)[0], phone)
 		return
 	} else {
 		f.Render("login.html")
@@ -167,7 +167,7 @@ func (f *Front) ChooseEnt() {
 		entId := f.GetString("ent_id")
 		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"], entId)
+		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 {
 			f.ServeJson(map[string]interface{}{
 				"code":    0,
@@ -176,7 +176,7 @@ func (f *Front) ChooseEnt() {
 			})
 			return
 		}
-		LoginCheck(f, entId, (*loginUser)[0], info["phone"].(string))
+		LoginCheck(f, qu.IntAll(entId), (*loginUser)[0], info["phone"].(string))
 		return
 	} else { // get 请求时铺企业页面
 		// 查询 企业信息  name  ent_id
@@ -466,7 +466,7 @@ func SendSMS(tplcode /*模板代码*/, mobile /*手机号码*/ string, param map
 	sms.SendSms(mobile, tplcode, text)
 }
 
-func LoginCheck(f *Front, entId string, loginUser map[string]interface{}, userPhone string) {
+func LoginCheck(f *Front, entId int, loginUser map[string]interface{}, userPhone string) {
 	// 1. 确认该企业有使用该系统的权限 查询配置文件appid 确认是否有使用该系统的权限
 	query2 := bson.M{
 		"ent_id": entId,
@@ -483,7 +483,7 @@ func LoginCheck(f *Front, entId string, loginUser map[string]interface{}, userPh
 		return
 	}
 	// 3. 查询企业管理员信息及手机号
-	entInfo := JyMysql.SelectBySql("select phone,name from entniche_info WHERE id = ?", loginUser["ent_id"])
+	entInfo := JyMysql.SelectBySql("select phone,name from entniche_info WHERE id = ?", entId)
 	if len(*entInfo) == 0 {
 		f.ServeJson(map[string]interface{}{
 			"code":    0,
@@ -521,8 +521,8 @@ func LoginCheck(f *Front, entId string, loginUser map[string]interface{}, userPh
 		"phone":  userPhone,
 		"role":   role,
 		"appid":  (*entMgoInfo)["appid"],
-		"ent_id": entId,
-		"id":     loginUser["id"],
+		"ent_id": qu.IntAll(entId),
+		"id":     qu.IntAll(loginUser["id"]),
 	})
 	//	返回
 	f.ServeJson(map[string]interface{}{