作者 yangfu

我的审核修改

@@ -137,7 +137,7 @@ func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64, @@ -137,7 +137,7 @@ func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64,
137 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( 137 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
138 select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status from ( 138 select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status from (
139 select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time 139 select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time
140 -from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?) 140 +from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?)
141 )a left outer join chance b on a.chance_id = b.id 141 )a left outer join chance b on a.chance_id = b.id
142 )a left outer join chance_data b on a.chance_id =b.chance_id 142 )a left outer join chance_data b on a.chance_id =b.chance_id
143 order by process_create_time desc 143 order by process_create_time desc
@@ -156,6 +156,29 @@ from audit_flow_process where uid=? and review_status in (%v) `, utils.JoinInt8 @@ -156,6 +156,29 @@ from audit_flow_process where uid=? and review_status in (%v) `, utils.JoinInt8
156 return 156 return
157 } 157 }
158 158
  159 +func GetChanceMyApproveChanceEnable(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) {
  160 + sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
  161 +select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status from (
  162 +select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time
  163 +from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?) and enable_status =1
  164 +)a left outer join chance b on a.chance_id = b.id
  165 +)a left outer join chance_data b on a.chance_id =b.chance_id
  166 +order by process_create_time desc
  167 +LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //
  168 +
  169 + sqlCount := fmt.Sprintf(`select count(0)
  170 +from audit_flow_process where uid=? and review_status in (%v) and enable_status =1`, utils.JoinInt8s(reviewStatus, ",")) //and enable_status =1
  171 + if err = utils.ExecuteQueryOne(&total, sqlCount, uid); err != nil {
  172 + return
  173 + }
  174 + if v != nil {
  175 + if err = utils.ExecuteQueryAll(v, sql, uid, lastId, lastId, pageSize); err != nil {
  176 + return
  177 + }
  178 + }
  179 + return
  180 +}
  181 +
159 func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { 182 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 ( 183 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
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 ( 184 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 (
@@ -43,7 +43,7 @@ var errmessge ErrorMap = map[int]string{ @@ -43,7 +43,7 @@ var errmessge ErrorMap = map[int]string{
43 5203: "审批服务器操作失败", 43 5203: "审批服务器操作失败",
44 5204: "评分或者公开状态不能为空", 44 5204: "评分或者公开状态不能为空",
45 5205: "机会未审核通过,不能修改评分或者公开状态", 45 5205: "机会未审核通过,不能修改评分或者公开状态",
46 - 5206: "未找到审批节点或者无权限", 46 + 5206: "该机会已经被其他人审批",
47 5207: "公司管理员未设置", 47 5207: "公司管理员未设置",
48 48
49 //模板相关 49 //模板相关
@@ -33,3 +33,15 @@ func MyApproveStatic(header *protocol.RequestHeader, reviewStatus ...int8) (tota @@ -33,3 +33,15 @@ func MyApproveStatic(header *protocol.RequestHeader, reviewStatus ...int8) (tota
33 } 33 }
34 return 34 return
35 } 35 }
  36 +func MyApproveEnableStatic(header *protocol.RequestHeader, reviewStatus ...int8) (total int, err error) {
  37 + var ()
  38 + if total, err = models.GetChanceMyApproveChanceEnable(header.UserId, header.CompanyId, reviewStatus, 0, 0, nil); err != nil {
  39 + if err == orm.ErrNoRows {
  40 + err = nil
  41 + return
  42 + }
  43 + log.Error(err)
  44 + return
  45 + }
  46 + return
  47 +}
@@ -1411,13 +1411,24 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove @@ -1411,13 +1411,24 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove
1411 total int 1411 total int
1412 provider *protocol.BaseUserInfo 1412 provider *protocol.BaseUserInfo
1413 ) 1413 )
1414 - if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {  
1415 - if err == orm.ErrNoRows {  
1416 - err = nil 1414 + if request.ReviewStatus == protocol.ReviewStatusAuditging {
  1415 + if total, err = models.GetChanceMyApproveChanceEnable(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
  1416 + if err == orm.ErrNoRows {
  1417 + err = nil
  1418 + return
  1419 + }
  1420 + log.Error(err)
  1421 + return
  1422 + }
  1423 + } else {
  1424 + if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
  1425 + if err == orm.ErrNoRows {
  1426 + err = nil
  1427 + return
  1428 + }
  1429 + log.Error(err)
1417 return 1430 return
1418 } 1431 }
1419 - log.Error(err)  
1420 - return  
1421 } 1432 }
1422 rsp = &protocol.MyApproveChanceResponse{Total: total} 1433 rsp = &protocol.MyApproveChanceResponse{Total: total}
1423 for i := 0; i < len(myChances); i++ { 1434 for i := 0; i < len(myChances); i++ {
@@ -74,11 +74,11 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe @@ -74,11 +74,11 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe
74 if msg.IsRead == 1 { 74 if msg.IsRead == 1 {
75 return 75 return
76 } 76 }
77 - //if msg.SourceType==protocol.SourceTypeBulletin{//公告已读  
78 - // if !checkBulletinCanRead(msg.SourceId){  
79 - // return  
80 - // }  
81 - //} 77 + if msg.SourceType == protocol.SourceTypeBulletin { //公告已读
  78 + if !checkBulletinCanRead(msg.SourceId) {
  79 + return
  80 + }
  81 + }
82 err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, request.MsgId) 82 err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, request.MsgId)
83 if err != nil { 83 if err != nil {
84 log.Error(err) 84 log.Error(err)
@@ -409,12 +409,17 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis @@ -409,12 +409,17 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis
409 } 409 }
410 break 410 break
411 case protocol.MyAuditChance: 411 case protocol.MyAuditChance:
412 - if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil { 412 + var total1, total2 int
  413 + if total1, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
413 log.Error(err) 414 log.Error(err)
414 } 415 }
  416 + if total2, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
  417 + log.Error(err)
  418 + }
  419 + total = total1 + total2
415 break 420 break
416 case protocol.MyAuditChanceWait: 421 case protocol.MyAuditChanceWait:
417 - if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusAuditging); err != nil { 422 + if total, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
418 log.Error(err) 423 log.Error(err)
419 } 424 }
420 break 425 break