generated from bing/readnotes
feat 不知道改了什么
This commit is contained in:
parent
4e392e9746
commit
dc9d8b6e94
|
@ -3,9 +3,9 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"net/http"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func get(resp http.ResponseWriter, req *http.Request) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
||||
func main() {
|
||||
cmd := cobra.Command{
|
||||
Use: "cobra",
|
||||
|
|
|
@ -8,21 +8,36 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
|
||||
const (
|
||||
RedMax = 33
|
||||
BlueMax = 16
|
||||
)
|
||||
|
||||
func randRate(){
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
rate := rand.Intn(100) + 1
|
||||
fmt.Printf("\t (中奖概率%d%%)", rate)
|
||||
type ball struct{
|
||||
B int
|
||||
R []int
|
||||
Rate int
|
||||
}
|
||||
|
||||
func (b ball)display(){
|
||||
for _, r := range b.R {
|
||||
fmt.Printf("\033[1;31;40m%d\033[0m \t", r)
|
||||
}
|
||||
fmt.Printf("\033[1;34;40m%d\033[0m \t", b.B)
|
||||
fmt.Printf("\t (中奖概率%d%%)\n", b.Rate)
|
||||
}
|
||||
|
||||
func randRate() int {
|
||||
src := rand.NewSource(time.Now().UnixNano())
|
||||
rd := rand.New(src)
|
||||
rate := rd.Intn(100) + 1
|
||||
return rate
|
||||
}
|
||||
|
||||
func randBall(max int) int {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
return rand.Intn(max) + 1
|
||||
src := rand.NewSource(time.Now().UnixNano())
|
||||
rd := rand.New(src)
|
||||
return rd.Intn(max) + 1
|
||||
}
|
||||
|
||||
func isIn(list []int, item int) bool {
|
||||
|
@ -34,35 +49,46 @@ func isIn(list []int, item int )bool{
|
|||
return false
|
||||
}
|
||||
|
||||
func randDoubleBall(){
|
||||
balls := []int{}
|
||||
func randDoubleBall()ball{
|
||||
b := ball{}
|
||||
for i := 0; i < 6; {
|
||||
ball := randBall(RedMax)
|
||||
if isIn(balls, ball) {
|
||||
r := randBall(RedMax)
|
||||
if isIn(b.R, r) {
|
||||
continue
|
||||
}
|
||||
i++
|
||||
balls = append(balls, ball)
|
||||
b.R = append(b.R, r)
|
||||
}
|
||||
sort.Ints(balls)
|
||||
blueball := randBall(BlueMax)
|
||||
for _, ball := range balls {
|
||||
fmt.Printf("\033[1;31;40m%d\033[0m \t", ball)
|
||||
}
|
||||
fmt.Printf("\033[1;34;40m%d\033[0m \t", blueball)
|
||||
randRate()
|
||||
fmt.Println("")
|
||||
sort.Ints(b.R)
|
||||
b.B = randBall(BlueMax)
|
||||
b.Rate = randRate()
|
||||
return b
|
||||
}
|
||||
|
||||
func main() {
|
||||
var groups int
|
||||
flag.IntVar(&groups, "g", 1, "注数")
|
||||
var zhong bool
|
||||
flag.IntVar(&groups, "g", 0, "注数")
|
||||
flag.BoolVar(&zhong, "z", true, "必中")
|
||||
flag.Parse()
|
||||
if groups < 0 {
|
||||
if groups < 1 {
|
||||
groups = 1
|
||||
}else{
|
||||
zhong = false
|
||||
}
|
||||
if zhong {
|
||||
for {
|
||||
b := randDoubleBall()
|
||||
if b.Rate == 100 {
|
||||
b.display()
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
fmt.Printf("为您选取了 %d 注随机双色球,祝君中奖!\n", groups)
|
||||
for i := 0; i < groups; i++ {
|
||||
randDoubleBall()
|
||||
b:=randDoubleBall()
|
||||
b.display()
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package font
|
||||
|
||||
|
||||
|
||||
type Font struct {
|
||||
Head Head `json:"head"`
|
||||
}
|
|
@ -86,7 +86,6 @@ type NameTable struct {
|
|||
Style string `json:"style"`
|
||||
}
|
||||
|
||||
|
||||
type NameRecord struct {
|
||||
Platform uint16
|
||||
PlatformSpecific uint16
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
func get(c *gin.Context) {
|
||||
//c.ClientIP()
|
||||
log.Println()
|
||||
|
|
|
@ -7,8 +7,6 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
||||
|
||||
func show(file string) error {
|
||||
mp3File, err := id3v2.Open(file, id3v2.Options{Parse: true})
|
||||
if err != nil {
|
||||
|
|
|
@ -50,7 +50,7 @@ func (n *Notifier)recieveMessage(ctx context.Context){
|
|||
func (n *Notifier) notify(msg Message) {
|
||||
n.lock.Lock()
|
||||
defer n.lock.Unlock()
|
||||
clts, ok := n.userClients[msg.User];
|
||||
clts, ok := n.userClients[msg.User]
|
||||
if !ok || len(clts) == 0 {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -217,7 +217,6 @@ func (a *AliOSS) CheckFileVersion(obj string, info os.FileInfo) (bool, error) {
|
|||
return info.ModTime().Unix() >= modifiedAt, nil
|
||||
}
|
||||
|
||||
|
||||
// const host = "http://testspeed.xk.design"
|
||||
|
||||
const MAX = 300
|
||||
|
@ -320,7 +319,6 @@ func NewRequest(url string)(*http.Request, error){
|
|||
return req, nil
|
||||
}
|
||||
|
||||
|
||||
func test(f file, count int, host string) {
|
||||
fmt.Printf("begin normal testing for %s\n", f.Name)
|
||||
startedAt := time.Now().UnixMilli()
|
||||
|
@ -410,7 +408,6 @@ func filelist(dir string)([]string, error){
|
|||
return fs, nil
|
||||
}
|
||||
|
||||
|
||||
func case3(dir string, ak string, sk string, count int, host string) error {
|
||||
files, err := filelist(dir)
|
||||
if err != nil {
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ func (w *Wechat)GetGrantToken(code string)(*GrantToken, error){
|
|||
err = json.Unmarshal(data, &token)
|
||||
return &token, err
|
||||
}
|
||||
|
||||
// {"expire_seconds":"60","action_name": "QR_STR_SCENE", "action_info": {"scene": {"scene_str": '.$id.'}}}
|
||||
type Scene struct {
|
||||
Str string `json:"scene_str"`
|
||||
|
|
Loading…
Reference in New Issue