forked from maybe1229/jd-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_share_codes.sh.sample
executable file
·119 lines (103 loc) · 3.54 KB
/
create_share_codes.sh.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export LC_ALL=C
## 按以下格式修改为自己的种豆得豆互助码,每个互助码间使用换行来分开,首尾一对引号
## 如不需要提交此互助码,删除互助码即可
ShareCodesBean="mze7pstbax4l7u5ggn5y2olhfy
3nwlq2wyvmz7sn4d5akh4rnrczsih2dehcx7as4ym6fgb3q7y5tq
olmijoxgmjutybihibx67mwivxbag4rjviz3cji
rsuben7ys7sfbu5eub7knbibke
olmijoxgmjutzexyge246xwmaxy43t3jsqc74zy"
## 按以下格式修改为自己的东东农场互助码,每个互助码间使用换行来分开,首尾一对引号
## 如不需要提交此互助码,删除互助码即可
ShareCodesFarm="e6e04602d5e343258873af1651b603ec
52801b06ce2a462f95e1d59d7e856ef4
e2fd1311229146cc9507528d0b054da8
6dc9461f662d490991a31b798f624128
30f29addd75d44e88fb452bbfe9f2110"
## 按以下格式修改为自己的东东萌宠互助码,每个互助码间使用换行来分开,首尾一对引号
## 如不需要提交此互助码,删除互助码即可
ShareCodesPet="MTE1NDQ5OTIwMDAwMDAwMzU5ODAzOTk=
MTE1NDUwMTI0MDAwMDAwMDM2MTUyNjE1
MTE1NDAxNzgwMDAwMDAwMzgyMTUyNTU=
MTE1NDAxNzgwMDAwMDAwMzgyMDk2MTk=
MTE1NDUyMjEwMDAwMDAwMzkxOTg1Mzc="
## 如果你希望在向服务器提交互助码后反馈提交结果,请补充ServerChan的SCKEY
## 教程:http://sc.ftqq.com/3.version
## 我懒,只做了ServerChan的通知渠道,其他不想做
SCKEY=""
################################## 以下勿动 ##################################
## 路径
ShellDir=$(cd $(dirname $0); pwd)
RootDir=$(cd $(dirname $0); cd ..; pwd)
ScriptsDir=${RootDir}/scripts
LogDir=${RootDir}/log
LogFile=${LogDir}/create_share_codes/create_share_codes.log
CreateURLBean="http://api.turinglabs.net/api/v1/jd/bean/create/"
CreateURLFarm="http://api.turinglabs.net/api/v1/jd/farm/create/"
CreateURLPet="http://api.turinglabs.net/api/v1/jd/pet/create/"
URLServerChan="https://sc.ftqq.com/"
## 删除旧的日志,创建新的日志
if [ ! -d ${LogDir}/create_share_codes ]; then
mkdir -p ${LogDir}/create_share_codes
fi
cd ${LogDir}/create_share_codes/
rm -f ${LogFile}
touch ${LogFile}
# 提交种豆得豆互助码
function CreateCodesBean {
echo -e "种豆得豆:\n\n" >> ${LogFile}
for Code in ${ShareCodesBean}
do
sleep 10
wget -q -O ${Code} ${CreateURLBean}${Code}
echo -n "${Code}: " >> ${LogFile}
cat ${Code} >> ${LogFile}
echo -e "\n\n" >> ${LogFile}
rm -f ${Code}
done
echo -e "\n\n" >> ${LogFile}
}
## 提交东东农场互助码
function CreateCodesFarm {
echo -e "东东农场:\n\n" >> ${LogFile}
for Code in ${ShareCodesFarm}
do
sleep 10
wget -q -O ${Code} ${CreateURLFarm}${Code}
echo -n "${Code}: " >> ${LogFile}
cat ${Code} >> ${LogFile}
echo -e "\n\n" >> ${LogFile}
rm -f ${Code}
done
echo -e "\n\n" >> ${LogFile}
}
## 提交东东萌宠互助码
function CreateCodesPet {
echo -e "东东萌宠:\n\n" >> ${LogFile}
for Code in ${ShareCodesPet}
do
sleep 10
wget -q -O ${Code} ${CreateURLPet}${Code}
echo -n "${Code}: " >> ${LogFile}
cat ${Code} >> ${LogFile}
echo -e "\n\n" >> ${LogFile}
rm -f ${Code}
done
echo -e "\n\n" >> ${LogFile}
}
## 向服务器提交互助码
if [ -n "${ShareCodesBean}" ]; then
CreateCodesBean
fi
if [ -n "${ShareCodesFarm}" ]; then
CreateCodesFarm
fi
if [ -n "${ShareCodesPet}" ]; then
CreateCodesPet
fi
## 向方糖发送消息
if [ -n "${SCKEY}" ]; then
desp=$(cat ${LogFile})
wget -q --output-document=/dev/null --post-data="text=互助码提交状态&desp=${desp}" ${URLServerChan}${SCKEY}.send
fi