wangchuanjin 2 жил өмнө
parent
commit
33e50e79e4

+ 17 - 0
rpc/db/db.go

@@ -0,0 +1,17 @@
+package db
+
+import (
+	. "app.yhyue.com/moapp/jybase/mysql"
+	"github.com/zeromicro/go-zero/core/logx"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/internal/config"
+)
+
+var (
+	Mysql_BaseService *Mysql
+)
+
+func Init(c config.Config) {
+	Mysql_BaseService = c.Mysql.BaseService
+	Mysql_BaseService.Init()
+	logx.Info("初始化 mysql baseService")
+}

+ 7 - 5
rpc/publicservice.go

@@ -4,16 +4,16 @@ import (
 	"flag"
 	"fmt"
 
-	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/internal/config"
-	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/internal/server"
-	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/internal/svc"
-	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/pb"
-
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/service"
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/reflection"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/db"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/internal/config"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/internal/server"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/internal/svc"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/pb"
 )
 
 var configFile = flag.String("f", "etc/publicservice.yaml", "the config file")
@@ -23,6 +23,8 @@ func main() {
 
 	var c config.Config
 	conf.MustLoad(*configFile, &c)
+	//初始化数据库
+	db.Init(c)
 	ctx := svc.NewServiceContext(c)
 	svr := server.NewDatasmtServer(ctx)
 

BIN
rpc/rpc.exe


+ 18 - 0
rpc/service/datasmt.go

@@ -0,0 +1,18 @@
+package service
+
+import (
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/pb"
+)
+
+type DataSmt struct {
+}
+
+//
+func (d *DataSmt) List(searchValue, dataType string, pageNum int) *pb.DatasmtRespList {
+	return &pb.DatasmtRespList{}
+}
+
+//
+func (d *DataSmt) Detail(id string) *pb.DatasmtRespDetail {
+	return &pb.DatasmtRespDetail{}
+}

+ 19 - 0
rpc/service/datasmt_test.go

@@ -0,0 +1,19 @@
+package service
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestDeduction(t *testing.T) {
+	// 医疗标讯搜索	lyh_yl_ylbxss
+	// 医疗机构搜索	lyh_yl_yljgss
+	// 经销商搜索		lyh_yl_jxsss
+	// 医疗机构画像	lyh_yl_yljghx
+	// 医疗机构认领	lyh_yl_yljgrl
+	// 经销商认领		lyh_yl_jxsrl
+	status, err := Deduction("10000", "ai_helper", 13485, 0, 1, []string{"test"})
+	assert.Nil(t, err)
+	assert.Equal(t, int64(1), status)
+}