作者 yangfu

关注的共创项目

@@ -219,3 +219,36 @@ func (srv CooperationProjectService) PersonSearchCooperationProjectShareInfo(pro @@ -219,3 +219,36 @@ func (srv CooperationProjectService) PersonSearchCooperationProjectShareInfo(pro
219 } 219 }
220 return result, nil 220 return result, nil
221 } 221 }
  222 +
  223 +// PersonSearchCooperationProject 共创用户获取共创项目列表
  224 +func (srv CooperationProjectService) PersonSearchCooperationProjectStarred(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) {
  225 + //extQueries := extQuires(projectQuery.Operator)
  226 + if projectQuery.Operator.UserBaseId == 0 {
  227 + return 0, []struct{}{}, nil
  228 + }
  229 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(projectQuery.Operator)
  230 + userInfo, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
  231 + UserBaseId: projectQuery.Operator.UserBaseId,
  232 + })
  233 + if err != nil {
  234 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  235 + }
  236 + if len(userInfo.FavoriteOrg()) == 0 {
  237 + return 0, []struct{}{}, nil
  238 + }
  239 +
  240 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  241 + projectQuery.Operator)
  242 + result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
  243 + PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的
  244 + PageSize: projectQuery.PageSize,
  245 + Status: 1, //搜索状态为“招标中”项目
  246 + Keyword: projectQuery.Keyword,
  247 + OrgIds: userInfo.FavoriteOrg(),
  248 + IsSkipFetchProjectModel: true,
  249 + })
  250 + if err != nil {
  251 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  252 + }
  253 + return int(result.Total), result.List, nil
  254 +}
@@ -112,6 +112,7 @@ type ( @@ -112,6 +112,7 @@ type (
112 ReqAuthUserBase struct { 112 ReqAuthUserBase struct {
113 // 手机号码 113 // 手机号码
114 Account string `cname:"账号" json:"account" valid:"Required"` 114 Account string `cname:"账号" json:"account" valid:"Required"`
  115 + UserBaseId int64 `json:"userBaseId"`
115 } 116 }
116 DataAuthUserBase struct { 117 DataAuthUserBase struct {
117 UserID int `json:"userId"` 118 UserID int `json:"userId"`
@@ -129,5 +130,26 @@ type ( @@ -129,5 +130,26 @@ type (
129 ImToken string `json:"imToken"` 130 ImToken string `json:"imToken"`
130 CsAccountID string `json:"csAccountId"` 131 CsAccountID string `json:"csAccountId"`
131 } `json:"im"` 132 } `json:"im"`
  133 + Favorite struct {
  134 + OrgItems []int64 `json:"orgItems"`
  135 + } `json:"favorite"`
132 } 136 }
133 ) 137 )
  138 +
  139 +func (user *DataAuthUserBase) CheckOrgStarred(orgId int64) bool {
  140 + var starred bool = false
  141 + for i := range user.Favorite.OrgItems {
  142 + if user.Favorite.OrgItems[i] == orgId {
  143 + starred = true
  144 + return starred
  145 + }
  146 + }
  147 + return false
  148 +}
  149 +
  150 +func (user *DataAuthUserBase) FavoriteOrg() []int64 {
  151 + if user == nil {
  152 + return []int64{}
  153 + }
  154 + return user.Favorite.OrgItems
  155 +}
@@ -249,7 +249,7 @@ func (controller *CooperationController) PersonSearchCooperationProjectStarred() @@ -249,7 +249,7 @@ func (controller *CooperationController) PersonSearchCooperationProjectStarred()
249 return 249 return
250 } 250 }
251 cmd.Operator = controller.GetOperator() 251 cmd.Operator = controller.GetOperator()
252 - total, data, err := svr.PersonSearchCooperationProject(cmd) 252 + total, data, err := svr.PersonSearchCooperationProjectStarred(cmd)
253 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber) 253 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
254 } 254 }
255 255