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


Golang buslogic.AdminLogic類代碼示例

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


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

示例1: AddReservationByAdmin

func AddReservationByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	startTime := r.PostFormValue("start_time")
	endTime := r.PostFormValue("end_time")
	teacherUsername := r.PostFormValue("teacher_username")
	teacherFullname := r.PostFormValue("teacher_fullname")
	teacherMobile := r.PostFormValue("teacher_mobile")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	var reservationJson = make(map[string]interface{})
	reservation, err := al.AddReservationByAdmin(startTime, endTime, teacherUsername, teacherFullname,
		teacherMobile, userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	reservationJson["reservation_id"] = reservation.Id
	reservationJson["start_time"] = reservation.StartTime.In(utils.Location).Format(utils.TIME_PATTERN)
	reservationJson["end_time"] = reservation.EndTime.In(utils.Location).Format(utils.TIME_PATTERN)
	reservationJson["teacher_username"] = reservation.TeacherUsername
	reservationJson["teacher_fullname"] = reservation.TeacherFullname
	reservationJson["teacher_mobile"] = reservation.TeacherMobile
	result["reservation"] = reservationJson

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:27,代碼來源:admin.go

示例2: GetStudentInfoByAdmin

func GetStudentInfoByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	reservationId := r.PostFormValue("reservation_id")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	var studentJson = make(map[string]interface{})
	studentInfo, err := al.GetStudentInfoByAdmin(reservationId, userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	studentJson["name"] = studentInfo.Name
	studentJson["gender"] = studentInfo.Gender
	studentJson["student_id"] = studentInfo.StudentId
	studentJson["school"] = studentInfo.School
	studentJson["hometown"] = studentInfo.Hometown
	studentJson["mobile"] = studentInfo.Mobile
	studentJson["email"] = studentInfo.Email
	studentJson["experience"] = studentInfo.Experience
	studentJson["problem"] = studentInfo.Problem
	result["student_info"] = studentJson

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:25,代碼來源:admin.go

示例3: GetFeedbackByAdmin

func GetFeedbackByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	reservationId := r.PostFormValue("reservation_id")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	var feedback = make(map[string]interface{})
	reservation, err := al.GetFeedbackByAdmin(reservationId, userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	if len(reservation.TeacherFeedback.TeacherFullname) == 0 {
		feedback["teacher_fullname"] = reservation.TeacherFullname
	} else {
		feedback["teacher_fullname"] = reservation.TeacherFeedback.TeacherFullname
	}
	if len(reservation.TeacherFeedback.TeacherUsername) == 0 {
		feedback["teacher_username"] = reservation.TeacherUsername
	} else {
		feedback["teacher_username"] = reservation.TeacherFeedback.TeacherUsername
	}
	if len(reservation.TeacherFeedback.StudentFullname) == 0 {
		feedback["student_fullname"] = reservation.StudentInfo.Name
	} else {
		feedback["student_fullname"] = reservation.TeacherFeedback.StudentFullname
	}
	feedback["problem"] = reservation.TeacherFeedback.Problem
	feedback["solution"] = reservation.TeacherFeedback.Solution
	feedback["advice"] = reservation.TeacherFeedback.AdviceToCenter
	result["feedback"] = feedback

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:34,代碼來源:admin.go

示例4: ExportReservationsByAdmin

func ExportReservationsByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	r.ParseForm()
	reservationIds := []string(r.Form["reservation_ids"])

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	url, err := al.ExportReservationsByAdmin(reservationIds, userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	result["url"] = url

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:16,代碼來源:admin.go

示例5: EditTeacherInfoByAdmin

func EditTeacherInfoByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	teacherUsername := r.PostFormValue("teacher_username")
	fullname := r.PostFormValue("fullname")
	gender := r.PostFormValue("gender")
	major := r.PostFormValue("major")
	academic := r.PostFormValue("academic")
	aptitude := r.PostFormValue("aptitude")
	problem := r.PostFormValue("problem")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	_, err := al.EditTeacherInfoByAdmin(teacherUsername, fullname, gender, major, academic, aptitude, problem, userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:20,代碼來源:admin.go

示例6: SubmitFeedbackByAdmin

func SubmitFeedbackByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	reservationId := r.PostFormValue("reservation_id")
	teacherUsername := r.PostFormValue("teacher_username")
	teacherFullname := r.PostFormValue("teacher_fullname")
	studentFullname := r.PostFormValue("student_fullname")
	problem := r.PostFormValue("problem")
	solution := r.PostFormValue("solution")
	advice := r.PostFormValue("advice")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	_, err := al.SubmitFeedbackByAdmin(reservationId, teacherFullname, teacherUsername, studentFullname,
		problem, solution, advice, userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:21,代碼來源:admin.go

示例7: SearchTeacherByAdmin

func SearchTeacherByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	teacherUsername := r.PostFormValue("teacher_username")
	teacherFullname := r.PostFormValue("teacher_fullname")
	teacherMoble := r.PostFormValue("teacher_mobile")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	var teacherJson = make(map[string]interface{})
	teacher, err := al.SearchTeacherByAdmin(teacherFullname, teacherUsername, teacherMoble,
		userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	teacherJson["teacher_username"] = teacher.Username
	teacherJson["teacher_fullname"] = teacher.Fullname
	teacherJson["teacher_mobile"] = teacher.Mobile
	result["teacher"] = teacherJson

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:22,代碼來源:admin.go

示例8: GetTeacherInfoByAdmin

func GetTeacherInfoByAdmin(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	teacherUsername := r.PostFormValue("teacher_username")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var al = buslogic.AdminLogic{}

	var teacherJson = make(map[string]interface{})
	teacher, err := al.GetTeacherInfoByAdmin(teacherUsername, userId, userType)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	teacherJson["teacher_username"] = teacher.Username
	teacherJson["fullname"] = teacher.Fullname
	teacherJson["gender"] = teacher.Gender
	teacherJson["major"] = teacher.Major
	teacherJson["academic"] = teacher.Academic
	teacherJson["aptitude"] = teacher.Aptitude
	teacherJson["problem"] = teacher.Problem
	result["teacher"] = teacherJson

	return result
}
開發者ID:shudiwsh2009,項目名稱:reservation_thxx_go,代碼行數:23,代碼來源:admin.go


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