wangchuanjin hace 2 años
padre
commit
240c1f410d

BIN
jyBXBase/rpc/rpc.exe


BIN
jyBXSubscribe/api/api.exe


+ 3 - 0
jyBXSubscribe/api/etc/bxsubscribe-api.yaml

@@ -16,3 +16,6 @@ Subscribe:
 AppId: 10000
 MgoLogsName: jybxsubscribe_logs
 MgoLogsCount: 500
+UserCenterKey: "usercenter.rpc" #用户中台rpc
+PowerCheckCenterKey: "powercheck.rpc" #权益校验中台
+EntManageApplication: "entmanageapplication.rpc" #企业管理中台

+ 8 - 4
jyBXSubscribe/api/internal/config/config.go

@@ -1,9 +1,10 @@
 package config
 
 import (
+	"jyBXSubscribe/entity"
+
 	"github.com/zeromicro/go-zero/rest"
 	"github.com/zeromicro/go-zero/zrpc"
-	"jyBXSubscribe/entity"
 )
 
 type Config struct {
@@ -14,9 +15,12 @@ type Config struct {
 		ServerCode string
 		Etcd       []string
 	}
-	Subscribe    zrpc.RpcClientConf
-	MgoLogsName  string
-	MgoLogsCount int
+	Subscribe            zrpc.RpcClientConf
+	MgoLogsName          string
+	MgoLogsCount         int
+	UserCenterKey        string
+	PowerCheckCenterKey  string
+	EntManageApplication string
 }
 
 type Db struct {

+ 16 - 9
jyBXSubscribe/api/internal/logic/subscribeupdatelogic.go

@@ -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

+ 2 - 1
jyBXSubscribe/rpc/bxsubscribe.go

@@ -3,9 +3,10 @@ package main
 import (
 	"flag"
 	"fmt"
+	"log"
+
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/os/gcfg"
-	"log"
 
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/internal/server"

+ 5 - 2
jyBXSubscribe/rpc/etc/bxsubscribe.yaml

@@ -13,5 +13,8 @@ DefaulCount:
 CodeServiceConf:
   Etcd:
     Hosts:
-      - 127.0.0.1:2379
-    Key: codeservice.rpc
+      - 192.168.3.149:2379
+    Key: codeservice.rpc
+UserCenterKey: "usercenter.rpc" #用户中台rpc
+PowerCheckCenterKey: "powercheck.rpc" #权益校验中台
+EntManageApplication: "entmanageapplication.rpc" #企业管理中台

+ 0 - 6
jyBXSubscribe/rpc/etc/config.yaml

@@ -1,6 +0,0 @@
-etcd:
-  hosts:
-  - 192.168.3.206:2379
-userCenterKey: "usercenter.rpc" #用户中台rpc
-powerCheckCenterKey: "powercheck.rpc" #权益校验中台
-entManageApplication: "entmanageapplication.rpc" #企业管理中台

+ 7 - 9
jyBXSubscribe/rpc/init/init.go

@@ -1,17 +1,16 @@
 package init
 
 import (
+	"jyBXSubscribe/entity"
+	"jyBXSubscribe/rpc/internal/config"
+
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/middleground"
 	codePb "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
 	_ "github.com/go-sql-driver/mysql"
-	"github.com/gogf/gf/v2/frame/g"
-	"github.com/gogf/gf/v2/os/gctx"
 	"github.com/zeromicro/go-zero/core/discov"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/zrpc"
-	"jyBXSubscribe/entity"
-	"jyBXSubscribe/rpc/internal/config"
 )
 
 var C config.Config
@@ -35,11 +34,10 @@ func InitC() {
 	RedisInit(&DB.Redis)
 	//初始es
 	EsInit(&DB.Es)
-	var ctx = gctx.New()
-	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).
-		RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).
-		RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String()).
-		RegEntManageApplication(g.Cfg().MustGet(ctx, "entManageApplication").String())
+	Middleground = middleground.NewMiddleground(C.CodeServiceConf.Etcd.Hosts).
+		RegUserCenter(C.UserCenterKey).
+		RegPowerCheckCenter(C.PowerCheckCenterKey).
+		RegEntManageApplication(C.EntManageApplication)
 	Compatible = compatible.NewCompatible(&Mgo, BaseServiceMysql, MainMysql, Middleground)
 	if len(Logc.Level) > 0 {
 		for _, v := range Logc.Level {

+ 6 - 2
jyBXSubscribe/rpc/internal/config/config.go

@@ -1,8 +1,9 @@
 package config
 
 import (
-	"github.com/zeromicro/go-zero/zrpc"
 	"jyBXSubscribe/entity"
+
+	"github.com/zeromicro/go-zero/zrpc"
 )
 
 type Config struct {
@@ -13,7 +14,10 @@ type Config struct {
 		Pay  int
 		Free int
 	}
-	CodeServiceConf zrpc.RpcClientConf
+	CodeServiceConf      zrpc.RpcClientConf
+	UserCenterKey        string
+	PowerCheckCenterKey  string
+	EntManageApplication string
 }
 
 type Db struct {

+ 1 - 1
jyBXSubscribe/rpc/internal/logic/updatesubscribeinfologic.go

@@ -58,7 +58,7 @@ func (l *UpdateSubScribeInfoLogic) UpdateSubScribeInfo(in *bxsubscribe.UpdateSub
 				})
 			}
 			item["a_key"] = akey
-			items = append(items)
+			items = append(items, item)
 		}
 		subService.Items = items
 	}

+ 4 - 1
jyBXSubscribe/rpc/model/service/subscribe.go

@@ -4,13 +4,15 @@ package service
 import (
 	"errors"
 	"jyBXSubscribe/entity"
+	"log"
 
 	"strconv"
 
+	IC "jyBXSubscribe/rpc/init"
+
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"github.com/zeromicro/go-zero/core/logx"
-	IC "jyBXSubscribe/rpc/init"
 )
 
 //
@@ -97,6 +99,7 @@ func (this *SubseribeService) Update() (int64, error) {
 		i_otherbuyerclass, _ := strconv.Atoi(this.Otherbuyerclass)
 		setMap["o_vipjy.i_matchbuyerclass_other"] = i_otherbuyerclass
 	}
+	log.Println(this.UserId, "----------", setMap)
 	if ok := IC.Compatible.Update(this.UserId, map[string]interface{}{
 		"$set": setMap,
 	}); ok {