本文整理汇总了Golang中One/tools.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
}
示例2: PostPersonActive
func (ps *PersonalService) PostPersonActive() (bool, string) {
tools.Info("post personal Active")
actmodel := Person.NewPersonAct()
actmodel.Personid = ps.Userid
actmodel.Createtime = time.Now().Unix()
actmodel.TargetGroupid = ps.Userid
actmodel.TargetGroupName = "one"
actmodel.TargetOrganizationId = ps.Userid
actmodel.TargetOrganizationName = "one"
actmodel.TargetPersonName = "one"
actmodel.TargetProjectId = ps.Userid
actmodel.TargetProjectName = "one"
actmodel.ActionTargetType = Person.PERSONAL_ACTIVE_TARGET_SELF
actmodel.ActionType = Person.PERSONAL_EMAOTION_ACTIVE
actmodel.TopicContent = "coldplay"
ok := actmodel.Insert()
if ok == false {
tools.Info("post personal Active failed")
return false, "post active error"
}
ps.Container["active"] = new(Common.ModelContainerSlice)
ps.Container["active"].(*Common.ModelContainerSlice).ContainerSlice = append(ps.Container["active"].(*Common.ModelContainerSlice).ContainerSlice, actmodel)
return true, "post active ok"
}
示例3: 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)
}
示例4: Insert
func (p *ProjectAct) Insert() bool {
p.Createtime = time.Now().Unix()
err := ProjectCon.Insert(p)
if err != nil {
tools.Info("insert info error")
tools.Info(p)
return false
}
tools.Info("insert info success")
tools.Info(p)
return true
}
示例5: HandleProjectAllGet
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
}
示例6: Get
func (p *Project) Get() (bool, int) {
log.Println("get Project")
object := orm.NewOrm()
log.Println(*p)
err := object.Read(p)
if err != nil {
if err == orm.ErrNoRows {
tools.Info(err)
return false, 0
} else {
tools.Info(err)
return false, -1
}
}
return true, 1
}
示例7: CreateProjectInfo
func (ps *ProjectService) CreateProjectInfo() (bool, string) {
tools.Info("create new project")
project := Project.NewProject()
project.Projectid = ps.Projectid
project.Projectname = ps.Params["projectname"].(string)
project.Star = 0
project.Creator = ps.Params["creator"].(string)
project.Watching = 1
ok, _ := project.Get()
if ok {
return false, "Process error : this project has been created"
}
ok, result := project.Insert()
if ok == false {
if result == 0 {
tools.Error("create project failed")
return false, "create project failed"
} else {
return false, "create project failed ,please try again later"
}
}
return true, "ok"
}
示例8: UpdataProjectInfo
func (ps *ProjectService) UpdataProjectInfo() (bool, string) {
tools.Info("updata project")
project := Project.NewProject()
project.Projectid = ps.Projectid
ok, result := project.Get()
if ok == false {
if result == 0 {
tools.Error("this project have not exist")
return false, "this project have not exist"
} else {
return false, "get project failed ,please try again later"
}
}
project.Projectname = ps.Params["projectname"].(string)
project.Star = 0
project.Creator = ps.Params["creator"].(string)
project.Watching = 1
ok, result = project.Update()
if ok == false {
if result == 0 {
tools.Error("this project have not exist")
return false, "update project have not exist"
} else {
return false, "update project failed ,please try again later"
}
}
return true, "ok"
}
示例9: init
func init() {
tools.Info("mongo db is start up........")
Session, err := mgo.Dial("127.0.0.1:27017")
if err != nil {
tools.Error(err)
}
Session.SetMode(mgo.Monotonic, true)
Person.InitDBConnection(Session)
Project.InitDBConnection(Session)
tools.Info("db has been start up")
}
示例10: GetBatch
func (p *ProjectAct) GetBatch(pb *[]*ProjectAct) bool {
err := ProjectCon.Find(bson.M{"personid": p.ProjectId}).Batch(5)
err.All(pb)
tools.Info("get personact betch")
return true
}
示例11: Delete
func (p *Project) Delete() (bool, int) {
log.Println("Delete Project")
object := orm.NewOrm()
p.Mtime = time.Now().Unix()
p.Updated = time.Now().String()
length, err := object.Delete(p)
if err != nil {
if err == orm.ErrNoRows {
tools.Info(length, err)
return false, 0
} else {
tools.Info(err)
return false, -1
}
}
return true, 1
}
示例12: HandleLoginGet
func HandleLoginGet(c *gin.Context) {
var result = make(map[string]interface{}, 16)
var cookieid string
var cookie = new(http.Cookie)
cookie, err := c.Request.Cookie("one")
if err != nil {
tools.Info(err.Error())
}
if cookie != nil {
cookieid = cookie.Value
tools.Info(cookieid)
}
result["error"] = "login"
c.JSON(200, result)
}
示例13: DeleteProjectActive
func (ps *ProjectService) DeleteProjectActive() (bool, string) {
tools.Info("delete project")
projectact := Project.ProjectAct{}
projectact.ProjectId = ps.Projectid
ok := projectact.Delete()
if !ok {
return false, "Process error"
}
return true, "ok"
}
示例14: 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)
}
}
示例15: 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)
}
}