作者 唐旭辉

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/opp into dev

1 ### 接口完成进度 1 ### 接口完成进度
2 |功能|完成状态|时间|接口路径|人员 2 |功能|完成状态|时间|接口路径|人员
3 |---|---|----|----|---| 3 |---|---|----|----|---|
  4 +|登录|完成|2019.10.20|/v1/auth/login|
  5 +|短信验证码|完成|2019.10.20|/v1/auth/smsCode|
  6 +|获取token|完成|2019.10.20|/v1/auth/accessToken|
  7 +|刷新token|完成|2019.10.20|/v1/auth/refreshToken|
4 |修改手机号-校验验证码|完成|2019.11.20|/v1/user/checkSmsCode| 8 |修改手机号-校验验证码|完成|2019.11.20|/v1/user/checkSmsCode|
5 |修改手机号|完成|2019.11.20|/v1/user/changePhone| 9 |修改手机号|完成|2019.11.20|/v1/user/changePhone|
6 |修改密码|完成|2019.11.20|v1/user/changePassword| 10 |修改密码|完成|2019.11.20|v1/user/changePassword|
7 |忘记密码|完成|2019.11.20|v1/user/resetPassword| 11 |忘记密码|完成|2019.11.20|v1/user/resetPassword|
8 -|机会评论列表| |2019.11.|/v1/chance/comments|  
9 -|我来评论| |2019.11.|/v1/chance/iComment|  
10 -|我的评论| |2019.11.|/v1/chance/iComments| 12 +|机会评论列表|完成|2019.11.21|/v1/chance/comments|
  13 +|我来评论|完成|2019.11.21|/v1/chance/iComment|
  14 +|我的评论|完成|2019.11.21|/v1/chance/iComments|
