當前位置: 首頁>>代碼示例>>Golang>>正文


Golang PersonalService.PersonalService類代碼示例

本文整理匯總了Golang中One/Service/PersonalService.PersonalService的典型用法代碼示例。如果您正苦於以下問題:Golang PersonalService類的具體用法?Golang PersonalService怎麽用?Golang PersonalService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PersonalService類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: HandlePersonProjectGet

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)
}
開發者ID:oldtree,項目名稱:One,代碼行數:31,代碼來源:personal.go

示例2: HandlePersonFollowingGet

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)

}
開發者ID:oldtree,項目名稱:One,代碼行數:35,代碼來源:personal.go

示例3: HandlePersonProjectPost

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)
	}
}
開發者ID:oldtree,項目名稱:One,代碼行數:41,代碼來源:personal.go

示例4: HandlePersonFollowingPost

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")
}
開發者ID:oldtree,項目名稱:One,代碼行數:39,代碼來源:personal.go

示例5: HandlePersonalMain

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)
	}
}
開發者ID:oldtree,項目名稱:One,代碼行數:43,代碼來源:personal.go

示例6: HandleLoginPost

func HandleLoginPost(c *gin.Context) {
	var userid string
	var cookieid string
	var cookie = new(http.Cookie)

	userid = c.Request.Header.Get("email")

	password := c.Request.Header.Get("password")
	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_LOGINLOGOUT_SERVICE_TYPE
	ser.ActionType = Service.PERSONAL_POST_ACTION
	ser.Params = make(map[string]interface{})
	ser.Params["userid"] = userid
	ser.Params["password"] = password
	ser.ProcessService()

	cookie.Name = "one"
	cookie.Value = userid
	cookie.MaxAge = 3600
	c.Request.AddCookie(cookie)
	if ser.Result["data"] != nil {
		tools.Info("user login success")
		c.Redirect(301, "/people/"+userid)
	} else {
		tools.Info("user login failed")
		c.JSON(200, ser.Result)
	}

}
開發者ID:oldtree,項目名稱:One,代碼行數:42,代碼來源:login.go

示例7: HandlePersonActiveGet

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)
}
開發者ID:oldtree,項目名稱:One,代碼行數:37,代碼來源:personal.go

示例8: HandlePersonActivePost

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")
}
開發者ID:oldtree,項目名稱:One,代碼行數:24,代碼來源:personal.go


注:本文中的One/Service/PersonalService.PersonalService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。