Files
Leantime/.dev/remote-deploy/51_verify_global.sh

33 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -u
cd /var/www/onebot
JAR=/tmp/ob51.txt
rm -f $JAR
BODY=$(curl -s -c $JAR http://127.0.0.1:8081/auth/login)
CSRF=$(echo "$BODY" | grep -oE 'name="csrf-token" content="[^"]*"' | sed 's/.*content="//;s/"//')
curl -s -b $JAR -c $JAR -X POST http://127.0.0.1:8081/auth/login \
-d "username=ruiguo_wang@163.com" -d "password=wrg521113.." -d "_token=$CSRF" \
-H "X-CSRF-TOKEN: $CSRF" -o /dev/null -w "login HTTP=%{http_code}\n"
echo ""
echo "=== 1. 主数据列表(全局,与项目无关) ==="
curl -s -b $JAR "http://127.0.0.1:8081/bom/show?type=bom" -o /tmp/ob51_bom.html -w "bom list HTTP=%{http_code}\n"
echo -n "列表含 PRUAGP215: "; grep -c "PRUAGP215" /tmp/ob51_bom.html
echo -n "列表含 PR215: "; grep -c "PR215" /tmp/ob51_bom.html
echo ""
echo "=== 2. 主数据详情(全局 projectId=0鉴权用全局角色 ==="
curl -s -b $JAR "http://127.0.0.1:8081/bom/api/1" -o /tmp/ob51_detail.json -w "detail HTTP=%{http_code}\n"
echo -n "详情返回 projectId=0: "; grep -oE '"projectId":0' /tmp/ob51_detail.json | head -1
echo ""
echo "=== 3. 数据室菜单含主数据 + 图标 ==="
curl -s -b $JAR "http://127.0.0.1:8081/dashboard/show" -o /tmp/ob51_dash.html
echo -n "菜单含 BOM 图标 fa-list-check: "; grep -c "fa-list-check" /tmp/ob51_dash.html
echo -n "菜单含工艺文件: "; grep -c "工艺文件" /tmp/ob51_dash.html
echo -n "菜单含工具清单: "; grep -c "工具清单" /tmp/ob51_dash.html
echo -n "make分组不再含BOM(应为0): "; grep -c 'id="submenu-materialize"' /tmp/ob51_dash.html
echo ""
echo "=== 完成 ==="