feat: 会员体验版、俱乐部分离上架与分红计数加固

扩展 club_huiyuan_price/huiyuangoumai/czjilu/gsfenhong 字段;微信购会员强制写 czjilu+收支入账;formal_cishu 仅统计正式已支付单;关闭余额购会员;俱乐部上架/下架 API。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-26 01:32:33 +08:00
parent deb1688d0c
commit 2f0838e552
11 changed files with 689 additions and 221 deletions

View File

@@ -2024,6 +2024,10 @@ class TixianShenqingView(APIView):
if dashou.yue < jine:
return {'code': 13, 'msg': f'余额不足,当前余额: {dashou.yue}'}
from jituan.services.member_recharge import dashou_in_active_trial_period
if dashou_in_active_trial_period(user_main.UserUID):
return {'code': 16, 'msg': '体验会员期间不可提现佣金,请升级正式会员或待体验到期'}
return {'code': 0, 'msg': 'ok', 'data': {'nicheng': dashou.nicheng or ''}}
def _check_guanshi_dividend_withdraw(self, user_main, jine):
@@ -8893,35 +8897,27 @@ class KefuUpdateDashouView(APIView):
return Response({'code': 403, 'msg': '无权限给打手加会员'})
if not huiyuan_id:
return Response({'code': 400, 'msg': '缺少会员ID'})
days = int(value) if value else 30 # 默认加30天
try:
huiyuan = Huiyuan.query.get(huiyuan_id=huiyuan_id)
except Huiyuan.DoesNotExist:
return Response({'code': 404, 'msg': '会员类型不存在'})
# 获取或创建购买记录
record, created = Huiyuangoumai.objects.select_for_update().get_or_create(
yonghu_id=dashou_id,
huiyuan_id=huiyuan_id,
defaults={
'huiyuan_zhuangtai': 1,
'jieshao': huiyuan.jieshao,
'daoqi_time': timezone.now() + timedelta(days=days),
}
from jituan.services.club_user import get_user_club_id
from jituan.services.member_recharge import extend_member_entitlement_admin, get_club_huiyuan_row
player_club = get_user_club_id(dashou_user)
row = get_club_huiyuan_row(player_club, huiyuan_id, require_enabled=False)
days = int(value) if value else int(row.formal_days or 30) if row else 30
record, err = extend_member_entitlement_admin(
dashou_id, huiyuan_id, days, player_club,
)
if not created:
# 延长有效期
new_daoqi = record.daoqi_time + timedelta(days=days)
record.daoqi_time = new_daoqi
record.huiyuan_zhuangtai = 1
record.save()
# 记录修改日志
if err:
return Response({'code': 400, 'msg': err})
Xiugaijilu.query.create(
yonghuid=dashou_id,
xiugaiid=kefu.user.Phone,
leixing=2,
huiyuants=days,
huiyuan_id=huiyuan_id,
qitashuoming=f'加会员 {huiyuan_id},增加{days}',
qitashuoming=f'正式会员 {huiyuan_id},增加{days}(无支付单、无分红)',
)
return Response({'code': 0, 'msg': '加会员成功', 'data': {'new_daoqi': record.daoqi_time.strftime('%Y-%m-%d %H:%M:%S')}})