func HandleProjectAllGet(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string //var cookieid string var projectid string userid = c.Params.ByName("personid") if userid == "" { result["code"] = 400 result["descrip"] = "userid is empty" result["data"] = nil c.JSON(200, result) return } ser := new(Service.ProjectService) ser.Userid = tools.ToInt64(userid) ser.Projectid = tools.ToInt64(projectid) ser.ActionType = Service.PROJECT_GET_ACTION ser.ServerType = Service.PROJECT_ALL_SERVICE_TYPE ok, _ := ser.ProcessService() result["code"] = 0 result["descrip"] = "ok" result["data"] = ser.Container if ok == false { tools.Info(result) c.JSON(200, result) return } c.JSON(200, result) return }
func HandlePersonProjectGet(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string var cookieid string userid = c.Request.Header.Get("userid") if userid == "" { cookie, err := c.Request.Cookie("one") if err != nil { tools.Info(err.Error()) } if cookie != nil { cookieid = cookie.Value tools.Info(cookieid) } } ser := new(Service.PersonalService) ser.Userid = tools.ToInt64(userid) ser.ActionType = 1 ok, _ := ser.ProcessService() result["code"] = ok result["result"] = ser.Container if ok == false { tools.Info(result) } c.Redirect(301, "/people/"+userid) }
func HandlePersonFollowingGet(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string var cookieid string userid = c.Request.Header.Get("userid") if userid == "" { cookie, err := c.Request.Cookie("one") if err != nil { tools.Info(err.Error()) } if cookie != nil { cookieid = cookie.Value tools.Info(cookieid) } } ser := new(Service.PersonalService) ser.ServerType = Service.PERSONAAL_FOLLOWING_SERVICE_TYPE ser.Userid = tools.ToInt64(userid) ser.ActionType = 1 ser.Params = make(map[string]interface{}, 16) ok, _ := ser.ProcessService() result["code"] = ok result["result"] = ser.Container if ok == false { tools.Info(result) } c.JSON(200, result) }
func HandleProjectStaticsGet(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string var projectid string // var cookieid string ser := new(Service.ProjectService) ser.Userid = tools.ToInt64(userid) ser.Projectid = tools.ToInt64(projectid) ser.ActionType = Service.PROJECT_GET_ACTION ok, _ := ser.ProcessService() result["code"] = ok result["result"] = ser.Container if ok == false { tools.Info(result) } }
func HandlePersonalMain(c *gin.Context) { var main = "personmain.html" var result = make(map[string]interface{}, 16) var userid string var cookieid string if c.Request.Method == "GET" || c.Request.Method == "get" { userid = c.Params.ByName("personid") if userid == "" { cookie, err := c.Request.Cookie("one") if err != nil { tools.Info(err.Error()) } if cookie != nil { cookieid = cookie.Value tools.Info(cookieid) } } ser := new(Service.PersonalService) ser.ActionType = 1 ser.Userid = tools.ToInt64(userid) ok, _ := ser.ProcessService() ser.ServerType = Service.PERSONAAL_ALL_SERVICE_TYPE result["code"] = ok result["result"] = ser.Container if ok == false { tools.Info(result) } } else { HandleAllPost(c) } if models.UsingJsonReturn { c.JSON(200, result) } else { c.HTML(200, main, nil) } }
func HandlePersonProjectPost(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string var cookieid string if c.Request.Method == "GET" || c.Request.Method == "get" { userid = c.Request.Header.Get("userid") if userid == "" { cookie, err := c.Request.Cookie("one") if err != nil { tools.Info(err.Error()) } if cookie != nil { cookieid = cookie.Value tools.Info(cookieid) } } ser := new(Service.PersonalService) ser.Userid = tools.ToInt64(userid) ser.ActionType = 1 ok, _ := ser.ProcessService() result["code"] = ok result["result"] = ser.Container if ok == false { tools.Info(result) } c.Redirect(301, "/people/"+userid) //c.JSON(200, result) } else if c.Request.Method == "post" || c.Request.Method == "POST" { HandleAllPost(c) } else { tools.Info("else branch") result["error"] = "Bad Request" c.Redirect(301, "/login") //c.JSON(200, result) } }
func HandlePersonFollowingPost(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string var cookieid string userid = c.Request.Header.Get("userid") if userid == "" { cookie, err := c.Request.Cookie("one") if err != nil { tools.Info(err.Error()) } if cookie != nil { cookieid = cookie.Value tools.Info(cookieid) } } followingid := c.Request.Header.Get("followingid") ser := new(Service.PersonalService) ser.ServerType = Service.PERSONAAL_FOLLOWING_SERVICE_TYPE ser.Userid = tools.ToInt64(userid) ser.ActionType = 2 ser.Params = make(map[string]interface{}, 16) ser.Params["up_personid"] = followingid ser.Params["down_personid"] = userid ok, re := ser.ProcessService() result["code"] = ok result["result"] = re if ok == false { tools.Info(result) } c.Redirect(302, "/people/"+followingid+"/following") }
func HandlePersonActiveGet(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string var cookieid string userid = c.Params.ByName("personid") if userid == "" { cookie, err := c.Request.Cookie("one") if err != nil { tools.Info(err.Error()) } if cookie != nil { cookieid = cookie.Value tools.Info(cookieid) } } ser := new(Service.PersonalService) ser.ServerType = Service.PERSONAAL_ACTIVE_SERVICE_TYPE ser.Userid = tools.ToInt64(userid) ser.ActionType = 1 ser.Params = make(map[string]interface{}, 16) ser.Params["personid"] = userid ok, _ := ser.ProcessService() result["code"] = ok result["result"] = ser.Container if ok == false { c.Redirect(302, "/people/"+userid) return } c.JSON(200, result) }
func HandlePersonActivePost(c *gin.Context) { var result = make(map[string]interface{}, 16) var userid string userid = c.Params.ByName("personid") ser := new(Service.PersonalService) ser.ServerType = Service.PERSONAAL_ACTIVE_SERVICE_TYPE ser.Userid = tools.ToInt64(userid) ser.ActionType = 2 ser.Params = make(map[string]interface{}, 16) ok, re := ser.ProcessService() result["code"] = ok result["result"] = re if ok == false { tools.Info(result) c.Redirect(302, "/people/"+userid) return } c.Redirect(302, "/people/"+userid+"/active") }