Sure233 | 8188c5d | 2025-05-28 11:43:06 +0800 | [diff] [blame^] | 1 | package com.pt5.pthouduan.service; |
| 2 | |
| 3 | import com.pt5.pthouduan.entity.Invites; |
| 4 | import com.pt5.pthouduan.mapper.InvitesMapper; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | import org.springframework.stereotype.Service; |
| 7 | |
| 8 | import java.util.HashMap; |
| 9 | import java.util.Map; |
| 10 | |
| 11 | @Service |
| 12 | public class InviteService { |
| 13 | @Autowired |
| 14 | private InvitesMapper invitesMapper; |
| 15 | //批量生成邀请码并存入数据库(6位)(这个直接在数据库更新) |
| 16 | //邀请码卖出(set buyername) |
| 17 | public Map<String, Object> setbuyername(String buyername){ |
| 18 | Map<String, Object> result = new HashMap<>(); |
| 19 | Invites invite=invitesMapper.selectFirstEmptyBuyername(); |
| 20 | invitesMapper.updatebuyer(invite.getCode(),buyername); |
| 21 | result.put("success", true); |
| 22 | result.put("invitecode", invite.getCode()); |
| 23 | result.put("message", "邀请码购买成功"); |
| 24 | return result; |
| 25 | } |
| 26 | |
| 27 | |
| 28 | } |