- member.plan_product, plan_auto_renew 컬럼(구독 상품·자동갱신) - GET /api/billing/subscription: 플랜·만료일·다음결제일·자동갱신 - POST /api/billing/cancel: 자동갱신 중단(만료일까지 이용), /resume: 재개 - verify 시 상품·자동갱신 기록, 만료 강등·관리자 변경 시 구독정보 정리 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
<result property="role" column="role"/>
|
||||
<result property="plan" column="plan"/>
|
||||
<result property="planExpiresAt" column="plan_expires_at"/>
|
||||
<result property="planProduct" column="plan_product"/>
|
||||
<result property="planAutoRenew" column="plan_auto_renew"/>
|
||||
<result property="points" column="points"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
@@ -24,7 +26,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="columns">
|
||||
id, login_id, password, name, email, provider, provider_id, google_id, google_picture, profile_image, role, plan, plan_expires_at, points, status, created_at, updated_at
|
||||
id, login_id, password, name, email, provider, provider_id, google_id, google_picture, profile_image, role, plan, plan_expires_at, plan_product, plan_auto_renew, points, status, created_at, updated_at
|
||||
</sql>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="memberResultMap">
|
||||
@@ -97,19 +99,27 @@
|
||||
UPDATE member SET role = #{role}, updated_at = NOW() WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 관리자 수동 변경: 만료일 없이(영구) 설정/해제 -->
|
||||
<!-- 관리자 수동 변경: 만료일/구독정보 없이(영구) 설정/해제 -->
|
||||
<update id="updatePlan">
|
||||
UPDATE member SET plan = #{plan}, plan_expires_at = NULL, updated_at = NOW() WHERE id = #{id}
|
||||
UPDATE member SET plan = #{plan}, plan_expires_at = NULL, plan_product = NULL, plan_auto_renew = 0,
|
||||
updated_at = NOW() WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 결제로 멤버십 부여/갱신: plan + 만료일 -->
|
||||
<!-- 결제로 멤버십 부여/갱신: plan + 만료일 + 구독상품 + 자동갱신 -->
|
||||
<update id="updateMembership">
|
||||
UPDATE member SET plan = #{plan}, plan_expires_at = #{expiresAt}, updated_at = NOW() WHERE id = #{id}
|
||||
UPDATE member SET plan = #{plan}, plan_expires_at = #{expiresAt},
|
||||
plan_product = #{product}, plan_auto_renew = #{autoRenew}, updated_at = NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 만료된 유료회원 자동 강등 (스케줄러) -->
|
||||
<!-- 구독 해지/재개: 자동 갱신 플래그만 변경 (이용은 만료일까지 유지) -->
|
||||
<update id="updateAutoRenew">
|
||||
UPDATE member SET plan_auto_renew = #{autoRenew}, updated_at = NOW() WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 만료된 유료회원 자동 강등 (스케줄러) — 구독정보도 정리 -->
|
||||
<update id="downgradeExpired">
|
||||
UPDATE member SET plan = 'FREE', updated_at = NOW()
|
||||
UPDATE member SET plan = 'FREE', plan_product = NULL, plan_auto_renew = 0, updated_at = NOW()
|
||||
WHERE plan = 'PREMIUM' AND plan_expires_at IS NOT NULL AND plan_expires_at < NOW()
|
||||
</update>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user