完善社会服务业务层

This commit is contained in:
2025-10-29 11:44:33 +08:00
parent 84b92085a1
commit f9c73558a1
6 changed files with 100 additions and 6 deletions

View File

@@ -4,11 +4,14 @@
package socialService
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service/internal/logic/socialService"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func UpdateSocialServiceHandler(cfg *config.Config) http.HandlerFunc {
return
}
l := socialService.NewUpdateSocialServiceLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
meetingModel := model.NewSocialServiceModel(conn)
l := socialService.NewUpdateSocialServiceLogic(r.Context(), cfg, meetingModel)
resp, err := l.UpdateSocialService(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)