11 |我的点赞| |2019.11.| | 15 |我的点赞| |2019.11.| |
12 |我的收藏| |2019.11.| | 16 |我的收藏| |2019.11.| |
13 |我提交的机会| |2019.11.| | 17 |我提交的机会| |2019.11.| |
@@ -152,6 +152,9 @@ func CheckToken(ctx *context.Context) (result bool) { @@ -152,6 +152,9 @@ func CheckToken(ctx *context.Context) (result bool) {
152 var ( 152 var (
153 msg *protocol.ResponseMessage 153 msg *protocol.ResponseMessage
154 ) 154 )
  155 + if strings.HasSuffix(ctx.Request.RequestURI,"login"){
  156 + return true
  157 + }
155 result = true 158 result = true
156 defer func() { 159 defer func() {
157 if msg != nil { 160 if msg != nil {
  1 +package v1
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
  6 + "opp/controllers"
  7 + "opp/protocol"
  8 + "opp/services/chance"
  9 +)
  10 +
  11 +type ChanceController struct {
  12 + controllers.BaseController
  13 +}
  14 +
  15 +//IComment
  16 +// @router /iComment [post]
  17 +func (this *ChanceController) IComment() {
  18 + var msg *protocol.ResponseMessage
  19 + defer func() {
  20 + this.Resp(msg)
  21 + }()
  22 + var request *protocol.ICommentRequest
  23 + if err := json.Unmarshal(this.ByteBody, &request); err != nil {
  24 + log.Error(err)
  25 + msg = protocol.BadRequestParam(1)
  26 + return
  27 + }
  28 + if b, m := this.Valid(request); !b {
  29 + msg = m
  30 + return
  31 + }
  32 + header := controllers.GetRequestHeader(this.Ctx)
  33 + msg = protocol.NewReturnResponse(chance.IComment(header, request))
  34 +}
  35 +
  36 +//IComments
  37 +// @router /iComments [post]
  38 +func (this *ChanceController) IComments() {
  39 + var msg *protocol.ResponseMessage
  40 + defer func() {
  41 + this.Resp(msg)
  42 + }()
  43 + var request *protocol.ICommentsRequest
  44 + if err := json.Unmarshal(this.ByteBody, &request); err != nil {
  45 + log.Error(err)
  46 + msg = protocol.BadRequestParam(1)
  47 + return
  48 + }
  49 + if b, m := this.Valid(request); !b {
  50 + msg = m
  51 + return
  52 + }
  53 + header := controllers.GetRequestHeader(this.Ctx)
  54 + msg = protocol.NewReturnResponse(chance.IComments(header, request))
  55 +}
  56 +
  57 +//Comments
  58 +// @router /comments [post]
  59 +func (this *ChanceController) Comments() {
  60 + var msg *protocol.ResponseMessage
  61 + defer func() {
  62 + this.Resp(msg)
  63 + }()
  64 + var request *protocol.CommentsRequest
  65 + if err := json.Unmarshal(this.ByteBody, &request); err != nil {
  66 + log.Error(err)
  67 + msg = protocol.BadRequestParam(1)
  68 + return
  69 + }
  70 + if b, m := this.Valid(request); !b {
  71 + msg = m
  72 + return
  73 + }
  74 + header := controllers.GetRequestHeader(this.Ctx)
  75 + msg = protocol.NewReturnResponse(chance.Comments(header, request))
  76 +}
  1 +package repository
  2 +
  3 +import "opp/models"
  4 +
  5 +type IChanceRepository interface {
  6 + GetChanceById(id int64) (v *models.Chance, err error)
  7 +}
  8 +
  9 +var _ IChanceRepository = (*ChanceRepository)(nil)
  10 +
  11 +type ChanceRepository struct{}
  12 +
  13 +func (r *ChanceRepository) GetChanceById(id int64) (v *models.Chance, err error) {
  14 + return models.GetChanceById(id)
  15 +}
  1 +package repository
  2 +
  3 +import "opp/models"
  4 +
  5 +type ICommentRepository interface {
  6 + GetCommentById(id int64) (v *models.Comment, err error)
  7 + AddComment(m *models.Comment) (id int64, err error)
  8 + GetComments(userId int64, sourceType int, sourceId int64, lastId int, pageSize int) (v []*models.Comment, total int, err error)
  9 +}
  10 +
  11 +var _ ICommentRepository = (*CommentRepository)(nil)
  12 +
  13 +type CommentRepository struct{}
  14 +
  15 +func (r *CommentRepository) GetCommentById(id int64) (v *models.Comment, err error) {
  16 + return models.GetCommentById(id)
  17 +}
  18 +
  19 +func (r *CommentRepository) AddComment(m *models.Comment) (id int64, err error) {
  20 + return models.AddComment(m)
  21 +}
  22 +
  23 +func (r *CommentRepository) GetComments(userId int64, sourceType int, sourceId int64, lastId int, pageSize int) (v []*models.Comment, total int, err error) {
  24 + return models.GetComments(userId, sourceType, sourceId, lastId, pageSize)
  25 +}
@@ -11,6 +11,8 @@ var ( @@ -11,6 +11,8 @@ var (
11 Company ICompanyRepository 11 Company ICompanyRepository
12 Department IDepartmentRepository 12 Department IDepartmentRepository
13 Position IPositionRepository 13 Position IPositionRepository
  14 + Chance IChanceRepository
  15 + Comment ICommentRepository
14 ) 16 )
15 17
16 func init() { 18 func init() {
@@ -24,6 +26,8 @@ func InitRepository() { @@ -24,6 +26,8 @@ func InitRepository() {
24 Company = &CompanyRepository{} 26 Company = &CompanyRepository{}
25 Department = &DepartmentRepository{} 27 Department = &DepartmentRepository{}
26 Position = &PositionRepository{} 28 Position = &PositionRepository{}
  29 + Chance = &ChanceRepository{}
  30 + Comment = &CommentRepository{}
27 } 31 }
28 32
29 func InitRepositoryMock() { 33 func InitRepositoryMock() {
  1 +package models
  2 +
  3 +import (
  4 + "errors"
  5 + "fmt"
  6 + "reflect"
  7 + "strings"
  8 + "time"
  9 +
  10 + "github.com/astaxie/beego/orm"
  11 +)
  12 +
  13 +type Chance struct {
  14 + Id int64 `orm:"column(id);pk" description:"id 主键"`
  15 + UserId int64 `orm:"column(user_id)" description:"表user.id 用户id"`
  16 + DepartmentId int64 `orm:"column(department_id)" description:"表department.id 部门id"`
  17 + ChanceTypeId int `orm:"column(chance_type_id)" description:"表cfg_chance_type.id 机会类型 1:产品 2:渠道 3.客户 4.区域 5.其他 "`
  18 + Content string `orm:"column(content)" description:"内容"`
  19 + CommentTotal int `orm:"column(comment_total)" description:"评论总数"`
  20 + ZanTotal int `orm:"column(zan_total)" description:"点赞总数"`
  21 + ReviewStatus int8 `orm:"column(review_status)" description:"审核状态 0:待审核 1:被退回 2:已通过 3:草稿箱"`
  22 + EnableStatus int8 `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 "`
  23 + UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"`
  24 + CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
  25 +}
  26 +
  27 +func (t *Chance) TableName() string {
  28 + return "chance"
  29 +}
  30 +
  31 +func init() {
  32 + orm.RegisterModel(new(Chance))
  33 +}
  34 +
  35 +// AddChance insert a new Chance into database and returns
  36 +// last inserted Id on success.
  37 +func AddChance(m *Chance) (id int64, err error) {
  38 + o := orm.NewOrm()
  39 + id, err = o.Insert(m)
  40 + return
  41 +}
  42 +
  43 +// GetChanceById retrieves Chance by Id. Returns error if
  44 +// Id doesn't exist
  45 +func GetChanceById(id int64) (v *Chance, err error) {
  46 + o := orm.NewOrm()
  47 + v = &Chance{Id: id}
  48 + if err = o.Read(v); err == nil {
  49 + return v, nil
  50 + }
  51 + return nil, err
  52 +}
  53 +
  54 +// GetAllChance retrieves all Chance matches certain condition. Returns empty list if
  55 +// no records exist
  56 +func GetAllChance(query map[string]string, fields []string, sortby []string, order []string,
  57 + offset int64, limit int64) (ml []interface{}, err error) {
  58 + o := orm.NewOrm()
  59 + qs := o.QueryTable(new(Chance))
  60 + // query k=v
  61 + for k, v := range query {
  62 + // rewrite dot-notation to Object__Attribute
  63 + k = strings.Replace(k, ".", "__", -1)
  64 + if strings.Contains(k, "isnull") {
  65 + qs = qs.Filter(k, (v == "true" || v == "1"))
  66 + } else {
  67 + qs = qs.Filter(k, v)
  68 + }
  69 + }
  70 + // order by:
  71 + var sortFields []string
  72 + if len(sortby) != 0 {
  73 + if len(sortby) == len(order) {
  74 + // 1) for each sort field, there is an associated order
  75 + for i, v := range sortby {
  76 + orderby := ""
  77 + if order[i] == "desc" {
  78 + orderby = "-" + v
  79 + } else if order[i] == "asc" {
  80 + orderby = v
  81 + } else {
  82 + return nil, errors.New("Error: Invalid order. Must be either [asc|desc]")
  83 + }
  84 + sortFields = append(sortFields, orderby)
  85 + }
  86 + qs = qs.OrderBy(sortFields...)
  87 + } else if len(sortby) != len(order) && len(order) == 1 {
  88 + // 2) there is exactly one order, all the sorted fields will be sorted by this order
  89 + for _, v := range sortby {
  90 + orderby := ""
  91 + if order[0] == "desc" {
  92 + orderby = "-" + v
  93 + } else if order[0] == "asc" {
  94 + orderby = v
  95 + } else {
  96 + return nil, errors.New("Error: Invalid order. Must be either [asc|desc]")
  97 + }
  98 + sortFields = append(sortFields, orderby)
  99 + }
  100 + } else if len(sortby) != len(order) && len(order) != 1 {
  101 + return nil, errors.New("Error: 'sortby', 'order' sizes mismatch or 'order' size is not 1")
  102 + }
  103 + } else {
  104 + if len(order) != 0 {
  105 + return nil, errors.New("Error: unused 'order' fields")
  106 + }
  107 + }
  108 +
  109 + var l []Chance
  110 + qs = qs.OrderBy(sortFields...)
  111 + if _, err = qs.Limit(limit, offset).All(&l, fields...); err == nil {
  112 + if len(fields) == 0 {
  113 + for _, v := range l {
  114 + ml = append(ml, v)
  115 + }
  116 + } else {
  117 + // trim unused fields
  118 + for _, v := range l {
  119 + m := make(map[string]interface{})
  120 + val := reflect.ValueOf(v)
  121 + for _, fname := range fields {
  122 + m[fname] = val.FieldByName(fname).Interface()
  123 + }
  124 + ml = append(ml, m)
  125 + }
  126 + }
  127 + return ml, nil
  128 + }
  129 + return nil, err
  130 +}
  131 +
  132 +// UpdateChance updates Chance by Id and returns error if
  133 +// the record to be updated doesn't exist
  134 +func UpdateChanceById(m *Chance) (err error) {
  135 + o := orm.NewOrm()
  136 + v := Chance{Id: m.Id}
  137 + // ascertain id exists in the database
  138 + if err = o.Read(&v); err == nil {
  139 + var num int64
  140 + if num, err = o.Update(m); err == nil {
  141 + fmt.Println("Number of records updated in database:", num)
  142 + }
  143 + }
  144 + return
  145 +}
  146 +
  147 +// DeleteChance deletes Chance by Id and returns error if
  148 +// the record to be deleted doesn't exist
  149 +func DeleteChance(id int64) (err error) {
  150 + o := orm.NewOrm()
  151 + v := Chance{Id: id}
  152 + // ascertain id exists in the database
  153 + if err = o.Read(&v); err == nil {
  154 + var num int64
  155 + if num, err = o.Delete(&Chance{Id: id}); err == nil {
  156 + fmt.Println("Number of records deleted in database:", num)
  157 + }
  158 + }
  159 + return
  160 +}
  1 +package models
  2 +
  3 +import (
  4 + "errors"
  5 + "fmt"
  6 + "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/mybeego"
  7 + "reflect"
  8 + "strings"
  9 + "time"
  10 +
  11 + "github.com/astaxie/beego/orm"
  12 +)
  13 +
  14 +type Comment struct {
  15 + Id int64 `orm:"column(id);pk" description:"评论编号"`
  16 + UserId int64 `orm:"column(user_id)" description:"表user.id "`
  17 + Content string `orm:"column(content);size(1024)" description:"评论内容"`
  18 + ViewTotal int `orm:"column(view_total)" description:"浏览总数"`
  19 + ZanTotal int `orm:"column(zan_total)" description:"点赞总数"`
  20 + CommentTotal int `orm:"column(comment_total)" description:"评论总数"`
  21 + SourceType int8 `orm:"column(source_type)" description:"来源类型 1:机会 2:评论"`
  22 + SourceId int64 `orm:"column(source_id)" description:"来源唯一编号"`
  23 + CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
  24 +}
  25 +
  26 +func (t *Comment) TableName() string {
  27 + return "comment"
  28 +}
  29 +
  30 +func init() {
  31 + orm.RegisterModel(new(Comment))
  32 +}
  33 +
  34 +// AddComment insert a new Comment into database and returns
  35 +// last inserted Id on success.
  36 +func AddComment(m *Comment) (id int64, err error) {
  37 + o := orm.NewOrm()
  38 + id, err = o.Insert(m)
  39 + return
  40 +}
  41 +
  42 +// GetCommentById retrieves Comment by Id. Returns error if
  43 +// Id doesn't exist
  44 +func GetCommentById(id int64) (v *Comment, err error) {
  45 + o := orm.NewOrm()
  46 + v = &Comment{Id: id}
  47 + if err = o.Read(v); err == nil {
  48 + return v, nil
  49 + }
  50 + return nil, err
  51 +}
  52 +
  53 +// GetAllComment retrieves all Comment matches certain condition. Returns empty list if
  54 +// no records exist
  55 +func GetAllComment(query map[string]string, fields []string, sortby []string, order []string,
  56 + offset int64, limit int64) (ml []interface{}, err error) {
  57 + o := orm.NewOrm()
  58 + qs := o.QueryTable(new(Comment))
  59 + // query k=v
  60 + for k, v := range query {
  61 + // rewrite dot-notation to Object__Attribute
  62 + k = strings.Replace(k, ".", "__", -1)
  63 + if strings.Contains(k, "isnull") {
  64 + qs = qs.Filter(k, (v == "true" || v == "1"))
  65 + } else {
  66 + qs = qs.Filter(k, v)
  67 + }
  68 + }
  69 + // order by:
  70 + var sortFields []string
  71 + if len(sortby) != 0 {
  72 + if len(sortby) == len(order) {
  73 + // 1) for each sort field, there is an associated order
  74 + for i, v := range sortby {
  75 + orderby := ""
  76 + if order[i] == "desc" {
  77 + orderby = "-" + v
  78 + } else if order[i] == "asc" {
  79 + orderby = v
  80 + } else {
  81 + return nil, errors.New("Error: Invalid order. Must be either [asc|desc]")
  82 + }
  83 + sortFields = append(sortFields, orderby)
  84 + }
  85 + qs = qs.OrderBy(sortFields...)
  86 + } else if len(sortby) != len(order) && len(order) == 1 {
  87 + // 2) there is exactly one order, all the sorted fields will be sorted by this order
  88 + for _, v := range sortby {
  89 + orderby := ""
  90 + if order[0] == "desc" {
  91 + orderby = "-" + v
  92 + } else if order[0] == "asc" {
  93 + orderby = v
  94 + } else {
  95 + return nil, errors.New("Error: Invalid order. Must be either [asc|desc]")
  96 + }
  97 + sortFields = append(sortFields, orderby)
  98 + }
  99 + } else if len(sortby) != len(order) && len(order) != 1 {
  100 + return nil, errors.New("Error: 'sortby', 'order' sizes mismatch or 'order' size is not 1")
  101 + }
  102 + } else {
  103 + if len(order) != 0 {
  104 + return nil, errors.New("Error: unused 'order' fields")
  105 + }
  106 + }
  107 +
  108 + var l []Comment
  109 + qs = qs.OrderBy(sortFields...)
  110 + if _, err = qs.Limit(limit, offset).All(&l, fields...); err == nil {
  111 + if len(fields) == 0 {
  112 + for _, v := range l {
  113 + ml = append(ml, v)
  114 + }
  115 + } else {
  116 + // trim unused fields
  117 + for _, v := range l {
  118 + m := make(map[string]interface{})
  119 + val := reflect.ValueOf(v)
  120 + for _, fname := range fields {
  121 + m[fname] = val.FieldByName(fname).Interface()
  122 + }
  123 + ml = append(ml, m)
  124 + }
  125 + }
  126 + return ml, nil
  127 + }
  128 + return nil, err
  129 +}
  130 +
  131 +// UpdateComment updates Comment by Id and returns error if
  132 +// the record to be updated doesn't exist
  133 +func UpdateCommentById(m *Comment) (err error) {
  134 + o := orm.NewOrm()
  135 + v := Comment{Id: m.Id}
  136 + // ascertain id exists in the database
  137 + if err = o.Read(&v); err == nil {
  138 + var num int64
  139 + if num, err = o.Update(m); err == nil {
  140 + fmt.Println("Number of records updated in database:", num)
  141 + }
  142 + }
  143 + return
  144 +}
  145 +
  146 +// DeleteComment deletes Comment by Id and returns error if
  147 +// the record to be deleted doesn't exist
  148 +func DeleteComment(id int64) (err error) {
  149 + o := orm.NewOrm()
  150 + v := Comment{Id: id}
  151 + // ascertain id exists in the database
  152 + if err = o.Read(&v); err == nil {
  153 + var num int64
  154 + if num, err = o.Delete(&Comment{Id: id}); err == nil {
  155 + fmt.Println("Number of records deleted in database:", num)
  156 + }
  157 + }
  158 + return
  159 +}
  160 +
  161 +func GetComments(userId int64, sourceType int, sourceId int64, lastId int, pageSize int) (v []*Comment, total int, err error) {
  162 + sql := mybeego.NewSqlExutor().Table("comment").Order("create_at desc")
  163 + if userId > 0 {
  164 + sql.Where(fmt.Sprintf("user_id=%d", userId))
  165 + }
  166 + if sourceId > 0 {
  167 + sql.Where(fmt.Sprintf("source_id=%d", sourceId))
  168 + }
  169 + if sourceType > 0 {
  170 + sql.Where(fmt.Sprintf("source_type=%d", sourceType))
  171 + }
  172 + if pageSize > 0 {
  173 + sql.Limit(0, pageSize)
  174 + }
  175 + if lastId > 0 {
  176 + sql.Where(fmt.Sprintf("id>%d", lastId))
  177 + }
  178 + if total, err = sql.Querys(&v); err == nil {
  179 + return
  180 + }
  181 + return
  182 +}
@@ -158,7 +158,7 @@ func DeleteUserAuth(id int) (err error) { @@ -158,7 +158,7 @@ func DeleteUserAuth(id int) (err error) {
158 158
159 func GetUserByAuthCode(authCode string) (v *UserAuth, err error) { 159 func GetUserByAuthCode(authCode string) (v *UserAuth, err error) {
160 o := orm.NewOrm() 160 o := orm.NewOrm()
161 - sql := "select * from user_auth where auth_code=? and auth_exp >= Now()" 161 + sql := "select * from user_auth where auth_code=? and auth_code_exp >= Now()"
162 if err = o.Raw(sql, authCode).QueryRow(&v); err == nil { 162 if err = o.Raw(sql, authCode).QueryRow(&v); err == nil {
163 return v, nil 163 return v, nil
164 } 164 }
@@ -167,7 +167,7 @@ func GetUserByAuthCode(authCode string) (v *UserAuth, err error) { @@ -167,7 +167,7 @@ func GetUserByAuthCode(authCode string) (v *UserAuth, err error) {
167 167
168 func GetUserAuthByRefreshToken(refreshToken string) (v *UserAuth, err error) { 168 func GetUserAuthByRefreshToken(refreshToken string) (v *UserAuth, err error) {
169 o := orm.NewOrm() 169 o := orm.NewOrm()
170 - sql := "select * from user_auth where refresh_token=? and auth_exp >= Now()" // TODO: and enabled = 1 170 + sql := "select * from user_auth where refresh_token=? and refresh_token_exp >= Now()" // TODO: and enabled = 1
171 if err = o.Raw(sql, refreshToken).QueryRow(&v); err == nil { 171 if err = o.Raw(sql, refreshToken).QueryRow(&v); err == nil {
172 return v, nil 172 return v, nil
173 } 173 }
@@ -176,7 +176,7 @@ func GetUserAuthByRefreshToken(refreshToken string) (v *UserAuth, err error) { @@ -176,7 +176,7 @@ func GetUserAuthByRefreshToken(refreshToken string) (v *UserAuth, err error) {
176 176
177 func GetUserAuthByToken(refreshToken string) (v *UserAuth, err error) { 177 func GetUserAuthByToken(refreshToken string) (v *UserAuth, err error) {
178 o := orm.NewOrm() 178 o := orm.NewOrm()
179 - sql := "select * from user_auth where refresh_token=? and auth_exp >= Now()" // TODO: and enabled = 1 179 + sql := "select * from user_auth where access_token=? and access_token_exp >= Now()" // TODO: and enabled = 1
180 if err = o.Raw(sql, refreshToken).QueryRow(&v); err == nil { 180 if err = o.Raw(sql, refreshToken).QueryRow(&v); err == nil {
181 return v, nil 181 return v, nil
182 } 182 }
@@ -12,14 +12,14 @@ type CommendResponse struct { @@ -12,14 +12,14 @@ type CommendResponse struct {
12 } 12 }
13 13
14 type CommendInfo struct { 14 type CommendInfo struct {
15 - Id int64 `json:"cid"` //表彰编号  
16 - Content string `json:"content"` //表彰内容  
17 - Company string `json:"company"` //公司名  
18 - CommendAt int64 `json:"getTime"` //表彰时间  
19 - Honored HonoredUserInfo `json:"honored"` //证书获得者 信息 15 + Id int64 `json:"cid"` //表彰编号
  16 + Content string `json:"content"` //表彰内容
  17 + Company string `json:"company"` //公司名
  18 + CommendAt int64 `json:"getTime"` //表彰时间
  19 + Honored BaseUserInfo `json:"honored"` //证书获得者 信息
20 } 20 }
21 21
22 -type HonoredUserInfo struct { 22 +type BaseUserInfo struct {
23 UserId int64 `json:"uid"` //用户id 23 UserId int64 `json:"uid"` //用户id
24 NickName string `json:"uname"` //用户名 24 NickName string `json:"uname"` //用户名
25 Department string `json:"department"` //部门 25 Department string `json:"department"` //部门
  1 +package protocol
  2 +
  3 +const (
  4 + SourceType_Chance = 1
  5 + SourceType_Comment = 2
  6 +)
  7 +
  8 +/*IComment */
  9 +type ICommentRequest struct {
  10 + Content string `json:"content" valid:"Required"`
  11 + SourceType int `json:"type" valid:"Required"`
  12 + Id int64 `json:"id" valid:"Required"`
  13 +}
  14 +type ICommentResponse struct {
  15 + Id int64 `json:"id"`
  16 + Provider *BaseUserInfo `json:"provider"`
  17 + CreateTime int64 `json:"createTime"`
  18 + Content string `json:"content"`
  19 +}
  20 +
  21 +/*IComments */
  22 +type ICommentsRequest struct {
  23 + LastId int `json:"lastId"`
  24 + PageSize int `json:"pageSize" valid:"Required"`
  25 +}
  26 +type ICommentsResponse struct {
  27 + Comments []*IComments `json:"comments"`
  28 + Total int `json:"total"`
  29 +}
  30 +
  31 +type IComments struct {
  32 + //question `json:"question"`
  33 + Comment *ICommentResponse `json:"comment"`
  34 +}
  35 +
  36 +/*机会评论*/
  37 +type CommentsRequest struct {
  38 + LastId int `json:"lastId"`
  39 + PageSize int `json:"pageSize" valid:"Required"`
  40 + SourceId int64 `json:"id" valid:"Required"`
  41 +}
  42 +type CommentsResponse struct {
  43 + Total int `json:"total"`
  44 + Comments []*Comments `json:"comments"`
  45 +}
  46 +
  47 +/*评论列表*/
  48 +type Comments struct {
  49 + Id int64 `json:"id"`
  50 + Provider *BaseUserInfo `json:"provider"`
  51 + Content string `json:"content"`
  52 + ViewTotal int `json:"pageView"`
  53 + CommentTotal int `json:"commentTotal"`
  54 + ZanTotal int `json:"zanTotal"`
  55 + CreateTime int64 `json:"createTime"`
  56 +}
1 package protocol 1 package protocol
2 2
3 var errmessge ErrorMap = map[int]string{ 3 var errmessge ErrorMap = map[int]string{
4 - 0: "", 4 + 0: "成功",
5 1: "系统异常", 5 1: "系统异常",
6 2: "参数错误", 6 2: "参数错误",
7 101: "clientId或clientSecret无效", 7 101: "clientId或clientSecret无效",
@@ -9,98 +9,122 @@ func init() { @@ -9,98 +9,122 @@ func init() {
9 9
10 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"], 10 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
11 beego.ControllerComments{ 11 beego.ControllerComments{
12 - Method: "AccessToken",  
13 - Router: `/accessToken`, 12 + Method: "AccessToken",
  13 + Router: `/accessToken`,
14 AllowHTTPMethods: []string{"post"}, 14 AllowHTTPMethods: []string{"post"},
15 - MethodParams: param.Make(),  
16 - Params: nil}) 15 + MethodParams: param.Make(),
  16 + Params: nil})
17 17
18 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"], 18 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
19 beego.ControllerComments{ 19 beego.ControllerComments{
20 - Method: "Login",  
21 - Router: `/login`, 20 + Method: "Login",
  21 + Router: `/login`,
22 AllowHTTPMethods: []string{"post"}, 22 AllowHTTPMethods: []string{"post"},
23 - MethodParams: param.Make(),  
24 - Params: nil}) 23 + MethodParams: param.Make(),
  24 + Params: nil})
25 25
26 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"], 26 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
27 beego.ControllerComments{ 27 beego.ControllerComments{
28 - Method: "RefreshToken",  
29 - Router: `/refreshToken`, 28 + Method: "RefreshToken",
  29 + Router: `/refreshToken`,
30 AllowHTTPMethods: []string{"post"}, 30 AllowHTTPMethods: []string{"post"},
31 - MethodParams: param.Make(),  
32 - Params: nil}) 31 + MethodParams: param.Make(),
  32 + Params: nil})
33 33
34 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"], 34 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
35 beego.ControllerComments{ 35 beego.ControllerComments{
36 - Method: "SmsCode",  
37 - Router: `/smsCode`, 36 + Method: "SmsCode",
  37 + Router: `/smsCode`,
38 AllowHTTPMethods: []string{"post"}, 38 AllowHTTPMethods: []string{"post"},
39 - MethodParams: param.Make(),  
40 - Params: nil}) 39 + MethodParams: param.Make(),
  40 + Params: nil})
41 41
42 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"], 42 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
43 beego.ControllerComments{ 43 beego.ControllerComments{
44 - Method: "UpdateDevice",  
45 - Router: `/updateDevice`, 44 + Method: "UpdateDevice",
  45 + Router: `/updateDevice`,
46 AllowHTTPMethods: []string{"post"}, 46 AllowHTTPMethods: []string{"post"},
47 - MethodParams: param.Make(),  
48 - Params: nil}) 47 + MethodParams: param.Make(),
  48 + Params: nil})
  49 +
  50 + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
  51 + beego.ControllerComments{
  52 + Method: "Comments",
  53 + Router: `/comments`,
  54 + AllowHTTPMethods: []string{"post"},
  55 + MethodParams: param.Make(),
  56 + Params: nil})
  57 +
  58 + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
  59 + beego.ControllerComments{
  60 + Method: "IComment",
  61 + Router: `/iComment`,
  62 + AllowHTTPMethods: []string{"post"},
  63 + MethodParams: param.Make(),
  64 + Params: nil})
  65 +
  66 + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
  67 + beego.ControllerComments{
  68 + Method: "IComments",
  69 + Router: `/iComments`,
  70 + AllowHTTPMethods: []string{"post"},
  71 + MethodParams: param.Make(),
  72 + Params: nil})
49 73
50 beego.GlobalControllerRouter["opp/controllers/v1:CommendController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:CommendController"], 74 beego.GlobalControllerRouter["opp/controllers/v1:CommendController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:CommendController"],
51 beego.ControllerComments{ 75 beego.ControllerComments{
52 - Method: "Company",  
53 - Router: `/company`, 76 + Method: "Company",
  77 + Router: `/company`,
54 AllowHTTPMethods: []string{"post"}, 78 AllowHTTPMethods: []string{"post"},
55 - MethodParams: param.Make(),  
56 - Params: nil}) 79 + MethodParams: param.Make(),
  80 + Params: nil})
57 81
58 beego.GlobalControllerRouter["opp/controllers/v1:UploadController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UploadController"], 82 beego.GlobalControllerRouter["opp/controllers/v1:UploadController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UploadController"],
59 beego.ControllerComments{ 83 beego.ControllerComments{
60 - Method: "Image",  
61 - Router: `/image`, 84 + Method: "Image",
  85 + Router: `/image`,
62 AllowHTTPMethods: []string{"post"}, 86 AllowHTTPMethods: []string{"post"},
63 - MethodParams: param.Make(),  
64 - Params: nil}) 87 + MethodParams: param.Make(),
  88 + Params: nil})
65 89
66 beego.GlobalControllerRouter["opp/controllers/v1:UploadController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UploadController"], 90 beego.GlobalControllerRouter["opp/controllers/v1:UploadController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UploadController"],
67 beego.ControllerComments{ 91 beego.ControllerComments{
68 - Method: "Voice",  
69 - Router: `/voice`, 92 + Method: "Voice",
  93 + Router: `/voice`,
70 AllowHTTPMethods: []string{"post"}, 94 AllowHTTPMethods: []string{"post"},
71 - MethodParams: param.Make(),  
72 - Params: nil}) 95 + MethodParams: param.Make(),
  96 + Params: nil})
73 97
74 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"], 98 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"],
75 beego.ControllerComments{ 99 beego.ControllerComments{
76 - Method: "ChangePassword",  
77 - Router: `/changePassword`, 100 + Method: "ChangePassword",
  101 + Router: `/changePassword`,
78 AllowHTTPMethods: []string{"post"}, 102 AllowHTTPMethods: []string{"post"},
79 - MethodParams: param.Make(),  
80 - Params: nil}) 103 + MethodParams: param.Make(),
  104 + Params: nil})
81 105
82 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"], 106 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"],
83 beego.ControllerComments{ 107 beego.ControllerComments{
84 - Method: "ChangePhone",  
85 - Router: `/changePhone`, 108 + Method: "ChangePhone",
  109 + Router: `/changePhone`,
86 AllowHTTPMethods: []string{"post"}, 110 AllowHTTPMethods: []string{"post"},
87 - MethodParams: param.Make(),  
88 - Params: nil}) 111 + MethodParams: param.Make(),
  112 + Params: nil})
89 113
90 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"], 114 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"],
91 beego.ControllerComments{ 115 beego.ControllerComments{
92 - Method: "CheckSmsCode",  
93 - Router: `/checkSmsCode`, 116 + Method: "CheckSmsCode",
  117 + Router: `/checkSmsCode`,
94 AllowHTTPMethods: []string{"post"}, 118 AllowHTTPMethods: []string{"post"},
95 - MethodParams: param.Make(),  
96 - Params: nil}) 119 + MethodParams: param.Make(),
  120 + Params: nil})
