本文整理匯總了Golang中github.com/goinggo/tracelog.CompletedErrorf函數的典型用法代碼示例。如果您正苦於以下問題:Golang CompletedErrorf函數的具體用法?Golang CompletedErrorf怎麽用?Golang CompletedErrorf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CompletedErrorf函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: UserLogup
func (controller *UserController) UserLogup() {
var params struct {
UserName string `form:"user_name" valid:"Required; MinSize(4)" error:"invalid_user_name"`
UserPwd string `form:"user_pwd" valid:"Required; MinSize(6)" error:"invalid_user_pwd"`
UserMobile string `form:"user_mobile" valid:"Required; MinSize(6)" error:"invalid_user_mobile"`
UserQQ string `form:"user_qq" valid:"Required; MinSize(6)" error:"invalid_user_qq"`
UserWechat string `form:"user_wechat" valid:"Required; MinSize(6)" error:"invalid_user_wechat"`
UserEmail string `form:"user_email" valid:"Required; MinSize(6)" error:"invalid_user_email"`
}
if controller.ParseAndValidate(¶ms) == false {
return
}
userInfo := userModel.UserInfo{}
if err := controller.ParseForm(&userInfo); err != nil {
return
}
resData, err := userService.UserLogup(&controller.Service, userInfo)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "UserController.UserLogup", "UserName[%s]", params.UserName)
controller.ServeError(err)
return
}
controller.Data["json"] = resData
controller.ServeJSON()
}
示例2: UserLogin
func (controller *UserController) UserLogin() {
var params struct {
UserName string `form:"user_name" valid:"Required; MinSize(4)" error:"invalid_user_name"`
UserPwd string `form:"user_pwd" valid:"Required; MinSize(6)" error:"invalid_user_pwd"`
}
if controller.ParseAndValidate(¶ms) == false {
return
}
userInfo, err := userService.UserLogin(&controller.Service, params.UserName, params.UserPwd)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "UserController.UserLogin", "UserName[%s]", params.UserName)
controller.ServeError(err)
return
}
// set session
if len(userInfo.ID) > 0 {
log.Trace("UserController", "UserLogin", "userID[%s]", userInfo.ID.Hex())
controller.SetSession("UserID", userInfo.ID.Hex())
}
controller.Data["json"] = userInfo
controller.ServeJson()
}
示例3: SaveWinSettings
func (controller *SettingsController) SaveWinSettings() {
var params struct {
Settings string `form:"win_settings" valid:"Required; MinSize(6)" error:"invalid_win_settings"`
}
if controller.AuthUser() == false {
return
}
if controller.ParseAndValidate(¶ms) == false {
return
}
userID := controller.GetSession("UserID").(string)
// 獲取設置屬性
settings, err := settingsService.FindSettings(&controller.Service, userID)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "SettingsController.SaveWinSettings", "UserID[%s]", userID)
controller.ServeError(err)
return
}
var win_settings settingsModel.WinSettings
win_settings.ID = settings.ID
win_settings.UserID = userID
win_settings.Settings = params.Settings
// save settings
resData, err := settingsService.SaveSettings(&controller.Service, win_settings)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "SettingsController.SaveWinSettings", "UserID[%s]", userID)
controller.ServeError(err)
return
}
controller.Data["json"] = resData
controller.ServeJson()
}
示例4: FindInfo
func (controller *InfoController) FindInfo() {
if controller.AuthUser() == false {
return
}
userID := controller.GetSession("UserID").(string)
info, err := infoService.FindInfo(&controller.Service, userID)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "InfoController.FindInfo", "UserID[%s]", userID)
controller.ServeError(err)
return
}
controller.Data["json"] = info
controller.ServeJSON()
}
示例5: FindWinSettings
func (controller *SettingsController) FindWinSettings() {
if controller.AuthUser() == false {
return
}
userID := controller.GetSession("UserID").(string)
settings, err := settingsService.FindSettings(&controller.Service, userID)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "SettingsController.GetWinSettings", "UserID[%s]", userID)
controller.ServeError(err)
return
}
controller.Data["json"] = settings
controller.ServeJson()
}
示例6: FindMsg
func (controller *MsgController) FindMsg() {
if controller.AuthUser() == false {
return
}
userID := controller.GetSession("UserID").(string)
settings, err := msgService.FindMsg(&controller.Service, userID)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "MsgController.FindMsg", "UserID[%s]", userID)
controller.ServeError(err)
return
}
controller.Data["json"] = settings
controller.ServeJSON()
}
示例7: Index
// Index is the initial view for the buoy system.
func (controller *BuoyController) Index() {
region := "Gulf Of Mexico"
log.Startedf(controller.UserID, "BuoyController.Index", "Region[%s]", region)
buoyStations, err := buoyService.FindRegion(&controller.Service, region)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "BuoyController.Index", "Region[%s]", region)
controller.ServeError(err)
return
}
controller.Data["Stations"] = buoyStations
controller.Layout = "shared/basic-layout.html"
controller.TplNames = "buoy/content.html"
controller.LayoutSections = map[string]string{}
controller.LayoutSections["PageHead"] = "buoy/page-head.html"
controller.LayoutSections["Header"] = "shared/header.html"
controller.LayoutSections["Modal"] = "shared/modal.html"
}
示例8: RetrieveStationJson
// Stations handles the example 3 tab
// http://localhost:9003/buoy/station/42002
func (controller *BuoyController) RetrieveStationJson() {
params := struct {
StationId string `form:":stationId" valid:"Required; MinSize(4)" error:"invalid_station_id"`
}{}
if controller.ParseAndValidate(¶ms) == false {
return
}
buoyStation, err := buoyService.FindStation(&controller.Service, params.StationId)
if err != nil {
tracelog.CompletedErrorf(err, controller.UserId, "Station", "StationId[%s]", params.StationId)
controller.ServeError(err)
return
}
controller.Data["json"] = &buoyStation
controller.ServeJson()
}
示例9: RetrieveStationJSON
// RetrieveStationJSON handles the example 3 tab.
// http://localhost:9003/buoy/station/42002
func (controller *BuoyController) RetrieveStationJSON() {
// The call to ParseForm inside of ParseAndValidate is failing. This is a BAD FIX
params := struct {
StationID string `form:":stationId" valid:"Required; MinSize(4)" error:"invalid_station_id"`
}{controller.GetString(":stationId")}
if controller.ParseAndValidate(¶ms) == false {
return
}
buoyStation, err := buoyService.FindStation(&controller.Service, params.StationID)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "Station", "StationID[%s]", params.StationID)
controller.ServeError(err)
return
}
controller.Data["json"] = buoyStation
controller.ServeJson()
}
示例10: SaveInfo
func (controller *InfoController) SaveInfo() {
var params struct {
ID string `form:"_id" valid:"Required; MinSize(6)" error:"invalid_id"`
InfoType string `form:"info_type" valid:"Required; MinSize(6)" error:"invalid_info_type"`
CreatedBy string `form:"created_by" valid:"Required; MinSize(6)" error:"invalid_created_by"`
CreatedTime int64 `form:"created_time" valid:"Required; MinSize(6)" error:"invalid_win_settings"`
Origin string `form:"info_origin" valid:"Required; MinSize(6)" error:"invalid_info_origin"`
Destination string `form:"info_destination" valid:"Required; MinSize(6)" error:"invalid_info_destination"`
Frequency string `form:"info_frequency" valid:"Required; MinSize(6)" error:"invalid_info_frequency"`
InfoContent string `form:"info_content" valid:"Required; MinSize(6)" error:"invalid_info_content"`
InfoTime int64 `form:"info_time" valid:"Required; MinSize(6)" error:"invalid_info_time"`
Mobile string `form:"info_mobile" valid:"Required; MinSize(6)" error:"invalid_info_mobile"`
Wechat string `form:"info_wechat" valid:"Required; MinSize(6)" error:"invalid_info_wechat"`
QQ string `form:"info_qq" valid:"Required; MinSize(6)" error:"invalid_info_qq"`
}
if controller.AuthUser() == false {
return
}
if controller.ParseAndValidate(¶ms) == false {
return
}
information := infoModel.Information{}
if err := controller.ParseForm(&information); err != nil {
return
}
// save msg
resData, err := infoService.SaveInfo(&controller.Service, information)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "InfoController.SaveInfo", "UserID[%s]", controller.UserID)
controller.ServeError(err)
return
}
controller.Data["json"] = resData
controller.ServeJSON()
}
示例11: LoadJSON
// LoadJSON takes a json document of translations and manually
// loads them into the system
func LoadJSON(userLocale string, translationDocument string) error {
tracelog.Startedf("localize", "LoadJSON", "userLocale[%s] length[%d]", userLocale, len(translationDocument))
var tranDocuments []map[string]interface{}
if err := json.Unmarshal([]byte(translationDocument), &tranDocuments); err != nil {
tracelog.CompletedErrorf(err, "localize", "LoadJSON", "**************>")
return err
}
for _, tranDocument := range tranDocuments {
tran, err := translation.NewTranslation(tranDocument)
if err != nil {
tracelog.CompletedError(err, "localize", "LoadJSON")
return err
}
i18n.AddTranslation(locale.MustNew(userLocale), tran)
}
tracelog.Completed("localize", "LoadJSON")
return nil
}
示例12: RetrieveStation
// RetrieveStation handles the example 2 tab.
func (controller *BuoyController) RetrieveStation() {
var params struct {
StationID string `form:"stationID" valid:"Required; MinSize(4)" error:"invalid_station_id"`
}
if controller.ParseAndValidate(¶ms) == false {
return
}
buoyStation, err := buoyService.FindStation(&controller.Service, params.StationID)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "BuoyController.RetrieveStation", "StationID[%s]", params.StationID)
controller.ServeError(err)
return
}
controller.Data["Station"] = buoyStation
controller.Layout = ""
controller.TplNames = "buoy/modal/pv_station-detail.html"
view, _ := controller.RenderString()
controller.AjaxResponse(0, "SUCCESS", view)
}
示例13: SaveMsg
func (controller *MsgController) SaveMsg() {
var params struct {
ID string `form:"_id" valid:"Required; MinSize(6)" error:"invalid_id"`
MsgType string `form:"msg_type" valid:"Required; MinSize(6)" error:"invalid_msg_type"`
CreatedBy string `form:"created_by" valid:"Required; MinSize(6)" error:"invalid_created_by"`
CreatedTime int64 `form:"created_time" valid:"Required; MinSize(6)" error:"invalid_win_settings"`
PushObject string `form:"push_object" valid:"Required; MinSize(6)" error:"invalid_push_object"`
PushTime string `form:"push_time" valid:"Required; MinSize(6)" error:"invalid_push_time"`
HasPushed string `form:"has_pushed" valid:"Required; MinSize(6)" error:"invalid_has_pushed"`
MsgContent string `form:"msg_content" valid:"Required; MinSize(6)" error:"invalid_msg_content"`
HasViewed int64 `form:"has_viewed" valid:"Required; MinSize(6)" error:"invalid_has_viewed"`
}
if controller.AuthUser() == false {
return
}
if controller.ParseAndValidate(¶ms) == false {
return
}
message := msgModel.Message{}
if err := controller.ParseForm(&message); err != nil {
return
}
// save msg
resData, err := msgService.SaveMsg(&controller.Service, message)
if err != nil {
log.CompletedErrorf(err, controller.UserID, "MsgController.SaveMsg", "UserID[%s]", controller.UserID)
controller.ServeError(err)
return
}
controller.Data["json"] = resData
controller.ServeJSON()
}