作者 yangfu

用户消息列表修改

... ... @@ -62,11 +62,6 @@ func (srv PersonStatisticsService) CompanyStatistics(userMenusCommand *command.C
}, nil
}
// CompanyDividendStatistics (废弃)共创用户-共创企业分红统计
func (srv PersonStatisticsService) CompanyDividendStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) {
return map[string]interface{}{}, nil
}
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
... ...
... ... @@ -10,7 +10,7 @@ import (
type MessageMarkReadCommand struct {
Operator domain.Operator `json:"-"`
MsgId int `json:"msgId"`
ReadAll int `json:"readAll"`
ReadAll bool `json:"readAll"`
}
func (cmd *MessageMarkReadCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -24,3 +24,18 @@ func NewMessageDto() *MessageDto {
Read: 1,
}
}
func (m *MessageDto) LoadMsgType(module string, action string) int {
switch module {
case "module01":
switch action {
case "action01_01", "action01_02":
return 1001 //跳转共创申请列表页面
case "action01_03":
return 1002 //跳转共创企业列表页面
case "action01_04", "action01_05", "action01_06":
return 1003
}
}
return 1 // 系统注册消息
}
... ...
... ... @@ -8,6 +8,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
... ... @@ -167,36 +168,44 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments
//MessagesList 消息列表
func (srv UserService) MessagesList(cmd *query.MessagesListQuery) (int64, interface{}, error) {
gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
cmd.Operator)
messages, err := gateway.NoticePersonal(allied_creation_basic.ReqNoticePersonal{
PageIndex: cmd.PageNumber,
PageSize: cmd.PageSize,
UserBaseId: cmd.Operator.UserBaseId,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var results []*dto.MessageDto
for i := 0; i < 5; i++ {
results = append(results, dto.NewMessageDto())
for i := 0; i < len(messages.List); i++ {
mItem := messages.List[i]
message := &dto.MessageDto{
MsgId: mItem.NoticePersonalID,
MsgContent: mItem.Content,
MsgTime: mItem.CreatedAt.Unix() * 1000,
Read: mItem.IsRead,
}
message.MsgType = message.LoadMsgType(mItem.Module, mItem.ModuleAction)
results = append(results, message)
}
//gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
// cmd.Operator)
//_,err:= gateway.NoticePersonal(allied_creation_basic.ReqNoticePersonal{
// PageIndex: cmd.PageNumber,
// PageSize: cmd.PageSize,
// UserId: cmd.Operator.UserId,
//})
//if err!=nil{
// return 0,nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
return 2, results, nil
return messages.Count, results, nil
}
//MessagesList 消息列表
func (srv UserService) MessagesMarkRead(cmd *command.MessageMarkReadCommand) (interface{}, error) {
//gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
// cmd.Operator)
//_,err:= gateway.ReadNotice(allied_creation_basic.ReqReadNotice{
// MsgId: cmd.MsgId,
// ReadAll: cmd.ReadAll,
// UserId: cmd.Operator.UserId,
//})
//if err!=nil{
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
cmd.Operator)
_, err := gateway.ReadNotice(allied_creation_basic.ReqReadNotice{
MsgId: cmd.MsgId,
ReadAll: cmd.ReadAll,
UserBaseId: cmd.Operator.UserBaseId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return struct{}{}, nil
}
... ...
... ... @@ -10,8 +10,8 @@ import (
// NoticeSettingUpdate 获取消息列表
func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal) (*DataNoticePersonal, error) {
url := gateway.baseUrL + "/notice-personal"
method := "Post"
url := gateway.baseUrL + "/notice-personal/search"
method := "post"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:获取消息列表。", map[string]interface{}{
"api": method + ":" + url,
... ... @@ -42,7 +42,7 @@ func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal
// NoticeSettingAdd 消息标记已读
func (gateway HttplibAlliedCreationBasic) ReadNotice(param ReqReadNotice) (*DataReadNotice, error) {
url := gateway.baseUrL + "/notice-personal/read"
method := "POST"
method := "post"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:消息标记已读。", map[string]interface{}{
"api": method + ":" + url,
... ...
package allied_creation_basic
import "time"
//返回编排消息通知内容列表
type (
ReqNoticePersonal struct {
IsRead int `json:"isRead"`
PageIndex int `json:"pageIndex"`
PageSize int `json:"pageSize"`
UserId int64 `json:"userId"`
UserBaseId int64 `json:"userBaseId"`
}
DataNoticePersonal struct {
NoticePersonal []struct {
List []struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
CreatedAt string `json:"createdAt"`
DeletedAt string `json:"deletedAt"`
CreatedAt time.Time `json:"createdAt"`
DeletedAt time.Time `json:"deletedAt"`
Extend string `json:"extend"`
IsRead string `json:"isRead"`
IsRead int `json:"isRead"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticePersonalID int `json:"noticePersonalId"`
... ... @@ -24,8 +26,8 @@ type (
SysCode string `json:"sysCode"`
UpdatedAt string `json:"updatedAt"`
UserID int `json:"userId"`
} `json:"noticePersonal"`
Count float64 `json:"count"`
} `json:"list"`
Count int64 `json:"count"`
}
)
... ... @@ -33,9 +35,9 @@ type (
type (
ReqReadNotice struct {
IsRead int `json:"isRead"`
MsgId int `json:"msgId"`
ReadAll int `json:"readAll"`
UserId int64 `json:"userId"`
MsgId int `json:"noticeId"`
ReadAll bool `json:"readAll"`
UserBaseId int64 `json:"userBaseId"`
}
DataReadNotice struct {
... ...
... ... @@ -540,18 +540,18 @@ func (controller *CooperationController) PersonCompanyStatistics() {
controller.Response(data, err)
}
func (controller *CooperationController) PersonCompanyDividendStatistics() {
svr := service.PersonStatisticsService{}
cmd := &command.CooperationPersonStatisticsCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CompanyDividendStatistics(cmd)
controller.Response(data, err)
}
//func (controller *CooperationController) PersonCompanyDividendStatistics() {
// svr := service.PersonStatisticsService{}
// cmd := &command.CooperationPersonStatisticsCommand{}
// err := controller.Unmarshal(cmd)
// if err != nil {
// controller.Response(nil, err)
// return
// }
// cmd.Operator = controller.GetOperator()
// data, err := svr.CompanyDividendStatistics(cmd)
// controller.Response(data, err)
//}
func (controller *CooperationController) PersonCooperationProjectRecommend() {
svr := service.PersonStatisticsService{}
... ...
... ... @@ -71,6 +71,6 @@ func init() {
/***** PersonStatistics 用户端统计 *****/
web.Router("/v1/app/cooperation-user/index", &mobile_client.CooperationController{}, "Get:PersonIndexStatistics")
web.Router("/v1/app/cooperation-user/company-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyStatistics")
web.Router("/v1/app/cooperation-user/company-dividend-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyDividendStatistics")
//web.Router("/v1/app/cooperation-user/company-dividend-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyDividendStatistics")
web.Router("/v1/app/cooperation-projects/recommend", &mobile_client.CooperationController{}, "Post:PersonCooperationProjectRecommend")
}
... ...