| @@ -71,5 +71,6 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| //void updateCode(Long id, String mcode); | //void updateCode(Long id, String mcode); | ||||
| void reductPoints(@Param("id")Long id,@Param("finalTenantId")String finalTenantId,@Param("reductPoints")Integer reductPoints); | void reductPoints(@Param("id")Long id,@Param("finalTenantId")String finalTenantId,@Param("reductPoints")Integer reductPoints); | ||||
| void addPoints(@Param("id")Long id,@Param("finalTenantId")String finalTenantId,@Param("addPoints")Integer addPoints); | |||||
| } | } | ||||
| @@ -207,5 +207,6 @@ public interface WxCUserBasicInfoService { | |||||
| // void updateCode(Long id, String mcode); | // void updateCode(Long id, String mcode); | ||||
| void reducePoints(Long id,String finalTenantId,Integer reducePoints); | void reducePoints(Long id,String finalTenantId,Integer reducePoints); | ||||
| void addPoints(Long id,String finalTenantId,Integer addPoints); | |||||
| } | } | ||||
| @@ -1545,5 +1545,10 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| public void reducePoints(Long id,String finalTenantId, Integer reducePoints) { | public void reducePoints(Long id,String finalTenantId, Integer reducePoints) { | ||||
| wxCUserBasicInfoMapper.reductPoints(id, finalTenantId, reducePoints); | wxCUserBasicInfoMapper.reductPoints(id, finalTenantId, reducePoints); | ||||
| } | } | ||||
| @Override | |||||
| public void addPoints(Long id, String finalTenantId, Integer addPoints) { | |||||
| wxCUserBasicInfoMapper.addPoints(id, finalTenantId, addPoints); | |||||
| } | |||||
| } | } | ||||
| @@ -22,7 +22,7 @@ public interface ProjectService { | |||||
| * 处理生成视频账单 | * 处理生成视频账单 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds,Long videoSize); | |||||
| public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoTimes,Long videoSize); | |||||
| } | } | ||||
| @@ -28,22 +28,21 @@ public class HYProjectService extends BaseProjectService implements ProjectServi | |||||
| @Override | @Override | ||||
| public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | ||||
| //更新用户的币 | //更新用户的币 | ||||
| wxCUserBasicInfoService.reducePoints(cUserId, cUserFinalTenantId,-product.getGlod()); | |||||
| wxCUserBasicInfoService.addPoints(cUserId, cUserFinalTenantId,-product.getGlod()); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds, Long videoSize) { | |||||
| public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoTimes, Long videoSize) { | |||||
| //慧影视频按照时长来扣币 | //慧影视频按照时长来扣币 | ||||
| CreateBilling cb = new CreateBilling(); | CreateBilling cb = new CreateBilling(); | ||||
| //每秒扣币 | |||||
| float poinsPerSeconds = 0.008F; | |||||
| cb.setTotalCostPoins(new BigDecimal(videoSeconds).multiply(new BigDecimal(poinsPerSeconds)).intValue()); | |||||
| cb.setDetail("每秒扣币"+poinsPerSeconds+"个,总共时长"+videoSeconds+"秒"); | |||||
| //每分钟扣币,不足一分钟按一分钟算 | |||||
| Integer minitues = new BigDecimal(videoTimes).setScale(0,BigDecimal.ROUND_UP).intValue(); | |||||
| float poinsPerSeconds = 1.0F; | |||||
| cb.setTotalCostPoins(new BigDecimal(videoTimes).multiply(new BigDecimal(poinsPerSeconds)).intValue()); | |||||
| cb.setDetail("每分钟扣币"+poinsPerSeconds+"个,总共时长"+videoTimes+"(分钟),按"+minitues+"分总计费。"); | |||||
| //扣去当前用户的币 | //扣去当前用户的币 | ||||
| wxCUserBasicInfoService.reducePoints(cUserId, cUserFinalTenantId,cb.getTotalCostPoins()); | wxCUserBasicInfoService.reducePoints(cUserId, cUserFinalTenantId,cb.getTotalCostPoins()); | ||||
| return cb; | return cb; | ||||
| } | } | ||||
| } | } | ||||
| @@ -584,5 +584,9 @@ | |||||
| <update id="reducePoints" parameterType="java.util.HashMap"> | <update id="reducePoints" parameterType="java.util.HashMap"> | ||||
| UPDATE wx_c_user_basic_info set points = points - #{reductPoints} where id = #{id} | UPDATE wx_c_user_basic_info set points = points - #{reductPoints} where id = #{id} | ||||
| </update> | </update> | ||||
| <update id="addPoints" parameterType="java.util.HashMap"> | |||||
| UPDATE wx_c_user_basic_info set points = points + #{addPoints} where id = #{id} | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||