|
|
@ -5,6 +5,7 @@ import api.Result;
|
|
|
|
import com.luoo.user.service.MembershipCodeService;
|
|
|
|
import com.luoo.user.service.MembershipCodeService;
|
|
|
|
import controller.BaseController;
|
|
|
|
import controller.BaseController;
|
|
|
|
import io.swagger.annotations.*;
|
|
|
|
import io.swagger.annotations.*;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@ -34,11 +35,28 @@ public class MembershipController extends BaseController {
|
|
|
|
@ApiImplicitParams(value = {
|
|
|
|
@ApiImplicitParams(value = {
|
|
|
|
@ApiImplicitParam(name = "duration", value = "会员时长(天)", required = true, dataType = "Integer", paramType = "query")
|
|
|
|
@ApiImplicitParam(name = "duration", value = "会员时长(天)", required = true, dataType = "Integer", paramType = "query")
|
|
|
|
})
|
|
|
|
})
|
|
|
|
public Result<String> generateMembershipCode(@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
public Result<String> generateMembershipCode(
|
|
|
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
@NotNull Integer duration) {
|
|
|
|
@NotNull Integer duration) {
|
|
|
|
return Result.success(membershipCodeService.generateMembershipCode(authorization, duration));
|
|
|
|
return Result.success(membershipCodeService.generateMembershipCode(authorization, duration));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "1.1 批量生成会员码", notes = "仅限admin权限用户调用")
|
|
|
|
|
|
|
|
@GetMapping("/code/generate/batch")
|
|
|
|
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
|
|
|
|
@ApiImplicitParams(value = {
|
|
|
|
|
|
|
|
@ApiImplicitParam(name = "duration", value = "会员时长(天)", required = true, dataType = "Integer", paramType = "query"),
|
|
|
|
|
|
|
|
@ApiImplicitParam(name = "count", value = "生成数量", required = true, dataType = "Integer", paramType = "query")
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
public Result<List<String>> generateMembershipCodeBatch(
|
|
|
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
|
|
|
|
@NotNull Integer duration,
|
|
|
|
|
|
|
|
@NotNull Integer count) {
|
|
|
|
|
|
|
|
List<String> list = membershipCodeService.generateMembershipCodeBatch(authorization,
|
|
|
|
|
|
|
|
duration, count);
|
|
|
|
|
|
|
|
return Result.success(list);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "2.绑定会员码", notes = "仅限app用户调用")
|
|
|
|
@ApiOperation(value = "2.绑定会员码", notes = "仅限app用户调用")
|
|
|
|
@PostMapping("/code/bind")
|
|
|
|
@PostMapping("/code/bind")
|
|
|
@ -46,7 +64,8 @@ public class MembershipController extends BaseController {
|
|
|
|
@ApiImplicitParams(value = {
|
|
|
|
@ApiImplicitParams(value = {
|
|
|
|
@ApiImplicitParam(name = "code", value = "会员码", required = true, dataType = "String", paramType = "query")
|
|
|
|
@ApiImplicitParam(name = "code", value = "会员码", required = true, dataType = "String", paramType = "query")
|
|
|
|
})
|
|
|
|
})
|
|
|
|
public Result<Void> bindMembershipCode(@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
public Result<Void> bindMembershipCode(
|
|
|
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
@NotNull String code) {
|
|
|
|
@NotNull String code) {
|
|
|
|
membershipCodeService.bindMembershipCode(authorization, code);
|
|
|
|
membershipCodeService.bindMembershipCode(authorization, code);
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|