Esempio n. 1
0
func NewExporteFile(ep Exporter) *ExporteFile {
	return &ExporteFile{
		Exporter: ep,
		filename: Getfilename(),
		fullpath: utils.GetConf().String("upload::root") + utils.GetConf().String("upload::export"),
	}
}
Esempio n. 2
0
File: init.go Progetto: zbzzbd/beego
func connectDB() {
	orm.RegisterDriver("mysql", orm.DR_MySQL)

	name := utils.GetConf().String("db::name")
	user := utils.GetConf().String("db::user")
	pass := utils.GetConf().String("db::pass")
	host := utils.GetConf().String("db::host")
	port := utils.GetConf().String("db::port")

	//data source name

	//	dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8", user, pass, host, port, name)
	dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local", user, pass, host, port, name)
	orm.RegisterDataBase("default", "mysql", dsn)

	orm.RegisterModel(new(User), new(Project), new(ProjectLog))
	orm.RegisterModel(new(Company), new(Job), new(Progress))
	orm.RegisterModel(new(File), new(JobComplaint), new(JobProgress))
	orm.RegisterModel(new(JobValid), new(JobClaim), new(JobSubmit))
	orm.RegisterModel(new(UserLogin), new(JobAssign))
	orm.RegisterModel(new(JobHistory), new(JobComplaintReply))
	orm.RegisterModel(new(Require))
	db = orm.NewOrm()
	setMaxIdleConns()
}
Esempio n. 3
0
File: main.go Progetto: zbzzbd/beego
func initStatic() error {
	uploadPath := utils.GetConf().String("upload::root")
	err := utils.EnsurePath(uploadPath)
	if err != nil {
		return err
	}

	jobPath := uploadPath + utils.GetConf().String("upload::job")
	err = utils.EnsurePath(jobPath)
	if err != nil {
		return err
	}

	exportPath := uploadPath + utils.GetConf().String("upload::export")
	err = utils.EnsurePath(exportPath)
	if err != nil {
		return err
	}

	beego.DirectoryIndex = true
	beego.StaticDir["/public"] = "public/"
	beego.SetStaticPath("/img", "public/img")
	beego.SetStaticPath("/export", exportPath)
	beego.SetStaticPath("/"+controllers.StaticPathPhoto, uploadPath)

	return nil
}
Esempio n. 4
0
func NewUploadFile(request *http.Request, formName, confKey string) *UploadFile {
	return &UploadFile{
		request:  request,
		formName: formName,
		savePath: utils.GetConf().String("upload::root") + utils.GetConf().String("upload::"+confKey),
		url:      path.Join(StaticPathPhoto, utils.GetConf().String("upload::"+confKey)),
	}
}
Esempio n. 5
0
func NewProjectExport() *ProjectExport {
	return &ProjectExport{
		filename: GetFileName(),
		fullpath: utils.GetConf().String("upload::root") + utils.GetConf().String("upload::export"),
	}
}
Esempio n. 6
0
func (e *Email) IsEnable() bool {
	isEnable, _ := utils.GetConf().Bool("email::enable")
	return isEnable
}
Esempio n. 7
0
func getParams() {
	apiUser = utils.GetConf().String("email::api_user")
	apiKey = utils.GetConf().String("email::api_key")
	from = utils.GetConf().String("email::from")
	sendEmailByTempUrl = utils.GetConf().String("email::email_tmp_url")
}
Esempio n. 8
0
File: init.go Progetto: zbzzbd/beego
func setMaxIdleConns() {
	maxIdleConns, _ := utils.GetConf().Int("db::max_idle_conns")
	orm.SetMaxIdleConns("default", maxIdleConns)
}
Esempio n. 9
0
File: main.go Progetto: zbzzbd/beego
func initHTTP() {
	beego.HttpPort, _ = utils.GetConf().Int("app::httpport")
	beego.CopyRequestBody, _ = utils.GetConf().Bool("app:copyrequestbody")
}