| package com.pt5.pthouduan.service; |
| |
| import com.pt5.pthouduan.entity.Invites; |
| import com.pt5.pthouduan.mapper.InvitesMapper; |
| import org.springframework.beans.factory.annotation.Autowired; |
| import org.springframework.stereotype.Service; |
| |
| import java.util.HashMap; |
| import java.util.Map; |
| |
| @Service |
| public class InviteService { |
| @Autowired |
| private InvitesMapper invitesMapper; |
| //批量生成邀请码并存入数据库(6位)(这个直接在数据库更新) |
| //邀请码卖出(set buyername) |
| public Map<String, Object> setbuyername(String buyername){ |
| Map<String, Object> result = new HashMap<>(); |
| Invites invite=invitesMapper.selectFirstEmptyBuyername(); |
| invitesMapper.updatebuyer(invite.getCode(),buyername); |
| result.put("success", true); |
| result.put("invitecode", invite.getCode()); |
| result.put("message", "邀请码购买成功"); |
| return result; |
| } |
| |
| |
| } |