正在显示
9 个修改的文件
包含
82 行增加
和
39 行删除
@@ -37,7 +37,7 @@ user_center_app_key ="39aefef9e22744a3b2d2d3791824ae7b" | @@ -37,7 +37,7 @@ user_center_app_key ="39aefef9e22744a3b2d2d3791824ae7b" | ||
37 | user_center_app_secret ="cykbjnfqgctn" | 37 | user_center_app_secret ="cykbjnfqgctn" |
38 | 38 | ||
39 | #Html5 | 39 | #Html5 |
40 | -h5_host = "https://mmm-web-open-test.fjmaimaimai.com" | 40 | +h5_host = "http://mmm-web-open-test.fjmaimaimai.com" |
41 | 41 | ||
42 | #审核中心 | 42 | #审核中心 |
43 | suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" | 43 | suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" |
@@ -81,6 +81,14 @@ func (this *BaseController) Resp(msg *protocol.ResponseMessage) { | @@ -81,6 +81,14 @@ func (this *BaseController) Resp(msg *protocol.ResponseMessage) { | ||
81 | this.ServeJSON() | 81 | this.ServeJSON() |
82 | } | 82 | } |
83 | 83 | ||
84 | +func (this *BaseController) RespH5(msg *protocol.ResponseMessage) { | ||
85 | + if msg.Errno != 0 { | ||
86 | + msg.Errno = -1 | ||
87 | + } | ||
88 | + this.Data["json"] = msg | ||
89 | + this.ServeJSON() | ||
90 | +} | ||
91 | + | ||
84 | //获取请求头信息 | 92 | //获取请求头信息 |
85 | func GetRequestHeader(ctx *context.Context) *protocol.RequestHeader { | 93 | func GetRequestHeader(ctx *context.Context) *protocol.RequestHeader { |
86 | h := &protocol.RequestHeader{} | 94 | h := &protocol.RequestHeader{} |
@@ -17,7 +17,7 @@ type H5Controller struct { | @@ -17,7 +17,7 @@ type H5Controller struct { | ||
17 | func (this *H5Controller) Announcement() { | 17 | func (this *H5Controller) Announcement() { |
18 | var msg *protocol.ResponseMessage | 18 | var msg *protocol.ResponseMessage |
19 | defer func() { | 19 | defer func() { |
20 | - this.Resp(msg) | 20 | + this.RespH5(msg) |
21 | }() | 21 | }() |
22 | var request *protocol.AnnouncementRequest | 22 | var request *protocol.AnnouncementRequest |
23 | if err := json.Unmarshal(this.ByteBody, &request); err != nil { | 23 | if err := json.Unmarshal(this.ByteBody, &request); err != nil { |
@@ -38,7 +38,7 @@ func (this *H5Controller) Announcement() { | @@ -38,7 +38,7 @@ func (this *H5Controller) Announcement() { | ||
38 | func (this *H5Controller) AnnouncementSubmit() { | 38 | func (this *H5Controller) AnnouncementSubmit() { |
39 | var msg *protocol.ResponseMessage | 39 | var msg *protocol.ResponseMessage |
40 | defer func() { | 40 | defer func() { |
41 | - this.Resp(msg) | 41 | + this.RespH5(msg) |
42 | }() | 42 | }() |
43 | var request *protocol.AnnouncementSubmitRequest | 43 | var request *protocol.AnnouncementSubmitRequest |
44 | if err := json.Unmarshal(this.ByteBody, &request); err != nil { | 44 | if err := json.Unmarshal(this.ByteBody, &request); err != nil { |
@@ -59,7 +59,7 @@ func (this *H5Controller) AnnouncementSubmit() { | @@ -59,7 +59,7 @@ func (this *H5Controller) AnnouncementSubmit() { | ||
59 | func (this *H5Controller) ChanceExample() { | 59 | func (this *H5Controller) ChanceExample() { |
60 | var msg *protocol.ResponseMessage | 60 | var msg *protocol.ResponseMessage |
61 | defer func() { | 61 | defer func() { |
62 | - this.Resp(msg) | 62 | + this.RespH5(msg) |
63 | }() | 63 | }() |
64 | var request *protocol.ChanceExampleRequest | 64 | var request *protocol.ChanceExampleRequest |
65 | if err := json.Unmarshal(this.ByteBody, &request); err != nil { | 65 | if err := json.Unmarshal(this.ByteBody, &request); err != nil { |
@@ -175,14 +175,14 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag | @@ -175,14 +175,14 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag | ||
175 | } | 175 | } |
176 | 176 | ||
177 | //获取机会消息 | 177 | //获取机会消息 |
178 | -func GetChanceMsg(uid, cid int64, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) { | 178 | +func GetChanceMsg(uid, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) { |
179 | sql := `select a.*,b.images,b.speechs,b.videos from ( | 179 | sql := `select a.*,b.images,b.speechs,b.videos from ( |
180 | -select a.*,b.source_content,b.enable_status,b.user_id chance_user_id from ( | ||
181 | -select id,company_id,receive_user_id,message,source_id,create_time,is_read | 180 | +select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data from ( |
181 | +select id,company_id,receive_user_id,message,source_id,is_read | ||
182 | from user_msg where receive_user_id=? and source_type=1 and (?=0 or id>?) and msg_type=? | 182 | from user_msg where receive_user_id=? and source_type=1 and (?=0 or id>?) and msg_type=? |
183 | )a left outer join chance b on a.source_id = b.id | 183 | )a left outer join chance b on a.source_id = b.id |
184 | )a left outer join chance_data b on a.source_id =b.chance_id | 184 | )a left outer join chance_data b on a.source_id =b.chance_id |
185 | -order by a.create_time desc | 185 | +order by a.create_at desc |
186 | LIMIT ?` | 186 | LIMIT ?` |
187 | 187 | ||
188 | sqlCount := `select count(0) | 188 | sqlCount := `select count(0) |
@@ -95,13 +95,6 @@ func NewReturnResponse(data interface{}, eRR error) *ResponseMessage { | @@ -95,13 +95,6 @@ func NewReturnResponse(data interface{}, eRR error) *ResponseMessage { | ||
95 | msg.Data = data | 95 | msg.Data = data |
96 | return msg | 96 | return msg |
97 | } | 97 | } |
98 | - //if x,ok :=eRR.(*ErrWithMessage);ok{ | ||
99 | - // if x.ErrorCode.Errno==0{ | ||
100 | - // msg = x.ParseToMessage() | ||
101 | - // msg.Data = data | ||
102 | - // } | ||
103 | - // return msg | ||
104 | - //} | ||
105 | // fmt.Println("日志:" + eRR.Error()) | 98 | // fmt.Println("日志:" + eRR.Error()) |
106 | if x, ok := eRR.(CustomErrParse); ok { | 99 | if x, ok := eRR.(CustomErrParse); ok { |
107 | msg = x.ParseToMessage() | 100 | msg = x.ParseToMessage() |
@@ -214,7 +214,8 @@ type MsgChanceApproveItemOrm struct { | @@ -214,7 +214,8 @@ type MsgChanceApproveItemOrm struct { | ||
214 | Images string `orm:"column(images)"` | 214 | Images string `orm:"column(images)"` |
215 | Voices string `orm:"column(speechs)"` | 215 | Voices string `orm:"column(speechs)"` |
216 | Videos string `orm:"column(videos)"` | 216 | Videos string `orm:"column(videos)"` |
217 | - //ReviewStatus int `orm:"column(review_status)"` | 217 | + ReviewStatus int `orm:"column(review_status)"` |
218 | + ApproveData string `orm:"column(approve_data)"` //审核数据 | ||
218 | 219 | ||
219 | Id int64 `orm:"column(id)"` //消息id | 220 | Id int64 `orm:"column(id)"` //消息id |
220 | ReceiveUserId int64 `orm:"column(receive_user_id)"` | 221 | ReceiveUserId int64 `orm:"column(receive_user_id)"` |
@@ -289,6 +289,14 @@ func init() { | @@ -289,6 +289,14 @@ func init() { | ||
289 | 289 | ||
290 | beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | 290 | beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], |
291 | beego.ControllerComments{ | 291 | beego.ControllerComments{ |
292 | + Method: "MsgChanceApprove", | ||
293 | + Router: `/msgChanceApprove`, | ||
294 | + AllowHTTPMethods: []string{"post"}, | ||
295 | + MethodParams: param.Make(), | ||
296 | + Params: nil}) | ||
297 | + | ||
298 | + beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | ||
299 | + beego.ControllerComments{ | ||
292 | Method: "MsgCompanyNotice", | 300 | Method: "MsgCompanyNotice", |
293 | Router: `/msgCompanyNotice`, | 301 | Router: `/msgCompanyNotice`, |
294 | AllowHTTPMethods: []string{"post"}, | 302 | AllowHTTPMethods: []string{"post"}, |
@@ -202,3 +202,17 @@ func GetIncrementSql(table string, column string, incre int, id int64) *utils.Sq | @@ -202,3 +202,17 @@ func GetIncrementSql(table string, column string, incre int, id int64) *utils.Sq | ||
202 | Sql: sql.String(), | 202 | Sql: sql.String(), |
203 | } | 203 | } |
204 | } | 204 | } |
205 | + | ||
206 | +//清楚未填写的表单数据 | ||
207 | +func ClearEmptyForm(inputFormList []*protocol.Form) (FormList []*protocol.Form) { | ||
208 | + if len(inputFormList) == 0 { | ||
209 | + return | ||
210 | + } | ||
211 | + for i := range inputFormList { | ||
212 | + item := inputFormList[i] | ||
213 | + if len(item.Value) > 0 { | ||
214 | + FormList = append(FormList, item) | ||
215 | + } | ||
216 | + } | ||
217 | + return | ||
218 | +} |
@@ -190,7 +190,7 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | @@ -190,7 +190,7 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | ||
190 | total int | 190 | total int |
191 | provider *protocol.BaseUserInfo | 191 | provider *protocol.BaseUserInfo |
192 | ) | 192 | ) |
193 | - if total, err = models.GetChanceMsg(header.UserId, header.CompanyId, request.LastId, request.PageSize, protocol.MsgTypeAudit, &myChances); err != nil { | 193 | + if total, err = models.GetChanceMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeAudit, &myChances); err != nil { |
194 | if err == orm.ErrNoRows { | 194 | if err == orm.ErrNoRows { |
195 | err = nil | 195 | err = nil |
196 | return | 196 | return |
@@ -198,26 +198,44 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | @@ -198,26 +198,44 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | ||
198 | log.Error(err) | 198 | log.Error(err) |
199 | return | 199 | return |
200 | } | 200 | } |
201 | - if provider, err = agg.GetUserBaseInfo(header.UserId, header.CompanyId); err != nil { | ||
202 | - log.Error(err) | ||
203 | - return | ||
204 | - } | ||
205 | rsp = &protocol.MsgChanceApproveResponse{Total: total} | 201 | rsp = &protocol.MsgChanceApproveResponse{Total: total} |
206 | for i := 0; i < len(myChances); i++ { | 202 | for i := 0; i < len(myChances); i++ { |
207 | chance := myChances[i] | 203 | chance := myChances[i] |
208 | commItem := protocol.CommonListItem{} | 204 | commItem := protocol.CommonListItem{} |
209 | - item := protocol.ChanceItem{ | ||
210 | - Id: chance.Id, | ||
211 | - Provider: provider, | ||
212 | - //CreateTime: chance.CreateTime.Unix() * 1000, | 205 | + commItem.ReviewStatus = chance.ReviewStatus |
206 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
207 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
208 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
209 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
210 | + } else { | ||
211 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
212 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
213 | + log.Error(err) | ||
214 | + continue | ||
215 | + } else { | ||
216 | + item := protocol.ChanceItem{ | ||
217 | + Id: chance.ChanceId, | ||
218 | + Provider: provider, | ||
219 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
220 | + } | ||
221 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
222 | + item.FormList = agg.ClearEmptyForm(item.FormList) | ||
223 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
224 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
225 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
226 | + commItem.Chance = item | ||
227 | + } | ||
213 | } | 228 | } |
214 | - utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
215 | - utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
216 | - utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
217 | - utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
218 | - { | ||
219 | - commItem.Chance = item | 229 | + |
230 | + if chance.ReviewStatus == protocol.ReviewStatusPass { | ||
231 | + var approveData *protocol.ApproveData | ||
232 | + utils.JsonUnmarshal(chance.ApproveData, &approveData) | ||
233 | + if approveData != nil { | ||
234 | + commItem.Score = approveData.Score | ||
235 | + } | ||
220 | } | 236 | } |
237 | + //审核完有审核数据 | ||
238 | + commItem.Message = chance.Message | ||
221 | rsp.List = append(rsp.List, commItem) | 239 | rsp.List = append(rsp.List, commItem) |
222 | } | 240 | } |
223 | return | 241 | return |
@@ -226,12 +244,12 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | @@ -226,12 +244,12 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | ||
226 | //H5公告详情 | 244 | //H5公告详情 |
227 | func H5Announcement(header *protocol.RequestHeader, request *protocol.AnnouncementRequest) (rsp *protocol.AnnouncementResponse, err error) { | 245 | func H5Announcement(header *protocol.RequestHeader, request *protocol.AnnouncementRequest) (rsp *protocol.AnnouncementResponse, err error) { |
228 | var ( | 246 | var ( |
229 | - bulletin *models.Bulletin | ||
230 | - question *models.BulletinQuestion | ||
231 | - userMsg *models.UserMsg | ||
232 | - bulletinAnswer *models.BulletinQuestionAnswer | ||
233 | - setRead bool = false | ||
234 | - answer *protocol.Answer | 247 | + bulletin *models.Bulletin |
248 | + question *models.BulletinQuestion | ||
249 | + userMsg *models.UserMsg | ||
250 | + //bulletinAnswer *models.BulletinQuestionAnswer | ||
251 | + setRead bool = false | ||
252 | + answer *protocol.Answer | ||
235 | ) | 253 | ) |
236 | if bulletin, err = models.GetBulletinById(request.Id); err != nil { | 254 | if bulletin, err = models.GetBulletinById(request.Id); err != nil { |
237 | log.Error(err.Error()) | 255 | log.Error(err.Error()) |
@@ -268,10 +286,11 @@ func H5Announcement(header *protocol.RequestHeader, request *protocol.Announceme | @@ -268,10 +286,11 @@ func H5Announcement(header *protocol.RequestHeader, request *protocol.Announceme | ||
268 | } | 286 | } |
269 | 287 | ||
270 | //获取回答详情数据 | 288 | //获取回答详情数据 |
271 | - if bulletinAnswer, err = models.GetBulletinQuestionAnswerBy(request.Id, int64(request.Uid)); err == nil { | 289 | + if bulletinAnswer, e := models.GetBulletinQuestionAnswerBy(request.Id, int64(request.Uid)); e == nil { |
272 | if len(bulletinAnswer.Answer) != 0 { | 290 | if len(bulletinAnswer.Answer) != 0 { |
273 | if err = json.Unmarshal([]byte(bulletinAnswer.Answer), &answer); err != nil { | 291 | if err = json.Unmarshal([]byte(bulletinAnswer.Answer), &answer); err != nil { |
274 | - log.Error(err) | 292 | + log.Error(e) |
293 | + return | ||
275 | } else { | 294 | } else { |
276 | rsp.Announcement.EditContent = answer.EditContent | 295 | rsp.Announcement.EditContent = answer.EditContent |
277 | rsp.Announcement.VoteResults = answer.VoteResults | 296 | rsp.Announcement.VoteResults = answer.VoteResults |
-
请 注册 或 登录 后发表评论