作者 yangfu

我把握的成果,机会成果,成果详情

package v1
import (
"encoding/json"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
"opp/controllers"
"opp/protocol"
"opp/services/chance"
)
//成果
type AchievementController struct {
controllers.BaseController
}
//AchievementPool 成果池
// @router /achievementPool [post]
func (this *AchievementController) AchievementPool() {
var msg *protocol.ResponseMessage
defer func() {
this.Resp(msg)
}()
var request *protocol.AchievementPoolRequest
if err := json.Unmarshal(this.ByteBody, &request); err != nil {
log.Error(err)
msg = protocol.BadRequestParam(1)
return
}
if b, m := this.Valid(request); !b {
msg = m
return
}
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(chance.AchievementPool(header, request))
}
//MyGrasp 我把握的
// @router /myGrasp [post]
func (this *AchievementController) MyGrasp() {
var msg *protocol.ResponseMessage
defer func() {
this.Resp(msg)
}()
var request *protocol.MyGraspRequest
if err := json.Unmarshal(this.ByteBody, &request); err != nil {
log.Error(err)
msg = protocol.BadRequestParam(1)
return
}
if b, m := this.Valid(request); !b {
msg = m
return
}
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(chance.MyGrasp(header, request))
}
//AchievementDetail 成果详情
// @router /achievementDetail [post]
func (this *AchievementController) AchievementDetail() {
var msg *protocol.ResponseMessage
defer func() {
this.Resp(msg)
}()
var request *protocol.AchievementDetailRequest
if err := json.Unmarshal(this.ByteBody, &request); err != nil {
log.Error(err)
msg = protocol.BadRequestParam(1)
return
}
if b, m := this.Valid(request); !b {
msg = m
return
}
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(chance.AchievementDetail(header, request))
}
... ...
package models
import (
"bytes"
"fmt"
"opp/internal/utils"
"time"
"github.com/astaxie/beego/orm"
)
type Achievement struct {
Id int64 `orm:"column(id);pk" description:"id 主键"`
CompanyId int64 `orm:"column(company_id);null" description:"公司编号 表company.id"`
UserCompanyId int64 `orm:"column(user_company_id)" description:"把握人 表user_company.id id"`
ChanceTypeId int `orm:"column(chance_type_id);null" description:"表chance_type.id 机会类型 "`
AuditTemplateId int `orm:"column(audit_template_id);null" description:"表audit_template.id 所属审批模板编号"`
SourceContent string `orm:"column(source_content);null" description:"成果详情文本"`
GraspScore float64 `orm:"column(grasp_score);digits(4);decimals(1)" description:"把握分"`
UserGraspScore float64 `orm:"column(user_grasp_score);digits(4);decimals(1)" description:"把握人得分"`
UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"`
CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
ViewTotal int `orm:"column(view_total);null" description:"查看总数"`
CommentTotal int `orm:"column(comment_total);null" description:"评论总数"`
ZanTotal int `orm:"column(zan_total);null" description:"点赞总数"`
Status int8 `orm:"column(status);null" description:"机会状态 1:开启 2:关闭 0:删除"`
}
func (t *Achievement) TableName() string {
return "new_achievement"
}
func init() {
orm.RegisterModel(new(Achievement))
}
// GetAchievementById retrieves Achievement by Id. Returns error if
// Id doesn't exist
func GetAchievementById(id int64) (v *Achievement, err error) {
o := orm.NewOrm()
v = &Achievement{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
}
// UpdateAchievement updates Achievement by Id and returns error if
// the record to be updated doesn't exist
func UpdateAchievementById(m *Achievement) (err error) {
o := orm.NewOrm()
v := Achievement{Id: m.Id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
if num, err = o.Update(m); err == nil {
fmt.Println("Number of records updated in database:", num)
}
}
return
}
//成果列表
//@uid 成果把握人
//@cid 公司编号
//@lastId 最后编号
//@chanceTypeId 机会一级分类编号
//@departmentId 部门编号
func GetAchievementAll(uid, cid int64, chanceTypeId int, lastId int64, departmentId int, pageSize int, v interface{}) (total int, err error) {
var whereString bytes.Buffer
if departmentId > 0 {
}
if uid > 0 {
whereString.WriteString(fmt.Sprintf(` and user_company_id=%v `, uid))
}
sql := fmt.Sprintf(`
select id,user_company_id,create_at,source_content,audit_template_id,chance_type_id,grasp_score,user_grasp_score,comment_total,zan_total,view_total,images from new_achievement
where company_id=%v and (%v=0 or id<%v) and (%v=0 or chance_type_id =%v) and status=1 %v
order by create_at desc
limit %v
`, cid, lastId, lastId, chanceTypeId, chanceTypeId, whereString.String(), pageSize)
sqlCount := fmt.Sprintf(`
select count(0) from new_achievement
where company_id=%v and (%v=0 or chance_type_id =%v) and status=1 %v
`, cid, chanceTypeId, chanceTypeId, whereString.String())
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
return
}
if v != nil {
if err = utils.ExecuteQueryAll(v, sql); err != nil {
return
}
}
return
}
//成果详情
func GetCommAchievementItemOrmId(id int64, v interface{}) (err error) {
o := orm.NewOrm()
sql := "select * from new_achievement where id=?"
if _, err = o.Raw(sql, id).QueryRows(v); err == nil {
return nil
}
return err
}
... ...
package models
import (
"time"
"github.com/astaxie/beego/orm"
)
type AchievementChance struct {
Id int64 `orm:"column(id);pk"`
AchievementId int64 `orm:"column(achievement_id);null" description:"成果编号 表achievement.id"`
ChanceId int64 `orm:"column(chance_id);null" description:"机会编号 表chance.id"`
ChanceCode string `orm:"column(chance_code);size(255);null" description:"机会编号 表chance.code"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
}
func (t *AchievementChance) TableName() string {
return "new_achievement_chance"
}
func init() {
orm.RegisterModel(new(AchievementChance))
}
// GetAchievementChanceById retrieves AchievementChance by Id. Returns error if
// Id doesn't exist
func GetAchievementChanceById(id int64) (v *AchievementChance, err error) {
o := orm.NewOrm()
v = &AchievementChance{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
}
... ...
package models
import (
"time"
"github.com/astaxie/beego/orm"
)
type AchievementProvider struct {
Id int64 `orm:"column(id);pk" description:"主键id"`
AchievementId int64 `orm:"column(achievement_id);null" description:"表achievement.id"`
UserCompanyId int64 `orm:"column(user_company_id);null" description:"user_company.id"`
UserGraspScore float64 `orm:"column(user_grasp_score);null;digits(4);decimals(1)" description:"把握人得分"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
}
func (t *AchievementProvider) TableName() string {
return "new_achievement_provider"
}
func init() {
orm.RegisterModel(new(AchievementProvider))
}
// GetAchievementProviderById retrieves AchievementProvider by Id. Returns error if
// Id doesn't exist
func GetAchievementProviderById(id int64) (v *AchievementProvider, err error) {
o := orm.NewOrm()
v = &AchievementProvider{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
}
//查询成果提供者列表
func GetAchievementProviders(achievementId int64) (v []*AchievementProvider, err error) {
o := orm.NewOrm()
sql := "select * from new_achievement_provider where achievement_id=?"
if _, err = o.Raw(sql, achievementId).QueryRows(&v); err == nil {
return v, nil
}
return nil, err
}
... ...
package protocol
import "time"
const (
Grasper = 1 //把握人
Provider = 2 //提供者
)
//成果项
type AchievementItem struct {
Id int64 `json:"id"`
CreateTime int64 `json:"createTime"`
Provider *BaseUserInfo `json:"provider"`
Content string `json:"content"`
Pictures []Picture `json:"pictures"`
GraspScore float64 `json:"graspScore"` //把握分
}
//机会列表 通用项
type AchievementCommonListItem struct {
Achievement AchievementItem `json:"achievement,omitempty"` //成果详情
StatisticData interface{} `json:"statisticData,omitempty"` //统计数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData
//我审核的-通过
Score interface{} `json:"score,omitempty"`
//模板
ChanceType interface{} `json:"chanceType,omitempty"` //机会类型
ChanceTemplate interface{} `json:"template,omitempty"` //机会模板
Message interface{} `json:"message,omitempty"` //消息
CommentData interface{} `json:"commentData,omitempty"` //评论
CollectData interface{} `json:"collectData,omitempty"` //收藏数据
ThumbUpData interface{} `json:"thumbUpData,omitempty"` //点赞数据
//我评论的 评论数据
CommentedData interface{} `json:"commentedData,omitempty"`
SourceType int `json:"sourceType,omitempty"` //类型 1:机会 2:评论
Status int `json:"-"` //0:删除 1:开启 2:关闭
}
/*AchievementPool 成果池*/
type AchievementPoolRequest struct {
UserId int64 `json:"userId"`
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
ChanceTypeId int `json:"chanceTypeId"` //0:所有机会 编号:对应机会类型编号的机会
DepartmentId int `json:"departmentId"`
}
type AchievementPoolResponse struct {
List []*AchievementCommonListItem `json:"list"`
Total int `json:"total"`
}
//通用 机会orm对象
type CommAchievementItemOrm struct {
AchievementItemOrm
StaticDataOrm
}
type AchievementItemOrm struct {
AchievementId int64 `orm:"column(id)"`
UserId int64 `orm:"column(user_company_id)"`
CreateTime time.Time `orm:"column(create_at)"`
SourceContent string `orm:"column(source_content)"`
Images string `orm:"column(images)"`
GraspScore float64 `orm:"column(grasp_score)"`
UserGraspScore float64 `orm:"column(user_grasp_score)"`
TemplateId int `orm:"column(audit_template_id)"`
ChanceTypeId int `orm:"column(chance_type_id)"`
Status int `orm:"column(status)"`
}
type StaticDataOrm struct {
CommentTotal int `orm:"column(comment_total)"`
ZanTotal int `orm:"column(zan_total)"`
ViewTotal int `orm:"column(view_total)"`
}
//机会池收藏列表项
//type AchievementsOrm struct {
// CommAchievementItemOrm
//}
/*MyGrasp 我把握的*/
type MyGraspRequest struct {
AchievementPoolRequest
}
type MyGraspResponse struct {
AchievementPoolResponse
}
/*AchievementDetail 成果详情*/
type AchievementDetailRequest struct {
Id int64 `json:"id" valid:"Required"`
}
type AchievementDetailResponse struct {
Achievement AchievementItem `json:"achievement,omitempty"` //成果详情
StatisticData interface{} `json:"statisticData,omitempty"` //统计数据(是否收藏/点赞 浏览数 点赞总数 评论数
//模板
ChanceType interface{} `json:"chanceType,omitempty"` //机会类型
ChanceTemplate interface{} `json:"template,omitempty"` //机会模板
Status int `json:"-"` //0:删除 1:开启 2:关闭
SourceChance []ChanceItem `json:"sourceChance"` //机会来源
Participants []UserGraspInfo //参与人
}
type UserGraspInfo struct {
Provider *BaseUserInfo `json:"provider"`
GraspScore float64 `json:"graspScore"` //把握分
Type int `json:"type"` //1:把握人 2:提供者
}
... ...
package protocol
const (
SourceTypeChance = 1
SourceTypeComment = 2
SourceTypeBulletin = 3
SourceTypeChance = 1 //机会
SourceTypeComment = 2 //机会评论
SourceTypeBulletin = 3
SourceTypeAchievement = 4 //成果
SourceTypeAchievementComment = 5 //成果评论
)
/*IComment */
... ...
... ... @@ -37,6 +37,7 @@ const (
MyAuditChanceWait //我审核的机会-待我审批
MyAuditChancePass //我审核的机会-已通过
MyAuditChanceReturn //我审核的机会-已退回
MyGraspAchievement //我把握的成果
)
var MapStaticName map[int64]string
... ...
... ... @@ -7,6 +7,30 @@ import (
func init() {
beego.GlobalControllerRouter["opp/controllers/v1:AchievementController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AchievementController"],
beego.ControllerComments{
Method: "AchievementDetail",
Router: `/achievementDetail`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["opp/controllers/v1:AchievementController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AchievementController"],
beego.ControllerComments{
Method: "AchievementPool",
Router: `/achievementPool`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["opp/controllers/v1:AchievementController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AchievementController"],
beego.ControllerComments{
Method: "MyGrasp",
Router: `/myGrasp`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
beego.ControllerComments{
Method: "AccessToken",
... ...
... ... @@ -24,6 +24,7 @@ func init() {
beego.NSNamespace("department", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.DepartmentController{})),
beego.NSNamespace("config", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.ConfigController{})),
beego.NSNamespace("file", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.FileController{})),
beego.NSNamespace("achievement", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.AchievementController{})),
)
beego.AddNamespace(nsV1)
... ...
... ... @@ -195,6 +195,21 @@ func GetChanceMarkData(userId, companyId int64, sourceId int64) (flag int, err e
return v.MarkFlag, nil
}
//获取机会标记数据 点赞 / 收藏
func GetMarkData(userId, companyId int64, sourceId int64, sourceType int) (flag int, err error) {
var (
v *models.ChanceFavorite
)
if v, err = models.GetChanceFavorite(userId, companyId, sourceId, sourceType); err != nil {
if err == orm.ErrNoRows {
//log.Error(userId, companyId, sourceId, err)
return 0, nil
}
return
}
return v.MarkFlag, nil
}
//构建统计sql语句
func GetIncrementSql(table string, column string, incre int, id int64) *utils.SqlData {
var sql *bytes.Buffer
... ...
... ... @@ -45,3 +45,17 @@ func MyApproveEnableStatic(header *protocol.RequestHeader, reviewStatus ...int8)
}
return
}
//我把握的统计
func MyGraspStatic(header *protocol.RequestHeader) (total int, err error) {
var ()
if total, err = models.GetAchievementAll(header.UserId, header.CompanyId, 0, 0, 0, 0, nil); err != nil {
if err == orm.ErrNoRows {
err = nil
return
}
log.Error(err)
return
}
return
}
... ...
package chance
import (
"github.com/astaxie/beego/orm"
"opp/internal/utils"
"opp/models"
"opp/protocol"
"opp/services/agg"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
)
//成果池
func AchievementPool(header *protocol.RequestHeader, request *protocol.AchievementPoolRequest) (rsp *protocol.AchievementPoolResponse, err error) {
var (
ormItems []protocol.CommAchievementItemOrm
total int
)
rsp = &protocol.AchievementPoolResponse{}
rsp.List = make([]*protocol.AchievementCommonListItem, 0)
if total, err = models.GetAchievementAll(request.UserId, header.CompanyId, request.ChanceTypeId, request.LastId, request.DepartmentId, request.PageSize, &ormItems); err != nil {
if err == orm.ErrNoRows {
err = nil
return
}
log.Error(err)
return
}
rsp.Total = total
for i := range ormItems {
item := ormItems[i]
rspItem := &protocol.AchievementCommonListItem{
Achievement: GetAchievementItem(header, item),
StatisticData: GetStatisticData(header, item.StaticDataOrm, item.AchievementId),
ChanceTemplate: getTemplate(item.TemplateId),
ChanceType: getChanceType(item.ChanceTypeId),
}
rsp.List = append(rsp.List, rspItem)
}
return
}
//获取成果项
func GetAchievementItem(header *protocol.RequestHeader, from protocol.CommAchievementItemOrm) (item protocol.AchievementItem) {
var (
provider *protocol.BaseUserInfo
err error
)
if from.UserId > 0 {
if provider, err = agg.GetUserBaseInfo(from.UserId, header.CompanyId); err != nil {
log.Error(err)
return
} else {
item = protocol.AchievementItem{
Id: from.AchievementId,
Provider: provider,
CreateTime: from.CreateTime.Unix() * 1000,
Content: from.SourceContent,
GraspScore: from.GraspScore,
}
jsonUnmarshal(from.Images, &item.Pictures)
}
}
return
}
//获取统计数据
func GetStatisticData(header *protocol.RequestHeader, from protocol.StaticDataOrm, sourceId int64) (chanceData protocol.ChanceData) {
chanceData = protocol.ChanceData{
ThumbsUpTotal: from.ZanTotal,
CommentTotal: from.CommentTotal,
PageViewTotal: from.ViewTotal,
}
chanceData.IsThumbsUp, chanceData.IsCollect, _ = getMarkFlag(header, sourceId, protocol.SourceTypeAchievement)
return
}
//我把握的
func MyGrasp(header *protocol.RequestHeader, request *protocol.MyGraspRequest) (rsp *protocol.MyGraspResponse, err error) {
var (
achievementPool *protocol.AchievementPoolResponse
)
request.UserId = header.UserId
if achievementPool, err = AchievementPool(header, &request.AchievementPoolRequest); err != nil {
log.Error(err)
return
}
rsp = &protocol.MyGraspResponse{}
rsp.AchievementPoolResponse = *achievementPool
return
}
//成果详情
func AchievementDetail(header *protocol.RequestHeader, request *protocol.AchievementDetailRequest) (rsp *protocol.AchievementDetailResponse, err error) {
var (
items []protocol.CommAchievementItemOrm
participants []*models.AchievementProvider
)
if err = models.GetCommAchievementItemOrmId(request.Id, &items); err != nil {
log.Error(err)
return
}
if len(items) == 0 {
err = protocol.NewErrWithMessage(1)
log.Error("items not empty", request.Id)
return
}
item := items[0]
if item.Status != 1 {
//错误 成果删除或关闭
}
rsp = &protocol.AchievementDetailResponse{}
{
rsp.Achievement = GetAchievementItem(header, item)
rsp.StatisticData = GetStatisticData(header, item.StaticDataOrm, item.AchievementId)
rsp.ChanceTemplate = getTemplate(item.TemplateId)
rsp.ChanceType = getChanceType(item.ChanceTypeId)
}
if participants, err = models.GetAchievementProviders(request.Id); err != nil && err != orm.ErrNoRows {
log.Error(err)
return
}
newParticipant := func(user *protocol.BaseUserInfo, score float64, t int) protocol.UserGraspInfo {
return protocol.UserGraspInfo{
Provider: user,
GraspScore: score,
Type: t,
}
}
addParticipants := func(item protocol.UserGraspInfo) {
rsp.Participants = append(rsp.Participants, item)
}
addParticipants(newParticipant(rsp.Achievement.Provider, item.UserGraspScore, protocol.Grasper))
for i := range participants {
p := participants[i]
if provider, e := agg.GetUserBaseInfo(p.UserCompanyId, header.CompanyId); e != nil {
log.Error(e)
return
} else {
addParticipants(newParticipant(provider, p.UserGraspScore, protocol.Provider))
}
}
//查看数量
utils.ExecuteSqlByRoll(true, agg.GetIncrementSql((&models.Achievement{}).TableName(), "view_total", 1, request.Id))
return
}
... ...
... ... @@ -1792,6 +1792,18 @@ func getChanceMarkFlag(header *protocol.RequestHeader, chanceId int64) (isThumbs
return
}
//获取机会点赞/收藏状态
func getMarkFlag(header *protocol.RequestHeader, sourceId int64, sourceType int) (isThumbsUp, isCollect bool, err error) {
var flag int
if flag, err = agg.GetMarkData(header.UserId, header.CompanyId, sourceId, sourceType); err != nil {
log.Error(err)
return
}
isThumbsUp = (flag & protocol.MarkFlagZan) == protocol.MarkFlagZan
isCollect = (flag & protocol.MarkFlagCollect) == protocol.MarkFlagCollect
return
}
//获取模板
func getTemplate(templateId int) protocol.NameItem {
if template, e := models.GetAuditTemplateById(int64(templateId)); e == nil {
... ...
... ... @@ -370,70 +370,78 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis
rsp = &protocol.UserStatisticsResponse{}
//buf :=bytes.NewBuffer(nil)
//buf.WriteString(fmt.Sprintf("用户中心-统计信息 user:%v type_total:%v \n",header.UserId,request.TypeTotal))
for flag = 1; flag <= (protocol.MyAuditChanceReturn); flag = flag << 1 {
for flag = 1; flag <= (protocol.MyGraspAchievement); flag = flag << 1 {
total = 0
switch flag {
case protocol.CollectStatic: //收藏
if total, err = models.GetChanceCollect(header.UserId, 0, 0, nil); err != nil {
log.Error(err)
}
break
case protocol.ZanStatic: //点赞
if total, err = models.GetChanceThumbUp(header.UserId, 0, 0, nil); err != nil {
log.Error(err)
}
break
case protocol.CommentStatic: //评论
if total, err = models.GetChanceComment(header.UserId, 0, 0, nil); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChance:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChanceWait:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChancePass:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusPass); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChanceReturn:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusReturn); err != nil {
log.Error(err)
}
break
case protocol.MyAuditChance:
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.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
log.Error(err)
}
break
case protocol.MyAuditChancePass:
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusPass); err != nil {
log.Error(err)
}
break
case protocol.MyAuditChanceReturn:
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn); err != nil {
log.Error(err)
if flag&request.TypeTotal > 0 {
switch flag {
case protocol.CollectStatic: //收藏
if total, err = models.GetChanceCollect(header.UserId, 0, 0, nil); err != nil {
log.Error(err)
}
break
case protocol.ZanStatic: //点赞
if total, err = models.GetChanceThumbUp(header.UserId, 0, 0, nil); err != nil {
log.Error(err)
}
break
case protocol.CommentStatic: //评论
if total, err = models.GetChanceComment(header.UserId, 0, 0, nil); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChance:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChanceWait:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChancePass:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusPass); err != nil {
log.Error(err)
}
break
case protocol.MyCommitChanceReturn:
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusReturn); err != nil {
log.Error(err)
}
break
case protocol.MyAuditChance:
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.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
log.Error(err)
}
break
case protocol.MyAuditChancePass:
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusPass); err != nil {
log.Error(err)
}
break
case protocol.MyAuditChanceReturn:
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn); err != nil {
log.Error(err)
}
break
case protocol.MyGraspAchievement:
if total, err = agg.MyGraspStatic(header); err != nil {
log.Error(err)
}
break
default:
break
}
break
}
if flag&request.TypeTotal > 0 {
rsp.Totals = append(rsp.Totals, protocol.TypeTotalItem{
... ...