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


Golang HTTPSession.MsgResErr方法代码示例

本文整理汇总了Golang中github.com/Centny/gwf/routing.HTTPSession.MsgResErr方法的典型用法代码示例。如果您正苦于以下问题:Golang HTTPSession.MsgResErr方法的具体用法?Golang HTTPSession.MsgResErr怎么用?Golang HTTPSession.MsgResErr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/Centny/gwf/routing.HTTPSession的用法示例。


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

示例1: Register

func Register(hs *routing.HTTPSession) routing.HResult {
	var userName string
	hobby := ""
	var mobile string
	head := ""
	var gender int64
	gender = 1
	err := hs.ValidCheckVal(`
		userName,R|S,L:0;
		hobby,O|S,L:0;
		mobile,R|S,L:0;
		head,O|S,L:0;
		gender,O|I,R:-1~2;
		`, &userName, &hobby, &mobile, &head, &gender)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.Register(userName, mobile, hobby, head, gender)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		} else {
			return hs.MsgRes(s)
		}
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:25,代码来源:userapi.go

示例2: PassengerFindDriver

func PassengerFindDriver(hs *routing.HTTPSession) routing.HResult {
	var uid int64
	var startTime int64
	var sLat float64
	var sLng float64
	var eLat float64
	var eLng float64
	var sCity string
	var eCity string
	t := time.Now()
	err := hs.ValidCheckVal(`
		uid,R|I,R:0;
		startTime,R|I,R:0;
		sLat,R|F,R:0;
		sLng,R|F,R:0;
		eLat,R|F,R:0;
		eLng,R|F,R:0;
		sCity,R|S,L:0;
		eCity,R|S,L:0;
		`, &uid, &startTime, &sLat, &sLng, &eLat, &eLng, &sCity, &eCity)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else if t.Unix()-startTime < 1800 {
		return hs.MsgResE(1, "invalid startTime , need > 30min from now")
	} else {
		s, err := db.FindDriverRoute(uid, startTime, sLat, sLng, eLat, eLng, sCity, eCity)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		} else {
			return hs.MsgRes(s)
		}
	}

}
开发者ID:caowenhua,项目名称:gocar,代码行数:34,代码来源:routeapi.go

示例3: DeleteUserByMobile

func DeleteUserByMobile(hs *routing.HTTPSession) routing.HResult {
	var mobile string
	err := hs.ValidCheckVal(`
		mobile,R|S,L:0
		`, &mobile)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.DeleteUserByMobile(mobile)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		}
		return hs.MsgRes(s)
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:15,代码来源:userapi.go

示例4: DeleteUserById

func DeleteUserById(hs *routing.HTTPSession) routing.HResult {
	var uid int64
	err := hs.ValidCheckVal(`
		uid,R|I,R:0
		`, &uid)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.DeleteUser(uid)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		}
		return hs.MsgRes(s)
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:15,代码来源:userapi.go

示例5: Login

func Login(hs *routing.HTTPSession) routing.HResult {
	var mobile string
	err := hs.ValidCheckVal(`
		mobile,R|S,L:0;
		`, &mobile)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.Login(mobile)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		} else {
			return hs.MsgRes(s)
		}
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:16,代码来源:userapi.go

示例6: ChargeBalance

func ChargeBalance(hs *routing.HTTPSession) routing.HResult {
	var uid int64
	var money float64
	err := hs.ValidCheckVal(`
		uid,R|I,R:0;
		money,R|F,R:0;
		`, &uid, &money)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.ChargeBalance(uid, money)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		} else {
			return hs.MsgRes(s)
		}
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:18,代码来源:orderapi.go

示例7: GetPassengerOrderList

func GetPassengerOrderList(hs *routing.HTTPSession) routing.HResult {
	var uid int64
	var page int64
	var pageCount int64
	err := hs.ValidCheckVal(`
		uid,R|I,R:0;
		page,O|I,R:0;
		pageCount,O|I,R:0;
		`, &uid, &page, &pageCount)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.GetPassengerOrderList(uid, page, pageCount)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		} else {
			return hs.MsgRes(s)
		}
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:20,代码来源:orderapi.go

示例8: PassengerCancelOrder

func PassengerCancelOrder(hs *routing.HTTPSession) routing.HResult {
	var uid int64
	var oid int64
	var drid int64
	err := hs.ValidCheckVal(`
		uid,R|I,R:0;
		oid,R|I,R:0;
		drid,R|I,R:0;
		`, &uid, &oid, &drid)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.PassengerCancelOrder(uid, oid, drid)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		} else {
			return hs.MsgRes(s)
		}
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:20,代码来源:orderapi.go

示例9: FillInfo

func FillInfo(hs *routing.HTTPSession) routing.HResult {
	var userName string
	var hobby string
	var head string
	var gender int64
	var uid int64
	err := hs.ValidCheckVal(`
		userName,R|S,L:0;
		hobby,R|S,L:0;
		head,R|S,L:0;
		gender,R|I,R:-1~2;
		uid,R|I,R:0
		`, &userName, &hobby, &head, &gender, &uid)
	if err != nil {
		return hs.MsgResErr(100, "config error", err)
	} else {
		s, err := db.FillInfo(userName, hobby, head, gender, uid)
		if err != nil {
			return hs.MsgResErr2(1, "", err)
		} else {
			return hs.MsgRes(s)
		}
	}
}
开发者ID:caowenhua,项目名称:gocar,代码行数:24,代码来源:userapi.go


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