审查视图

pkg/infrastructure/service_gateway/allied_creation_user/param_auth.go 4.2 KB
tangxuhui authored
1 2
package allied_creation_user
3 4
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
tangxuhui authored
5 6 7 8 9 10 11 12 13
//企业注册
type (
	ReqAuthCompanySignUp struct {
		CompanyName      string `json:"companyName"`
		Contacts         string `json:"contacts"`
		IndustryCategory string `json:"industryCategory"`
		Password         string `json:"password"`
		Phone            string `json:"phone"`
		Scale            string `json:"scale"`
14 15 16 17 18 19 20 21 22

		// 法人
		LegalPerson string `cname:"法人" json:"legalPerson" valid:"Required"`
		// 社会信用代码
		SocialCreditCode string `cname:"社会信用代码" json:"socialCreditCode" valid:"Required"`
		// 营业执照所在地
		BusinessLicenseAddress domain.BusinessLicenseAddress `cname:"营业执照所在地" json:"businessLicenseAddress" valid:"Required"`
		// 营业执照-附件
		BusinessLicenseAttachments []domain.Attachment `cname:"营业执照-附件" json:"businessLicenseAttachments" valid:"Required"`
tangxuhui authored
23 24 25 26 27 28
	}

	DataAuthCompanySignUp struct {
	}
)
yangfu authored
29 30 31 32 33 34 35 36 37
//企业注册
type (
	ReqAuthUserSignUp struct {
		// 企业名称
		Name string `cname:"用户姓名" json:"name" valid:"Required"`
		// 手机号码
		Phone string `cname:"手机号码" json:"phone" valid:"Required"`
		// 密码
		Password string `cname:"密码" json:"password" valid:"Required"`
yangfu authored
38 39
		// 推荐人
		Referrer string `cname:"推荐人" json:"referrer"`
yangfu authored
40 41 42 43 44 45
	}

	DataAuthUserSignUp struct {
	}
)
tangxuhui authored
46 47 48 49 50
//修改密码
type (
	ReqAuthChangePassword struct {
		NewPassword string `json:"newPassword"`
		OldPassword string `json:"oldPassword"`
51
		UserId      int64  `json:"userId"`
tangxuhui authored
52 53 54 55 56 57 58 59 60
	}

	DataAuthChangePassword struct {
	}
)

//手机账号密码检查
type (
	ReqAuthCheckPassword struct {
tangxuhui authored
61 62
		Password string `json:"password"`
		Phone    string `json:"phone"`
tangxuhui authored
63 64 65
	}

	DataAuthCheckPassword struct {
tangxuhui authored
66
		UserId int `json:"userId"`
tangxuhui authored
67 68 69 70 71 72
	}
)

//注销账号 (添加用户时重新激活)
type (
	ReqAuthDestroyAccount struct {
yangfu authored
73
		// 用户Id 用户唯一标识
yangfu authored
74 75 76
		//UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"`
		// 用户Id 用户唯一标识
		Account string `cname:"账号" json:"account"`
tangxuhui authored
77 78 79 80 81 82 83 84
	}

	DataAuthDestroyAccount struct {
	}
)

//重置手机号
type (
yangfu authored
85 86 87 88 89 90
	ReqAuthResetPhone struct {
		// 用户Id 用户唯一标识
		UserId   int64  `cname:"用户Id 用户唯一标识" json:"userId"`
		OldPhone string `cname:"" json:"oldPhone" valid:"Required"`
		NewPhone string `cname:"" json:"newPhone" valid:"Required"`
	}
tangxuhui authored
91 92 93 94 95
	DataAuthResetPhone struct{}
)

//重置密码(忘记密码)
type (
yangfu authored
96 97 98 99 100 101
	ReqAuthResetPassword struct {
		// 手机号码
		Phone string `cname:"手机号码" json:"phone" valid:"Required"`
		// 密码
		Password string `cname:"密码" json:"password" valid:"Required"`
	}
tangxuhui authored
102 103
	DataAuthResetPassword struct{}
)
yangfu authored
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

//重置手机号
type (
	ReqAuthRefreshIM struct {
		// 手机号码
		Phone string `cname:"手机号码" json:"phone" valid:"Required"`
		// 刷新标识  0:刷新IM信息,并返回 1:使用旧的im信息
		RefreshFlag int `cname:"刷新标识" json:"refreshFlag"`
	}
	DataAuthRefreshIM struct {
		// 网易云信ID
		Accid string `json:"accid"`
		// 网易云信Token
		ImToken string `json:"imToken"`
		// 系统分配客服ID
		CsAccountId string `json:"csAccountId"`
	}
)
122 123 124 125 126

//重置手机号
type (
	ReqAuthUserBase struct {
		// 手机号码
yangfu authored
127 128
		Account    string `cname:"账号" json:"account" valid:"Required"`
		UserBaseId int64  `json:"userBaseId"`
129 130
	}
	DataAuthUserBase struct {
yangfu authored
131
		UserID     int `json:"userId"`
132 133 134 135 136 137 138 139 140 141 142 143 144 145
		UserBaseID int `json:"userBaseId"`
		UserInfo   struct {
			UserName string `json:"userName"`
			Phone    string `json:"phone"`
			// 头像
			Avatar string `json:"avatar,omitempty"`
			// 邮箱
			Email string `json:"email,omitempty"`
		} `json:"userInfo"`
		Im struct {
			Accid       string `json:"accid"`
			ImToken     string `json:"imToken"`
			CsAccountID string `json:"csAccountId"`
		} `json:"im"`
yangfu authored
146 147 148
		Favorite struct {
			OrgItems []int64 `json:"orgItems"`
		} `json:"favorite"`
149 150
	}
)
yangfu authored
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168

func (user *DataAuthUserBase) CheckOrgStarred(orgId int64) bool {
	var starred bool = false
	for i := range user.Favorite.OrgItems {
		if user.Favorite.OrgItems[i] == orgId {
			starred = true
			return starred
		}
	}
	return false
}

func (user *DataAuthUserBase) FavoriteOrg() []int64 {
	if user == nil {
		return []int64{}
	}
	return user.Favorite.OrgItems
}