97 121
98 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"], 122 beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"],
99 beego.ControllerComments{ 123 beego.ControllerComments{
100 - Method: "ResetPassword",  
101 - Router: `/resetPassword`, 124 + Method: "ResetPassword",
  125 + Router: `/resetPassword`,
102 AllowHTTPMethods: []string{"post"}, 126 AllowHTTPMethods: []string{"post"},
103 - MethodParams: param.Make(),  
104 - Params: nil}) 127 + MethodParams: param.Make(),
  128 + Params: nil})
105 129
106 } 130 }
@@ -17,6 +17,7 @@ func init() { @@ -17,6 +17,7 @@ func init() {
17 beego.NSNamespace("version", beego.NSInclude(&v1.VersionController{})), 17 beego.NSNamespace("version", beego.NSInclude(&v1.VersionController{})),
18 beego.NSNamespace("commend", beego.NSInclude(&v1.CommendController{})), 18 beego.NSNamespace("commend", beego.NSInclude(&v1.CommendController{})),
19 beego.NSNamespace("user", beego.NSInclude(&v1.UserController{})), 19 beego.NSNamespace("user", beego.NSInclude(&v1.UserController{})),
  20 + beego.NSNamespace("chance", beego.NSInclude(&v1.ChanceController{})),
20 ) 21 )
21 beego.AddNamespace(nsV1) 22 beego.AddNamespace(nsV1)
22 beego.SetStaticPath("/file/ab", beego.AppConfig.String("source_path")) 23 beego.SetStaticPath("/file/ab", beego.AppConfig.String("source_path"))
@@ -7,7 +7,7 @@ import ( @@ -7,7 +7,7 @@ import (
7 "sync" 7 "sync"
8 ) 8 )
9 9
10 -func GetUserBaseInfo(uid int64) (v *protocol.UserBaseInfoAggregation, err error) { 10 +func GetUserBaseInfoAggregation(uid int64) (v *protocol.UserBaseInfoAggregation, err error) {
11 v = &protocol.UserBaseInfoAggregation{} 11 v = &protocol.UserBaseInfoAggregation{}
12 var wg sync.WaitGroup 12 var wg sync.WaitGroup
13 if v.User, err = repository.User.GetUsersById(uid); err != nil { 13 if v.User, err = repository.User.GetUsersById(uid); err != nil {
@@ -42,3 +42,19 @@ func GetUserBaseInfo(uid int64) (v *protocol.UserBaseInfoAggregation, err error) @@ -42,3 +42,19 @@ func GetUserBaseInfo(uid int64) (v *protocol.UserBaseInfoAggregation, err error)
42 wg.Wait() 42 wg.Wait()
43 return 43 return
44 } 44 }
  45 +
  46 +func GetUserBaseInfo(uid int64) (v *protocol.BaseUserInfo, err error) {
  47 + var (
  48 + agg *protocol.UserBaseInfoAggregation
  49 + )
  50 + if agg, err = GetUserBaseInfoAggregation(uid); err != nil {
  51 + return
  52 + }
  53 + v = &protocol.BaseUserInfo{
  54 + UserId: agg.User.Id,
  55 + NickName: agg.User.NickName,
  56 + Department: agg.Department.Name,
  57 + Position: agg.Position.Name,
  58 + }
  59 + return
  60 +}
@@ -76,6 +76,7 @@ func (s *AuthService) Login(request *protocol.LoginRequest) (rsp *protocol.Login @@ -76,6 +76,7 @@ func (s *AuthService) Login(request *protocol.LoginRequest) (rsp *protocol.Login
76 if result, err = CheckSmsCode(request.Phone, request.Code, protocol.SmsCode); result && err == nil { 76 if result, err = CheckSmsCode(request.Phone, request.Code, protocol.SmsCode); result && err == nil {
77 goto Success 77 goto Success
78 } else { 78 } else {
  79 + err = protocol.NewErrWithMessage(1012, err)
79 return 80 return
80 } 81 }
81 default: 82 default:
@@ -116,7 +117,7 @@ Success: @@ -116,7 +117,7 @@ Success:
116 if user.CsAccount == 0 { 117 if user.CsAccount == 0 {
117 user.CsAccount = imGetRandomCSAccount() 118 user.CsAccount = imGetRandomCSAccount()
118 } 119 }
119 - userAuth.AccessTokenExp = time.Now().Add(time.Second * protocol.TokenExpire) 120 + userAuth.AuthCodeExp = time.Now().Add(time.Second * protocol.TokenExpire)
120 if err = repository.UserAuth.UpdateUserAuthById(userAuth); err != nil { 121 if err = repository.UserAuth.UpdateUserAuthById(userAuth); err != nil {
121 return 122 return
122 } 123 }
@@ -148,6 +149,8 @@ func (s *AuthService) AccessToken(request *protocol.AccessTokenRequest) (rsp *pr @@ -148,6 +149,8 @@ func (s *AuthService) AccessToken(request *protocol.AccessTokenRequest) (rsp *pr
148 } 149 }
149 userAuth.AccessToken = uid.NewV1().StringNoDash() 150 userAuth.AccessToken = uid.NewV1().StringNoDash()
150 userAuth.RefreshToken = uid.NewV1().StringNoDash() 151 userAuth.RefreshToken = uid.NewV1().StringNoDash()
  152 + userAuth.AccessTokenExp = time.Now().Add(protocol.TokenExpire*time.Second)
  153 + userAuth.RefreshTokenExp = time.Now().Add(protocol.TokenExpire*time.Second)
151 if err = repository.UserAuth.UpdateUserAuthById(userAuth); err != nil { 154 if err = repository.UserAuth.UpdateUserAuthById(userAuth); err != nil {
152 log.Error(err) 155 log.Error(err)
153 return 156 return
  1 +package chance
  2 +
  3 +import (
  4 + "fmt"
  5 + "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen"
  6 + "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
  7 + "opp/internal/repository"
  8 + "opp/internal/utils"
  9 + "opp/models"
  10 + "opp/protocol"
  11 + "opp/services/agg"
  12 + "time"
  13 +)
  14 +
  15 +//我来评论
  16 +func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) (rsp *protocol.ICommentResponse, err error) {
  17 + var (
  18 + comment *models.Comment
  19 + baseUserInfo *protocol.BaseUserInfo
  20 + chance *models.Chance
  21 + )
  22 + switch request.SourceType {
  23 + case protocol.SourceType_Chance:
  24 + if chance, err = repository.Chance.GetChanceById(request.Id); err != nil {
  25 + log.Error(err)
  26 + return
  27 + }
  28 + case protocol.SourceType_Comment:
  29 + if _, err = repository.Comment.GetCommentById(request.Id); err != nil {
  30 + log.Error(err)
  31 + return
  32 + }
  33 + default:
  34 + err = fmt.Errorf("unknow source_type:%v", request.SourceType)
  35 + }
  36 + comment = &models.Comment{
  37 + Id: idgen.Next(),
  38 + UserId: header.Uid,
  39 + SourceType: int8(request.SourceType),
  40 + Content: request.Content,
  41 + CreateAt: time.Now(),
  42 + SourceId: request.Id,
  43 + }
  44 + if _, err = repository.Comment.AddComment(comment); err != nil {
  45 + log.Error(err)
  46 + return
  47 + }
  48 + if baseUserInfo, err = agg.GetUserBaseInfo(header.Uid); err != nil {
  49 + log.Error(err)
  50 + return
  51 + }
  52 + if chance != nil {
  53 + //TODO:sql更新
  54 + utils.UpdateTableByMap(chance, map[string]interface{}{"CommentTotal": chance.CommentTotal + 1})
  55 + }
  56 + rsp = &protocol.ICommentResponse{
  57 + Id: comment.Id,
  58 + Content: comment.Content,
  59 + CreateTime: comment.CreateAt.Unix(),
  60 + Provider: baseUserInfo,
  61 + }
  62 + return
  63 +}
  64 +
  65 +//我的评论
  66 +func IComments(header *protocol.RequestHeader, request *protocol.ICommentsRequest) (rsp *protocol.ICommentsResponse, err error) {
  67 + var (
  68 + comments []*models.Comment
  69 + baseUserInfo *protocol.BaseUserInfo
  70 + total int
  71 + )
  72 + if comments, total, err = repository.Comment.GetComments(header.Uid, protocol.SourceType_Chance, 0, request.LastId, request.PageSize); err != nil {
  73 + log.Error(err)
  74 + return
  75 + }
  76 + rsp = &protocol.ICommentsResponse{
  77 + Total: total,
  78 + }
  79 + if baseUserInfo, err = agg.GetUserBaseInfo(header.Uid); err != nil {
  80 + log.Error(err)
  81 + return
  82 + }
  83 + rsp.Comments = make([]*protocol.IComments, len(comments))
  84 + for i := range comments {
  85 + comment := comments[i]
  86 + item := &protocol.IComments{
  87 + //TODO: 机会详情
  88 + //机会详情
  89 + //评论
  90 + Comment: &protocol.ICommentResponse{
  91 + Id: comment.Id,
  92 + Content: comment.Content,
  93 + CreateTime: comment.CreateAt.Unix(),
  94 + Provider: baseUserInfo,
  95 + },
  96 + }
  97 + rsp.Comments[i] = item
  98 + }
  99 + return
  100 +}
  101 +
  102 +//机会评论列表
  103 +func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest) (rsp *protocol.CommentsResponse, err error) {
  104 + var (
  105 + comments []*models.Comment
  106 + baseUserInfo *protocol.BaseUserInfo
  107 + total int
  108 + )
  109 + if comments, total, err = repository.Comment.GetComments(header.Uid, protocol.SourceType_Chance, request.SourceId, request.LastId, request.PageSize); err != nil {
  110 + log.Error(err)
  111 + return
  112 + }
  113 + rsp = &protocol.CommentsResponse{
  114 + Total: total,
  115 + }
  116 + for i := range comments {
  117 + comment := comments[i]
  118 + if baseUserInfo, err = agg.GetUserBaseInfo(comment.UserId); err != nil {
  119 + log.Error(err)
  120 + //return
  121 + }
  122 + item := &protocol.Comments{
  123 + Id: comment.Id,
  124 + Provider: baseUserInfo,
  125 + Content: comment.Content,
  126 + CreateTime: comment.CreateAt.Unix(),
  127 + ViewTotal: comment.ViewTotal,
  128 + ZanTotal: comment.ZanTotal,
  129 + CommentTotal: comment.CommentTotal,
  130 + }
  131 + rsp.Comments = append(rsp.Comments, item)
  132 + }
  133 + return
  134 +}
@@ -24,7 +24,7 @@ func Commend(header *protocol.RequestHeader, request *protocol.CommendRequest) ( @@ -24,7 +24,7 @@ func Commend(header *protocol.RequestHeader, request *protocol.CommendRequest) (
24 } 24 }
25 for i := 0; i < len(commends); i++ { 25 for i := 0; i < len(commends); i++ {
26 c := commends[i] 26 c := commends[i]
27 - userBaseInfo, err = agg.GetUserBaseInfo(c.UserId) 27 + userBaseInfo, err = agg.GetUserBaseInfoAggregation(c.UserId)
28 if err != nil { 28 if err != nil {
29 continue 29 continue
30 } 30 }
@@ -34,7 +34,7 @@ func Commend(header *protocol.RequestHeader, request *protocol.CommendRequest) ( @@ -34,7 +34,7 @@ func Commend(header *protocol.RequestHeader, request *protocol.CommendRequest) (
34 Content: c.Content, 34 Content: c.Content,
35 Company: userBaseInfo.Company.Name, 35 Company: userBaseInfo.Company.Name,
36 CommendAt: time.GetUnixTimeByNDayUnix(c.CommendAt.Unix(), 0), 36 CommendAt: time.GetUnixTimeByNDayUnix(c.CommendAt.Unix(), 0),
37 - Honored: protocol.HonoredUserInfo{ 37 + Honored: protocol.BaseUserInfo{
38 UserId: c.UserId, 38 UserId: c.UserId,
39 NickName: user.NickName, 39 NickName: user.NickName,
40 Department: userBaseInfo.Department.Name, 40 Department: userBaseInfo.Department.Name,