正在显示
2 个修改的文件
包含
347 行增加
和
48 行删除
services/agg/permission.go
0 → 100644
| 1 | +package agg | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "encoding/json" | ||
| 5 | + "fmt" | ||
| 6 | + "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | ||
| 7 | + "opp/internal/utils" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +//模块编号 | ||
| 11 | +const ( | ||
| 12 | + M_ENTERPRISE string = "ENTERPRISE" //企业基础设置 | ||
| 13 | + M_SYSTEM string = "SYSTEM" //系统设置 | ||
| 14 | + M_SYSTEM_OPPORTUNITY string = "SYSTEM_OPPORTUNITY" //机会管理 | ||
| 15 | + M_ENTERPRISE_PROFILE string = "ENTERPRISE_PROFILE" //企业信息维护 | ||
| 16 | + M_ENTERPRISE_ORGANIZATION string = "ENTERPRISE_ORGANIZATION" //组织架构设置 | ||
| 17 | + M_ENTERPRISE_EMPLOYEE_POST string = "ENTERPRISE_EMPLOYEE-POST" //员工职位设置 | ||
| 18 | + M_ENTERPRISE_EMPLOYEE_ROLE string = "ENTERPRISE_EMPLOYEE-ROLE" //员工角色/权限设置 | ||
| 19 | + M_ENTERPRISE_EMPLOYEE string = "ENTERPRISE_EMPLOYEE" //员工设置 | ||
| 20 | + M_SYSTEM_OPPORTUNITY_TEMPLATE string = "SYSTEM_OPPORTUNITY-TEMPLATE" //机会模板管理 | ||
| 21 | + M_SYSTEM_RATING string = "SYSTEM_RATING" //评分模式设置 | ||
| 22 | + M_SYSTEM_ANNOUNCEMENT string = "SYSTEM_ANNOUNCEMENT" //公告管理 | ||
| 23 | +) | ||
| 24 | + | ||
| 25 | +type CodeToObject func() PermissionOptionObject | ||
| 26 | + | ||
| 27 | +var CodePermissionObject = map[string]CodeToObject{ | ||
| 28 | + M_ENTERPRISE_ORGANIZATION: NewPermissionOptionBase, //公司组织架构设置 | ||
| 29 | + M_ENTERPRISE_EMPLOYEE_POST: NewPermissionOptionBase, //公司职务管理 | ||
| 30 | + M_ENTERPRISE_EMPLOYEE_ROLE: NewPermissionOptionBase, //员工角色/权限设置 | ||
| 31 | + M_ENTERPRISE_EMPLOYEE: NewPermissionOptionBase, //公司员工管理 | ||
| 32 | + M_ENTERPRISE: NewPermissionOptionBase, //企业基础设置(大节点) | ||
| 33 | + M_SYSTEM: NewPermissionOptionBase, //系统设置(大节点) | ||
| 34 | + M_ENTERPRISE_PROFILE: NewPermissionOptionBase, //企业信息维护 | ||
| 35 | + M_SYSTEM_OPPORTUNITY_TEMPLATE: NewPermissionOptionBase, //机会模板管理 | ||
| 36 | + M_SYSTEM_RATING: NewPermissionOptionBase, //评分模式 | ||
| 37 | + M_SYSTEM_OPPORTUNITY: NewOptionOpportunity, //机会管理 | ||
| 38 | + M_SYSTEM_ANNOUNCEMENT: NewPermissionOptionBase, //公告管理 | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +type PermissionOptionObject interface { | ||
| 42 | + // StringUnmarshal(string) error | ||
| 43 | + // ObjectMarshal() string | ||
| 44 | + GetValidFunc(string) func(UserObject) bool | ||
| 45 | + MergeObject(string) error | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +type UserObject struct { | ||
| 49 | + UserId int64 `json:"user_id"` | ||
| 50 | + CompanyId int64 `json:"company_id"` | ||
| 51 | + UserCompanyId int64 `json:"user_company_id"` | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +//PermissionOptionBase 基本权限 | ||
| 55 | +type PermissionOptionBase struct { | ||
| 56 | + Check int8 `json:"check"` | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +var ( | ||
| 60 | + _ PermissionOptionObject = &PermissionOptionBase{} | ||
| 61 | +) | ||
| 62 | + | ||
| 63 | +func NewPermissionOptionBase() PermissionOptionObject { | ||
| 64 | + return &PermissionOptionBase{ | ||
| 65 | + Check: 1, | ||
| 66 | + } | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +func (p *PermissionOptionBase) ValidDefault(obj UserObject) bool { | ||
| 70 | + if p.Check == 1 { | ||
| 71 | + return true | ||
| 72 | + } | ||
| 73 | + return false | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +//GetValidFunc PermissionOptionBase 接口实现 | ||
| 77 | +func (p *PermissionOptionBase) GetValidFunc(k string) func(UserObject) bool { | ||
| 78 | + m := map[string]func(UserObject) bool{ | ||
| 79 | + "default": p.ValidDefault, | ||
| 80 | + } | ||
| 81 | + if _, ok := m[k]; ok { | ||
| 82 | + return m[k] | ||
| 83 | + } | ||
| 84 | + return nil | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +func (p *PermissionOptionBase) MergeObject(jsonString string) error { | ||
| 88 | + var obj PermissionOptionBase | ||
| 89 | + err := json.Unmarshal([]byte(jsonString), &obj) | ||
| 90 | + if err != nil { | ||
| 91 | + return err | ||
| 92 | + } | ||
| 93 | + if obj.Check > p.Check { | ||
| 94 | + p.Check = obj.Check | ||
| 95 | + } | ||
| 96 | + return nil | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +// //StringUnmarshal PermissionOptionBase 接口实现 | ||
| 100 | +// func (p *PermissionOptionBase) StringUnmarshal(s string) error { | ||
| 101 | +// err := json.Unmarshal([]byte(s), p) | ||
| 102 | +// return err | ||
| 103 | +// } | ||
| 104 | + | ||
| 105 | +// //ObjectMarshal PermissionOptionBase 接口实现 | ||
| 106 | +// func (p *PermissionOptionBase) ObjectMarshal() string { | ||
| 107 | +// bt, err := json.Marshal(p) | ||
| 108 | +// if err != nil { | ||
| 109 | +// return "" | ||
| 110 | +// } | ||
| 111 | +// return string(bt) | ||
| 112 | +// } | ||
| 113 | + | ||
| 114 | +/* | ||
| 115 | +机会管理模块 | ||
| 116 | +CheckOpp | ||
| 117 | +CheckDeparment | ||
| 118 | +OptionOpportunity | ||
| 119 | +*/ | ||
| 120 | + | ||
| 121 | +//CheckDeparment 特殊的查看条件设定中关于部门的设定 | ||
| 122 | +type CheckDeparment struct { | ||
| 123 | + Id int64 `json:"id"` | ||
| 124 | + Name string `json:"name,omitempty"` | ||
| 125 | + Wait int `json:"wait"` | ||
| 126 | + OpenAll int `json:"open_all"` | ||
| 127 | + OpenDepart int `json:"open_depart"` | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +//CheckOpp 特殊的查看条件设定 | ||
| 131 | +type CheckOpp struct { | ||
| 132 | + Departments []CheckDeparment `json:"departments"` | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +//OptionOpportunity 机会管理 高级权限设置 | ||
| 136 | +type OptionOpportunity struct { | ||
| 137 | + Check int `json:"check"` | ||
| 138 | + CheckMap map[int]int `json:"-"` | ||
| 139 | + CheckOption CheckOpp `json:"check_option"` | ||
| 140 | + EditSorce int `json:"edit_sorce"` | ||
| 141 | + EditPublicStatus int `json:"edit_public_status"` | ||
| 142 | + CloseChance int `json:"close_chance"` | ||
| 143 | + EditChance int `json:"edit_chance"` | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | +/* | ||
| 147 | +机会管理高级设置中的 check | ||
| 148 | +1:禁止查看所有机会:禁止查看所有机会(除自己提交过的机会及可执行审核操作的机会) | ||
| 149 | +2:仅查看自己部门和公开机会:查看对自己部门公开的机会+公司公开的机会 | ||
| 150 | +3:特定部门的机会:自由配置选定部门的待审核、公司公开、部门公开的机会+查看对自己部门公开的机会 | ||
| 151 | +4:查看所有机会:查看所有部门的待审核机会、公开机会及部门公开机会 | ||
| 152 | +*/ | ||
| 153 | +const ( | ||
| 154 | + OpportunityCheckLv1 int = 1 | ||
| 155 | + OpportunityCheckLv2 int = 2 | ||
| 156 | + OpportunityCheckLv3 int = 3 | ||
| 157 | + OpportunityCheckLv4 int = 4 | ||
| 158 | +) | ||
| 159 | + | ||
| 160 | +var ( | ||
| 161 | + _ PermissionOptionObject = &OptionOpportunity{} | ||
| 162 | +) | ||
| 163 | + | ||
| 164 | +func NewOptionOpportunity() PermissionOptionObject { | ||
| 165 | + return &OptionOpportunity{ | ||
| 166 | + Check: OpportunityCheckLv4, | ||
| 167 | + CheckMap: make(map[int]int), | ||
| 168 | + CheckOption: CheckOpp{ | ||
| 169 | + Departments: []CheckDeparment{}, | ||
| 170 | + }, | ||
| 171 | + } | ||
| 172 | +} | ||
| 173 | + | ||
| 174 | +//GetValidFunc PermissionOptionBase 接口实现 | ||
| 175 | +func (p *OptionOpportunity) GetValidFunc(k string) func(UserObject) bool { | ||
| 176 | + m := map[string]func(UserObject) bool{ | ||
| 177 | + "check": p.ValidCheck, | ||
| 178 | + } | ||
| 179 | + if _, ok := m[k]; ok { | ||
| 180 | + return m[k] | ||
| 181 | + } | ||
| 182 | + return nil | ||
| 183 | +} | ||
| 184 | + | ||
| 185 | +//MergeObject PermissionOptionBase 接口实现 | ||
| 186 | +func (p *OptionOpportunity) MergeObject(jsonString string) error { | ||
| 187 | + var obj OptionOpportunity | ||
| 188 | + err := json.Unmarshal([]byte(jsonString), &obj) | ||
| 189 | + if err != nil { | ||
| 190 | + return err | ||
| 191 | + } | ||
| 192 | + if p.CheckMap == nil { | ||
| 193 | + p.CheckMap = make(map[int]int) | ||
| 194 | + } | ||
| 195 | + p.CheckMap[obj.Check] = 1 | ||
| 196 | + departMap := make(map[int64]*CheckDeparment) | ||
| 197 | + for k := range p.CheckOption.Departments { | ||
| 198 | + i := p.CheckOption.Departments[k].Id | ||
| 199 | + departMap[i] = &p.CheckOption.Departments[k] | ||
| 200 | + } | ||
| 201 | + //列表合并 | ||
| 202 | + for k := range obj.CheckOption.Departments { | ||
| 203 | + i := obj.CheckOption.Departments[k].Id | ||
| 204 | + if _, ok := departMap[i]; ok { | ||
| 205 | + if obj.CheckOption.Departments[k].OpenAll > departMap[i].OpenAll { | ||
| 206 | + departMap[i].OpenAll = obj.CheckOption.Departments[k].OpenAll | ||
| 207 | + } | ||
| 208 | + if obj.CheckOption.Departments[k].OpenDepart > departMap[i].OpenDepart { | ||
| 209 | + departMap[i].OpenDepart = obj.CheckOption.Departments[k].OpenDepart | ||
| 210 | + } | ||
| 211 | + if obj.CheckOption.Departments[k].Wait > departMap[i].Wait { | ||
| 212 | + departMap[i].Wait = obj.CheckOption.Departments[k].Wait | ||
| 213 | + } | ||
| 214 | + } else { | ||
| 215 | + | ||
| 216 | + departMap[i] = &obj.CheckOption.Departments[k] | ||
| 217 | + | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + p.CheckOption.Departments = make([]CheckDeparment, 0) | ||
| 221 | + for k := range departMap { | ||
| 222 | + p.CheckOption.Departments = append(p.CheckOption.Departments, *departMap[k]) | ||
| 223 | + } | ||
| 224 | + if obj.CloseChance > p.CloseChance { | ||
| 225 | + p.CloseChance = obj.CloseChance | ||
| 226 | + } | ||
| 227 | + if obj.EditPublicStatus > p.EditPublicStatus { | ||
| 228 | + p.EditPublicStatus = obj.EditPublicStatus | ||
| 229 | + } | ||
| 230 | + if obj.EditSorce > p.EditSorce { | ||
| 231 | + p.EditSorce = obj.EditSorce | ||
| 232 | + } | ||
| 233 | + if obj.EditChance > p.EditChance { | ||
| 234 | + p.EditChance = obj.EditChance | ||
| 235 | + } | ||
| 236 | + return nil | ||
| 237 | +} | ||
| 238 | + | ||
| 239 | +func (p *OptionOpportunity) ValidCheck(obj UserObject) bool { | ||
| 240 | + if p.Check > 0 { | ||
| 241 | + return true | ||
| 242 | + } | ||
| 243 | + return false | ||
| 244 | +} | ||
| 245 | + | ||
| 246 | +func (p *OptionOpportunity) ValidEditSorce(obj UserObject) bool { | ||
| 247 | + if p.EditSorce > 0 { | ||
| 248 | + return true | ||
| 249 | + } | ||
| 250 | + return false | ||
| 251 | +} | ||
| 252 | +func (p *OptionOpportunity) ValidEditPublicStatus(obj UserObject) bool { | ||
| 253 | + if p.EditPublicStatus > 0 { | ||
| 254 | + return true | ||
| 255 | + } | ||
| 256 | + return false | ||
| 257 | +} | ||
| 258 | + | ||
| 259 | +func GetUserPermission(userCompanyid int64) (map[string]PermissionOptionObject, error) { | ||
| 260 | + type CodeOpptionData struct { | ||
| 261 | + Code string `orm:"column(code)"` | ||
| 262 | + Opption string `orm:"column(opption)"` | ||
| 263 | + } | ||
| 264 | + const datasql string = `SELECT a.code,a.opption | ||
| 265 | + FROM role_menu AS a | ||
| 266 | + JOIN user_role AS b ON a.role_id = b.role_id | ||
| 267 | + JOIN role AS c ON a.role_id = c.id | ||
| 268 | + WHERE b.user_company_id=? AND c.delete_at =0` | ||
| 269 | + var ( | ||
| 270 | + data []CodeOpptionData | ||
| 271 | + err error | ||
| 272 | + objMap = make(map[string]PermissionOptionObject) | ||
| 273 | + ) | ||
| 274 | + err = utils.ExecuteQueryAll(&data, datasql, userCompanyid) | ||
| 275 | + if err != nil { | ||
| 276 | + e := fmt.Errorf("EXCUTE SQL ERR:%s", err) | ||
| 277 | + return nil, e | ||
| 278 | + } | ||
| 279 | + for _, v := range data { | ||
| 280 | + if _, ok := objMap[v.Code]; ok { | ||
| 281 | + err = objMap[v.Code].MergeObject(v.Opption) | ||
| 282 | + if err != nil { | ||
| 283 | + log.Warn(err.Error()) | ||
| 284 | + } | ||
| 285 | + continue | ||
| 286 | + } | ||
| 287 | + if fn, ok := CodePermissionObject[v.Code]; ok { | ||
| 288 | + obj := fn() | ||
| 289 | + if err = json.Unmarshal([]byte(v.Opption), obj); err != nil { | ||
| 290 | + log.Debug("解析权限配置option 失败%s", err) | ||
| 291 | + } | ||
| 292 | + objMap[v.Code] = obj | ||
| 293 | + } else { | ||
| 294 | + log.Error("未知code:%s", v.Code) | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + } | ||
| 298 | + return objMap, nil | ||
| 299 | +} |
| @@ -255,24 +255,24 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | @@ -255,24 +255,24 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | ||
| 255 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 255 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 256 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 | 256 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 |
| 257 | commItem.ChanceStatus = protocol.ChanceStatusClose | 257 | commItem.ChanceStatus = protocol.ChanceStatusClose |
| 258 | + } | ||
| 259 | + | ||
| 260 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 261 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 262 | + log.Error(err) | ||
| 263 | + continue | ||
| 258 | } else { | 264 | } else { |
| 259 | - if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 260 | - commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 261 | - log.Error(err) | ||
| 262 | - continue | ||
| 263 | - } else { | ||
| 264 | - item := protocol.ChanceItem{ | ||
| 265 | - Id: chance.ChanceId, | ||
| 266 | - Provider: provider, | ||
| 267 | - CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 268 | - } | ||
| 269 | - utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 270 | - item.FormList = agg.ClearEmptyForm(item.FormList) | ||
| 271 | - utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 272 | - utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 273 | - utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 274 | - commItem.Chance = item | 265 | + item := protocol.ChanceItem{ |
| 266 | + Id: chance.ChanceId, | ||
| 267 | + Provider: provider, | ||
| 268 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 275 | } | 269 | } |
| 270 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 271 | + item.FormList = agg.ClearEmptyForm(item.FormList) | ||
| 272 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 273 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 274 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 275 | + commItem.Chance = item | ||
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | if chance.ReviewStatus == protocol.ReviewStatusPass { | 278 | if chance.ReviewStatus == protocol.ReviewStatusPass { |
| @@ -316,24 +316,24 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance | @@ -316,24 +316,24 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance | ||
| 316 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 316 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 317 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 | 317 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 |
| 318 | commItem.ChanceStatus = protocol.ChanceStatusClose | 318 | commItem.ChanceStatus = protocol.ChanceStatusClose |
| 319 | + } | ||
| 320 | + | ||
| 321 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 322 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 323 | + log.Error(err) | ||
| 324 | + continue | ||
| 319 | } else { | 325 | } else { |
| 320 | - if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 321 | - commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 322 | - log.Error(err) | ||
| 323 | - continue | ||
| 324 | - } else { | ||
| 325 | - item := protocol.ChanceItem{ | ||
| 326 | - Id: chance.ChanceId, | ||
| 327 | - Provider: provider, | ||
| 328 | - CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 329 | - } | ||
| 330 | - utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 331 | - item.FormList = agg.ClearEmptyForm(item.FormList) | ||
| 332 | - utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 333 | - utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 334 | - utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 335 | - commItem.Chance = item | 326 | + item := protocol.ChanceItem{ |
| 327 | + Id: chance.ChanceId, | ||
| 328 | + Provider: provider, | ||
| 329 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 336 | } | 330 | } |
| 331 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 332 | + item.FormList = agg.ClearEmptyForm(item.FormList) | ||
| 333 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 334 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 335 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 336 | + commItem.Chance = item | ||
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | if chance.ReviewStatus == protocol.ReviewStatusPass { | 339 | if chance.ReviewStatus == protocol.ReviewStatusPass { |
| @@ -451,24 +451,24 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc | @@ -451,24 +451,24 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc | ||
| 451 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 451 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 452 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 | 452 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 |
| 453 | commItem.ChanceStatus = protocol.ChanceStatusClose | 453 | commItem.ChanceStatus = protocol.ChanceStatusClose |
| 454 | + } | ||
| 455 | + | ||
| 456 | + if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { | ||
| 457 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 458 | + log.Error(err) | ||
| 459 | + //return | ||
| 454 | } else { | 460 | } else { |
| 455 | - if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { | ||
| 456 | - commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 457 | - log.Error(err) | ||
| 458 | - //return | ||
| 459 | - } else { | ||
| 460 | - item := protocol.ChanceItem{ | ||
| 461 | - Id: chance.SourceId, | ||
| 462 | - Provider: provider, | ||
| 463 | - CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 464 | - } | ||
| 465 | - utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 466 | - item.FormList = protocol.ClearEmptyForm(item.FormList) | ||
| 467 | - utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 468 | - utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 469 | - utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 470 | - commItem.Chance = item | 461 | + item := protocol.ChanceItem{ |
| 462 | + Id: chance.SourceId, | ||
| 463 | + Provider: provider, | ||
| 464 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 471 | } | 465 | } |
| 466 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 467 | + item.FormList = protocol.ClearEmptyForm(item.FormList) | ||
| 468 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 469 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 470 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 471 | + commItem.Chance = item | ||
| 472 | } | 472 | } |
| 473 | commItem.ReviewStatus = chance.ReviewStatus | 473 | commItem.ReviewStatus = chance.ReviewStatus |
| 474 | } | 474 | } |
-
请 注册 或 登录 后发表评论