测试限制功能
parent
59621a8c16
commit
5f10ea17ed
|
@ -89,6 +89,18 @@ public class Product extends BaseEntity {
|
|||
*/
|
||||
private String requestMethod;
|
||||
|
||||
/**
|
||||
* 允许试用次数
|
||||
*/
|
||||
private Integer userCount;
|
||||
/**
|
||||
* 是否被购买
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
|
||||
public static Product addProductList(ProductAddReq productAddReq){
|
||||
return Product.builder()
|
||||
.productId(null)
|
||||
|
|
|
@ -65,6 +65,14 @@ public class ProductListResp {
|
|||
* 重要路径
|
||||
*/
|
||||
private String apiRouter;
|
||||
/**
|
||||
* 允许试用次数
|
||||
*/
|
||||
private Integer userCount;
|
||||
/**
|
||||
* 是否被购买
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人",defaultValue = "muyu",type = "String")
|
||||
private String createBy;
|
||||
|
@ -94,6 +102,8 @@ public class ProductListResp {
|
|||
.returnFormat(product.getReturnFormat())
|
||||
.requestMethod(product.getRequestMethod())
|
||||
.apiRouter(product.getApiRouter())
|
||||
.remark(product.getRemark())
|
||||
.userCount(product.getUserCount())
|
||||
.createBy(product.getCreateBy())
|
||||
.createTime(product.getCreateTime())
|
||||
.build();
|
||||
|
|
|
@ -124,4 +124,18 @@ public class ProductApiController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/ifbuy")
|
||||
@Operation(summary = "是否购买",description = "判断是否已经购买")
|
||||
public Result ifbuy(@Validated @RequestBody Product product){
|
||||
String selectremark = productApiService.selectremark(product);
|
||||
if (selectremark.equals("否")){
|
||||
return Result.error("尊敬的客户,由于您没有对此产品进行购买,我们会给您提供两次的测试机会,若您想要多次使用本产品,请先购买!");
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,11 @@ public interface ProductApiMapper extends BaseMapper<Product> {
|
|||
*/
|
||||
List<ChosehowpayResp> selectspecification(ChosehowpayResp chosehowpayResp);
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
String selectremark(Product product);
|
||||
}
|
||||
|
|
|
@ -44,4 +44,12 @@ public interface ProductApiService extends IService<Product> {
|
|||
* @return
|
||||
*/
|
||||
List<ChosehowpayResp> selectspecification(ChosehowpayResp chosehowpayResp);
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
String selectremark(Product product);
|
||||
}
|
||||
|
|
|
@ -99,4 +99,16 @@ public class ProductApiServiceImpl extends ServiceImpl<ProductApiMapper, Product
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口是否已被购买
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String selectremark(Product product) {
|
||||
return productApiMapper.selectremark(product);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,4 +17,7 @@
|
|||
left join product_specification on middle_specification_product.middle_specification=product_specification.product_specification_id
|
||||
WHERE product.product_id = #{productId}
|
||||
</select>
|
||||
<select id="selectremark" resultType="java.lang.String">
|
||||
SELECT remark from product where product_id=#{productId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue