Explorar el Código

问题功能添加

WH01243 hace 5 meses
padre
commit
15fe777dbc

+ 1 - 3
api/aiSearch/aiSearch.go

@@ -15,8 +15,6 @@ type IAiSearchV1 interface {
 	LikeSession(ctx context.Context, req *v1.LikeSessionReq) (res *v1.LikeSessionRes, err error)
 	HistorySsList(ctx context.Context, req *v1.HistorySsListReq) (res *v1.HistorySsListRes, err error)
 	SessionDetail(ctx context.Context, req *v1.SessionDetailReq) (res *v1.SessionDetailRes, err error)
-	ProblemDelete(ctx context.Context, req *v1.ProblemDeleteReq) (res *v1.ProblemDeleteRes, err error)
-	ProblemList(ctx context.Context, req *v1.ProblemListReq) (res *v1.ProblemListRes, err error)
 	ProblemConfiguration(ctx context.Context, req *v1.ProblemConfigurationReq) (res *v1.ProblemConfigurationRes, err error)
-	ProblemCollect(ctx context.Context, req *v1.ProblemCollectReq) (res *v1.ProblemCollectRes, err error)
+	BiddingList(ctx context.Context, req *v1.BiddingListReq) (res *v1.BiddingListRes, err error)
 }

+ 5 - 20
api/aiSearch/v1/aiSearchApi.go

@@ -43,24 +43,7 @@ type SessionDetailRes struct {
 	ErrorMsg  string      `dc:"错误信息"`
 	Data      interface{} `dc:"返回数据"`
 }
-type ProblemDeleteReq struct {
-	g.Meta `path:"/problem/delete" tags:"AiSearch" method:"post" summary:"问题删除"`
-}
-
-type ProblemDeleteRes struct {
-	ErrorCode int         `dc:"状态码"`
-	ErrorMsg  string      `dc:"错误信息"`
-	Data      interface{} `dc:"返回数据"`
-}
-type ProblemListReq struct {
-	g.Meta `path:"/problem/list" tags:"AiSearch" method:"post" summary:"问题列表"`
-}
 
-type ProblemListRes struct {
-	ErrorCode int         `dc:"状态码"`
-	ErrorMsg  string      `dc:"错误信息"`
-	Data      interface{} `dc:"返回数据"`
-}
 type ProblemConfigurationReq struct {
 	g.Meta `path:"/problem/configuration" tags:"AiSearch" method:"post" summary:"问题配置"`
 }
@@ -70,11 +53,13 @@ type ProblemConfigurationRes struct {
 	ErrorMsg  string      `dc:"错误信息"`
 	Data      interface{} `dc:"返回数据"`
 }
