fix:修改购买方法
parent
60056f4ddc
commit
637411436c
|
@ -33,6 +33,10 @@ public class ConnectorUser {
|
||||||
* 购买次数
|
* 购买次数
|
||||||
*/
|
*/
|
||||||
private Integer connectorFrequency;
|
private Integer connectorFrequency;
|
||||||
|
/**
|
||||||
|
* 测试次数
|
||||||
|
*/
|
||||||
|
private Integer textNumber;
|
||||||
/**
|
/**
|
||||||
* 接口名称
|
* 接口名称
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class BuyServiceImpl extends ServiceImpl<BuyMapper, Connector> implements
|
||||||
Integer i = buyMapper.doBuyInterface(connectorUser);
|
Integer i = buyMapper.doBuyInterface(connectorUser);
|
||||||
if (i>0){
|
if (i>0){
|
||||||
user.setUserBalance(user.getUserBalance()-connectorUser.getConnectorFrequency()*connectorUser.getConnectorPrice());
|
user.setUserBalance(user.getUserBalance()-connectorUser.getConnectorFrequency()*connectorUser.getConnectorPrice());
|
||||||
|
//购买减余额
|
||||||
buyMapper.buyPrice(user);
|
buyMapper.buyPrice(user);
|
||||||
buyMapper.doBuyInterface(connectorUser);
|
buyMapper.doBuyInterface(connectorUser);
|
||||||
ConnectorLog connectorLog = new ConnectorLog();
|
ConnectorLog connectorLog = new ConnectorLog();
|
||||||
|
@ -53,21 +54,22 @@ public class BuyServiceImpl extends ServiceImpl<BuyMapper, Connector> implements
|
||||||
buyMapper.insertPurchaseRecord(connectorLog);
|
buyMapper.insertPurchaseRecord(connectorLog);
|
||||||
return Result.success(i,"购买成功");
|
return Result.success(i,"购买成功");
|
||||||
}
|
}
|
||||||
ConnectorUser connectorUser1 = buyMapper.selectConnectorUser(connectorUser);
|
// ConnectorUser connectorUser1 = buyMapper.selectConnectorUser(connectorUser);
|
||||||
if (connectorUser1==null){
|
// if (connectorUser1==null){
|
||||||
Integer i1 = buyMapper.addConnectorUser(connectorUser);
|
// //添加
|
||||||
if (i1>0){
|
//// Integer i1 = buyMapper.addConnectorUser(connectorUser);
|
||||||
user.setUserBalance(user.getUserBalance()-connectorUser.getConnectorFrequency()*connectorUser.getConnectorPrice());
|
//// if (i1>0){
|
||||||
buyMapper.buyPrice(user);
|
// user.setUserBalance(user.getUserBalance()-connectorUser.getConnectorFrequency()*connectorUser.getConnectorPrice());
|
||||||
buyMapper.doBuyInterface(connectorUser);
|
// buyMapper.buyPrice(user);
|
||||||
ConnectorLog connectorLog = new ConnectorLog();
|
// buyMapper.doBuyInterface(connectorUser);
|
||||||
connectorLog.setDataName(connectorUser.getConnectorName());
|
// ConnectorLog connectorLog = new ConnectorLog();
|
||||||
connectorLog.setAmount(connectorUser.getConnectorPrice());
|
// connectorLog.setDataName(connectorUser.getConnectorName());
|
||||||
// 插入购买记录
|
// connectorLog.setAmount(connectorUser.getConnectorPrice());
|
||||||
buyMapper.insertPurchaseRecord(connectorLog);
|
// // 插入购买记录
|
||||||
return Result.success(i,"购买成功");
|
// buyMapper.insertPurchaseRecord(connectorLog);
|
||||||
}
|
// return Result.success(i,"购买成功");
|
||||||
}
|
//// }
|
||||||
|
// }
|
||||||
return Result.error("购买失败");
|
return Result.error("购买失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<insert id="addConnectorUser">
|
<insert id="addConnectorUser">
|
||||||
INSERT INTO `text`.`connector_user`
|
INSERT INTO `text`.`connector_user`
|
||||||
(`connector_user_id`, `user_id`, `connector_id`, `connector_residue_degree`, `connector_frequency`)
|
(`connector_user_id`, `user_id`, `connector_id`, `connector_residue_degree`, `connector_frequency`)
|
||||||
VALUES (0,#{userId}, #{connectorId}, 0, 0)
|
VALUES (0,#{userId}, #{connectorId}, 0, 0,5)
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue