feat: 更新数据库结构和链接任务逻辑
主要修改: 1. 更新`game.sql`文件,添加`system_config`表并调整多个表的`ENGINE`和`AUTO_INCREMENT`设置。 2. 在`LinkTask`实体中新增`completedPoints`字段,更新状态字段以包含`COMPLETED`状态。 3. 在`LinkTaskMapper`中新增根据设备ID和状态查询链接任务的方法。 4. 在`LinkStatusService`中更新状态描述映射,增加对`COMPLETED`状态的处理。 5. 在`DeviceStatusService`和`ScriptClient`中新增解析设备状态的方法,支持检查设备是否完成游戏。 技术细节: - 通过数据库结构的更新,增强了系统的配置管理和链接任务的状态处理能力。 - 新增的功能支持更灵活的设备状态监控和任务管理。
This commit is contained in:
@@ -21,24 +21,25 @@
|
||||
<result property="qrCreatedAt" column="qr_created_at" />
|
||||
<result property="qrExpireAt" column="qr_expire_at" />
|
||||
<result property="firstRegionSelectAt" column="first_region_select_at" />
|
||||
<result property="completedPoints" column="completed_points" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="findByCodeNo" parameterType="string" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
WHERE code_no = #{codeNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="findByTokenHash" parameterType="string" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
WHERE token_hash = #{tokenHash}
|
||||
LIMIT 1
|
||||
@@ -78,7 +79,7 @@
|
||||
</update>
|
||||
|
||||
<select id="findByAgentId" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
WHERE agent_id = #{agentId}
|
||||
ORDER BY created_at DESC
|
||||
@@ -90,7 +91,7 @@
|
||||
</select>
|
||||
|
||||
<select id="findByAgentIdAndStatus" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
WHERE agent_id = #{agentId} AND status = #{status}
|
||||
ORDER BY created_at DESC
|
||||
@@ -102,7 +103,7 @@
|
||||
</select>
|
||||
|
||||
<select id="findByBatchId" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
WHERE batch_id = #{batchId}
|
||||
ORDER BY created_at DESC
|
||||
@@ -114,7 +115,7 @@
|
||||
</select>
|
||||
|
||||
<select id="findExpiredTasks" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
WHERE expire_at <= #{expireTime} AND status IN ('NEW', 'USING')
|
||||
ORDER BY expire_at ASC
|
||||
@@ -122,7 +123,7 @@
|
||||
</select>
|
||||
|
||||
<select id="findLinkTasksWithConditions" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points
|
||||
FROM link_task
|
||||
<where>
|
||||
agent_id = #{agentId}
|
||||
@@ -199,7 +200,7 @@
|
||||
</delete>
|
||||
|
||||
<select id="findByCodeNosAndAgentId" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points, completed_points
|
||||
FROM link_task
|
||||
WHERE agent_id = #{agentId}
|
||||
AND code_no IN
|
||||
@@ -207,4 +208,10 @@
|
||||
#{codeNo}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="findByMachineIdAndStatus" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points, completed_points
|
||||
FROM link_task
|
||||
WHERE machine_id = #{machineId} AND status = #{status}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user