mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-10 11:13:44 +08:00
发布代码生成、更新20+表单组件,优化数据字典,gf版本更新到2.3.1
This commit is contained in:
@@ -33,16 +33,31 @@ func (c *cSite) Ping(ctx context.Context, req *common.SitePingReq) (res *common.
|
||||
|
||||
// Config 获取配置
|
||||
func (c *cSite) Config(ctx context.Context, req *common.SiteConfigReq) (res *common.SiteConfigRes, err error) {
|
||||
|
||||
wsAddr, _ := g.Cfg().Get(ctx, "hotgo.wsAddr", "ws://127.0.0.1:8000/ws")
|
||||
g.Log().Warningf(ctx, "wsAddr:%+v", wsAddr.String())
|
||||
res = &common.SiteConfigRes{
|
||||
Version: consts.VersionApp,
|
||||
WsAddr: wsAddr.String(),
|
||||
WsAddr: c.getWsAddr(ctx),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cSite) getWsAddr(ctx context.Context) string {
|
||||
ws := g.Cfg().MustGet(ctx, "hotgo.wsAddr", "ws://127.0.0.1:8000/socket")
|
||||
return ws.String()
|
||||
|
||||
//// nginx负载均衡部署
|
||||
//// 如果是IP访问,则认为是调试模式,走配置中的ws地址,否则走实际请求中的域名+协议
|
||||
//if !validate.IsDNSName(ghttp.RequestFromCtx(ctx).Host) {
|
||||
// ws := g.Cfg().MustGet(ctx, "hotgo.wsAddr", "ws://127.0.0.1:8000/socket")
|
||||
// return ws.String()
|
||||
//}
|
||||
//
|
||||
//if !validate.IsHTTPS(ctx) {
|
||||
// return fmt.Sprintf("ws://%s/socket", url.GetDomain(ctx))
|
||||
//}
|
||||
//
|
||||
//return fmt.Sprintf("wss://%s/socket", url.GetDomain(ctx))
|
||||
}
|
||||
|
||||
// Captcha 登录验证码
|
||||
func (c *cSite) Captcha(ctx context.Context, req *common.LoginCaptchaReq) (res *common.LoginCaptchaRes, err error) {
|
||||
|
||||
|
||||
@@ -34,3 +34,20 @@ func (c *cUpload) UploadImage(ctx context.Context, req *common.UploadImageReq) (
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UploadFile 上传附件
|
||||
func (c *cUpload) UploadFile(ctx context.Context, req *common.UploadFileReq) (res common.UploadFileRes, err error) {
|
||||
r := g.RequestFromCtx(ctx)
|
||||
file := r.GetUploadFile("file")
|
||||
if file == nil {
|
||||
err = gerror.New("没有找到上传的文件")
|
||||
return
|
||||
}
|
||||
|
||||
res, err = service.CommonUpload().UploadFile(ctx, file)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user