1
|
package company
|
1
|
package company
|
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
4
|
- "encoding/json"
|
|
|
5
|
- "fmt"
|
|
|
6
|
"oppmg/common/log"
|
4
|
"oppmg/common/log"
|
7
|
"oppmg/models"
|
5
|
"oppmg/models"
|
8
|
"oppmg/protocol"
|
6
|
"oppmg/protocol"
|
9
|
- "oppmg/services/ucenter"
|
|
|
10
|
"oppmg/utils"
|
7
|
"oppmg/utils"
|
11
|
"strings"
|
8
|
"strings"
|
12
|
"time"
|
9
|
"time"
|
|
@@ -15,445 +12,445 @@ import ( |
|
@@ -15,445 +12,445 @@ import ( |
15
|
)
|
12
|
)
|
16
|
|
13
|
|
17
|
//InitCompanyInfo 初始化公司
|
14
|
//InitCompanyInfo 初始化公司
|
18
|
-func InitCompanyInfo(centerCompany protocol.CenterCompanyInfo) error {
|
|
|
19
|
- var (
|
|
|
20
|
- newDeparment *models.Department
|
|
|
21
|
- newRoleGroup *models.Role
|
|
|
22
|
- newRole *models.Role
|
|
|
23
|
- newUser *models.User
|
|
|
24
|
- newCompany *models.Company
|
|
|
25
|
- newUserCompany *models.UserCompany
|
|
|
26
|
- err error
|
|
|
27
|
- )
|
|
|
28
|
- o := orm.NewOrm()
|
|
|
29
|
- o.Begin()
|
|
|
30
|
- //处理用户数据
|
|
|
31
|
- newUser, err = initAdminUser(centerCompany, o)
|
|
|
32
|
- if err != nil {
|
|
|
33
|
- o.Rollback()
|
|
|
34
|
- log.Error("处理公司主管数据失败:%s", err)
|
|
|
35
|
- return protocol.NewErrWithMessage("1")
|
|
|
36
|
- }
|
|
|
37
|
- //处理公司数据
|
|
|
38
|
- newCompany, err = initCompany(centerCompany, newUser, o)
|
|
|
39
|
- if err != nil {
|
|
|
40
|
- o.Rollback()
|
|
|
41
|
- log.Error("处理公司数据失败:%s", err)
|
|
|
42
|
- return protocol.NewErrWithMessage("1")
|
|
|
43
|
- }
|
|
|
44
|
- err = iniSysConfig(int(newCompany.Id), o)
|
|
|
45
|
- if err != nil {
|
|
|
46
|
- o.Rollback()
|
|
|
47
|
- log.Error("处理评分配置数据失败:%s", err)
|
|
|
48
|
- return protocol.NewErrWithMessage("1")
|
|
|
49
|
- }
|
|
|
50
|
- //添加user_company
|
|
|
51
|
- newUserCompany, err = initUserCompany(newCompany, newUser, o)
|
|
|
52
|
- if err != nil {
|
|
|
53
|
- o.Rollback()
|
|
|
54
|
- log.Error("处理user_company数据失败:%s", err)
|
|
|
55
|
- return protocol.NewErrWithMessage("1")
|
|
|
56
|
- }
|
|
|
57
|
- //添加部门
|
|
|
58
|
- newDeparment, err = initDepartment(newCompany, newUserCompany, o)
|
|
|
59
|
- if err != nil {
|
|
|
60
|
- o.Rollback()
|
|
|
61
|
- log.Error("处理部门数据失败:%s", err)
|
|
|
62
|
- return protocol.NewErrWithMessage("1")
|
|
|
63
|
- }
|
|
|
64
|
- //添加用户部门数据
|
|
|
65
|
- _, err = initUserDedaprtmet(newDeparment, newUserCompany, o)
|
|
|
66
|
- if err != nil {
|
|
|
67
|
- o.Rollback()
|
|
|
68
|
- log.Error("处理user_department数据失败:%s", err)
|
|
|
69
|
- return protocol.NewErrWithMessage("1")
|
|
|
70
|
- }
|
|
|
71
|
- //添加角色组
|
|
|
72
|
- newRoleGroup, err = initRoleGroup(newCompany, o)
|
|
|
73
|
- if err != nil {
|
|
|
74
|
- o.Rollback()
|
|
|
75
|
- log.Error("处理角色组数据失败:%s", err)
|
|
|
76
|
- return protocol.NewErrWithMessage("1")
|
|
|
77
|
- }
|
|
|
78
|
- //添加角色
|
|
|
79
|
- newRole, err = initRole(newCompany, newRoleGroup, o)
|
|
|
80
|
- if err != nil {
|
|
|
81
|
- o.Rollback()
|
|
|
82
|
- log.Error("处理角色数据失败:%s", err)
|
|
|
83
|
- return protocol.NewErrWithMessage("1")
|
|
|
84
|
- }
|
|
|
85
|
- //添加用户的角色
|
|
|
86
|
- _, err = initUserRole(newUserCompany, newRole, o)
|
|
|
87
|
- if err != nil {
|
|
|
88
|
- o.Rollback()
|
|
|
89
|
- log.Error("处理user_role数据失败:%s", err)
|
|
|
90
|
- return protocol.NewErrWithMessage("1")
|
|
|
91
|
- }
|
|
|
92
|
- o.Commit()
|
|
|
93
|
- return nil
|
|
|
94
|
-}
|
15
|
+// func InitCompanyInfo(centerCompany protocol.CenterCompanyInfo) error {
|
|
|
16
|
+// var (
|
|
|
17
|
+// newDeparment *models.Department
|
|
|
18
|
+// newRoleGroup *models.Role
|
|
|
19
|
+// newRole *models.Role
|
|
|
20
|
+// newUser *models.User
|
|
|
21
|
+// newCompany *models.Company
|
|
|
22
|
+// newUserCompany *models.UserCompany
|
|
|
23
|
+// err error
|
|
|
24
|
+// )
|
|
|
25
|
+// o := orm.NewOrm()
|
|
|
26
|
+// o.Begin()
|
|
|
27
|
+// //处理用户数据
|
|
|
28
|
+// newUser, err = initAdminUser(centerCompany, o)
|
|
|
29
|
+// if err != nil {
|
|
|
30
|
+// o.Rollback()
|
|
|
31
|
+// log.Error("处理公司主管数据失败:%s", err)
|
|
|
32
|
+// return protocol.NewErrWithMessage("1")
|
|
|
33
|
+// }
|
|
|
34
|
+// //处理公司数据
|
|
|
35
|
+// newCompany, err = initCompany(centerCompany, newUser, o)
|
|
|
36
|
+// if err != nil {
|
|
|
37
|
+// o.Rollback()
|
|
|
38
|
+// log.Error("处理公司数据失败:%s", err)
|
|
|
39
|
+// return protocol.NewErrWithMessage("1")
|
|
|
40
|
+// }
|
|
|
41
|
+// err = iniSysConfig(int(newCompany.Id), o)
|
|
|
42
|
+// if err != nil {
|
|
|
43
|
+// o.Rollback()
|
|
|
44
|
+// log.Error("处理评分配置数据失败:%s", err)
|
|
|
45
|
+// return protocol.NewErrWithMessage("1")
|
|
|
46
|
+// }
|
|
|
47
|
+// //添加user_company
|
|
|
48
|
+// newUserCompany, err = initUserCompany(newCompany, newUser, o)
|
|
|
49
|
+// if err != nil {
|
|
|
50
|
+// o.Rollback()
|
|
|
51
|
+// log.Error("处理user_company数据失败:%s", err)
|
|
|
52
|
+// return protocol.NewErrWithMessage("1")
|
|
|
53
|
+// }
|
|
|
54
|
+// //添加部门
|
|
|
55
|
+// newDeparment, err = initDepartment(newCompany, newUserCompany, o)
|
|
|
56
|
+// if err != nil {
|
|
|
57
|
+// o.Rollback()
|
|
|
58
|
+// log.Error("处理部门数据失败:%s", err)
|
|
|
59
|
+// return protocol.NewErrWithMessage("1")
|
|
|
60
|
+// }
|
|
|
61
|
+// //添加用户部门数据
|
|
|
62
|
+// _, err = initUserDedaprtmet(newDeparment, newUserCompany, o)
|
|
|
63
|
+// if err != nil {
|
|
|
64
|
+// o.Rollback()
|
|
|
65
|
+// log.Error("处理user_department数据失败:%s", err)
|
|
|
66
|
+// return protocol.NewErrWithMessage("1")
|
|
|
67
|
+// }
|
|
|
68
|
+// //添加角色组
|
|
|
69
|
+// newRoleGroup, err = initRoleGroup(newCompany, o)
|
|
|
70
|
+// if err != nil {
|
|
|
71
|
+// o.Rollback()
|
|
|
72
|
+// log.Error("处理角色组数据失败:%s", err)
|
|
|
73
|
+// return protocol.NewErrWithMessage("1")
|
|
|
74
|
+// }
|
|
|
75
|
+// //添加角色
|
|
|
76
|
+// newRole, err = initRole(newCompany, newRoleGroup, o)
|
|
|
77
|
+// if err != nil {
|
|
|
78
|
+// o.Rollback()
|
|
|
79
|
+// log.Error("处理角色数据失败:%s", err)
|
|
|
80
|
+// return protocol.NewErrWithMessage("1")
|
|
|
81
|
+// }
|
|
|
82
|
+// //添加用户的角色
|
|
|
83
|
+// _, err = initUserRole(newUserCompany, newRole, o)
|
|
|
84
|
+// if err != nil {
|
|
|
85
|
+// o.Rollback()
|
|
|
86
|
+// log.Error("处理user_role数据失败:%s", err)
|
|
|
87
|
+// return protocol.NewErrWithMessage("1")
|
|
|
88
|
+// }
|
|
|
89
|
+// o.Commit()
|
|
|
90
|
+// return nil
|
|
|
91
|
+// }
|
95
|
|
92
|
|
96
|
-func initCompany(centerCompany protocol.CenterCompanyInfo, admininfo *models.User, o orm.Ormer) (*models.Company, error) {
|
|
|
97
|
- var (
|
|
|
98
|
- err error
|
|
|
99
|
- newCompany = &models.Company{}
|
|
|
100
|
- )
|
|
|
101
|
- err = o.QueryTable(&models.Company{}).
|
|
|
102
|
- Filter("user_center_id", centerCompany.CompanyId).
|
|
|
103
|
- One(newCompany)
|
|
|
104
|
- if err == nil {
|
|
|
105
|
- _, err = o.QueryTable(&models.Company{}).
|
|
|
106
|
- Filter("user_center_id", centerCompany.CompanyId).
|
|
|
107
|
- Update(orm.Params{
|
|
|
108
|
- "name": centerCompany.CompanyName,
|
|
|
109
|
- "admin_id": admininfo.Id,
|
|
|
110
|
- "delete_at": 0,
|
|
|
111
|
- "enable": models.COMPANY_ENABLE_YES,
|
|
|
112
|
- })
|
|
|
113
|
- if err != nil {
|
|
|
114
|
- log.Error("更新公司数据失败:%s", err)
|
|
|
115
|
- return nil, err
|
|
|
116
|
- }
|
|
|
117
|
- } else if err == orm.ErrNoRows {
|
|
|
118
|
- newCompany = &models.Company{
|
|
|
119
|
- Id: centerCompany.CompanyId,
|
|
|
120
|
- Name: centerCompany.CompanyName,
|
|
|
121
|
- AdminId: admininfo.Id,
|
|
|
122
|
- UserCenterId: centerCompany.CompanyId,
|
|
|
123
|
- }
|
|
|
124
|
- _, err = models.AddCompany(newCompany, o)
|
|
|
125
|
- if err != nil {
|
|
|
126
|
- log.Error("添加公司数据失败:%s", err)
|
|
|
127
|
- return nil, err
|
|
|
128
|
- }
|
93
|
+// func initCompany(centerCompany protocol.CenterCompanyInfo, admininfo *models.User, o orm.Ormer) (*models.Company, error) {
|
|
|
94
|
+// var (
|
|
|
95
|
+// err error
|
|
|
96
|
+// newCompany = &models.Company{}
|
|
|
97
|
+// )
|
|
|
98
|
+// err = o.QueryTable(&models.Company{}).
|
|
|
99
|
+// Filter("user_center_id", centerCompany.CompanyId).
|
|
|
100
|
+// One(newCompany)
|
|
|
101
|
+// if err == nil {
|
|
|
102
|
+// _, err = o.QueryTable(&models.Company{}).
|
|
|
103
|
+// Filter("user_center_id", centerCompany.CompanyId).
|
|
|
104
|
+// Update(orm.Params{
|
|
|
105
|
+// "name": centerCompany.CompanyName,
|
|
|
106
|
+// "admin_id": admininfo.Id,
|
|
|
107
|
+// "delete_at": 0,
|
|
|
108
|
+// "enable": models.COMPANY_ENABLE_YES,
|
|
|
109
|
+// })
|
|
|
110
|
+// if err != nil {
|
|
|
111
|
+// log.Error("更新公司数据失败:%s", err)
|
|
|
112
|
+// return nil, err
|
|
|
113
|
+// }
|
|
|
114
|
+// } else if err == orm.ErrNoRows {
|
|
|
115
|
+// newCompany = &models.Company{
|
|
|
116
|
+// Id: centerCompany.CompanyId,
|
|
|
117
|
+// Name: centerCompany.CompanyName,
|
|
|
118
|
+// AdminId: admininfo.Id,
|
|
|
119
|
+// UserCenterId: centerCompany.CompanyId,
|
|
|
120
|
+// }
|
|
|
121
|
+// _, err = models.AddCompany(newCompany, o)
|
|
|
122
|
+// if err != nil {
|
|
|
123
|
+// log.Error("添加公司数据失败:%s", err)
|
|
|
124
|
+// return nil, err
|
|
|
125
|
+// }
|
129
|
|
126
|
|
130
|
- } else {
|
|
|
131
|
- log.Error("查询公司数据失败:%s", err)
|
|
|
132
|
- return nil, err
|
|
|
133
|
- }
|
|
|
134
|
- return newCompany, nil
|
|
|
135
|
-}
|
127
|
+// } else {
|
|
|
128
|
+// log.Error("查询公司数据失败:%s", err)
|
|
|
129
|
+// return nil, err
|
|
|
130
|
+// }
|
|
|
131
|
+// return newCompany, nil
|
|
|
132
|
+// }
|
136
|
|
133
|
|
137
|
-func initAdminUser(centerCompany protocol.CenterCompanyInfo, o orm.Ormer) (*models.User, error) {
|
|
|
138
|
- var (
|
|
|
139
|
- err error
|
|
|
140
|
- newUser = &models.User{}
|
|
|
141
|
- )
|
|
|
142
|
- err = o.QueryTable(&models.User{}).
|
|
|
143
|
- Filter("phone", centerCompany.AdminAccount).
|
|
|
144
|
- Filter("delete_at", 0).
|
|
|
145
|
- One(newUser)
|
|
|
146
|
- if err == nil {
|
|
|
147
|
- // 更新数据
|
|
|
148
|
- _, err = o.QueryTable(&models.User{}).
|
|
|
149
|
- Filter("user_center_id", centerCompany.CompanyId).
|
|
|
150
|
- Filter("delete_at", 0).
|
|
|
151
|
- Update(orm.Params{
|
|
|
152
|
- "nick_name": centerCompany.AdminName,
|
|
|
153
|
- "phone": centerCompany.AdminAccount,
|
|
|
154
|
- "enable_status": models.USER_ENABLE_YES,
|
|
|
155
|
- })
|
|
|
156
|
- if err != nil {
|
|
|
157
|
- log.Error("数据操作失败:%s", err)
|
|
|
158
|
- return nil, err
|
|
|
159
|
- }
|
|
|
160
|
- } else if err == orm.ErrNoRows {
|
|
|
161
|
- var (
|
|
|
162
|
- ucenterUser = &ucenter.ResponseAddUser{}
|
|
|
163
|
- err error
|
|
|
164
|
- )
|
|
|
165
|
- ucenterUser, err = ucenter.RequestUCenterAddUser(centerCompany.AdminAccount, centerCompany.AdminName, "")
|
|
|
166
|
- if err != nil {
|
|
|
167
|
- log.Error("获取统一用户中心数据失败 :%s", err)
|
|
|
168
|
- return nil, err
|
|
|
169
|
- }
|
|
|
170
|
- //添加用户
|
|
|
171
|
- newUser = &models.User{
|
|
|
172
|
- Phone: centerCompany.AdminAccount,
|
|
|
173
|
- NickName: centerCompany.AdminName,
|
|
|
174
|
- Icon: ucenterUser.Data.Avatar,
|
|
|
175
|
- Accid: ucenterUser.Data.Accid,
|
|
|
176
|
- UserCenterId: ucenterUser.Data.Id,
|
|
|
177
|
- CsAccount: ucenterUser.Data.CustomerAccount,
|
|
|
178
|
- }
|
|
|
179
|
- _, err = models.AddUser(newUser, o)
|
|
|
180
|
- if err != nil {
|
|
|
181
|
- log.Error("添加用户数据失败:%s", err)
|
|
|
182
|
- return nil, err
|
|
|
183
|
- }
|
|
|
184
|
- } else {
|
|
|
185
|
- log.Error("查询用户数据失败:%s", err)
|
|
|
186
|
- return nil, err
|
|
|
187
|
- }
|
|
|
188
|
- return newUser, nil
|
|
|
189
|
-}
|
134
|
+// func initAdminUser(centerCompany protocol.CenterCompanyInfo, o orm.Ormer) (*models.User, error) {
|
|
|
135
|
+// var (
|
|
|
136
|
+// err error
|
|
|
137
|
+// newUser = &models.User{}
|
|
|
138
|
+// )
|
|
|
139
|
+// err = o.QueryTable(&models.User{}).
|
|
|
140
|
+// Filter("phone", centerCompany.AdminAccount).
|
|
|
141
|
+// Filter("delete_at", 0).
|
|
|
142
|
+// One(newUser)
|
|
|
143
|
+// if err == nil {
|
|
|
144
|
+// // 更新数据
|
|
|
145
|
+// _, err = o.QueryTable(&models.User{}).
|
|
|
146
|
+// Filter("user_center_id", centerCompany.CompanyId).
|
|
|
147
|
+// Filter("delete_at", 0).
|
|
|
148
|
+// Update(orm.Params{
|
|
|
149
|
+// "nick_name": centerCompany.AdminName,
|
|
|
150
|
+// "phone": centerCompany.AdminAccount,
|
|
|
151
|
+// "enable_status": models.USER_ENABLE_YES,
|
|
|
152
|
+// })
|
|
|
153
|
+// if err != nil {
|
|
|
154
|
+// log.Error("数据操作失败:%s", err)
|
|
|
155
|
+// return nil, err
|
|
|
156
|
+// }
|
|
|
157
|
+// } else if err == orm.ErrNoRows {
|
|
|
158
|
+// var (
|
|
|
159
|
+// ucenterUser = &ucenter.ResponseAddUser{}
|
|
|
160
|
+// err error
|
|
|
161
|
+// )
|
|
|
162
|
+// ucenterUser, err = ucenter.RequestUCenterAddUser(centerCompany.AdminAccount, centerCompany.AdminName, "")
|
|
|
163
|
+// if err != nil {
|
|
|
164
|
+// log.Error("获取统一用户中心数据失败 :%s", err)
|
|
|
165
|
+// return nil, err
|
|
|
166
|
+// }
|
|
|
167
|
+// //添加用户
|
|
|
168
|
+// newUser = &models.User{
|
|
|
169
|
+// Phone: centerCompany.AdminAccount,
|
|
|
170
|
+// NickName: centerCompany.AdminName,
|
|
|
171
|
+// Icon: ucenterUser.Data.Avatar,
|
|
|
172
|
+// Accid: ucenterUser.Data.Accid,
|
|
|
173
|
+// UserCenterId: ucenterUser.Data.Id,
|
|
|
174
|
+// CsAccount: ucenterUser.Data.CustomerAccount,
|
|
|
175
|
+// }
|
|
|
176
|
+// _, err = models.AddUser(newUser, o)
|
|
|
177
|
+// if err != nil {
|
|
|
178
|
+// log.Error("添加用户数据失败:%s", err)
|
|
|
179
|
+// return nil, err
|
|
|
180
|
+// }
|
|
|
181
|
+// } else {
|
|
|
182
|
+// log.Error("查询用户数据失败:%s", err)
|
|
|
183
|
+// return nil, err
|
|
|
184
|
+// }
|
|
|
185
|
+// return newUser, nil
|
|
|
186
|
+// }
|
190
|
|
187
|
|
191
|
-func initUserCompany(newcompany *models.Company, newuser *models.User, o orm.Ormer) (*models.UserCompany, error) {
|
|
|
192
|
- var (
|
|
|
193
|
- err error
|
|
|
194
|
- uc = &models.UserCompany{}
|
|
|
195
|
- )
|
|
|
196
|
- err = o.QueryTable(&models.UserCompany{}).
|
|
|
197
|
- Filter("user_id", newuser.Id).
|
|
|
198
|
- Filter("company_id", newcompany.Id).
|
|
|
199
|
- Filter("delete_at", 0).
|
|
|
200
|
- One(uc)
|
|
|
201
|
- if err == nil {
|
|
|
202
|
- _, err = o.QueryTable(&models.UserCompany{}).
|
|
|
203
|
- Filter("id", uc.Id).
|
|
|
204
|
- Update(orm.Params{
|
|
|
205
|
- "enable": models.USERCOMPANY_ENABLE_YES,
|
|
|
206
|
- })
|
|
|
207
|
- if err != nil {
|
|
|
208
|
- log.Error("更新user_company数据失败:%s", err)
|
|
|
209
|
- return nil, err
|
|
|
210
|
- }
|
|
|
211
|
- } else if err == orm.ErrNoRows {
|
|
|
212
|
- uc = &models.UserCompany{
|
|
|
213
|
- UserId: newuser.Id,
|
|
|
214
|
- CompanyId: newcompany.Id,
|
|
|
215
|
- OpenId: newuser.UserCenterId,
|
|
|
216
|
- Enable: models.USERCOMPANY_ENABLE_YES,
|
|
|
217
|
- ChargeStatus: models.USERCOMPANY_CHARGE_YES,
|
|
|
218
|
- }
|
|
|
219
|
- _, err = models.AddUserCompany(uc, o)
|
|
|
220
|
- if err != nil {
|
|
|
221
|
- log.Error("添加user_company数据失败:%s", err)
|
|
|
222
|
- return nil, err
|
|
|
223
|
- }
|
|
|
224
|
- } else {
|
|
|
225
|
- log.Error("获取user_company数据失败:%s", err)
|
|
|
226
|
- return nil, err
|
|
|
227
|
- }
|
|
|
228
|
- return uc, nil
|
|
|
229
|
-}
|
188
|
+// func initUserCompany(newcompany *models.Company, newuser *models.User, o orm.Ormer) (*models.UserCompany, error) {
|
|
|
189
|
+// var (
|
|
|
190
|
+// err error
|
|
|
191
|
+// uc = &models.UserCompany{}
|
|
|
192
|
+// )
|
|
|
193
|
+// err = o.QueryTable(&models.UserCompany{}).
|
|
|
194
|
+// Filter("user_id", newuser.Id).
|
|
|
195
|
+// Filter("company_id", newcompany.Id).
|
|
|
196
|
+// Filter("delete_at", 0).
|
|
|
197
|
+// One(uc)
|
|
|
198
|
+// if err == nil {
|
|
|
199
|
+// _, err = o.QueryTable(&models.UserCompany{}).
|
|
|
200
|
+// Filter("id", uc.Id).
|
|
|
201
|
+// Update(orm.Params{
|
|
|
202
|
+// "enable": models.USERCOMPANY_ENABLE_YES,
|
|
|
203
|
+// })
|
|
|
204
|
+// if err != nil {
|
|
|
205
|
+// log.Error("更新user_company数据失败:%s", err)
|
|
|
206
|
+// return nil, err
|
|
|
207
|
+// }
|
|
|
208
|
+// } else if err == orm.ErrNoRows {
|
|
|
209
|
+// uc = &models.UserCompany{
|
|
|
210
|
+// UserId: newuser.Id,
|
|
|
211
|
+// CompanyId: newcompany.Id,
|
|
|
212
|
+// OpenId: newuser.UserCenterId,
|
|
|
213
|
+// Enable: models.USERCOMPANY_ENABLE_YES,
|
|
|
214
|
+// ChargeStatus: models.USERCOMPANY_CHARGE_YES,
|
|
|
215
|
+// }
|
|
|
216
|
+// _, err = models.AddUserCompany(uc, o)
|
|
|
217
|
+// if err != nil {
|
|
|
218
|
+// log.Error("添加user_company数据失败:%s", err)
|
|
|
219
|
+// return nil, err
|
|
|
220
|
+// }
|
|
|
221
|
+// } else {
|
|
|
222
|
+// log.Error("获取user_company数据失败:%s", err)
|
|
|
223
|
+// return nil, err
|
|
|
224
|
+// }
|
|
|
225
|
+// return uc, nil
|
|
|
226
|
+// }
|
230
|
|
227
|
|
231
|
-func initDepartment(newCompany *models.Company, newusercompany *models.UserCompany, o orm.Ormer) (*models.Department, error) {
|
|
|
232
|
- var (
|
|
|
233
|
- newDepartment = &models.Department{}
|
|
|
234
|
- err error
|
|
|
235
|
- )
|
|
|
236
|
- err = o.QueryTable(&models.Department{}).
|
|
|
237
|
- Filter("company_id", newCompany.Id).
|
|
|
238
|
- Filter("is_top", 1).
|
|
|
239
|
- One(newDepartment)
|
|
|
240
|
- if err == nil {
|
|
|
241
|
- newDepartment.Name = newCompany.Name
|
|
|
242
|
- err = models.UpdateDepartmentById(newDepartment, []string{"Name"}, o)
|
|
|
243
|
- if err != nil {
|
|
|
244
|
- log.Error("更新部门关系树数据失败:%s", err)
|
|
|
245
|
- return nil, err
|
|
|
246
|
- }
|
|
|
247
|
- return newDepartment, nil
|
|
|
248
|
- } else if err == orm.ErrNoRows {
|
|
|
249
|
- //添加部门
|
|
|
250
|
- newDepartment = &models.Department{
|
|
|
251
|
- CompanyId: newCompany.Id,
|
|
|
252
|
- Name: newCompany.Name,
|
|
|
253
|
- IsTop: 1,
|
|
|
254
|
- ParentId: 0,
|
|
|
255
|
- Relation: fmt.Sprint(utils.GenerateIDBySonyflake()),
|
|
|
256
|
- }
|
|
|
257
|
- newDepartment.SetManages([]int64{newusercompany.Id})
|
|
|
258
|
- _, err = models.AddDepartment(newDepartment, o)
|
|
|
259
|
- if err != nil {
|
|
|
260
|
- log.Error("添加部门数据失败:%s", err)
|
|
|
261
|
- return nil, err
|
|
|
262
|
- }
|
|
|
263
|
- newDepartment.SetRelation(nil)
|
|
|
264
|
- err = models.UpdateDepartmentById(newDepartment, []string{"Relation"}, o)
|
|
|
265
|
- if err != nil {
|
|
|
266
|
- log.Error("更新部门关系树数据失败:%s", err)
|
|
|
267
|
- return nil, err
|
|
|
268
|
- }
|
|
|
269
|
- } else {
|
|
|
270
|
- log.Error("查询部门数据失败:%s", err)
|
|
|
271
|
- return nil, err
|
|
|
272
|
- }
|
228
|
+// func initDepartment(newCompany *models.Company, newusercompany *models.UserCompany, o orm.Ormer) (*models.Department, error) {
|
|
|
229
|
+// var (
|
|
|
230
|
+// newDepartment = &models.Department{}
|
|
|
231
|
+// err error
|
|
|
232
|
+// )
|
|
|
233
|
+// err = o.QueryTable(&models.Department{}).
|
|
|
234
|
+// Filter("company_id", newCompany.Id).
|
|
|
235
|
+// Filter("is_top", 1).
|
|
|
236
|
+// One(newDepartment)
|
|
|
237
|
+// if err == nil {
|
|
|
238
|
+// newDepartment.Name = newCompany.Name
|
|
|
239
|
+// err = models.UpdateDepartmentById(newDepartment, []string{"Name"}, o)
|
|
|
240
|
+// if err != nil {
|
|
|
241
|
+// log.Error("更新部门关系树数据失败:%s", err)
|
|
|
242
|
+// return nil, err
|
|
|
243
|
+// }
|
|
|
244
|
+// return newDepartment, nil
|
|
|
245
|
+// } else if err == orm.ErrNoRows {
|
|
|
246
|
+// //添加部门
|
|
|
247
|
+// newDepartment = &models.Department{
|
|
|
248
|
+// CompanyId: newCompany.Id,
|
|
|
249
|
+// Name: newCompany.Name,
|
|
|
250
|
+// IsTop: 1,
|
|
|
251
|
+// ParentId: 0,
|
|
|
252
|
+// Relation: fmt.Sprint(utils.GenerateIDBySonyflake()),
|
|
|
253
|
+// }
|
|
|
254
|
+// newDepartment.SetManages([]int64{newusercompany.Id})
|
|
|
255
|
+// _, err = models.AddDepartment(newDepartment, o)
|
|
|
256
|
+// if err != nil {
|
|
|
257
|
+// log.Error("添加部门数据失败:%s", err)
|
|
|
258
|
+// return nil, err
|
|
|
259
|
+// }
|
|
|
260
|
+// newDepartment.SetRelation(nil)
|
|
|
261
|
+// err = models.UpdateDepartmentById(newDepartment, []string{"Relation"}, o)
|
|
|
262
|
+// if err != nil {
|
|
|
263
|
+// log.Error("更新部门关系树数据失败:%s", err)
|
|
|
264
|
+// return nil, err
|
|
|
265
|
+// }
|
|
|
266
|
+// } else {
|
|
|
267
|
+// log.Error("查询部门数据失败:%s", err)
|
|
|
268
|
+// return nil, err
|
|
|
269
|
+// }
|
273
|
|
270
|
|
274
|
- return newDepartment, nil
|
|
|
275
|
-}
|
271
|
+// return newDepartment, nil
|
|
|
272
|
+// }
|
276
|
|
273
|
|
277
|
-func initUserDedaprtmet(newDepartment *models.Department, newUserCompany *models.UserCompany, o orm.Ormer) (*models.UserDepartment, error) {
|
|
|
278
|
- var (
|
|
|
279
|
- newUserDepartment = &models.UserDepartment{}
|
|
|
280
|
- err error
|
|
|
281
|
- )
|
|
|
282
|
- err = o.QueryTable(&models.UserDepartment{}).
|
|
|
283
|
- Filter("department_id", newDepartment.Id).
|
|
|
284
|
- Filter("user_company_id", newUserCompany.Id).
|
|
|
285
|
- Filter("enable_status", models.USER_DEPARTMENT_ENABLE_YES).
|
|
|
286
|
- One(newUserDepartment)
|
|
|
287
|
- if err == nil {
|
|
|
288
|
- return newUserDepartment, nil
|
|
|
289
|
- } else if err == orm.ErrNoRows {
|
|
|
290
|
- //添加部门
|
|
|
291
|
- newUserDepartment = &models.UserDepartment{
|
|
|
292
|
- UserCompanyId: newUserCompany.Id,
|
|
|
293
|
- //UserId: newUserCompany.UserId,
|
|
|
294
|
- CompanyId: newUserCompany.CompanyId,
|
|
|
295
|
- DepartmentId: newDepartment.Id,
|
|
|
296
|
- }
|
|
|
297
|
- _, err = models.AddUserDepartment(newUserDepartment, o)
|
|
|
298
|
- if err != nil {
|
|
|
299
|
- log.Error("添加部门数据失败:%s", err)
|
|
|
300
|
- return nil, err
|
|
|
301
|
- }
|
|
|
302
|
- } else {
|
|
|
303
|
- log.Error("查询部门数据失败:%s", err)
|
|
|
304
|
- return nil, err
|
|
|
305
|
- }
|
274
|
+// func initUserDedaprtmet(newDepartment *models.Department, newUserCompany *models.UserCompany, o orm.Ormer) (*models.UserDepartment, error) {
|
|
|
275
|
+// var (
|
|
|
276
|
+// newUserDepartment = &models.UserDepartment{}
|
|
|
277
|
+// err error
|
|
|
278
|
+// )
|
|
|
279
|
+// err = o.QueryTable(&models.UserDepartment{}).
|
|
|
280
|
+// Filter("department_id", newDepartment.Id).
|
|
|
281
|
+// Filter("user_company_id", newUserCompany.Id).
|
|
|
282
|
+// Filter("enable_status", models.USER_DEPARTMENT_ENABLE_YES).
|
|
|
283
|
+// One(newUserDepartment)
|
|
|
284
|
+// if err == nil {
|
|
|
285
|
+// return newUserDepartment, nil
|
|
|
286
|
+// } else if err == orm.ErrNoRows {
|
|
|
287
|
+// //添加部门
|
|
|
288
|
+// newUserDepartment = &models.UserDepartment{
|
|
|
289
|
+// UserCompanyId: newUserCompany.Id,
|
|
|
290
|
+// //UserId: newUserCompany.UserId,
|
|
|
291
|
+// CompanyId: newUserCompany.CompanyId,
|
|
|
292
|
+// DepartmentId: newDepartment.Id,
|
|
|
293
|
+// }
|
|
|
294
|
+// _, err = models.AddUserDepartment(newUserDepartment, o)
|
|
|
295
|
+// if err != nil {
|
|
|
296
|
+// log.Error("添加部门数据失败:%s", err)
|
|
|
297
|
+// return nil, err
|
|
|
298
|
+// }
|
|
|
299
|
+// } else {
|
|
|
300
|
+// log.Error("查询部门数据失败:%s", err)
|
|
|
301
|
+// return nil, err
|
|
|
302
|
+// }
|
306
|
|
303
|
|
307
|
- return newUserDepartment, nil
|
|
|
308
|
-}
|
304
|
+// return newUserDepartment, nil
|
|
|
305
|
+// }
|
309
|
|
306
|
|
310
|
-func initRoleGroup(newCompany *models.Company, o orm.Ormer) (*models.Role, error) {
|
|
|
311
|
- var (
|
|
|
312
|
- newRoleGroup = &models.Role{}
|
|
|
313
|
- err error
|
|
|
314
|
- )
|
|
|
315
|
- err = o.QueryTable(&models.Role{}).
|
|
|
316
|
- Filter("delete_at", 0).
|
|
|
317
|
- Filter("is_default", models.ROLE_DEFAULR).
|
|
|
318
|
- Filter("types", models.ROLETYPES_GROUP).
|
|
|
319
|
- Filter("company_id", newCompany.Id).
|
|
|
320
|
- One(newRoleGroup)
|
|
|
321
|
- if err == nil {
|
|
|
322
|
- return newRoleGroup, nil
|
|
|
323
|
- } else if err == orm.ErrNoRows {
|
|
|
324
|
- //添加部门
|
|
|
325
|
- newRoleGroup = &models.Role{
|
|
|
326
|
- Types: models.ROLETYPES_GROUP,
|
|
|
327
|
- CompanyId: newCompany.Id,
|
|
|
328
|
- IsDefault: models.ROLE_DEFAULR,
|
|
|
329
|
- Name: "管理员",
|
|
|
330
|
- }
|
|
|
331
|
- _, err = models.AddRole(newRoleGroup, o)
|
|
|
332
|
- if err != nil {
|
|
|
333
|
- log.Error("添加角色组数据失败:%s", err)
|
|
|
334
|
- return nil, err
|
|
|
335
|
- }
|
|
|
336
|
- } else {
|
|
|
337
|
- log.Error("查询角色组数据失败:%s", err)
|
|
|
338
|
- return nil, err
|
|
|
339
|
- }
|
307
|
+// func initRoleGroup(newCompany *models.Company, o orm.Ormer) (*models.Role, error) {
|
|
|
308
|
+// var (
|
|
|
309
|
+// newRoleGroup = &models.Role{}
|
|
|
310
|
+// err error
|
|
|
311
|
+// )
|
|
|
312
|
+// err = o.QueryTable(&models.Role{}).
|
|
|
313
|
+// Filter("delete_at", 0).
|
|
|
314
|
+// Filter("is_default", models.ROLE_DEFAULR).
|
|
|
315
|
+// Filter("types", models.ROLETYPES_GROUP).
|
|
|
316
|
+// Filter("company_id", newCompany.Id).
|
|
|
317
|
+// One(newRoleGroup)
|
|
|
318
|
+// if err == nil {
|
|
|
319
|
+// return newRoleGroup, nil
|
|
|
320
|
+// } else if err == orm.ErrNoRows {
|
|
|
321
|
+// //添加部门
|
|
|
322
|
+// newRoleGroup = &models.Role{
|
|
|
323
|
+// Types: models.ROLETYPES_GROUP,
|
|
|
324
|
+// CompanyId: newCompany.Id,
|
|
|
325
|
+// IsDefault: models.ROLE_DEFAULR,
|
|
|
326
|
+// Name: "管理员",
|
|
|
327
|
+// }
|
|
|
328
|
+// _, err = models.AddRole(newRoleGroup, o)
|
|
|
329
|
+// if err != nil {
|
|
|
330
|
+// log.Error("添加角色组数据失败:%s", err)
|
|
|
331
|
+// return nil, err
|
|
|
332
|
+// }
|
|
|
333
|
+// } else {
|
|
|
334
|
+// log.Error("查询角色组数据失败:%s", err)
|
|
|
335
|
+// return nil, err
|
|
|
336
|
+// }
|
340
|
|
337
|
|
341
|
- return newRoleGroup, nil
|
|
|
342
|
-}
|
338
|
+// return newRoleGroup, nil
|
|
|
339
|
+// }
|
343
|
|
340
|
|
344
|
-func initRole(newCompany *models.Company, newRoleGroup *models.Role, o orm.Ormer) (*models.Role, error) {
|
|
|
345
|
- var (
|
|
|
346
|
- newRole = &models.Role{}
|
|
|
347
|
- err error
|
|
|
348
|
- )
|
|
|
349
|
- err = o.QueryTable(&models.Role{}).
|
|
|
350
|
- Filter("delete_at", 0).
|
|
|
351
|
- Filter("is_default", models.ROLE_DEFAULR).
|
|
|
352
|
- Filter("types", models.ROLETYPES_ROLE).
|
|
|
353
|
- Filter("company_id", newCompany.Id).
|
|
|
354
|
- One(newRole)
|
|
|
355
|
- if err == nil {
|
|
|
356
|
- return newRole, nil
|
|
|
357
|
- } else if err == orm.ErrNoRows {
|
|
|
358
|
- //添加部门
|
|
|
359
|
- newRole = &models.Role{
|
|
|
360
|
- Types: models.ROLETYPES_ROLE,
|
|
|
361
|
- CompanyId: newCompany.Id,
|
|
|
362
|
- IsDefault: models.ROLE_DEFAULR,
|
|
|
363
|
- Name: "主管理员",
|
|
|
364
|
- Pid: newRoleGroup.Id,
|
|
|
365
|
- }
|
|
|
366
|
- _, err = models.AddRole(newRole, o)
|
|
|
367
|
- if err != nil {
|
|
|
368
|
- log.Error("添加角色数据失败:%s", err)
|
|
|
369
|
- return nil, err
|
|
|
370
|
- }
|
|
|
371
|
- } else {
|
|
|
372
|
- log.Error("查询角色数据失败:%s", err)
|
|
|
373
|
- return nil, err
|
|
|
374
|
- }
|
341
|
+// func initRole(newCompany *models.Company, newRoleGroup *models.Role, o orm.Ormer) (*models.Role, error) {
|
|
|
342
|
+// var (
|
|
|
343
|
+// newRole = &models.Role{}
|
|
|
344
|
+// err error
|
|
|
345
|
+// )
|
|
|
346
|
+// err = o.QueryTable(&models.Role{}).
|
|
|
347
|
+// Filter("delete_at", 0).
|
|
|
348
|
+// Filter("is_default", models.ROLE_DEFAULR).
|
|
|
349
|
+// Filter("types", models.ROLETYPES_ROLE).
|
|
|
350
|
+// Filter("company_id", newCompany.Id).
|
|
|
351
|
+// One(newRole)
|
|
|
352
|
+// if err == nil {
|
|
|
353
|
+// return newRole, nil
|
|
|
354
|
+// } else if err == orm.ErrNoRows {
|
|
|
355
|
+// //添加部门
|
|
|
356
|
+// newRole = &models.Role{
|
|
|
357
|
+// Types: models.ROLETYPES_ROLE,
|
|
|
358
|
+// CompanyId: newCompany.Id,
|
|
|
359
|
+// IsDefault: models.ROLE_DEFAULR,
|
|
|
360
|
+// Name: "主管理员",
|
|
|
361
|
+// Pid: newRoleGroup.Id,
|
|
|
362
|
+// }
|
|
|
363
|
+// _, err = models.AddRole(newRole, o)
|
|
|
364
|
+// if err != nil {
|
|
|
365
|
+// log.Error("添加角色数据失败:%s", err)
|
|
|
366
|
+// return nil, err
|
|
|
367
|
+// }
|
|
|
368
|
+// } else {
|
|
|
369
|
+// log.Error("查询角色数据失败:%s", err)
|
|
|
370
|
+// return nil, err
|
|
|
371
|
+// }
|
375
|
|
372
|
|
376
|
- return newRole, nil
|
|
|
377
|
-}
|
373
|
+// return newRole, nil
|
|
|
374
|
+// }
|
378
|
|
375
|
|
379
|
-func initUserRole(newUserCompany *models.UserCompany, newRole *models.Role, o orm.Ormer) (*models.UserRole, error) {
|
|
|
380
|
- var (
|
|
|
381
|
- newUserRole = &models.UserRole{}
|
|
|
382
|
- err error
|
|
|
383
|
- )
|
|
|
384
|
- err = o.QueryTable(&models.UserRole{}).
|
|
|
385
|
- Filter("enable_status", models.USER_ROLE_ENABLE_YES).
|
|
|
386
|
- Filter("user_company_id", newUserCompany.Id).
|
|
|
387
|
- Filter("role_id", newRole.Id).
|
|
|
388
|
- One(newUserRole)
|
|
|
389
|
- if err == nil {
|
|
|
390
|
- return newUserRole, nil
|
|
|
391
|
- } else if err == orm.ErrNoRows {
|
|
|
392
|
- //添加UserRole
|
|
|
393
|
- newUserRole = &models.UserRole{
|
|
|
394
|
- RoleId: newRole.Id,
|
|
|
395
|
- UserCompanyId: newUserCompany.Id,
|
|
|
396
|
- CompanyId: newUserCompany.CompanyId,
|
|
|
397
|
- }
|
|
|
398
|
- _, err = models.AddUserRole(newUserRole, o)
|
|
|
399
|
- if err != nil {
|
|
|
400
|
- log.Error("添加user_role数据失败:%s", err)
|
|
|
401
|
- return nil, err
|
|
|
402
|
- }
|
|
|
403
|
- } else {
|
|
|
404
|
- log.Error("查询user_role数据失败:%s", err)
|
|
|
405
|
- return nil, err
|
|
|
406
|
- }
|
376
|
+// func initUserRole(newUserCompany *models.UserCompany, newRole *models.Role, o orm.Ormer) (*models.UserRole, error) {
|
|
|
377
|
+// var (
|
|
|
378
|
+// newUserRole = &models.UserRole{}
|
|
|
379
|
+// err error
|
|
|
380
|
+// )
|
|
|
381
|
+// err = o.QueryTable(&models.UserRole{}).
|
|
|
382
|
+// Filter("enable_status", models.USER_ROLE_ENABLE_YES).
|
|
|
383
|
+// Filter("user_company_id", newUserCompany.Id).
|
|
|
384
|
+// Filter("role_id", newRole.Id).
|
|
|
385
|
+// One(newUserRole)
|
|
|
386
|
+// if err == nil {
|
|
|
387
|
+// return newUserRole, nil
|
|
|
388
|
+// } else if err == orm.ErrNoRows {
|
|
|
389
|
+// //添加UserRole
|
|
|
390
|
+// newUserRole = &models.UserRole{
|
|
|
391
|
+// RoleId: newRole.Id,
|
|
|
392
|
+// UserCompanyId: newUserCompany.Id,
|
|
|
393
|
+// CompanyId: newUserCompany.CompanyId,
|
|
|
394
|
+// }
|
|
|
395
|
+// _, err = models.AddUserRole(newUserRole, o)
|
|
|
396
|
+// if err != nil {
|
|
|
397
|
+// log.Error("添加user_role数据失败:%s", err)
|
|
|
398
|
+// return nil, err
|
|
|
399
|
+// }
|
|
|
400
|
+// } else {
|
|
|
401
|
+// log.Error("查询user_role数据失败:%s", err)
|
|
|
402
|
+// return nil, err
|
|
|
403
|
+// }
|
407
|
|
404
|
|
408
|
- return newUserRole, nil
|
|
|
409
|
-}
|
405
|
+// return newUserRole, nil
|
|
|
406
|
+// }
|
410
|
|
407
|
|
411
|
-func iniSysConfig(companyid int, o orm.Ormer) error {
|
|
|
412
|
- var (
|
|
|
413
|
- m *models.SysConfig
|
|
|
414
|
- err error
|
|
|
415
|
- )
|
|
|
416
|
- m, err = models.GetSysConfigByCompanyId(companyid, models.KeyScore)
|
|
|
417
|
- if err == nil {
|
|
|
418
|
- return nil
|
|
|
419
|
- }
|
|
|
420
|
- v := protocol.ScoreConfig{
|
|
|
421
|
- DiscoveryScore: &protocol.DiscoveryScore{
|
|
|
422
|
- BasicFactor: 1,
|
|
|
423
|
- ExtraFactor: 1,
|
|
|
424
|
- ValueFactor: 1,
|
|
|
425
|
- },
|
|
|
426
|
- SumScore: &protocol.SumScore{
|
|
|
427
|
- DiscoveryFactor: 1,
|
|
|
428
|
- CatchFactor: 1,
|
|
|
429
|
- },
|
|
|
430
|
- BasicScore: &protocol.ScoreRange{
|
|
|
431
|
- Max: 10000,
|
|
|
432
|
- Min: 0,
|
|
|
433
|
- Step: 1,
|
|
|
434
|
- },
|
|
|
435
|
- ExtraScore: &protocol.ScoreRange{
|
|
|
436
|
- Max: 10000,
|
|
|
437
|
- Min: 0,
|
|
|
438
|
- Step: 1,
|
|
|
439
|
- },
|
|
|
440
|
- ValueScore: &protocol.ScoreRange{
|
|
|
441
|
- Max: 10000,
|
|
|
442
|
- Min: 0,
|
|
|
443
|
- Step: 1,
|
|
|
444
|
- },
|
|
|
445
|
- }
|
|
|
446
|
- bt, _ := json.Marshal(v)
|
|
|
447
|
- m = &models.SysConfig{
|
|
|
448
|
- Key: models.KeyScore,
|
|
|
449
|
- CompanyId: companyid,
|
|
|
450
|
- CreateAt: time.Now(),
|
|
|
451
|
- UpdateAt: time.Now(),
|
|
|
452
|
- Content: string(bt),
|
|
|
453
|
- }
|
|
|
454
|
- _, err = models.AddSysConfig(m, o)
|
|
|
455
|
- return err
|
|
|
456
|
-}
|
408
|
+// func iniSysConfig(companyid int, o orm.Ormer) error {
|
|
|
409
|
+// var (
|
|
|
410
|
+// m *models.SysConfig
|
|
|
411
|
+// err error
|
|
|
412
|
+// )
|
|
|
413
|
+// m, err = models.GetSysConfigByCompanyId(companyid, models.KeyScore)
|
|
|
414
|
+// if err == nil {
|
|
|
415
|
+// return nil
|
|
|
416
|
+// }
|
|
|
417
|
+// v := protocol.ScoreConfig{
|
|
|
418
|
+// DiscoveryScore: &protocol.DiscoveryScore{
|
|
|
419
|
+// BasicFactor: 1,
|
|
|
420
|
+// ExtraFactor: 1,
|
|
|
421
|
+// ValueFactor: 1,
|
|
|
422
|
+// },
|
|
|
423
|
+// SumScore: &protocol.SumScore{
|
|
|
424
|
+// DiscoveryFactor: 1,
|
|
|
425
|
+// CatchFactor: 1,
|
|
|
426
|
+// },
|
|
|
427
|
+// BasicScore: &protocol.ScoreRange{
|
|
|
428
|
+// Max: 10000,
|
|
|
429
|
+// Min: 0,
|
|
|
430
|
+// Step: 1,
|
|
|
431
|
+// },
|
|
|
432
|
+// ExtraScore: &protocol.ScoreRange{
|
|
|
433
|
+// Max: 10000,
|
|
|
434
|
+// Min: 0,
|
|
|
435
|
+// Step: 1,
|
|
|
436
|
+// },
|
|
|
437
|
+// ValueScore: &protocol.ScoreRange{
|
|
|
438
|
+// Max: 10000,
|
|
|
439
|
+// Min: 0,
|
|
|
440
|
+// Step: 1,
|
|
|
441
|
+// },
|
|
|
442
|
+// }
|
|
|
443
|
+// bt, _ := json.Marshal(v)
|
|
|
444
|
+// m = &models.SysConfig{
|
|
|
445
|
+// Key: models.KeyScore,
|
|
|
446
|
+// CompanyId: companyid,
|
|
|
447
|
+// CreateAt: time.Now(),
|
|
|
448
|
+// UpdateAt: time.Now(),
|
|
|
449
|
+// Content: string(bt),
|
|
|
450
|
+// }
|
|
|
451
|
+// _, err = models.AddSysConfig(m, o)
|
|
|
452
|
+// return err
|
|
|
453
|
+// }
|
457
|
|
454
|
|
458
|
func CompanyInfoEdit(companyid int64, logo string) error {
|
455
|
func CompanyInfoEdit(companyid int64, logo string) error {
|
459
|
data := models.Company{
|
456
|
data := models.Company{
|