当前位置: 首页>>代码示例>>Golang>>正文


Golang utils.GetLog函数代码示例

本文整理汇总了Golang中utils.GetLog函数的典型用法代码示例。如果您正苦于以下问题:Golang GetLog函数的具体用法?Golang GetLog怎么用?Golang GetLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetComplainList

//获取投诉列表
func GetComplainList(filter map[string]interface{}) (compalins []*models.JobComplaint, cnt int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetList : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetList : debug : filter=%s, compalints=%v", utils.Sdump(filter), utils.Sdump(compalins))
		}
	}()

	q := models.GetDB().QueryTable("job_complaints").OrderBy("-created").RelatedSel("Job", "User", "Project", "Employee")

	//按照传入的条件进行过滤查询结果
	for k, v := range filter {
		if k != "limit" && k != "offset" && v != "" {
			q = q.Filter(k, v)
		}
	}
	cnt, _ = q.Count()

	if filter["limit"] != nil {
		q = q.Limit(filter["limit"].(int))
	}

	if filter["offset"] != nil {
		q = q.Offset(filter["offset"].(int))
	}

	_, err = q.All(&compalins)

	return

}
开发者ID:zbzzbd,项目名称:beego,代码行数:33,代码来源:complaint.go

示例2: Do

func (pr *PasswordModify) Do() (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("accountSrv.PasswordReset.Do : %s", err.Error())
		} else {
			utils.GetLog().Debug("accountSrv.PasswordReset.Do : pr %v", pr)
		}
	}()

	if !pr.newPasswordConfirm() {
		return ErrPasswordNotSame
	}

	if err = pr.newPasswordValid(); err != nil {
		return err
	}

	if !pr.oldPasswordValid() {
		return ErrOldPassword
	}

	if err = pr.updatePassword(); err != nil {
		return err
	}
	return nil
}
开发者ID:zbzzbd,项目名称:beego,代码行数:26,代码来源:reset_password.go

示例3: Do

func (ja *JobAssignment) Do() (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("job.JobAssignment.Do : error = %s, ojb= %s", err.Error(), utils.Sdump(ja))
		}
		utils.GetLog().Debug("job.JobAssignment.Do : ojb= %s", utils.Sdump(ja))
	}()

	if ja.jobAssign.Job, err = ja.getJob(); err != nil {
		return
	}

	if ja.jobAssign.FromUser, err = ja.getFromUser(); err != nil {
		return
	}

	if ja.jobAssign.ToUser, err = ja.getToUser(); err != nil {
		return
	}

	if ja.jobAssign.Remark, err = ja.getRemark(); err != nil {
		return
	}

	if err = ja.jobAssign.Insert(); err != nil {
		return
	}

	if err = ja.afterAssignment(); err != nil {
		return
	}

	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:34,代码来源:assign.go

示例4: AddHistory

func AddHistory(j *models.Job, user *models.User, isCreate bool) (jid uint, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.AddHistory : error : %s, ", err.Error())
		} else {
			utils.GetLog().Debug("services.job.AddHistory : debug : Job=%s", utils.Sdump(j))
		}
	}()

	var jh models.JobHistory
	jh.Job = j
	jh.IsCreate = isCreate
	jh.Code = j.Code
	jh.CreateUser = j.CreateUser
	jh.Project = j.Project
	jh.Employee = j.Employee
	jh.Type = j.Type
	jh.Department = j.Department
	jh.Target = j.Target
	jh.TargetUrl = j.TargetUrl
	jh.Desc = j.Desc
	jh.Message = j.Message
	jh.FinishTime = j.FinishTime
	jh.ValidTime = j.ValidTime
	jh.ClaimTime = j.ClaimTime
	jh.ValidStatus = j.ValidStatus
	jh.ClaimStatus = j.ClaimStatus
	jh.SubmitStatus = j.SubmitStatus

	var insertId int64
	insertId, err = models.GetDB().Insert(&jh)
	jid = uint(insertId)

	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:35,代码来源:job_utils.go

示例5: do

