linhw 2024-08-05 10:24:31 +08:00
parent c4c043d41d
commit 26cb95f60a
6 changed files with 26 additions and 11 deletions

View File

@ -8,10 +8,7 @@ import com.alipay.api.response.AlipayTradeCreateResponse;
import com.ruoyi.app.domain.*;
import com.ruoyi.app.domain.dto.*;
import com.ruoyi.app.domain.vo.AppDynamicCommentVo;
import com.ruoyi.app.mapper.AppExchangeCodeMapper;
import com.ruoyi.app.mapper.AppOrderMapper;
import com.ruoyi.app.mapper.AppOrderPayMapper;
import com.ruoyi.app.mapper.AppUserMapper;
import com.ruoyi.app.mapper.*;
import com.ruoyi.app.service.AlipayService;
import com.ruoyi.app.service.IAppDynamicCommentService;
import com.ruoyi.app.service.IPayService;
@ -77,6 +74,9 @@ public class PayController extends BaseController
@Autowired
private AlipayService alipayService;
@Autowired
private AppVipMapper appVipMapper;
@RequestMapping("/generateCode")
@ApiOperation(value = "生成兑换码", notes = "生成兑换码", httpMethod = "GET")
public String generateCode(@RequestParam("num") Integer num,
@ -505,12 +505,13 @@ public class PayController extends BaseController
@PostMapping(value = "/aliPay")
@ApiOperation(value = "支付宝支付", notes = "支付宝支付", httpMethod = "POST")
public String aliPay(@RequestBody AppOrderArg appOrderArg) throws Exception{
//return alipayService.startPay(appOrderArg);
String orderNo = KeyUtil.generateUniqueKey();
AlipayTradeAppPayResponse result = null;
try {
AppVip appVip = appVipMapper.selectAppVipByLevel(appOrderArg.getLevel());
String price = appVip.getPrice() + ".00";
//result = alipayService.startPay(orderNo,appOrderArg.getPrice(),appOrderArg.getLevel() == 2 ? 30 : (appOrderArg.getLevel() == 3 ? 365 : 0));
result = alipayService.startPay(orderNo,appOrderArg.getPrice(),0);
result = alipayService.startPay(orderNo,price,0);
} catch (AlipayApiException e) {
e.printStackTrace();
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppVip;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -58,4 +59,8 @@ public interface AppVipMapper
* @return
*/
public int deleteAppVipByIds(Long[] ids);
public AppVip selectAppVipByLevel(@Param("level") int level);
}

View File

@ -44,7 +44,7 @@ public class AlipayService {
request.setNotifyUrl(AlipayConstant.NOTIFY_URL);
JSONObject jsonObject = new JSONObject();
jsonObject.put("out_trade_no" , orderNo);
jsonObject.put("total_amount","0.01");
jsonObject.put("total_amount",price);
jsonObject.put("subject",AlipayConstant.SUBJECT);
if (day > 0) {
jsonObject.put("product_code", "CYCLE_PAY_AUTH");

View File

@ -218,7 +218,9 @@ public class AppUserServiceImpl implements IAppUserService {
userSkillMapper.deleteUserSkillByUserId(id);
AppUser appUser = appUserMapper.selectAppUserById(id);
AppRegister appRegister = appRegisterMapper.selectAppRegisterByphone(appUser.getPhone());
if (appRegister != null) {
appRegisterMapper.deleteAppRegisterById(appRegister.getId());
}
AppUserDynamic appUserDynamic = new AppUserDynamic();
appUserDynamic.setUserId(id);
List<AppUserDynamic> list = appUserDynamicMapper.selectAppUserDynamicList(appUserDynamic);

View File

@ -80,7 +80,6 @@ public class SendNoteUtil {
if ("18000000000".equals(PhoneNumber)) {
randomNumber = "1234";
}
randomNumber = "1234";
log.info("--------------------------------------------- " + PhoneNumber + "验证码:" + randomNumber);
redisService.setCacheObject(PhoneNumber, randomNumber, 300L, TimeUnit.SECONDS);
if (!redisService.hasKey(PhoneNumber)) {
@ -158,7 +157,9 @@ public class SendNoteUtil {
String homeTem = "SMS_467520300";
String foreignTem = "SMS_468380559";
if (!isChineseMobileNumber(PhoneNumber)) {
return sendForeign(PhoneNumber,"1234");
Random random = new Random();
String randomNumber = String.valueOf(random.nextInt(9000) + 1000);
return sendForeign(PhoneNumber,randomNumber);
}
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);

View File

@ -27,11 +27,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectAppVipById" parameterType="Long" resultMap="AppVipResult">
<select id="selectAppVipById" resultMap="AppVipResult">
<include refid="selectAppVipVo"/>
where id = #{id}
</select>
<select id="selectAppVipByLevel" parameterType="Long" resultMap="AppVipResult">
<include refid="selectAppVipVo"/>
where level = #{level}
limit 1
</select>
<insert id="insertAppVip" parameterType="AppVip">
insert into app_vip
<trim prefix="(" suffix=")" suffixOverrides=",">