Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
21888 committed Sep 15, 2022
0 parents commit 129dc04
Show file tree
Hide file tree
Showing 17 changed files with 15,135 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 羊了个羊在线刷榜通关辅助小工具

# API地址
```
/chabai/v1
req {
token: string
}
```
# web地址
`/assets/index.htm`
37 changes: 37 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module service

go 1.17

require github.com/zeromicro/go-zero v1.4.0

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/openzipkin/zipkin-go v0.4.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
go.opentelemetry.io/otel v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.9.0 // indirect
go.opentelemetry.io/otel/sdk v1.9.0 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.uber.org/automaxprocs v1.5.1 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
google.golang.org/genproto v0.0.0-20220602131408-e326c6e8e9c8 // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
828 changes: 828 additions & 0 deletions go.sum

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions yang/etc/chabai-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Name: chabai-api
Host: 0.0.0.0
Port: 8888
7 changes: 7 additions & 0 deletions yang/internal/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package config

import "github.com/zeromicro/go-zero/rest"

type Config struct {
rest.RestConf
}
28 changes: 28 additions & 0 deletions yang/internal/handler/comehandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package handler

import (
"net/http"

"github.com/zeromicro/go-zero/rest/httpx"
"service/yang/internal/logic"
"service/yang/internal/svc"
"service/yang/internal/types"
)

func ComeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ComeReq
if err := httpx.Parse(r, &req); err != nil {
httpx.Error(w, err)
return
}

l := logic.NewComeLogic(r.Context(), svcCtx)
resp, err := l.Come(&req)
if err != nil {
httpx.Error(w, err)
} else {
httpx.OkJson(w, resp)
}
}
}
22 changes: 22 additions & 0 deletions yang/internal/handler/routes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions yang/internal/logic/comelogic.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package logic

import (
"context"
"fmt"
"io/ioutil"
"net/http"
"service/yang/internal/svc"
"service/yang/internal/types"
"strings"

"github.com/zeromicro/go-zero/core/logx"
)

type ComeLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}

func NewComeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ComeLogic {
return &ComeLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}

func (l *ComeLogic) Come(req *types.ComeReq) (resp *types.ComeResp, err error) {
// ------------------------------------
// - 检查是否为空
// ------------------------------------
if req.Token == "" {
return &types.ComeResp{
Code: 201,
Msg: "token is empty",
}, nil
}
// ------------------------------------
// - request
// ------------------------------------
client := &http.Client{}
httpReq, err := http.NewRequest("GET",
fmt.Sprintf("https://cat-match.easygame2021.com/sheep/v1/game/game_over?rank_score=1&rank_state=1&rank_time=1&rank_role=1&skin=1&t=%v", req.Token),
nil)
if err != nil {
return &types.ComeResp{
Code: 202,
Msg: "request is error",
}, nil
}
//httpReq.Header.Set("accept", "application/json, text/plain, */*")
//httpReq.Header.Set("token", "")
httpResp, err := client.Do(httpReq)
if err != nil {
return &types.ComeResp{
Code: 202,
Msg: "request is error",
}, nil
}
bodyText, err := ioutil.ReadAll(httpResp.Body)
if err != nil {
return &types.ComeResp{
Code: 202,
Msg: "request is error",
}, nil
}
if strings.Contains(string(bodyText), "没有权限") {
return &types.ComeResp{
Code: 203,
Msg: "token is invalid",
}, nil
}

return &types.ComeResp{
Code: 200,
Msg: string(bodyText),
}, nil
}
15 changes: 15 additions & 0 deletions yang/internal/svc/servicecontext.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package svc

import (
"service/yang/internal/config"
)

type ServiceContext struct {
Config config.Config
}

func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
}
}
11 changes: 11 additions & 0 deletions yang/internal/types/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions yang/web/assets/ajax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

function trim (str) { //去掉头尾空格
return str.replace(/(^\s*)|(\s*$)/g, "");
}