-type ProblemCollectReq struct {
-	g.Meta `path:"/problem/collect" tags:"AiSearch" method:"post" summary:"问题收藏"`
+
+type BiddingListReq struct {
+	g.Meta `path:"/bidding/List" tags:"AiSearch" method:"post" summary:"报讯列表"`
+	ChatId int64 `json:"chatId" dc:"聊天Id"`
 }
 
-type ProblemCollectRes struct {
+type BiddingListRes struct {
 	ErrorCode int         `dc:"状态码"`
 	ErrorMsg  string      `dc:"错误信息"`
 	Data      interface{} `dc:"返回数据"`

+ 46 - 0
internal/controller/aiSearch/aiSearch_v1_bidding_list.go

@@ -0,0 +1,46 @@
+package aiSearch
+
+import (
+	"aiChat/api/aiSearch/v1"
+	"aiChat/internal/model"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"context"
+	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+)
+
+func (c *ControllerV1) BiddingList(ctx context.Context, req *v1.BiddingListReq) (res *v1.BiddingListRes, err error) {
+	var hTmp []ResBidding
+	session := model.SessionCtx.Get(ctx).JSession
+	if session.PositionId <= 0 {
+		return nil, fmt.Errorf("请登录")
+	}
+	err = g.Model("ai_search_bidding").Where("chat_id = ? and  position_id=?", req.ChatId, session.PositionId).OrderDesc("create_time").Scan(&hTmp)
+	if hTmp != nil && len(hTmp) > 0 {
+		for i := len(hTmp) - 1; i >= 0; i-- {
+			data := hTmp[i]
+			data.InfoId = encrypt.EncodeArticleId2ByCheck(data.InfoId)
+			hTmp[i] = data
+		}
+	}
+	return &v1.BiddingListRes{
+		ErrorCode: 0,
+		ErrorMsg:  "",
+		Data:      hTmp,
+	}, nil
+}
+
+type ResBidding struct {
+	InfoId        string  `json:"infoId" dc:"内容"`
+	Id            string  `json:"id" dc:"信息加密id"`
+	Title         string  `json:"title" dc:"内容"`
+	Area          string  `json:"area" dc:"内容"`
+	Subtype       string  `json:"subtype" dc:"内容"`
+	Annex         string  `json:"annex" dc:"内容"`
+	Subscopeclass string  `json:"subscopeclass" dc:"内容"`
+	Buyerclass    string  `json:"buyerclass" dc:"内容"`
+	Budget        float64 `json:"budget" dc:"内容"`
+	Bidanount     float64 `json:"bidanount" dc:"内容"`
+	Publishtime   string  `json:"publishtime" dc:"内容"`
+	Create_time   string  `json:"create_time" dc:"内容"`
+}

+ 0 - 14
internal/controller/aiSearch/aiSearch_v1_problem_collect.go

@@ -1,14 +0,0 @@
-package aiSearch
-
-import (
-	"context"
-
-	"github.com/gogf/gf/v2/errors/gcode"
-	"github.com/gogf/gf/v2/errors/gerror"
-
-	"aiChat/api/aiSearch/v1"
-)
-
-func (c *ControllerV1) ProblemCollect(ctx context.Context, req *v1.ProblemCollectReq) (res *v1.ProblemCollectRes, err error) {
-	return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}

+ 5 - 4
internal/controller/aiSearch/aiSearch_v1_problem_configuration.go

@@ -2,13 +2,14 @@ package aiSearch
 
 import (
 	"context"
-
-	"github.com/gogf/gf/v2/errors/gcode"
-	"github.com/gogf/gf/v2/errors/gerror"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/util/gconv"
 
 	"aiChat/api/aiSearch/v1"
 )
 
 func (c *ControllerV1) ProblemConfiguration(ctx context.Context, req *v1.ProblemConfigurationReq) (res *v1.ProblemConfigurationRes, err error) {
-	return nil, gerror.NewCode(gcode.CodeNotImplemented)
+	return &v1.ProblemConfigurationRes{
+		Data: gconv.Maps(g.Cfg("./manifest/config/ai_search.yaml").MustGet(ctx, "initConifg")),
+	}, nil
 }

+ 0 - 14
internal/controller/aiSearch/aiSearch_v1_problem_delete.go

@@ -1,14 +0,0 @@
-package aiSearch
-
-import (
-	"context"
-
-	"github.com/gogf/gf/v2/errors/gcode"
-	"github.com/gogf/gf/v2/errors/gerror"
-
-	"aiChat/api/aiSearch/v1"
-)
-
-func (c *ControllerV1) ProblemDelete(ctx context.Context, req *v1.ProblemDeleteReq) (res *v1.ProblemDeleteRes, err error) {
-	return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}

+ 0 - 14
internal/controller/aiSearch/aiSearch_v1_problem_list.go

@@ -1,14 +0,0 @@
-package aiSearch
-
-import (
-	"context"
-
-	"github.com/gogf/gf/v2/errors/gcode"
-	"github.com/gogf/gf/v2/errors/gerror"
-
-	"aiChat/api/aiSearch/v1"
-)
-
-func (c *ControllerV1) ProblemList(ctx context.Context, req *v1.ProblemListReq) (res *v1.ProblemListRes, err error) {
-	return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}

+ 0 - 9
main.go

@@ -6,19 +6,10 @@ import (
 	"aiChat/utility/fsw"
 	_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
 	_ "github.com/gogf/gf/contrib/nosql/redis/v2"
-	"github.com/gogf/gf/v2/frame/g"
-	"github.com/gogf/gf/v2/os/gcfg"
 	"github.com/gogf/gf/v2/os/gctx"
-	"log"
 )
 
 func main() {
 	fsw.ReadFswDirDict("./manifest/fsw/")
 	cmd.Main.Run(gctx.New())
 }
-func init() {
-	g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("./manifest/config/ai_search.yaml")
-	var ctx = gctx.New()
-	log.Println(g.Cfg().MustGet(ctx, "aaa").Int64())
-	log.Println(g.Cfg().MustGet(ctx, "server.address").Strings())
-}

+ 13 - 1
manifest/config/ai_search.yaml

@@ -1 +1,13 @@
-aaa: 111
+initConifg:
+  - goodsName: 看标讯
+    goodsType: 1
+    isUsed: true
+  - goodsName: 看项目
+    goodsType: 2
+    isUsed: false
+  - goodsName: 看企业
+    goodsType: 3
+    isUsed: false
+  - goodsName: 看市场
+    goodsType: 4
+    isUsed: false