func (userList *UserList) do() *UserList {
	if userList.isDo {
		return userList
	}
	userList.isDo = true

	var err error
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.user.GetList : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.user.GetList : debug : users=%v", utils.Sdump(userList.users))
		}
	}()

	q := models.GetDB().QueryTable("users").RelatedSel("Company")
	if !userList.includeDel {
		q = q.Filter("deleted__isnull", true)
	}

	for k, v := range userList.filter {
		if k != "limit" && k != "offset" && v != "" {
			q = q.Filter(k, v)
		} else if k == "limit" {
			limit := v.(int)
			if limit < 0 {
				limit = 10
			}
			q = q.Limit(limit)
		} else if k == "offset" {
			limit := userList.filter["limit"].(int)
			if limit < 0 {
				limit = 10
			}

			offset := v.(int)
			if offset > 0 {
				offset = (offset - 1) * limit
			}
			q = q.Offset(offset)
		}
	}

	userList.count, _ = q.Count()
	_, err = q.All(&userList.users)
	if err != nil {
		return userList
	}

	return userList
}
开发者ID:zbzzbd,项目名称:beego,代码行数:51,代码来源:user_list.go

示例6: GetTodayJobCount

func GetTodayJobCount() (cnt int64) {
	var err error
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetTodayJobCount : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetTodayJobCount : count=%v", cnt)
		}
	}()

	q := models.GetDB().QueryTable(models.TABLE_NAME_JOB).Filter("created__gte", time.Now().Format("2006-01-02"))
	cnt, err = q.Count()

	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:15,代码来源:job_utils.go

示例7: CreateComplian

func (cp *ComplaintCreator) CreateComplian(mapComplain map[string]interface{}, user *models.User) (complainId, jobId uint, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.complain.Create : error : %s, ", err.Error())
		} else {
			utils.GetLog().Debug("services.complain.Create : debug : mapComplain=%s", utils.Sdump(mapComplain))
		}
	}()

	var complian models.JobComplaint
	pid, _ := mapComplain["JobId"].(string)

	filter := make(map[string]interface{})
	filter["id"] = pid

	var job *models.Job
	job, err = GetOneJob(filter)
	complian.Job = &models.Job{Id: job.Id}
	complian.Project = &models.Project{Id: job.Project.Id}

	if mapComplain["employee_id"] != nil {
		employId, _ := strconv.Atoi(mapComplain["employee_id"].(string))
		complian.Employee = &models.User{Id: uint(employId)}
	}
	complian.Complain = mapComplain["Complain"].(string)
	complian.Source = mapComplain["source"].(string)
	complian.Type = mapComplain["Type"].(string)
	response, _ := mapComplain["response"].(int)
	complian.Response = uint(response)
	if mapComplain["editstatus"] != nil {
		editStatus, _ := strconv.Atoi(mapComplain["editstatus"].(string))
		complian.EditStatus = uint(editStatus)
	}

	complian.User = user

	//cp.compliant = complian
	var insertId int64
	insertId, err = models.GetDB().Insert(&complian)
	if err != nil {
		utils.GetLog().Debug("services.complian.Create : debug : job=%s", utils.Sdump(complian))
		return
	}
	complainId = uint(insertId)
	jobId = uint(job.Id)
	return

}
开发者ID:zbzzbd,项目名称:beego,代码行数:48,代码来源:complaint_create.go

示例8: Do

func (c *Creation) Do() (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("user.Creatin.Do : err = %v , obj = %s ", err, c)
		}
	}()

	if err = c.valid(); err != nil {
		return
	}

	c.password.GenSalt()
	c.password.GenPwd()

	u := models.User{
		Name:          c.name,
		Email:         c.email.EmailAddress(),
		Password:      c.password.Encryped(),
		Salt:          c.password.Salt(),
		Company:       &models.Company{Id: uint(c.companyId)},
		Roles:         c.roles.String(),
		LastLoginTime: time.Now(),
	}

	models.GetDB().Insert(&u)

	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:28,代码来源:creation.go

示例9: setCurrentUser

