-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
644 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM golang:1.17 as builder | ||
|
||
RUN apt-get update && apt-get install -y libasound2-dev | ||
|
||
ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct | ||
ENV GO111MODULE=on | ||
|
||
WORKDIR /go/cache | ||
ADD go.mod . | ||
ADD go.sum . | ||
RUN go mod download | ||
|
||
WORKDIR /work | ||
ADD . . | ||
RUN GOOS=linux CGO_ENABLED=1 GOARCH=amd64 go build -ldflags="-w -s" -o /usr/local/bin/ddshop github.com/zc2638/ddshop/cmd/ddshop | ||
|
||
FROM alpine:3.6 | ||
MAINTAINER zc | ||
LABEL maintainer="zc" \ | ||
email="[email protected]" | ||
|
||
ENV TZ="Asia/Shanghai" | ||
|
||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \ | ||
apk update && \ | ||
apk --no-cache add tzdata ca-certificates libc6-compat libgcc libstdc++ alsa-lib-dev | ||
|
||
COPY --from=builder /usr/local/bin/ddshop /usr/local/bin/ddshop | ||
COPY --from=builder /work/config/config.yaml /work/config/config.yaml | ||
|
||
WORKDIR /work | ||
CMD ["ddshop", "-c", "config/config.yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cookie: "" | ||
interval: 100 # 连续发起请求间隔时间(ms) | ||
payType: "wechat" # 支付方式:支付宝、alipay、微信、wechat | ||
barkKey: "" # Bark 通知推送的 Key | ||
#periods: # 抢购时间段 | ||
# - start: "05:59" | ||
# end: "06:10" | ||
# - start: "08:29" | ||
# end: "08:35" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright © 2022 zc2638 <[email protected]>. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package core | ||
|
||
type Config struct { | ||
Cookie string `json:"cookie"` | ||
Interval int64 `json:"interval"` | ||
PayType string `json:"payType"` | ||
BarkKey string `json:"barkKey"` | ||
Periods []TimePeriod `json:"periods"` | ||
} | ||
|
||
type TimePeriod struct { | ||
Start string `json:"start"` | ||
End string `json:"end"` | ||
|
||
startHour int | ||
startMinute int | ||
endHour int | ||
endMinute int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.