|
@@ -6,7 +6,7 @@ import (
|
|
|
it "jyBXSubscribe/api/init"
|
|
|
"jyBXSubscribe/api/internal/svc"
|
|
|
"jyBXSubscribe/api/internal/types"
|
|
|
- "jyBXSubscribe/rpc/model/service"
|
|
|
+ "jyBXSubscribe/rpc/bxsubscribe"
|
|
|
"time"
|
|
|
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
@@ -30,18 +30,23 @@ func NewSubscribeUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *S
|
|
|
|
|
|
//
|
|
|
func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (resp *types.CommonResp, err error) {
|
|
|
- resp = &types.CommonResp{} //出参
|
|
|
-
|
|
|
+ resp = &types.CommonResp{}
|
|
|
if req.UserId == "" {
|
|
|
return
|
|
|
}
|
|
|
- subService := &service.SubseribeService{
|
|
|
+ subService := &bxsubscribe.UpdateSubScribeInfoReq{
|
|
|
UserId: req.UserId,
|
|
|
- Mgo: it.Mgo,
|
|
|
PositionType: req.PositionType,
|
|
|
}
|
|
|
if req.Area != nil {
|
|
|
- subService.Area = req.Area
|
|
|
+ area := map[string]*bxsubscribe.CityList{}
|
|
|
+ for k, v := range req.Area {
|
|
|
+ cityList := &bxsubscribe.CityList{}
|
|
|
+ vv, _ := v.([]interface{})
|
|
|
+ cityList.City = common.ObjArrToStringArr(vv)
|
|
|
+ area[k] = cityList
|
|
|
+ }
|
|
|
+ subService.Area = area
|
|
|
}
|
|
|
if req.Apppush != "" {
|
|
|
subService.Apppush = req.Apppush
|
|
@@ -60,7 +65,9 @@ func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (r
|
|
|
return
|
|
|
}
|
|
|
if req.Items != nil {
|
|
|
- subService.Items = req.Items
|
|
|
+ items := []*bxsubscribe.Items{}
|
|
|
+ is := common.JsonUnmarshal(req.Items, &items).(*[]*bxsubscribe.Items)
|
|
|
+ subService.Items = *is
|
|
|
}
|
|
|
if req.Mail != "" {
|
|
|
subService.Mail = req.Mail
|
|
@@ -80,7 +87,7 @@ func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (r
|
|
|
if req.Ratemode != "" {
|
|
|
subService.Ratemode = req.Ratemode
|
|
|
}
|
|
|
- status, err := subService.Update()
|
|
|
+ rp, err := l.svcCtx.Suscribe.UpdateSubScribeInfo(l.ctx, subService)
|
|
|
if err != nil {
|
|
|
resp.Err_code, resp.Err_msg = -1, "修改失败"
|
|
|
l.Error(fmt.Sprintf("%+v", req), resp.Err_msg)
|
|
@@ -92,7 +99,7 @@ func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (r
|
|
|
"type": "o_vipjy",
|
|
|
})
|
|
|
resp.Data = map[string]interface{}{
|
|
|
- "status": status,
|
|
|
+ "status": rp.Status,
|
|
|
}
|
|
|
}
|
|
|
return
|