Compare commits
2 Commits
27daf68736
...
5d262d25c3
Author | SHA1 | Date | |
---|---|---|---|
5d262d25c3 | |||
c6ac5c15da |
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/hyxc/golang:alpine-1.18 as builder
|
||||
|
||||
WORKDIR /builder
|
||||
COPY . .
|
||||
VOLUME /tmp/drone_cache
|
||||
VOLUME /cache
|
||||
RUN go mod tidy && go mod download && go build -o wineApp .
|
||||
RUN ls -lh && chmod +x ./wineApp
|
||||
|
||||
FROM alpine:3.13.4 as runner
|
||||
RUN echo "http://mirrors.aliyun.com/alpine/v3.13/main/" > /etc/apk/repositories
|
||||
RUN echo "http://mirrors.aliyun.com/alpine/v3.13/community/" >> /etc/apk/repositories
|
||||
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone \
|
||||
&& apk del tzdata
|
||||
|
||||
COPY --from=builder /builder/wineApp .
|
||||
|
||||
ADD config.yaml /config.yaml
|
||||
|
||||
CMD ./wineApp
|
@ -26,5 +26,5 @@ aliyun:
|
||||
|
||||
tencent:
|
||||
mini-app:
|
||||
app-id: wxcac07f5e3d0dedf0
|
||||
app-secret: 431d9dad0c96c2b7020da7d23c761196
|
||||
app-id: wx29f3e0dc2f7f2c54
|
||||
app-secret: 95a893451cf25b696612a7d1735a04b8
|
3
main.go
3
main.go
@ -4,6 +4,7 @@ import (
|
||||
"Lee-WineList/config"
|
||||
"Lee-WineList/core"
|
||||
"Lee-WineList/initialize"
|
||||
"Lee-WineList/oauth2"
|
||||
appRoute "Lee-WineList/router"
|
||||
"fmt"
|
||||
"git.echol.cn/loser/logger/log"
|
||||
@ -18,7 +19,7 @@ var g errgroup.Group
|
||||
// 系统初始化
|
||||
func init() {
|
||||
initialize.InitSystem() // 初始化系统配置
|
||||
//oauth2.InitOAuth2Server() // 初始化OAuth2服务
|
||||
oauth2.InitOAuth2Server() // 初始化OAuth2服务
|
||||
}
|
||||
|
||||
// 启动入口
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"Lee-WineList/common/constant"
|
||||
"Lee-WineList/model/entity"
|
||||
"Lee-WineList/repository"
|
||||
"Lee-WineList/utils"
|
||||
"errors"
|
||||
"git.echol.cn/loser/logger/log"
|
||||
"strconv"
|
||||
@ -16,24 +15,24 @@ func getUser(account string, loginType constant.LoginType, nikeName string, avat
|
||||
|
||||
// 定义微信小程序信息
|
||||
//var unionId, openId, sessionKey string
|
||||
var mobile string
|
||||
//var mobile string
|
||||
// 定义用户信息
|
||||
var user entity.User
|
||||
switch loginType {
|
||||
case constant.LoginTypeWeChatMiniApp:
|
||||
mobile, err = utils.WeChatUtils().GetPhoneNumber(account)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if mobile == "" {
|
||||
err = errors.New("获取手机号失败")
|
||||
return
|
||||
}
|
||||
user.Phone = mobile
|
||||
//mobile, err = utils.WeChatUtils().GetPhoneNumber(account)
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
//if mobile == "" {
|
||||
// err = errors.New("获取手机号失败")
|
||||
// return
|
||||
//}
|
||||
//user.Phone = mobile
|
||||
user.Nickname = nikeName
|
||||
user.Avatar = avatarUrl
|
||||
default:
|
||||
user.Phone = account
|
||||
//user.Phone = account
|
||||
user.Nickname = nikeName
|
||||
user.Avatar = avatarUrl
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user