x
This commit is contained in:
parent
72e74e6bcf
commit
0064d5e304
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,4 +21,5 @@ conf/config.yaml
|
||||
conf/config_cdle.yaml
|
||||
conf/reply.php
|
||||
jdCookie.js
|
||||
scripts/node_modules
|
||||
scripts/node_modules
|
||||
task/*
|
||||
@ -18,15 +18,15 @@ type Task struct {
|
||||
Cron string
|
||||
Path string
|
||||
Enable bool
|
||||
Mode string //obo alo
|
||||
Mode string
|
||||
Word string
|
||||
Run func()
|
||||
Name string
|
||||
Timeout int
|
||||
Envs []Env
|
||||
Args string
|
||||
Ykq bool
|
||||
Hack bool
|
||||
From string
|
||||
}
|
||||
|
||||
type Env struct {
|
||||
|
||||
@ -41,6 +41,7 @@ func NewActiveUser(class string, uid int, msgs ...interface{}) {
|
||||
var first = false
|
||||
total := []int{}
|
||||
err := db.Where("class = ? and number = ?", class, uid).First(&u).Error
|
||||
get := 0
|
||||
if err != nil {
|
||||
first = true
|
||||
u = User{
|
||||
@ -59,6 +60,7 @@ func NewActiveUser(class string, uid int, msgs ...interface{}) {
|
||||
"active_at": ntime,
|
||||
"coin": gorm.Expr("coin+1"),
|
||||
})
|
||||
get++
|
||||
u.Coin++
|
||||
} else {
|
||||
msg += fmt.Sprintf("你打过卡了,许愿币余额%d。", u.Coin)
|
||||
@ -67,7 +69,14 @@ func NewActiveUser(class string, uid int, msgs ...interface{}) {
|
||||
}
|
||||
if first {
|
||||
db.Model(User{}).Select("count(id) as total").Where("active_at > ?", zero).Pluck("total", &total)
|
||||
msg += fmt.Sprintf("你是打卡第%d人,奖励%d个许愿币,许愿币余额%d。", total[0]+1, 1, u.Coin)
|
||||
if (total[0]+1)%8 == 0 {
|
||||
db.Model(&u).Updates(map[string]interface{}{
|
||||
"coin": gorm.Expr("coin+1"),
|
||||
})
|
||||
get++
|
||||
u.Coin++
|
||||
}
|
||||
msg += fmt.Sprintf("你是打卡第%d人,奖励%d个许愿币,许愿币余额%d。", total[0]+1, get, u.Coin)
|
||||
// fmt.Println(msg)
|
||||
sendMessagee(msg, msgs...)
|
||||
}
|
||||
|
||||
@ -34,26 +34,6 @@ func initVersion() {
|
||||
return
|
||||
}
|
||||
(&JdCookie{}).Push("版本过低,自动更新")
|
||||
// rsp, err := httplib.Get(GhProxy + "https://github.com/cdle/jd_study/releases/download/main/" + name).Response()
|
||||
// if err != nil {
|
||||
// logs.Warn("无法下载更新")
|
||||
// return
|
||||
// }
|
||||
// filename := ExecPath + "/." + pname
|
||||
// f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
// if err != nil {
|
||||
// logs.Warn("无法创建更新临时文件:%v"+filename, err)
|
||||
// return
|
||||
// }
|
||||
// _, err = io.Copy(f, rsp.Body)
|
||||
// f.Close()
|
||||
// if err != nil {
|
||||
// logs.Warn("下载更新失败")
|
||||
// return
|
||||
// }
|
||||
// if err := os.Rename(filename, ExecPath+"/"+pname); err != nil {
|
||||
// logs.Warn("移动临时更新文件失败")
|
||||
// }
|
||||
Daemon()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user