Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
31 rinda
653 B
31 rinda
653 B
pirms 4 gadiem
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"github.com/spf13/cobra"
|
||
|
"github.com/ztino/jd_seckill/common"
|
||
|
"github.com/ztino/jd_seckill/jd_seckill"
|
||
|
"log"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
rootCmd.AddCommand(reserveCmd)
|
||
|
}
|
||
|
|
||
|
var reserveCmd = &cobra.Command{
|
||
|
Use: "reserve",
|
||
|
Short: "Open JD Moutai buying appointment",
|
||
|
Run: startReserve,
|
||
|
}
|
||
|
|
||
|
func startReserve(cmd *cobra.Command, args []string) {
|
||
|
session:=jd_seckill.NewSession(common.CookieJar)
|
||
|
err:=session.CheckLoginStatus()
|
||
|
if err!=nil {
|
||
|
log.Println("预约失败,请重新登录")
|
||
|
}else{
|
||
|
//开始预约,预约过的就重复预约
|
||
|
seckill:=jd_seckill.NewSeckill(common.Client,common.Config)
|
||
|
seckill.MakeReserve()
|
||
|
}
|
||
|
}
|