while true; do echo "正在查询任务状态..." if command -v curl >/dev/null 2>&1; then QUERY_RESULT=$(curl -s ${CHECK_URL}) elif command -v wget >/dev/null 2>&1; then QUERY_RESULT=$(wget -q -O - ${CHECK_URL}) fi
echo "查询结果:${QUERY_RESULT}"
if [[ ${QUERY_RESULT} == *"任务成功"* ]]; then echo "任务成功" DOWNLOAD_URL="https://nop.gs/xz.php?url=${HASH" echo "下载地址为:${DOWNLOAD_URL}" if command -v curl >/dev/null 2>&1; then curl -o "${TKFILE}${HASH}.zip" ${DOWNLOAD_URL} echo "下载成功,文件已经下载到${TKFILE}${HASH}.zip" elif command -v wget >/dev/null 2>&1; then wget -O "${TKFILE}${HASH}.zip" ${DOWNLOAD_URL} echo "下载成功,文件已经下载到${TKFILE}${HASH}.zip" fi break elif [[ ${QUERY_RESULT} == *"任务失败"* ]] || [[ ${QUERY_RESULT} == *"任务异常"* ]]; then echo "任务失败或任务异常" break else sleep 25 fi done