func (c *BaseController) setCurrentUser() {
	if !c.isLogin {
		return
	}
	userId := c.GetSession("user_id").(uint)
	var err error

	defer func() {
		if err != nil {
			utils.GetLog().Error("controllers.BaseController.setCurrentUser : NewUserWithId error : userId = %v, noNeedLogin=%v", userId, c.noNeedLogin)
		}
	}()

	if c.currentUser, err = user.NewUserWithId(userId); err != nil {
		if !c.noNeedLogin {
			c.Redirect("/login", 302)
		}
		return
	}
	c.userId = int(userId)

	c.Data["user_info"] = c.currentUser.GetUser()

	c.setUserCookie()
}
开发者ID:zbzzbd,项目名称:beego,代码行数:25,代码来源:base.go

示例10: UpdateProjectStatus

func (p *Project) UpdateProjectStatus(filter map[string]interface{}) (num int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.project.UpdateProjectStatus: error : %s", err.Error())
		} else {
			utils.GetLog().Error("services.project updateProjectStatus: debug: filter=%s,id=%v", utils.Sdump(filter))
		}
	}()
	q := models.GetDB().QueryTable(models.TABLE_NAME_PROJECT)
	for k, v := range filter {
		if k == "project_id" {
			num, err = q.Filter("Id", v).Update(orm.Params{"del_status": 1})
		}
	}
	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:16,代码来源:project.go

示例11: GetCount

func GetCount(filter map[string]interface{}) (cnt int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetCount : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetCount : debug : filter=%s, count=%v", utils.Sdump(filter), cnt)
		}
	}()

	q := models.GetDB().QueryTable(models.TABLE_NAME_JOB)
	for k, v := range filter {
		q = q.Filter(k, v)
	}
	cnt, err = q.Count()

	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:17,代码来源:job_count.go

示例12: UpdateJobDelStatus

//更新删除状态
func (jobList *JobList) UpdateJobDelStatus(filter map[string]interface{}, Delstatus uint) (num int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.updateJobDelStatus: error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.update: debug: filter=%s,job=%v", utils.Sdump(filter))
		}
	}()

	q := models.GetDB().QueryTable(models.TABLE_NAME_JOB)
	for k, v := range filter {
		if k == "Job_id" {
			num, err = q.Filter("Id", v).Update(orm.Params{"del_status": Delstatus})
		}
	}
	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:18,代码来源:job.go

示例13: UpdateComplaint

//更新投诉状态
func UpdateComplaint(filter map[string]interface{}) (num int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.UpdateComplain : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.UpdateComplain : debug : filter=%s, job=%v", utils.Sdump(filter))
		}
	}()

	q := models.GetDB().QueryTable("job_complaints")
	for k, v := range filter {
		if k == "Complain_id" {
			num, err = q.Filter("Id", v).Update(orm.Params{"ReplyStatus": 1})
		}
	}
	return
}
开发者ID:zbzzbd,项目名称:beego,代码行数:18,代码来源:complaint.go

示例14: GetOneComplain

//根据投诉编号获取投诉信息
func GetOneComplain(filter map[string]interface{}) (*models.JobComplaint, error) {
	var complaint models.JobComplaint
	var err error
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetOneComplain : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetOneComplain : debug : filter=%s, job=%v", utils.Sdump(filter), utils.Sdump(complaint))
		}
	}()
	q := models.GetDB().QueryTable("job_complaints").RelatedSel("Job", "User", "Project")
	for k, v := range filter {
		q = q.Filter(k, v)
	}
	err = q.One(&complaint)
	if err == orm.ErrNoRows {
		err = errors.New("投诉找不到")
	}
	return &complaint, err

}
开发者ID:zbzzbd,项目名称:beego,代码行数:22,代码来源:complaint.go

示例15: Login

func (u *User) Login(email string, password string) (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("user.User.Login : error :%s", err.Error())
		}
		utils.GetLog().Debug("user.User.Login : user = %s", utils.Sdump(u))
	}()

	u.email = NewEmail(email)
	u.password = NewPassword(password)

	if err = u.validLogin(); err != nil {
		return err
	}

	if err = u.afterLogin(); err != nil {
		return err
	}

	return nil
}
开发者ID:zbzzbd,项目名称:beego,代码行数:21,代码来源:user.go


注:本文中的utils.GetLog函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。