| 
					
				 | 
			
			
				@@ -5,6 +5,7 @@ import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"encoding/json" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"fmt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"gorm.io/gorm" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"log" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"project_management/app/e" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"project_management/global" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"project_management/unity" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -16,24 +17,23 @@ import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 type Apply struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//gorm.Model 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	utils.BaseModel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	AppID                  string      `gorm:"type:varchar(50);not null;unique" json:"app_id"`                                              // 应用id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	UserId                 int         `gorm:"type:int;" json:"user_id"`                                                                    // 用户id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	UserName               string      `gorm:"type:varchar(50);" json:"user_name"`                                                          // 用户名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	AppName                string      `gorm:"type:varchar(50);index:idx_name,unique" json:"app_name" validate:"required" min:"3" max:"20"` // 应用名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	AppDescription         string      `gorm:"type:varchar(255);" json:"app_description" validate:"required"`                               // 应用描述 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	CertificationTime      utils.Time  `gorm:"type:datetime;" json:"certification_time"`                                                    // 认证到期时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	State                  int         `gorm:"type:int;" json:"state"`                                                                      // 状态 1 正常 2 停用 3 过期 4 禁用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Icon                   string      `gorm:"type:varchar(255);" json:"icon"`                                                              // 应用图标 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	StartupDiagramPc       string      `gorm:"type:varchar(255);" json:"startup_diagram_pc"`                                                // 启动图pc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	StartupDiagramMobile   string      `gorm:"type:varchar(255);" json:"startup_diagram_mobile"`                                            // 启动图移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	LoginMode              int         `gorm:"type:int;" json:"login_mode"`                                                                 // 注册模式 1 公开注册 2禁止注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	LoginMethod            LoginMethod `gorm:"type:json" json:"login_method"`                                                               // 登录方式 1 短信 2 微信登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	BackgroundImagePc      string      `gorm:"type:varchar(255);" json:"background_image_pc"`                                               // 背景图pc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	BackgroundImageMobile  string      `gorm:"type:varchar(255);" json:"background_image_mobile"`                                           // 背景图移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	BackgroundImageObscure float32     `gorm:"type:double;" json:"background_image_obscure"`                                                // 背景图模糊度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	TopicPC                int         `gorm:"type:int;" json:"topic_pc"`                                                                   // 主题pc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	TopicMobile            int         `gorm:"type:int;" json:"topic_mobile"`                                                               // 主题移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Caps                   string      `gorm:"type:varchar(255);" json:"caps"`                                                              // 应用能力 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	AppID                  string       `gorm:"type:varchar(50);not null;unique" json:"app_id"`                                              // 应用id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	UserId                 int          `gorm:"type:int;" json:"user_id"`                                                                    // 用户id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	UserName               string       `gorm:"type:varchar(50);" json:"user_name"`                                                          // 用户名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	AppName                string       `gorm:"type:varchar(50);index:idx_name,unique" json:"app_name" validate:"required" min:"3" max:"20"` // 应用名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	AppDescription         string       `gorm:"type:varchar(255);" json:"app_description" validate:"required"`                               // 应用描述 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	CertificationTime      utils.Time   `gorm:"type:datetime;" json:"certification_time"`                                                    // 认证到期时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	State                  int          `gorm:"type:int;" json:"state"`                                                                      // 状态 1 正常 2 停用 3 过期 4 禁用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Icon                   string       `gorm:"type:varchar(255);" json:"icon"`                                                              // 应用图标 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	StartupDiagramPc       *string      `gorm:"type:varchar(255);" json:"startup_diagram_pc"`                                                // 启动图pc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	StartupDiagramMobile   *string      `gorm:"type:varchar(255);" json:"startup_diagram_mobile"`                                            // 启动图移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	LoginMode              *int         `gorm:"type:int;" json:"login_mode"`                                                                 // 注册模式 1 公开注册 2禁止注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	LoginMethod            *LoginMethod `gorm:"type:json" json:"login_method"`                                                               // 登录方式 1 短信 2 微信登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	BackgroundImagePc      *string      `gorm:"type:varchar(255);" json:"background_image_pc"`                                               // 背景图pc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	BackgroundImageMobile  *string      `gorm:"type:varchar(255);" json:"background_image_mobile"`                                           // 背景图移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	BackgroundImageObscure *float32     `gorm:"type:double;" json:"background_image_obscure"`                                                // 背景图模糊度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TopicPC                *int         `gorm:"type:int;" json:"topic_pc"`                                                                   // 主题pc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TopicMobile            *int         `gorm:"type:int;" json:"topic_mobile"`                                                               // 主题移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 type LoginMethod []int 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -120,7 +120,7 @@ func (a Apply) GetApplyById(appid string) (Apply, error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if tx.RowsAffected > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if a.LoginMethod == nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			a.LoginMethod = LoginMethod{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			a.LoginMethod = &LoginMethod{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return a, nil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,6 +129,7 @@ func (a Apply) GetApplyById(appid string) (Apply, error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (a Apply) UserUpdateApply(apply Apply) e.Rescode { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//TODO implement me 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	log.Print(apply) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	tx := global.DBLink.Where("id=?", apply.ID).Where("user_id=?", apply.UserId).Updates(&apply) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if tx.Error != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return e.ERROR 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -223,7 +224,7 @@ func (a Apply) GetApplyList(params unity.QueryPageParams, apply Apply, queryCond 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for i, _ := range result { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if result[i].LoginMethod == nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			result[i].LoginMethod = LoginMethod{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result[i].LoginMethod = &LoginMethod{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return result, total, nil 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -231,14 +232,14 @@ func (a Apply) GetApplyList(params unity.QueryPageParams, apply Apply, queryCond 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (a Apply) AddApply(apply Apply) e.Rescode { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//TODO implement me 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	//默认每一应用有一年免费时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	//time.Parse("2006-01-02 15:04:05", apply.CertificationTime) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//设置系统默认状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	tiem := time.Now().AddDate(0, 0, 365) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	apply.CertificationTime = utils.Time(tiem) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	apply.State = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	apply.BackgroundImageObscure = 0.5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	apply.TopicPC = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	apply.TopicMobile = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	apply.Icon = global.IconSetting.IconPath 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*apply.BackgroundImageObscure = 0.5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*apply.TopicPC = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*apply.TopicMobile = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	tx := global.DBLink.Create(&apply) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if tx.Error != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		errMsg := tx.Error.Error() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -309,9 +310,6 @@ func (a Apply) UpDateApplyCap(applycap ApplyCapabilities) e.Rescode { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	begin := global.DBLink.Begin() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	begin.Table(a.TableName()).Where("app_id = ?", applycap.AppID).First(&a) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if a.Caps == applycap.CapID { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if err := begin.Table(a.TableName()). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Where("app_id = ?", applycap.AppID). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Update("caps", applycap.CapID).Error; err != nil { 
			 |