<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="drawio" version="26.0.0">
  <diagram name="时序图">
    <mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1000" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />

        <!-- Title -->
        <mxCell id="title" value="12306旅客管理系统 - 购票流程时序图" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=20;fontStyle=1" vertex="1" parent="1">
          <mxGeometry x="600" y="20" width="400" height="40" as="geometry" />
        </mxCell>

        <!-- Participants -->
        <mxCell id="p1" value="用户" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;fontSize=12" vertex="1" parent="1">
          <mxGeometry x="60" y="100" width="40" height="80" as="geometry" />
        </mxCell>

        <mxCell id="p2" value="前端" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e3f2fd;strokeColor=#1976d2;fontSize=12;align=center;" vertex="1" parent="1">
          <mxGeometry x="180" y="100" width="60" height="40" as="geometry" />
        </mxCell>

        <mxCell id="p3" value="网关" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e8f5e9;strokeColor=#388e3c;fontSize=12;align=center;" vertex="1" parent="1">
          <mxGeometry x="300" y="100" width="60" height="40" as="geometry" />
        </mxCell>

        <mxCell id="p4" value="订单服务" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff3e0;strokeColor=#f57c00;fontSize=12;align=center;" vertex="1" parent="1">
          <mxGeometry x="420" y="100" width="70" height="40" as="geometry" />
        </mxCell>

        <mxCell id="p5" value="票务服务" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f3e5f5;strokeColor=#7b1fa2;fontSize=12;align=center;" vertex="1" parent="1">
          <mxGeometry x="550" y="100" width="70" height="40" as="geometry" />
        </mxCell>

        <mxCell id="p6" value="支付服务" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffebee;strokeColor=#d32f2f;fontSize=12;align=center;" vertex="1" parent="1">
          <mxGeometry x="680" y="100" width="70" height="40" as="geometry" />
        </mxCell>

        <mxCell id="p7" value="数据库" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;align=center;" vertex="1" parent="1">
          <mxGeometry x="810" y="100" width="60" height="40" as="geometry" />
        </mxCell>

        <!-- Lifelines -->
        <mxCell id="ll2" style="endArrow=none;strokeColor=#666666;dashed=1;" edge="1" parent="1" source="p2" target="p2">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="210" y="150" as="sourcePoint" />
            <mxPoint x="210" y="750" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="ll3" style="endArrow=none;strokeColor=#666666;dashed=1;" edge="1" parent="1" source="p3" target="p3">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="330" y="150" as="sourcePoint" />
            <mxPoint x="330" y="750" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="ll4" style="endArrow=none;strokeColor=#666666;dashed=1;" edge="1" parent="1" source="p4" target="p4">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="455" y="150" as="sourcePoint" />
            <mxPoint x="455" y="750" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="ll5" style="endArrow=none;strokeColor=#666666;dashed=1;" edge="1" parent="1" source="p5" target="p5">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="585" y="150" as="sourcePoint" />
            <mxPoint x="585" y="750" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="ll6" style="endArrow=none;strokeColor=#666666;dashed=1;" edge="1" parent="1" source="p6" target="p6">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="715" y="150" as="sourcePoint" />
            <mxPoint x="715" y="750" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="ll7" style="endArrow=none;strokeColor=#666666;dashed=1;" edge="1" parent="1" source="p7" target="p7">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="840" y="150" as="sourcePoint" />
            <mxPoint x="840" y="750" as="targetPoint" />
          </mxGeometry>
        </mxCell>

        <!-- 1. Query tickets -->
        <mxCell id="m1" value="1. 选择车次、日期" style="text;html=1;strokeColor=none;fillColor=none;align=left;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="80" y="150" width="120" height="20" as="geometry" />
        </mxCell>
        <mxCell id="m2" value="GET /trains/{id}/inventory" style="endArrow=block;endFill=1;strokeColor=#1976d2;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="210" y="180" as="sourcePoint" />
            <mxPoint x="585" y="180" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m3" value="SELECT available_seats" style="endArrow=block;endFill=1;strokeColor=#388e3c;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="585" y="210" as="sourcePoint" />
            <mxPoint x="840" y="210" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m4" value="返回余票信息" style="endArrow=block;endFill=1;strokeColor=#388e3c;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="840" y="240" as="sourcePoint" />
            <mxPoint x="585" y="240" as="targetPoint" />
          </mxGeometry>
        </mxCell>

        <!-- 2. Select passengers -->
        <mxCell id="m5" value="2. 选择乘客(1-4人)" style="text;html=1;strokeColor=none;fillColor=none;align=left;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="80" y="270" width="120" height="20" as="geometry" />
        </mxCell>
        <mxCell id="m6" value="GET /passengers?userId=xxx" style="endArrow=block;endFill=1;strokeColor=#1976d2;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="210" y="300" as="sourcePoint" />
            <mxPoint x="840" y="300" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m7" value="返回旅客列表" style="endArrow=block;endFill=1;strokeColor=#1976d2;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="840" y="330" as="sourcePoint" />
            <mxPoint x="210" y="330" as="targetPoint" />
          </mxGeometry>
        </mxCell>

        <!-- 3. Lock seat -->
        <mxCell id="m8" value="3. 确认订单" style="text;html=1;strokeColor=none;fillColor=none;align=left;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="80" y="360" width="120" height="20" as="geometry" />
        </mxCell>
        <mxCell id="m9" value="POST /inventory/lock" style="endArrow=block;endFill=1;strokeColor=#1976d2;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="210" y="390" as="sourcePoint" />
            <mxPoint x="585" y="390" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m10" value="锁定10分钟有效期" style="text;html=1;strokeColor=none;fillColor=#fff9c4;align=center;fontSize=10;fontStyle=2;" vertex="1" parent="1">
          <mxGeometry x="600" y="400" width="120" height="20" as="geometry" />
        </mxCell>
        <mxCell id="m11" value="UPDATE inventory" style="endArrow=block;endFill=1;strokeColor=#388e3c;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="585" y="430" as="sourcePoint" />
            <mxPoint x="840" y="430" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m12" value="锁定成功" style="endArrow=block;endFill=1;strokeColor=#388e3c;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="840" y="460" as="sourcePoint" />
            <mxPoint x="210" y="460" as="targetPoint" />
          </mxGeometry>
        </mxCell>

        <!-- 4. Create order -->
        <mxCell id="m13" value="4. 确认订单" style="text;html=1;strokeColor=none;fillColor=none;align=left;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="80" y="490" width="120" height="20" as="geometry" />
        </mxCell>
        <mxCell id="m14" value="POST /orders" style="endArrow=block;endFill=1;strokeColor=#1976d2;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="210" y="520" as="sourcePoint" />
            <mxPoint x="455" y="520" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m15" value="INSERT orders, order_items" style="endArrow=block;endFill=1;strokeColor=#f57c00;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="455" y="550" as="sourcePoint" />
            <mxPoint x="840" y="550" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m16" value="返回订单号" style="endArrow=block;endFill=1;strokeColor=#f57c00;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="840" y="580" as="sourcePoint" />
            <mxPoint x="210" y="580" as="targetPoint" />
          </mxGeometry>
        </mxCell>

        <!-- 5. Payment -->
        <mxCell id="m17" value="5. 点击支付" style="text;html=1;strokeColor=none;fillColor=none;align=left;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="80" y="610" width="120" height="20" as="geometry" />
        </mxCell>
        <mxCell id="m18" value="POST /orders/{id}/pay" style="endArrow=block;endFill=1;strokeColor=#1976d2;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="210" y="640" as="sourcePoint" />
            <mxPoint x="715" y="640" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m19" value="返回支付链接" style="endArrow=block;endFill=1;strokeColor=#d32f2f;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="715" y="670" as="sourcePoint" />
            <mxPoint x="210" y="670" as="targetPoint" />
          </mxGeometry>
        </mxCell>

        <!-- 6. Payment callback -->
        <mxCell id="m20" value="6. 第三方支付回调" style="text;html=1;strokeColor=none;fillColor=#c8e6c9;align=left;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="80" y="700" width="130" height="20" as="geometry" />
        </mxCell>
        <mxCell id="m21" value="UPDATE order status='PAID'" style="endArrow=block;endFill=1;strokeColor=#388e3c;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="455" y="730" as="sourcePoint" />
            <mxPoint x="840" y="730" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="m22" value="购票成功" style="text;html=1;strokeColor=none;fillColor=#c8e6c9;align=center;fontSize=11;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="350" y="760" width="100" height="20" as="geometry" />
        </mxCell>

      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
