You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
495 B
27 lines
495 B
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"github.com/ztino/jd_seckill/common"
|
|
"github.com/ztino/jd_seckill/log"
|
|
"os"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(logoutCmd)
|
|
}
|
|
|
|
var logoutCmd = &cobra.Command{
|
|
Use: "logout",
|
|
Short: "Open JD’s simulated logout",
|
|
Run: startLogout,
|
|
}
|
|
|
|
func startLogout(cmd *cobra.Command, args []string) {
|
|
if common.Exists("./cookie.txt") {
|
|
_=os.Remove("./cookie.txt")
|
|
log.Println("退出成功")
|
|
}else{
|
|
log.Println("退出失败,未登录")
|
|
}
|
|
}
|