ql repo https://github.com/Tsukasa007/my_script.git "" "jdCookie|USER_AGENTS|sendNotify|backup" "" "master"
env_name=(
FRUITSHARECODES
PETSHARECODES
PLANT_BEAN_SHARECODES
DREAM_FACTORY_SHARE_CODES
DDFACTORY_SHARECODES
JDZZ_SHARECODES
JDJOY_SHARECODES
JXNC_SHARECODES
BOOKSHOP_SHARECODES
JD_CASH_SHARECODES
JDSGMH_SHARECODES
JDCFD_SHARECODES
JDHEALTH_SHARECODES
)
var_name=(
ForOtherFruit
ForOtherPet
ForOtherBean
ForOtherDreamFactory
ForOtherJdFactory
ForOtherJdzz
ForOtherJoy
ForOtherJxnc
ForOtherBookShop
ForOtherCash
ForOtherSgmh
ForOtherCfd
ForOtherHealth
)
## name_js为脚本文件名,如果使用ql repo命令拉取,文件名含有作者名
## 所有有互助码的活动,把脚本名称列在 name_js 中,对应 config.sh 中互助码后缀列在 name_config 中,中文名称列在 name_chinese 中。
## name_js、name_config 和 name_chinese 中的三个名称必须一一对应。
name_js=(
xxxxxxxx_jd_scripts_jd_fruit
xxxxxxxx_jd_scripts_jd_pet
xxxxxxxx_jd_scripts_jd_plantBean
xxxxxxxx_jd_scripts_jd_dreamFactory
xxxxxxxx_jd_scripts_jd_jdfactory
xxxxxxxx_jd_scripts_jd_jdzz
xxxxxxxx_jd_scripts_jd_crazy_joy
xxxxxxxx_jd_scripts_jd_jxnc
xxxxxxxx_jd_bookshop
xxxxxxxx_jd_scripts_jd_cash
xxxxxxxx_jd_scripts_jd_sgmh
xxxxxxxx_jd_scripts_jd_cfd
xxxxxxxx_jd_scripts_jd_health
)
name_config=(
Fruit
Pet
Bean
DreamFactory
JdFactory
Jdzz
Joy
Jxnc
BookShop
Cash
Sgmh
Cfd
Health
)
name_chinese=(
东东农场
东东萌宠
京东种豆得豆
京喜工厂
东东工厂
京东赚赚
crazyJoy任务
京喜农场
口袋书店
签到领现金
闪购盲盒
京喜财富岛
东东健康社区
)
#####请举一反三
#!/usr/bin/env bash
##helpStart
##helpEnd
combine_sub() {
local what_combine=$1
local combined_all=""
local tmp1 tmp2
local envs=$(eval echo "\$JD_COOKIE")
local array=($(echo $envs | sed 's/&/ /g'))
local user_sum=${#array[*]}
for ((i = 1; i <= $user_sum; i++)); do
local tmp1=$what_combine$i
local tmp2=${!tmp1}
combined_all="$combined_all&$tmp2"
done
echo $combined_all | perl -pe "{s|^&||; s|^@+||; s|&@|&|g; s|@+&|&|g; s|@+|@|g; s|@+$||}"
}
## 正常依次运行时,组合所有账号的Cookie与互助码
combine_all() {
for ((i = 0; i < ${#env_name[*]}; i++)); do
result=$(combine_sub ${var_name[i]})
if [[ $result ]]; then
export ${env_name[i]}="$result"
fi
done
}
combine_all