function cx (token, num) {
$('#submit').hide();


$('#load').html('正在通关,请稍等...');
var i = 0;
var win = 0;
var count = 0;
for (i; i < num; i++) {
$.ajax({
type: "POST",
url: "http://gg.liujiaweixiaoman.cn/chabai/v1/",
contentType: "application/json",
data: JSON.stringify({ "token": token }),
dataType: "json",
success: function (data) {
if (data.code === 200) {
$('#log').html($('#log').html() + "第" + (count+1) + "次成功" + '\n');
win++;
} else {
$('#log').html($('#log').html() + "第" + (count+1) + "次失败" + '\n' + "已结束!");
return;
}
count++;
if (count == num) {
$('#submit').show();
$('#load').html('已通关' + win + '次');

}

},

});



//$('#submit').show();
}
}
$(document).ready(function () {

$('#submit').click(function () {
var self = $(this);
var token = trim($('#uin').val());
var num = trim($('#num').val());
if (token == '') {
alert("请输入Token!");
return false;
}

$('#load').show();
$("#log").html("");
cx(token, num);
});


});
68 changes: 68 additions & 0 deletions yang/web/assets/index.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>羊了个羊在线刷榜小工具</title>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.12.0/js/md5.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/mdui.min.css" integrity="sha384-cLRrMq39HOZdvE0j6yBojO4+1PrHfB7a9l5qLcmRm/fiWXYY+CndJPmyu5FV/9Tw" crossorigin="anonymous" />
<script src="mdui.min.js" integrity="sha384-gCMZcshYKOGRX9r6wbDrvF+TcCCswSHFucUzUPwka+Gr+uHgjlYvkABr95TCOz3A" crossorigin="anonymous"></script>
<link rel="stylesheet" href="oneui.css">
<img style="background: linear-gradient(to bottom,#104E8B,#9FB6CD);" class="full-bg full-bg-bottom" ondragstart="return false;" oncontextmenu="return false;">

</head>

<body>
<br>
<div class="container">
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 center-block" style="float: none;">
<div class="panel panel-primary">
<div class="panel-heading" style="text-align: center;"><h3 class="panel-title">
羊了个羊</h3>
</div>
<div class="panel-body" style="text-align: center;">

<div class="list-group">

<div id="login" class="list-group-item">
<div class="form-group">
<div class="input-group"><div class="input-group-addon">Token</div>
<input type="text" id="uin" value="" class="form-control">
</div></div>
<div class="input-group"><div class="input-group-addon">通关次数</div>
<input id="num" value="1" oninput="value=value.replace(/[^\d]/g,'');if(value>1000)value=1000" class="form-control">
</div></div>
<button type="button" id="submit" class="mdui-btn mdui-btn-block mdui-color-blue-100 mdui-ripple mdui-btn-raised">立即通关</button>

</div>
<div class="list-group">

</div>
<div class="mdui-table-fluid" id="liebiao" >
<textarea id="log" class="form-control" rows="10" readonly></textarea>
</div>
</div>
<center><h1>防止和谐,请务必复制网址到浏览器打开!</h1></center>
<center><h1><a href="https://jq.qq.com/?_wv=1027&k=IyM8tjjN" target="_blank" style="color:red">点我加入交流群</a></h1></center>
<center><h2><a href="https://jq.qq.com/?_wv=1027&k=IyM8tjjN" target="_blank" style="color:red">IOS教程</a></h2></center>
<center><h2><a href="https://jq.qq.com/?_wv=1027&k=IyM8tjjN" target="_blank" style="color:red">安卓教程</a></h2></center>
</div>
</div>
</div>

</body>
<script>
// 统计代码
</script>
<script src="ajax.js?ver=22"></script>

</html>
7 changes: 7 additions & 0 deletions yang/web/assets/mdui.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 129dc04

Please sign in to comment.