作者 yangfu

点赞列表修改

@@ -158,8 +158,8 @@ from audit_flow_process where uid=? and enable_status =1 and review_status in (% @@ -158,8 +158,8 @@ from audit_flow_process where uid=? and enable_status =1 and review_status in (%
158 158
159 func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { 159 func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
160 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( 160 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
161 -select a.*,b.user_id,b.id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (  
162 -select id collect_id,source_id,update_at collect_time,chance_id from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1 161 +select a.*,b.user_id chance_user_id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
  162 +select id collect_id,source_id,update_at,collect_time,chance_id from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
163 and source_type=1 163 and source_type=1
164 and (mark_flag&2)>0 164 and (mark_flag&2)>0
165 )a left outer join chance b on a.source_id = b.id 165 )a left outer join chance b on a.source_id = b.id
@@ -181,13 +181,13 @@ limit ?`) @@ -181,13 +181,13 @@ limit ?`)
181 181
182 func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { 182 func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
183 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( 183 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
184 -select a.*,b.user_id,b.id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (  
185 -select id collect_id,source_id,update_at collect_time from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1 184 +select a.*,b.user_id chance_user_id,b.id chance_id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
  185 +select id collect_id,source_id,update_at,zan_time from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
186 and source_type=1 186 and source_type=1
187 and (mark_flag&1)>0 187 and (mark_flag&1)>0
188 )a left outer join chance b on a.source_id = b.id 188 )a left outer join chance b on a.source_id = b.id
189 )a left outer join chance_data b on a.source_id =b.chance_id 189 )a left outer join chance_data b on a.source_id =b.chance_id
190 -order by collect_time desc 190 +order by zan_time desc
191 limit ?`) 191 limit ?`)
192 192
193 sqlCount := `select count(0) from chance_favorite where user_id =? and enable_status=1 and (mark_flag&1)>0 and source_type=1` 193 sqlCount := `select count(0) from chance_favorite where user_id =? and enable_status=1 and (mark_flag&1)>0 and source_type=1`
@@ -216,7 +216,7 @@ func GetChanceComment(uid int64, lastId int64, pageSize int, v interface{}) (tot @@ -216,7 +216,7 @@ func GetChanceComment(uid int64, lastId int64, pageSize int, v interface{}) (tot
216 sql := fmt.Sprintf(`select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id 216 sql := fmt.Sprintf(`select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id
217 from ( 217 from (
218 select a.*,b.images,b.speechs,b.videos from ( 218 select a.*,b.images,b.speechs,b.videos from (
219 -select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data,b.publish_status from ( 219 +select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data,b.publish_status,b.status from (
220 select id,content,view_total,zan_total,comment_total,source_type,source_id,create_at comment_time from comment 220 select id,content,view_total,zan_total,comment_total,source_type,source_id,create_at comment_time from comment
221 where user_id =? and (?=0 or id<?) 221 where user_id =? and (?=0 or id<?)
222 )a left outer join chance b on a.source_id = b.id and source_type=1 222 )a left outer join chance b on a.source_id = b.id and source_type=1
@@ -244,7 +244,7 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i @@ -244,7 +244,7 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i
244 sql := `select a.*,b.images,speechs,videos 244 sql := `select a.*,b.images,speechs,videos
245 from ( 245 from (
246 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance 246 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance
247 -where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1 247 +where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1 and status=1
248 order by create_at desc 248 order by create_at desc
249 limit ? 249 limit ?
250 ) a left JOIN chance_data b on a.id =b.chance_id` 250 ) a left JOIN chance_data b on a.id =b.chance_id`
@@ -252,7 +252,7 @@ limit ? @@ -252,7 +252,7 @@ limit ?
252 252
253 sqlCount := fmt.Sprintf(`select count(0) from ( 253 sqlCount := fmt.Sprintf(`select count(0) from (
254 select id from chance 254 select id from chance
255 -where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 255 +where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 and status=1
256 order by create_at desc 256 order by create_at desc
257 ) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId) 257 ) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId)
258 if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil { 258 if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
@@ -273,26 +273,26 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int @@ -273,26 +273,26 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int
273 select a.*,b.images,speechs,videos from ( 273 select a.*,b.images,speechs,videos from (
274 select * from ( 274 select * from (
275 ##公司公开的机会 275 ##公司公开的机会
276 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 276 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
277 where company_id = %v and publish_status = 2 277 where company_id = %v and publish_status = 2
278 UNION 278 UNION
279 279
280 ##指定部门-机会提交的部门 280 ##指定部门-机会提交的部门
281 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 281 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
282 where department_id in (%v) 282 where department_id in (%v)
283 UNION 283 UNION
284 284
285 ##本人 285 ##本人
286 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 286 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
287 where user_id = %v 287 where user_id = %v
288 UNION 288 UNION
289 289
290 ##我审核 290 ##我审核
291 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 291 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
292 select DISTINCT chance_id from audit_flow_process where uid =%v 292 select DISTINCT chance_id from audit_flow_process where uid =%v
293 ) a inner join chance b on a.chance_id = b.id 293 ) a inner join chance b on a.chance_id = b.id
294 294
295 -) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 295 +) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
296 order by create_at desc 296 order by create_at desc
297 limit %v 297 limit %v
298 ) a left JOIN chance_data b on a.id =b.chance_id 298 ) a left JOIN chance_data b on a.id =b.chance_id
@@ -301,26 +301,26 @@ limit %v @@ -301,26 +301,26 @@ limit %v
301 sqlCount := fmt.Sprintf(` 301 sqlCount := fmt.Sprintf(`
302 select count(0) from ( 302 select count(0) from (
303 ##公司公开的机会 303 ##公司公开的机会
304 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 304 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
305 where company_id = %v and publish_status = 2 305 where company_id = %v and publish_status = 2
306 UNION 306 UNION
307 307
308 ##指定部门-机会提交的部门 308 ##指定部门-机会提交的部门
309 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 309 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
310 where department_id in (%v) 310 where department_id in (%v)
311 UNION 311 UNION
312 312
313 ##本人 313 ##本人
314 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 314 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
315 where user_id = %v 315 where user_id = %v
316 UNION 316 UNION
317 317
318 ##我审核 318 ##我审核
319 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 319 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
320 select DISTINCT chance_id from audit_flow_process where uid =%v 320 select DISTINCT chance_id from audit_flow_process where uid =%v
321 ) a inner join chance b on a.chance_id = b.id 321 ) a inner join chance b on a.chance_id = b.id
322 322
323 -) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 323 +) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
324 `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId) 324 `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
325 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil { 325 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
326 return 326 return
@@ -340,32 +340,32 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag @@ -340,32 +340,32 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag
340 select a.*,b.images,speechs,videos from ( 340 select a.*,b.images,speechs,videos from (
341 select * from ( 341 select * from (
342 ##指定部门-机会公开的部门 342 ##指定部门-机会公开的部门
343 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 343 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
344 select DISTINCT chance_id from chance_department where department_id in (%v) 344 select DISTINCT chance_id from chance_department where department_id in (%v)
345 )a inner join chance b on a.chance_id = b.id 345 )a inner join chance b on a.chance_id = b.id
346 UNION 346 UNION
347 347
348 ##公司公开的机会 348 ##公司公开的机会
349 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 349 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
350 where company_id = %v and publish_status = 2 350 where company_id = %v and publish_status = 2
351 UNION 351 UNION
352 352
353 ##指定部门-机会提交的部门 353 ##指定部门-机会提交的部门
354 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 354 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
355 where department_id in (%v) 355 where department_id in (%v)
356 UNION 356 UNION
357 357
358 ##本人 358 ##本人
359 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 359 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
360 where user_id = %v 360 where user_id = %v
361 UNION 361 UNION
362 362
363 ##我审核 363 ##我审核
364 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 364 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
365 select DISTINCT chance_id from audit_flow_process where uid =%v 365 select DISTINCT chance_id from audit_flow_process where uid =%v
366 ) a inner join chance b on a.chance_id = b.id 366 ) a inner join chance b on a.chance_id = b.id
367 367
368 -) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 368 +) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
369 order by create_at desc 369 order by create_at desc
370 limit %v 370 limit %v
371 ) a left JOIN chance_data b on a.id =b.chance_id 371 ) a left JOIN chance_data b on a.id =b.chance_id
@@ -374,32 +374,32 @@ limit %v @@ -374,32 +374,32 @@ limit %v
374 sqlCount := fmt.Sprintf(` 374 sqlCount := fmt.Sprintf(`
375 select count(0) from ( 375 select count(0) from (
376 ##指定部门-机会公开的部门 376 ##指定部门-机会公开的部门
377 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 377 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
378 select DISTINCT chance_id from chance_department where department_id in (%v) 378 select DISTINCT chance_id from chance_department where department_id in (%v)
379 )a inner join chance b on a.chance_id = b.id 379 )a inner join chance b on a.chance_id = b.id
380 UNION 380 UNION
381 381
382 ##公司公开的机会 382 ##公司公开的机会
383 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 383 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
384 where company_id = %v and publish_status = 2 384 where company_id = %v and publish_status = 2
385 UNION 385 UNION
386 386
387 ##指定部门-机会提交的部门 387 ##指定部门-机会提交的部门
388 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 388 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
389 where department_id in (%v) 389 where department_id in (%v)
390 UNION 390 UNION
391 391
392 ##本人 392 ##本人
393 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 393 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
394 where user_id = %v 394 where user_id = %v
395 UNION 395 UNION
396 396
397 ##我审核 397 ##我审核
398 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 398 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
399 select DISTINCT chance_id from audit_flow_process where uid =%v 399 select DISTINCT chance_id from audit_flow_process where uid =%v
400 ) a inner join chance b on a.chance_id = b.id 400 ) a inner join chance b on a.chance_id = b.id
401 401
402 -) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 402 +) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
403 `, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId) 403 `, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
404 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil { 404 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
405 return 405 return
@@ -418,27 +418,27 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64, @@ -418,27 +418,27 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64,
418 select a.*,b.images,speechs,videos from ( 418 select a.*,b.images,speechs,videos from (
419 select * from ( 419 select * from (
420 ##公司公开的机会 420 ##公司公开的机会
421 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 421 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
422 where company_id = %v and publish_status = 2 422 where company_id = %v and publish_status = 2
423 423
424 UNION 424 UNION
425 ##指定部门-机会公开的部门 425 ##指定部门-机会公开的部门
426 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 426 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
427 select DISTINCT chance_id from chance_department where department_id in (%v) 427 select DISTINCT chance_id from chance_department where department_id in (%v)
428 )a inner join chance b on a.chance_id = b.id 428 )a inner join chance b on a.chance_id = b.id
429 UNION 429 UNION
430 430
431 ##本人 431 ##本人
432 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 432 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
433 where user_id = %v 433 where user_id = %v
434 UNION 434 UNION
435 435
436 ##我审核 436 ##我审核
437 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 437 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
438 select DISTINCT chance_id from audit_flow_process where uid =%v 438 select DISTINCT chance_id from audit_flow_process where uid =%v
439 ) a inner join chance b on a.chance_id = b.id 439 ) a inner join chance b on a.chance_id = b.id
440 440
441 -) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 441 +) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
442 order by create_at desc 442 order by create_at desc
443 limit %v 443 limit %v
444 ) a left JOIN chance_data b on a.id =b.chance_id 444 ) a left JOIN chance_data b on a.id =b.chance_id
@@ -447,27 +447,27 @@ limit %v @@ -447,27 +447,27 @@ limit %v
447 sqlCount := fmt.Sprintf(` 447 sqlCount := fmt.Sprintf(`
448 select count(0) from ( 448 select count(0) from (
449 ##公司公开的机会 449 ##公司公开的机会
450 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 450 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
451 where company_id = %v and publish_status = 2 451 where company_id = %v and publish_status = 2
452 452
453 UNION 453 UNION
454 ##指定部门-机会公开的部门 454 ##指定部门-机会公开的部门
455 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 455 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
456 select DISTINCT chance_id from chance_department where department_id in (%v) 456 select DISTINCT chance_id from chance_department where department_id in (%v)
457 )a inner join chance b on a.chance_id = b.id 457 )a inner join chance b on a.chance_id = b.id
458 UNION 458 UNION
459 459
460 ##本人 460 ##本人
461 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 461 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
462 where user_id = %v 462 where user_id = %v
463 UNION 463 UNION
464 464
465 ##我审核 465 ##我审核
466 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 466 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
467 select DISTINCT chance_id from audit_flow_process where uid =%v 467 select DISTINCT chance_id from audit_flow_process where uid =%v
468 ) a inner join chance b on a.chance_id = b.id 468 ) a inner join chance b on a.chance_id = b.id
469 469
470 -) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 470 +) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
471 `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId) 471 `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
472 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil { 472 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
473 return 473 return
@@ -486,16 +486,16 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz @@ -486,16 +486,16 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz
486 select a.*,b.images,speechs,videos from ( 486 select a.*,b.images,speechs,videos from (
487 select * from ( 487 select * from (
488 ##本人 488 ##本人
489 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 489 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
490 where user_id = %v 490 where user_id = %v
491 UNION 491 UNION
492 492
493 ##我审核 493 ##我审核
494 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 494 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
495 select DISTINCT chance_id from audit_flow_process where uid =%v 495 select DISTINCT chance_id from audit_flow_process where uid =%v
496 ) a inner join chance b on a.chance_id = b.id 496 ) a inner join chance b on a.chance_id = b.id
497 497
498 -) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 498 +) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
499 order by create_at desc 499 order by create_at desc
500 limit %v 500 limit %v
501 ) a left JOIN chance_data b on a.id =b.chance_id 501 ) a left JOIN chance_data b on a.id =b.chance_id
@@ -504,16 +504,16 @@ limit %v @@ -504,16 +504,16 @@ limit %v
504 sqlCount := fmt.Sprintf(` 504 sqlCount := fmt.Sprintf(`
505 select count(0) from ( 505 select count(0) from (
506 ##本人 506 ##本人
507 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance 507 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
508 where user_id = %v 508 where user_id = %v
509 UNION 509 UNION
510 510
511 ##我审核 511 ##我审核
512 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from ( 512 + select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
513 select DISTINCT chance_id from audit_flow_process where uid =%v 513 select DISTINCT chance_id from audit_flow_process where uid =%v
514 ) a inner join chance b on a.chance_id = b.id 514 ) a inner join chance b on a.chance_id = b.id
515 515
516 -) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 516 +) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
517 `, uid, uid, chanceTypeId, chanceTypeId) 517 `, uid, uid, chanceTypeId, chanceTypeId)
518 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil { 518 if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
519 return 519 return
@@ -582,120 +582,6 @@ select * from ( @@ -582,120 +582,6 @@ select * from (
582 return 582 return
583 } 583 }
584 584
585 -//type2 对我所在部门公开的机会 公司公开的机会  
586 -func ValidtChancePublicCompany(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, v interface{}, departmentIds []int64) (total int, err error) {  
587 - sql := fmt.Sprintf(`  
588 -select a.*,b.images,speechs,videos from (  
589 -select * from (  
590 - ##公司公开的机会  
591 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance  
592 - where company_id = %v and publish_status = 2  
593 -  
594 - UNION  
595 - ##指定部门-机会公开的部门  
596 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from (  
597 - select DISTINCT chance_id from chance_department where department_id in (%v)  
598 - )a inner join chance b on a.chance_id = b.id  
599 - UNION  
600 -  
601 - ##本人  
602 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance  
603 - where user_id = %v  
604 - UNION  
605 -  
606 - ##我审核  
607 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from (  
608 - select DISTINCT chance_id from audit_flow_process where uid =%v  
609 - ) a inner join chance b on a.chance_id = b.id  
610 -  
611 -) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1  
612 -order by create_at desc  
613 -limit %v  
614 -) a left JOIN chance_data b on a.id =b.chance_id  
615 -`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)  
616 -  
617 - sqlCount := fmt.Sprintf(`  
618 -select count(0) from (  
619 - ##公司公开的机会  
620 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance  
621 - where company_id = %v and publish_status = 2  
622 -  
623 - UNION  
624 - ##指定部门-机会公开的部门  
625 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from (  
626 - select DISTINCT chance_id from chance_department where department_id in (%v)  
627 - )a inner join chance b on a.chance_id = b.id  
628 - UNION  
629 -  
630 - ##本人  
631 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance  
632 - where user_id = %v  
633 - UNION  
634 -  
635 - ##我审核  
636 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from (  
637 - select DISTINCT chance_id from audit_flow_process where uid =%v  
638 - ) a inner join chance b on a.chance_id = b.id  
639 -  
640 -) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1  
641 -`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)  
642 - if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {  
643 - return  
644 - }  
645 - if v != nil {  
646 - if err = utils.ExecuteQueryAll(v, sql); err != nil {  
647 - return  
648 - }  
649 - }  
650 - return  
651 -}  
652 -  
653 -//type1 禁止查看所有机会  
654 -func ValidChanceMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, v interface{}) (total int, err error) {  
655 - sql := fmt.Sprintf(`  
656 -select a.*,b.images,speechs,videos from (  
657 -select * from (  
658 - ##本人  
659 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance  
660 - where user_id = %v  
661 - UNION  
662 -  
663 - ##我审核  
664 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from (  
665 - select DISTINCT chance_id from audit_flow_process where uid =%v  
666 - ) a inner join chance b on a.chance_id = b.id  
667 -  
668 -) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1  
669 -order by create_at desc  
670 -limit %v  
671 -) a left JOIN chance_data b on a.id =b.chance_id  
672 -`, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)  
673 -  
674 - sqlCount := fmt.Sprintf(`  
675 -select count(0) from (  
676 - ##本人  
677 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from chance  
678 - where user_id = %v  
679 - UNION  
680 -  
681 - ##我审核  
682 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id from (  
683 - select DISTINCT chance_id from audit_flow_process where uid =%v  
684 - ) a inner join chance b on a.chance_id = b.id  
685 -  
686 -) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1  
687 -`, uid, uid, chanceTypeId, chanceTypeId)  
688 - if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {  
689 - return  
690 - }  
691 - if v != nil {  
692 - if err = utils.ExecuteQueryAll(v, sql); err != nil {  
693 - return  
694 - }  
695 - }  
696 - return  
697 -}  
698 -  
699 //是否存在按发布机会部门编号查询 585 //是否存在按发布机会部门编号查询
700 func ExitsChanceByDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) { 586 func ExitsChanceByDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) {
701 sql := fmt.Sprintf(`select id from chance where id=%v and department_id in (%v)`, 587 sql := fmt.Sprintf(`select id from chance where id=%v and department_id in (%v)`,
@@ -21,6 +21,8 @@ type ChanceFavorite struct { @@ -21,6 +21,8 @@ type ChanceFavorite struct {
21 CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"` 21 CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
22 UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"删除时间"` 22 UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"删除时间"`
23 ChanceId int64 `orm:"column(chance_id)" description:"机会编号"` 23 ChanceId int64 `orm:"column(chance_id)" description:"机会编号"`
  24 + CollectTime time.Time `orm:"column(collect_time);type(timestamp);null" description:"收藏时间"`
  25 + ZanTime time.Time `orm:"column(zan_time);type(timestamp);null" description:"点赞时间"`
24 } 26 }
25 27
26 func (t *ChanceFavorite) TableName() string { 28 func (t *ChanceFavorite) TableName() string {
@@ -127,8 +129,12 @@ func ExitsChanceFavorite(userId, companyId int64, sourceId int64, markFlag int) @@ -127,8 +129,12 @@ func ExitsChanceFavorite(userId, companyId int64, sourceId int64, markFlag int)
127 //更新机会点赞/收藏状态 129 //更新机会点赞/收藏状态
128 func UpdateChanceFavorite(userId, companyId int64, sourceId int64, markFlag int) (err error) { 130 func UpdateChanceFavorite(userId, companyId int64, sourceId int64, markFlag int) (err error) {
129 o := orm.NewOrm() 131 o := orm.NewOrm()
130 - sql := `update chance_favorite set mark_flag = mark_flag ^ ? ,update_at=now() 132 + sql := `update chance_favorite set mark_flag = mark_flag ^ ? ,update_at=now(),zan_time=now()
131 where user_id =? and company_id =? and source_id=? ` // 133 where user_id =? and company_id =? and source_id=? ` //
  134 + if markFlag == 2 {
  135 + sql = `update chance_favorite set mark_flag = mark_flag ^ ? ,update_at=now(),collect_time=now()
  136 +where user_id =? and company_id =? and source_id=? `
  137 + }
132 if _, err = o.Raw(sql, markFlag, userId, companyId, sourceId).Exec(); err == nil { 138 if _, err = o.Raw(sql, markFlag, userId, companyId, sourceId).Exec(); err == nil {
133 return 139 return
134 } 140 }
@@ -182,7 +182,7 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag @@ -182,7 +182,7 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag
182 //获取机会消息 182 //获取机会消息
183 func GetChanceMsg(uid, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) { 183 func GetChanceMsg(uid, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) {
184 sql := `select a.*,b.images,b.speechs,b.videos from ( 184 sql := `select a.*,b.images,b.speechs,b.videos from (
185 -select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data from ( 185 +select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data,b.status from (
186 select id,company_id,receive_user_id,message,source_id,is_read,chance_id,create_at msg_time,data,sender_user_id 186 select id,company_id,receive_user_id,message,source_id,is_read,chance_id,create_at msg_time,data,sender_user_id
187 from user_msg where receive_user_id=? and source_type=1 and (?=0 or id<?) and msg_type=? 187 from user_msg where receive_user_id=? and source_type=1 and (?=0 or id<?) and msg_type=?
188 )a left outer join chance b on a.source_id = b.id 188 )a left outer join chance b on a.source_id = b.id
@@ -207,7 +207,7 @@ from user_msg where receive_user_id=? and source_type=1 and msg_type=? ` @@ -207,7 +207,7 @@ from user_msg where receive_user_id=? and source_type=1 and msg_type=? `
207 func GetChanceCommentMsg(uid, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) { 207 func GetChanceCommentMsg(uid, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) {
208 sql := `select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id from ( 208 sql := `select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id from (
209 select a.*,b.images,b.speechs,b.videos from ( 209 select a.*,b.images,b.speechs,b.videos from (
210 -select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status from ( 210 +select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.status from (
211 select id,message content,source_type,source_id,is_read,create_at comment_time,chance_id,receive_user_id,sender_user_id from user_msg 211 select id,message content,source_type,source_id,is_read,create_at comment_time,chance_id,receive_user_id,sender_user_id from user_msg
212 where receive_user_id =? and (?=0 or id<?) and msg_type=? and sender_user_id<>0 212 where receive_user_id =? and (?=0 or id<?) and msg_type=? and sender_user_id<>0
213 )a left outer join chance b on a.source_id = b.id and source_type=1 213 )a left outer join chance b on a.source_id = b.id and source_type=1
@@ -285,75 +285,32 @@ type ChancePoolItemOrm struct { @@ -285,75 +285,32 @@ type ChancePoolItemOrm struct {
285 285
286 //机会池收藏列表项 286 //机会池收藏列表项
287 type ChanceCollectItemOrm struct { 287 type ChanceCollectItemOrm struct {
288 - ChanceId int64 `orm:"column(id)"`  
289 - ChanceUserId int64 `orm:"column(user_id)"`  
290 - CreateTime time.Time `orm:"column(create_at)"`  
291 - SourceContent string `orm:"column(source_content)"`  
292 - ChanceEnableStatus int `orm:"column(enable_status)"`  
293 - ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过  
294 - Images string `orm:"column(images)"`  
295 - Voices string `orm:"column(speechs)"`  
296 - Videos string `orm:"column(videos)"`  
297 - PublishStatus int `orm:"column(publish_status)"` //公开状态  
298 - Status int `orm:"column(status)"` 288 + CommChanceItemOrm
299 289
300 - //ApproveData string `json:"approveData"` //审核数据  
301 TemplateId int `orm:"column(audit_template_id)"` 290 TemplateId int `orm:"column(audit_template_id)"`
302 ChanceTypeId int `orm:"column(chance_type_id)"` 291 ChanceTypeId int `orm:"column(chance_type_id)"`
303 292
304 - CommentTotal int `orm:"column(comment_total)"`  
305 - ZanTotal int `orm:"column(zan_total)"`  
306 - ViewTotal int `orm:"column(view_total)"`  
307 -  
308 CollectId int64 `orm:"column(collect_id)"` //收藏id 293 CollectId int64 `orm:"column(collect_id)"` //收藏id
309 CollectTime time.Time `orm:"column(collect_time)"` //收藏时间 294 CollectTime time.Time `orm:"column(collect_time)"` //收藏时间
310 -  
311 - //chance_id  
312 - //ChanceId int64 `orm:"column(id)"` 295 + UpdateTime time.Time `orm:"column(update_at)"` //收藏时间
313 } 296 }
314 297
315 //机会池收藏列表项 298 //机会池收藏列表项
316 type ChanceThumbUpItemOrm struct { 299 type ChanceThumbUpItemOrm struct {
317 - ChanceId int64 `orm:"column(id)"`  
318 - ChanceUserId int64 `orm:"column(user_id)"`  
319 - CreateTime time.Time `orm:"column(create_at)"`  
320 - SourceContent string `orm:"column(source_content)"`  
321 - ChanceEnableStatus int `orm:"column(enable_status)"`  
322 - ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过  
323 - Images string `orm:"column(images)"`  
324 - Voices string `orm:"column(speechs)"`  
325 - Videos string `orm:"column(videos)"`  
326 - PublishStatus int `orm:"column(publish_status)"` //公开状态  
327 - Status int `orm:"column(status)"` //公开状态 300 + CommChanceItemOrm
328 301
329 //ApproveData string `json:"approveData"` //审核数据 302 //ApproveData string `json:"approveData"` //审核数据
330 TemplateId int `orm:"column(audit_template_id)"` 303 TemplateId int `orm:"column(audit_template_id)"`
331 ChanceTypeId int `orm:"column(chance_type_id)"` 304 ChanceTypeId int `orm:"column(chance_type_id)"`
332 305
333 - CommentTotal int `orm:"column(comment_total)"`  
334 - ZanTotal int `orm:"column(zan_total)"`  
335 - ViewTotal int `orm:"column(view_total)"`  
336 -  
337 - CollectId int64 `orm:"column(collect_id)"` //收藏id  
338 - CollectTime time.Time `orm:"column(collect_time)"` //收藏时间 306 + CollectId int64 `orm:"column(collect_id)"` //收藏id
  307 + ZanTime time.Time `orm:"column(zan_time)"` //收藏时间
  308 + UpdateTime time.Time `orm:"column(update_at)"` //收藏时间
339 } 309 }
340 310
341 //我的评论 311 //我的评论
342 type ChanceCommentItemOrm struct { 312 type ChanceCommentItemOrm struct {
343 - ChanceId int64 `orm:"column(chance_id)"`  
344 - Uid int64 `orm:"column(chance_user_id)"`  
345 - CreateTime time.Time `orm:"column(create_at)"`  
346 - SourceContent string `orm:"column(source_content)"`  
347 - ChanceEnableStatus int `orm:"column(enable_status)"`  
348 - ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过  
349 - Images string `orm:"column(images)"`  
350 - Voices string `orm:"column(speechs)"`  
351 - Videos string `orm:"column(videos)"`  
352 - PublishStatus int `orm:"column(publish_status)"` //公开状态  
353 -  
354 - CommentTotal int `orm:"column(comment_total)"`  
355 - ZanTotal int `orm:"column(zan_total)"`  
356 - ViewTotal int `orm:"column(view_total)"` 313 + CommChanceItemOrm
357 314
358 CommentId int64 `orm:"column(id)"` 315 CommentId int64 `orm:"column(id)"`
359 CommentContent string `orm:"column(content)"` 316 CommentContent string `orm:"column(content)"`
@@ -372,6 +329,24 @@ type ChanceCommentItemOrm struct { @@ -372,6 +329,24 @@ type ChanceCommentItemOrm struct {
372 SenderUserId int64 `orm:"column(sender_user_id)"` 329 SenderUserId int64 `orm:"column(sender_user_id)"`
373 } 330 }
374 331
  332 +//通用 机会orm对象
  333 +type CommChanceItemOrm struct {
  334 + ChanceId int64 `orm:"column(chance_id)"`
  335 + ChanceUserId int64 `orm:"column(chance_user_id)"`
  336 + CreateTime time.Time `orm:"column(create_at)"`
  337 + SourceContent string `orm:"column(source_content)"`
  338 + ChanceEnableStatus int `orm:"column(enable_status)"`
  339 + ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过
  340 + Images string `orm:"column(images)"`
  341 + Voices string `orm:"column(speechs)"`
  342 + Videos string `orm:"column(videos)"`
  343 + PublishStatus int `orm:"column(publish_status)"` //公开状态
  344 + Status int `orm:"column(status)"` //开启状态
  345 + CommentTotal int `orm:"column(comment_total)"`
  346 + ZanTotal int `orm:"column(zan_total)"`
  347 + ViewTotal int `orm:"column(view_total)"`
  348 +}
  349 +
375 /*ChanceDetail 机会详情*/ 350 /*ChanceDetail 机会详情*/
376 type ChanceDetailRequest struct { 351 type ChanceDetailRequest struct {
377 Id int64 `json:"id"` //机会编号 352 Id int64 `json:"id"` //机会编号
@@ -538,6 +513,7 @@ type CommonListItem struct { @@ -538,6 +513,7 @@ type CommonListItem struct {
538 SourceType int `json:"sourceType,omitempty"` //类型 1:机会 2:评论 513 SourceType int `json:"sourceType,omitempty"` //类型 1:机会 2:评论
539 514
540 ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭 515 ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭
  516 + Status int `json:"-"` //1:开启 2:关闭
541 ReviewStatus int `json:"reviewStatus"` //审核状态 517 ReviewStatus int `json:"reviewStatus"` //审核状态
542 518
543 ChanceId int64 `json:"chanceId"` //机会编号 519 ChanceId int64 `json:"chanceId"` //机会编号
@@ -572,17 +548,17 @@ type MsgCommonListItem struct { @@ -572,17 +548,17 @@ type MsgCommonListItem struct {
572 ChanceId int64 `json:"chanceId"` //机会编号 548 ChanceId int64 `json:"chanceId"` //机会编号
573 } 549 }
574 type ChanceItem struct { 550 type ChanceItem struct {
575 - Id int64 `json:"id"`  
576 - CreateTime int64 `json:"createTime"`  
577 - CreateTimeCopy int64 `json:"createTimeCopy"`  
578 - UpdateTime int64 `json:"updateTime"`  
579 - ApproveTime int64 `json:"approveTime"`  
580 - Provider *BaseUserInfo `json:"provider"`  
581 - FormList []*Form `json:"formList" valid:"Required"`  
582 - Speechs []Speech `json:"speechs"`  
583 - Pictures []Picture `json:"pictures"`  
584 - Videos []Video `json:"videos"`  
585 - PublicStatus int `json:"-"` //publicStatus 551 + Id int64 `json:"id"`
  552 + CreateTime int64 `json:"createTime"`
  553 + //CreateTimeCopy int64 `json:"createTimeCopy"`
  554 + UpdateTime int64 `json:"updateTime"`
  555 + ApproveTime int64 `json:"approveTime"`
  556 + Provider *BaseUserInfo `json:"provider"`
  557 + FormList []*Form `json:"formList" valid:"Required"`
  558 + Speechs []Speech `json:"speechs"`
  559 + Pictures []Picture `json:"pictures"`
  560 + Videos []Video `json:"videos"`
  561 + PublicStatus int `json:"-"` //publicStatus
586 } 562 }
587 type ChanceData struct { 563 type ChanceData struct {
588 ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数 564 ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数
@@ -266,6 +266,7 @@ type MsgChanceApproveItemOrm struct { @@ -266,6 +266,7 @@ type MsgChanceApproveItemOrm struct {
266 Voices string `orm:"column(speechs)"` 266 Voices string `orm:"column(speechs)"`
267 Videos string `orm:"column(videos)"` 267 Videos string `orm:"column(videos)"`
268 ReviewStatus int `orm:"column(review_status)"` 268 ReviewStatus int `orm:"column(review_status)"`
  269 + Status int `orm:"column(status)"`
269 ApproveData string `orm:"column(approve_data)"` //审核数据 270 ApproveData string `orm:"column(approve_data)"` //审核数据
270 271
271 Id int64 `orm:"column(id)"` //消息id 272 Id int64 `orm:"column(id)"` //消息id
@@ -98,6 +98,10 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er @@ -98,6 +98,10 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er
98 if items[i].ChanceStatus != 0 { 98 if items[i].ChanceStatus != 0 {
99 continue 99 continue
100 } 100 }
  101 + if items[i].Status == models.ChanceStatusClose {
  102 + items[i].ChanceStatus = protocol.ChanceStatusClose
  103 + log.Debug(fmt.Sprintf("chance_id:%v 关闭原因:%v %v", items[i].ChanceId, "后台关闭", items[i].Status))
  104 + }
101 if items[i].ChanceId == 0 { 105 if items[i].ChanceId == 0 {
102 items[i].ChanceStatus = protocol.ChanceStatusClose 106 items[i].ChanceStatus = protocol.ChanceStatusClose
103 log.Debug(fmt.Sprintf("chance_id:%v 关闭原因:%v", items[i].ChanceId, "机会编号0")) 107 log.Debug(fmt.Sprintf("chance_id:%v 关闭原因:%v", items[i].ChanceId, "机会编号0"))
@@ -148,6 +148,8 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc @@ -148,6 +148,8 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc
148 UpdateAt: time.Now(), 148 UpdateAt: time.Now(),
149 EnableStatus: 1, 149 EnableStatus: 1,
150 ChanceId: request.ChanceId, 150 ChanceId: request.ChanceId,
  151 + CollectTime: time.Now(),
  152 + ZanTime: time.Now(),
151 } 153 }
152 if _, err = models.AddChanceFavorite(chanceFavoirte); err != nil { 154 if _, err = models.AddChanceFavorite(chanceFavoirte); err != nil {
153 log.Error(err) 155 log.Error(err)
@@ -1519,9 +1521,9 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect @@ -1519,9 +1521,9 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect
1519 //return 1521 //return
1520 } else { 1522 } else {
1521 item := protocol.ChanceItem{ 1523 item := protocol.ChanceItem{
1522 - Id: chance.ChanceId,  
1523 - Provider: provider,  
1524 - //CreateTime: chance.CreateTime.Unix() * 1000, 1524 + Id: chance.ChanceId,
  1525 + Provider: provider,
  1526 + CreateTime: chance.CreateTime.Unix() * 1000,
1525 PublicStatus: chance.PublishStatus, 1527 PublicStatus: chance.PublishStatus,
1526 } 1528 }
1527 jsonUnmarshal(chance.SourceContent, &item.FormList) 1529 jsonUnmarshal(chance.SourceContent, &item.FormList)
@@ -1549,11 +1551,16 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect @@ -1549,11 +1551,16 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect
1549 commItem.ChanceType = getChanceType(chance.ChanceTypeId) 1551 commItem.ChanceType = getChanceType(chance.ChanceTypeId)
1550 } 1552 }
1551 { 1553 {
1552 - //收藏数据  
1553 - commItem.CollectData = protocol.CollectData{ 1554 + collect := protocol.CollectData{
1554 Id: chance.CollectId, 1555 Id: chance.CollectId,
1555 CollectTime: chance.CollectTime.Unix() * 1000, 1556 CollectTime: chance.CollectTime.Unix() * 1000,
1556 } 1557 }
  1558 + if collect.CollectTime <= 0 && chance.UpdateTime.Unix() > 0 {
  1559 + collect.CollectTime = chance.UpdateTime.Unix() * 1000
  1560 + }
  1561 + //收藏数据
  1562 + commItem.CollectData = collect
  1563 +
1557 //commItem.ChanceId = chance.ChanceId 1564 //commItem.ChanceId = chance.ChanceId
1558 } 1565 }
1559 rsp.List = append(rsp.List, commItem) 1566 rsp.List = append(rsp.List, commItem)
@@ -1625,11 +1632,15 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp @@ -1625,11 +1632,15 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp
1625 commItem.ChanceType = getChanceType(chance.ChanceTypeId) 1632 commItem.ChanceType = getChanceType(chance.ChanceTypeId)
1626 } 1633 }
1627 { 1634 {
1628 - //收藏数据  
1629 - commItem.ThumbUpData = protocol.ThumbUpData{ 1635 + thumb := protocol.ThumbUpData{
1630 Id: chance.CollectId, 1636 Id: chance.CollectId,
1631 - ThumbUpTime: chance.CollectTime.Unix() * 1000, 1637 + ThumbUpTime: chance.ZanTime.Unix() * 1000,
1632 } 1638 }
  1639 + if thumb.ThumbUpTime <= 0 && chance.UpdateTime.Unix() > 0 {
  1640 + thumb.ThumbUpTime = chance.UpdateTime.Unix() * 1000
  1641 + }
  1642 + //收藏数据
  1643 + commItem.ThumbUpData = thumb
1633 } 1644 }
1634 rsp.List = append(rsp.List, commItem) 1645 rsp.List = append(rsp.List, commItem)
1635 } 1646 }
@@ -1664,7 +1675,10 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques @@ -1664,7 +1675,10 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques
1664 } else if chance.ChanceEnableStatus == 0 { //机会关闭 1675 } else if chance.ChanceEnableStatus == 0 { //机会关闭
1665 commItem.ChanceStatus = protocol.ChanceStatusClose 1676 commItem.ChanceStatus = protocol.ChanceStatusClose
1666 } 1677 }
1667 - if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { 1678 + if chance.Status == models.ChanceStatusClose { //机会关闭
  1679 + commItem.ChanceStatus = protocol.ChanceStatusClose
  1680 + }
  1681 + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
1668 commItem.ChanceStatus = protocol.ChanceStatusDelete 1682 commItem.ChanceStatus = protocol.ChanceStatusDelete
1669 err = nil 1683 err = nil
1670 log.Error(err) 1684 log.Error(err)
@@ -265,7 +265,9 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc @@ -265,7 +265,9 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc
265 } else if chance.ChanceEnableStatus == 0 { //机会关闭 265 } else if chance.ChanceEnableStatus == 0 { //机会关闭
266 commItem.ChanceStatus = protocol.ChanceStatusClose 266 commItem.ChanceStatus = protocol.ChanceStatusClose
267 } 267 }
268 - 268 + if chance.Status == models.ChanceStatusClose {
  269 + commItem.ChanceStatus = protocol.ChanceStatusClose
  270 + }
269 if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { 271 if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
270 commItem.ChanceStatus = protocol.ChanceStatusDelete 272 commItem.ChanceStatus = protocol.ChanceStatusDelete
271 log.Error(err) 273 log.Error(err)
@@ -328,6 +330,9 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance @@ -328,6 +330,9 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance
328 } else if chance.ChanceEnableStatus == 0 { //机会关闭 330 } else if chance.ChanceEnableStatus == 0 { //机会关闭
329 commItem.ChanceStatus = protocol.ChanceStatusClose 331 commItem.ChanceStatus = protocol.ChanceStatusClose
330 } 332 }
  333 + if chance.Status == models.ChanceStatusClose {
  334 + commItem.ChanceStatus = protocol.ChanceStatusClose
  335 + }
331 approveUserId := chance.ChanceUserId 336 approveUserId := chance.ChanceUserId
332 if chance.SenderUserId != 0 { 337 if chance.SenderUserId != 0 {
333 approveUserId = chance.SenderUserId 338 approveUserId = chance.SenderUserId
@@ -399,8 +404,12 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc @@ -399,8 +404,12 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc
399 commItem.ChanceStatus = protocol.ChanceStatusDelete 404 commItem.ChanceStatus = protocol.ChanceStatusDelete
400 } else if chance.ChanceEnableStatus == 0 { //机会关闭 405 } else if chance.ChanceEnableStatus == 0 { //机会关闭
401 commItem.ChanceStatus = protocol.ChanceStatusClose 406 commItem.ChanceStatus = protocol.ChanceStatusClose
402 - } else {  
403 - if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { 407 + }
  408 + if chance.Status == models.ChanceStatusClose {
  409 + commItem.ChanceStatus = protocol.ChanceStatusClose
  410 + }
  411 + if chance.ChanceUserId > 0 {
  412 + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
404 commItem.ChanceStatus = protocol.ChanceStatusDelete 413 commItem.ChanceStatus = protocol.ChanceStatusDelete
405 log.Error(err) 414 log.Error(err)
406 //return 415 //return
@@ -478,8 +487,10 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc @@ -478,8 +487,10 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc
478 } else if chance.ChanceEnableStatus == 0 { //机会关闭 487 } else if chance.ChanceEnableStatus == 0 { //机会关闭
479 commItem.ChanceStatus = protocol.ChanceStatusClose 488 commItem.ChanceStatus = protocol.ChanceStatusClose
480 } 489 }
481 -  
482 - if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { 490 + if chance.Status == models.ChanceStatusClose {
  491 + commItem.ChanceStatus = protocol.ChanceStatusClose
  492 + }
  493 + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
483 commItem.ChanceStatus = protocol.ChanceStatusDelete 494 commItem.ChanceStatus = protocol.ChanceStatusDelete
484 log.Error(err) 495 log.Error(err)
485 //return 496 //return