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


Golang Service.Where方法代码示例

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


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

示例1: Post

func (this *TemplatesController) Post() {
	action := this.GetString("action")
	switch action {
	case "":
		service := entity.Service{}
		service.Name = this.GetString("name")
		service.Description = this.GetString("description")
		service.Where = this.GetString("where")

		id, err := this.GetInt64("id", 0)
		if err == nil {
			if id == 0 {
				service.Save()
				if service.Where == utils.Deploy_On_PaaS {
					deployOnPaaS := entity.OnPaaS{}
					deployOnPaaS.Api = this.GetString("Api")
					deployOnPaaS.Sid = service.Id
					deployOnPaaS.User = this.GetString("UserName")
					deployOnPaaS.Passwd = this.GetString("Passwd")
					deployOnPaaS.Org = this.GetString("Org")
					deployOnPaaS.Space = this.GetString("Space")
					deployOnPaaS.Save()
				}
				if service.Where == utils.Deploy_On_Vms {
					deployOnCustom := entity.OnCustom{}
					deployOnCustom.Sid = service.Id
					deployOnCustom.Ip = this.GetString("ip")
					deployOnCustom.User = this.GetString("VmUserName")
					deployOnCustom.Passwd = this.GetString("VmPasswd")
					deployOnCustom.Save()
				}
			} else {
				service.Id = id
				service.Update()
				if service.Where == utils.Deploy_On_PaaS {
					paasid, _ := this.GetInt64("paasid", 0)
					deployOnPaaS := entity.OnPaaS{}
					deployOnPaaS.Id = paasid
					deployOnPaaS.Api = this.GetString("Api")
					deployOnPaaS.Sid = service.Id
					deployOnPaaS.User = this.GetString("UserName")
					deployOnPaaS.Passwd = this.GetString("Passwd")
					deployOnPaaS.Org = this.GetString("Org")
					deployOnPaaS.Space = this.GetString("Space")
					deployOnPaaS.Update()
				}
				if service.Where == utils.Deploy_On_Vms {
					vmid, _ := this.GetInt64("vmid", 0)
					deployOnCustom := entity.OnCustom{}
					deployOnCustom.Id = vmid
					deployOnCustom.Sid = service.Id
					deployOnCustom.Ip = this.GetString("ip")
					deployOnCustom.User = this.GetString("VmUserName")
					deployOnCustom.Passwd = this.GetString("VmPasswd")
					deployOnCustom.Update()
				}
			}
		}

	case "delete":
		this.DeleteCustomService()
	}
	this.Redirect("templates", 301) //this.Get()
}
开发者ID:alex8023,项目名称:citycloud.cf-deploy-ui,代码行数:64,代码来源:templates.go


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