作者 yangfu

我的审核修改

... ... @@ -137,7 +137,7 @@ func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64,
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
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 (
select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time
from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?)
from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?)
)a left outer join chance b on a.chance_id = b.id
)a left outer join chance_data b on a.chance_id =b.chance_id
order by process_create_time desc
... ... @@ -156,6 +156,29 @@ from audit_flow_process where uid=? and review_status in (%v) `, utils.JoinInt8
return
}
func GetChanceMyApproveChanceEnable(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) {
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
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 (
select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time
from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?) and enable_status =1
)a left outer join chance b on a.chance_id = b.id
)a left outer join chance_data b on a.chance_id =b.chance_id
order by process_create_time desc
LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //
sqlCount := fmt.Sprintf(`select count(0)
from audit_flow_process where uid=? and review_status in (%v) and enable_status =1`, utils.JoinInt8s(reviewStatus, ",")) //and enable_status =1
if err = utils.ExecuteQueryOne(&total, sqlCount, uid); err != nil {
return
}
if v != nil {
if err = utils.ExecuteQueryAll(v, sql, uid, lastId, lastId, pageSize); err != nil {
return
}
}
return
}
func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
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{
5203: "审批服务器操作失败",
5204: "评分或者公开状态不能为空",
5205: "机会未审核通过,不能修改评分或者公开状态",
5206: "未找到审批节点或者无权限",
5206: "该机会已经被其他人审批",
5207: "公司管理员未设置",
//模板相关
... ...
... ... @@ -33,3 +33,15 @@ func MyApproveStatic(header *protocol.RequestHeader, reviewStatus ...int8) (tota
}
return
}
func MyApproveEnableStatic(header *protocol.RequestHeader, reviewStatus ...int8) (total int, err error) {
var ()
if total, err = models.GetChanceMyApproveChanceEnable(header.UserId, header.CompanyId, reviewStatus, 0, 0, nil); err != nil {
if err == orm.ErrNoRows {
err = nil
return
}
log.Error(err)
return
}
return
}
... ...
... ... @@ -1411,13 +1411,24 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove
total int
provider *protocol.BaseUserInfo
)
if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
if err == orm.ErrNoRows {
err = nil
if request.ReviewStatus == protocol.ReviewStatusAuditging {
if total, err = models.GetChanceMyApproveChanceEnable(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
if err == orm.ErrNoRows {
err = nil
return
}
log.Error(err)
return
}
} else {
if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
if err == orm.ErrNoRows {
err = nil
return
}
log.Error(err)
return
}
log.Error(err)
return
}
rsp = &protocol.MyApproveChanceResponse{Total: total}
for i := 0; i < len(myChances); i++ {
... ...
... ... @@ -74,11 +74,11 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe
if msg.IsRead == 1 {
return
}
//if msg.SourceType==protocol.SourceTypeBulletin{//公告已读
// if !checkBulletinCanRead(msg.SourceId){
// return
// }
//}
if msg.SourceType == protocol.SourceTypeBulletin { //公告已读
if !checkBulletinCanRead(msg.SourceId) {
return
}
}
err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, request.MsgId)
if err != nil {
log.Error(err)
... ...
... ... @@ -409,12 +409,17 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis
}
break
case protocol.MyAuditChance:
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
var total1, total2 int
if total1, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
log.Error(err)
}
if total2, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
log.Error(err)
}
total = total1 + total2
break
case protocol.MyAuditChanceWait:
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusAuditging); err != nil {
if total, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
log.Error(err)
}
break
... ...