diff --git a/doc/readme.md b/doc/readme.md index fe248bb..9e62b91 100644 --- a/doc/readme.md +++ b/doc/readme.md @@ -1,3 +1,11 @@ +# 20250528 + +## 新增配置 + +```yaml + +``` + # 20250409(已上线20250424) ## 微信oauth2扫码登录 diff --git a/src/main/java/cn/com/tenlion/operator/controller/api/account/AccountController.java b/src/main/java/cn/com/tenlion/operator/controller/api/account/AccountController.java index 335fb76..cbb0c21 100644 --- a/src/main/java/cn/com/tenlion/operator/controller/api/account/AccountController.java +++ b/src/main/java/cn/com/tenlion/operator/controller/api/account/AccountController.java @@ -30,6 +30,7 @@ import ink.wgink.pojo.result.SuccessResultList; import cn.com.tenlion.operator.pojo.dtos.account.AccountDTO; import cn.com.tenlion.operator.pojo.vos.account.AccountVO; import cn.com.tenlion.operator.service.account.IAccountService; +import ink.wgink.util.date.DateUtil; import io.swagger.annotations.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -105,12 +106,52 @@ public class AccountController extends DefaultBaseController { return json.toJSONString(); } - public static void main(String[] args) { - try { - JSONObject jsonObject = JSON.parseObject("错误"); - } catch (Exception e) { - System.out.println("错误"); + @ApiOperation(value = "百度支付成功后回调", notes = "百度成功后回调接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("pay-bd") + public synchronized String payBd(@RequestParam("userId") Long userId, + @RequestParam("orderId") Long orderId, + @RequestParam("unitPrice") Integer unitPrice, + @RequestParam("count") Integer count, + @RequestParam("totalMoney") Integer totalMoney, + @RequestParam("payMoney") Integer payMoney, + @RequestParam("promoMoney") Integer promoMoney, + @RequestParam("hbMoney") Integer hbMoney, + @RequestParam("hbBalanceMoney") Integer hbBalanceMoney, + @RequestParam("giftCardMoney") Integer giftCardMoney, + @RequestParam("dealId") Long dealId, + @RequestParam("payTime") Integer payTime, + @RequestParam("promoDetail") String promoDetail, + @RequestParam("payType") Integer payType, + @RequestParam("partnerId") Integer partnerId, + @RequestParam("status") Integer status, + @RequestParam("tpOrderId") String tpOrderId, + @RequestParam("returnData") String returnData, + @RequestParam("rsaSign") String rsaSign) { + LOG.debug("百度回调,rechargeId:{}", tpOrderId); + AccountRechargeDTO dto = iAccountRechargeService.get(tpOrderId); + JSONObject data = new JSONObject(); + data.put("isConsumed", 2); + // 成功 + if (dto.getThirdParty().equals(ThirdPartyEnum.BD.getValue()) && + StringUtils.equals(dto.getRechargeCheck(), RechargeCheckEnum.UN_RECHARGE.getValue()) && + StringUtils.equals(dto.getReconciliationStatus(), ReconciliationStatusEnum.UN_RECONCILIATION.getValue())) { + if (totalMoney.equals(PayUtil.buiderMoney(dto.getRechargeMoney()))) { + String successTime = DateUtil.getDateTime(new Date(payTime * 1000L)); + iAccountRechargeService.saveConfirmOnline(dto.getAccountRechargeId(), String.valueOf(orderId), successTime); + } else { + LOG.error("订单状态异常,退款"); + data.put("isErrorOrder", 1); + } + } else { + LOG.error("微信支付订单状态查询失败"); + data.put("isErrorOrder", 1); } + JSONObject json = new JSONObject(); + json.put("errno", 0); + json.put("msg", "success"); + json.put("data", data); + return json.toJSONString(); } @Autowired diff --git a/src/main/java/cn/com/tenlion/operator/controller/api/accountrecharge/AccountRechargeController.java b/src/main/java/cn/com/tenlion/operator/controller/api/accountrecharge/AccountRechargeController.java index 2e49ce9..da65aaf 100644 --- a/src/main/java/cn/com/tenlion/operator/controller/api/accountrecharge/AccountRechargeController.java +++ b/src/main/java/cn/com/tenlion/operator/controller/api/accountrecharge/AccountRechargeController.java @@ -1,8 +1,7 @@ package cn.com.tenlion.operator.controller.api.accountrecharge; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeWxPrepayDTO; +import cn.com.tenlion.operator.pojo.dtos.accountrecharge.*; +import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeBdOrderInfoVO; import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeWxPrepayVO; import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.common.base.DefaultBaseController; @@ -13,7 +12,6 @@ import ink.wgink.pojo.result.ErrorResult; import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResultData; import ink.wgink.pojo.result.SuccessResultList; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeDTO; import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeVO; import cn.com.tenlion.operator.service.accountrecharge.IAccountRechargeService; import ink.wgink.pojo.vos.IdsVO; @@ -66,6 +64,15 @@ public class AccountRechargeController extends DefaultBaseController { return accountRechargeWxPrepayDTO; } + @ApiOperation(value = "保存百度支付订单信息", notes = "保存微信预支付充值接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("save-bd-pay-order-info") + public AccountRechargeBdOrderInfoDTO saveBdOrderInfo(@RequestBody AccountRechargeBdOrderInfoVO accountRechargeBdOrderInfoVO) { + AccountRechargeBdOrderInfoDTO accountRechargeBdOrderInfoDTO = accountRechargeService.saveBdOrderInfo(accountRechargeBdOrderInfoVO); + return accountRechargeBdOrderInfoDTO; + } + + // @ApiOperation(value = "账户确认到账", notes = "账户确认到账接口") // @ApiImplicitParams({ // @ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3") diff --git a/src/main/java/cn/com/tenlion/operator/enums/ThirdPartyEnum.java b/src/main/java/cn/com/tenlion/operator/enums/ThirdPartyEnum.java index a9cbdb0..3185961 100644 --- a/src/main/java/cn/com/tenlion/operator/enums/ThirdPartyEnum.java +++ b/src/main/java/cn/com/tenlion/operator/enums/ThirdPartyEnum.java @@ -12,7 +12,7 @@ public enum ThirdPartyEnum { DGZZ("对公转账"), WX("微信"), ZFB("支付宝"), - + BD("百度"), XT("系统"); /** 2025年3月24日14:11:30 CBC 新增了 系统充值 */ private final String value; diff --git a/src/main/java/cn/com/tenlion/operator/pojo/dtos/accountrecharge/AccountRechargeBdOrderInfoDTO.java b/src/main/java/cn/com/tenlion/operator/pojo/dtos/accountrecharge/AccountRechargeBdOrderInfoDTO.java new file mode 100644 index 0000000..93bccb0 --- /dev/null +++ b/src/main/java/cn/com/tenlion/operator/pojo/dtos/accountrecharge/AccountRechargeBdOrderInfoDTO.java @@ -0,0 +1,159 @@ +package cn.com.tenlion.operator.pojo.dtos.accountrecharge; + +/** + * 百度订单 + * 文档地址:https://smartprogram.baidu.com/docs/develop/function/tune_up_2.0/ + */ +public class AccountRechargeBdOrderInfoDTO { + + private String dealId; + private String appKey; + private String totalAmount; + private String tpOrderId; + private String notifyUrl; + private String dealTitle; + private String signFieldsRange; + private String rsaSign; + private String bizInfo; + private String payResultUrl; + private String inlinePaySign; + private String promotionTag; + + public String getDealId() { + return dealId == null ? "" : dealId.trim(); + } + + public void setDealId(String dealId) { + this.dealId = dealId; + } + + public String getAppKey() { + return appKey == null ? "" : appKey.trim(); + } + + public void setAppKey(String appKey) { + this.appKey = appKey; + } + + public String getTotalAmount() { + return totalAmount == null ? "" : totalAmount.trim(); + } + + public void setTotalAmount(String totalAmount) { + this.totalAmount = totalAmount; + } + + public String getTpOrderId() { + return tpOrderId == null ? "" : tpOrderId.trim(); + } + + public void setTpOrderId(String tpOrderId) { + this.tpOrderId = tpOrderId; + } + + public String getNotifyUrl() { + return notifyUrl == null ? "" : notifyUrl.trim(); + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + public String getDealTitle() { + return dealTitle == null ? "" : dealTitle.trim(); + } + + public void setDealTitle(String dealTitle) { + this.dealTitle = dealTitle; + } + + public String getSignFieldsRange() { + return signFieldsRange == null ? "" : signFieldsRange.trim(); + } + + public void setSignFieldsRange(String signFieldsRange) { + this.signFieldsRange = signFieldsRange; + } + + public String getRsaSign() { + return rsaSign == null ? "" : rsaSign.trim(); + } + + public void setRsaSign(String rsaSign) { + this.rsaSign = rsaSign; + } + + public String getBizInfo() { + return bizInfo == null ? "" : bizInfo.trim(); + } + + public void setBizInfo(String bizInfo) { + this.bizInfo = bizInfo; + } + + public String getPayResultUrl() { + return payResultUrl == null ? "" : payResultUrl.trim(); + } + + public void setPayResultUrl(String payResultUrl) { + this.payResultUrl = payResultUrl; + } + + public String getInlinePaySign() { + return inlinePaySign == null ? "" : inlinePaySign.trim(); + } + + public void setInlinePaySign(String inlinePaySign) { + this.inlinePaySign = inlinePaySign; + } + + public String getPromotionTag() { + return promotionTag == null ? "" : promotionTag.trim(); + } + + public void setPromotionTag(String promotionTag) { + this.promotionTag = promotionTag; + } + + @Override + public String toString() { + return "{" + + "\"dealId\":\"" + + dealId + '\"' + + + ",\"appKey\":\"" + + appKey + '\"' + + + ",\"totalAmount\":\"" + + totalAmount + '\"' + + + ",\"tpOrderId\":\"" + + tpOrderId + '\"' + + + ",\"notifyUrl\":\"" + + notifyUrl + '\"' + + + ",\"dealTitle\":\"" + + dealTitle + '\"' + + + ",\"signFieldsRange\":\"" + + signFieldsRange + '\"' + + + ",\"rsaSign\":\"" + + rsaSign + '\"' + + + ",\"bizInfo\":\"" + + bizInfo + '\"' + + + ",\"payResultUrl\":\"" + + payResultUrl + '\"' + + + ",\"inlinePaySign\":\"" + + inlinePaySign + '\"' + + + ",\"promotionTag\":\"" + + promotionTag + '\"' + + + "}"; + } +} diff --git a/src/main/java/cn/com/tenlion/operator/pojo/vos/accountrecharge/AccountRechargeBdOrderInfoVO.java b/src/main/java/cn/com/tenlion/operator/pojo/vos/accountrecharge/AccountRechargeBdOrderInfoVO.java new file mode 100644 index 0000000..e054f7e --- /dev/null +++ b/src/main/java/cn/com/tenlion/operator/pojo/vos/accountrecharge/AccountRechargeBdOrderInfoVO.java @@ -0,0 +1,39 @@ +package cn.com.tenlion.operator.pojo.vos.accountrecharge; + +import ink.wgink.annotation.CheckNumberAnnotation; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @ClassName: AccountRechargeBdOrderInfoVO + * @Description: 账户充值 + * @Author: CodeFactory + * @Date: 2024-01-13 14:38:21 + * @Version: 3.0 + **/ +@ApiModel +public class AccountRechargeBdOrderInfoVO { + + @ApiModelProperty(name = "rechargeMoney", value = "充值金额") + @CheckNumberAnnotation(name = "金额") + private Double rechargeMoney; + @ApiModelProperty(name = "packageInfoId", value = "自定义回调函数/2025年2月28日10:03:44/CBC新增") + private String packageInfoId; + + public String getPackageInfoId() { + return packageInfoId == null ? "" : packageInfoId.trim(); + } + + public void setPackageInfoId(String packageInfoId) { + this.packageInfoId = packageInfoId; + } + + public Double getRechargeMoney() { + return rechargeMoney == null ? 0 : rechargeMoney; + } + + public void setRechargeMoney(Double rechargeMoney) { + this.rechargeMoney = rechargeMoney; + } + +} diff --git a/src/main/java/cn/com/tenlion/operator/service/accountrecharge/IAccountRechargeService.java b/src/main/java/cn/com/tenlion/operator/service/accountrecharge/IAccountRechargeService.java index d3d07f1..28a4bab 100644 --- a/src/main/java/cn/com/tenlion/operator/service/accountrecharge/IAccountRechargeService.java +++ b/src/main/java/cn/com/tenlion/operator/service/accountrecharge/IAccountRechargeService.java @@ -1,13 +1,11 @@ package cn.com.tenlion.operator.service.accountrecharge; import cn.com.tenlion.operator.enums.RechargeCheckEnum; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeWxPrepayDTO; +import cn.com.tenlion.operator.pojo.dtos.accountrecharge.*; +import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeBdOrderInfoVO; import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeWxPrepayVO; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResultList; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeDTO; import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeVO; import cn.com.tenlion.operator.pojo.bos.accountrecharge.AccountRechargeBO; import cn.com.tenlion.operator.pojo.pos.accountrecharge.AccountRechargePO; @@ -195,6 +193,8 @@ public interface IAccountRechargeService { AccountRechargeWxPrepayDTO saveWxMiniappPayPrepayId(AccountRechargeWxPrepayVO accountRechargeWxPrepayVO); + AccountRechargeBdOrderInfoDTO saveBdOrderInfo(AccountRechargeBdOrderInfoVO accountRechargeBdOrderInfoVO); + void updateClose(String accountRechargeId); void updateCloseByIds(List accountRechargeIds); @@ -211,5 +211,4 @@ public interface IAccountRechargeService { SuccessResultList> listPageBO(ListPage page); - } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/operator/service/accountrecharge/impl/AccountRechargeServiceImpl.java b/src/main/java/cn/com/tenlion/operator/service/accountrecharge/impl/AccountRechargeServiceImpl.java index 701a663..8f397df 100644 --- a/src/main/java/cn/com/tenlion/operator/service/accountrecharge/impl/AccountRechargeServiceImpl.java +++ b/src/main/java/cn/com/tenlion/operator/service/accountrecharge/impl/AccountRechargeServiceImpl.java @@ -6,12 +6,11 @@ import cn.com.tenlion.operator.enums.ReconciliationStatusEnum; import cn.com.tenlion.operator.enums.ThirdPartyEnum; import cn.com.tenlion.operator.pojo.dtos.account.AccountDTO; import cn.com.tenlion.operator.pojo.dtos.accountbank.AccountBankDTO; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeWxPrepayDTO; +import cn.com.tenlion.operator.pojo.dtos.accountrecharge.*; import cn.com.tenlion.operator.pojo.dtos.ic.UsericDTO; import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO; import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemVO; +import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeBdOrderInfoVO; import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeWxPrepayVO; import cn.com.tenlion.operator.properties.SystemApiPathProperties; import cn.com.tenlion.operator.remote.IOperatorPluginRemoteService; @@ -26,10 +25,7 @@ import cn.com.tenlion.operator.service.sys.callback.SysCallbackService; import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl; import cn.com.tenlion.operator.util.TenlionSMS; import cn.com.tenlion.operator.util.UserUtil; -import cn.com.tenlion.operator.util.pay.ALiPay; -import cn.com.tenlion.operator.util.pay.PayResultDTO; -import cn.com.tenlion.operator.util.pay.PayUtil; -import cn.com.tenlion.operator.util.pay.WXPay; +import cn.com.tenlion.operator.util.pay.*; import cn.com.tenlion.projectconfig.util.ProjectConfigUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -49,7 +45,6 @@ import ink.wgink.util.date.DateUtil; import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.UUIDUtil; import cn.com.tenlion.operator.dao.accountrecharge.IAccountRechargeDao; -import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeDTO; import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeVO; import cn.com.tenlion.operator.pojo.bos.accountrecharge.AccountRechargeBO; import cn.com.tenlion.operator.pojo.pos.accountrecharge.AccountRechargePO; @@ -98,6 +93,8 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA private IOperatorPluginRemoteService operatorPluginRemoteService; @Autowired private UserExpandServiceImpl userExpandServiceImpl; + @Autowired + private BaiduPay baiduPay; @Override public void save(AccountRechargeVO accountRechargeVO) { @@ -202,9 +199,9 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA updateCheck(po.getAccountRechargeId(), RechargeCheckEnum.RECHARGE_SUCCESS, rechargeRemark, accountItemId, "", DateUtil.getTime()); // 套餐包购买的不通知 - if(StringUtils.isEmpty(dto.getPackageInfoId())) { + if (StringUtils.isEmpty(dto.getPackageInfoId())) { // 3. 平台通知到账 - JSONObject jsonobject =new JSONObject(); + JSONObject jsonobject = new JSONObject(); jsonobject.put("money", po.getRechargeMoney()); sysCallbackService.save("对公充值到账", systemApiPathProperties.getCopyright() + "api/pay/recharge-success/user-id/" + po.getAccountId(), jsonobject); } @@ -330,7 +327,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA accountRechargeDao.updateCheck(params); AccountRechargeDTO dto = get(accountRechargeId); // 创建套餐包关闭支付 - if(!StringUtils.isEmpty(dto.getPackageInfoId())) { + if (!StringUtils.isEmpty(dto.getPackageInfoId())) { String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); SuccessResultData result = operatorPluginRemoteService.updateClose(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accessToken); if (!result.getData().equals("Success")) { @@ -377,18 +374,18 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA // 2025年2月28日11:12:47 CBC 新增 套餐包 逻辑 AccountRechargeDTO dto = get(accountRechargeId); // 绑定了套餐包 & 已对账 & 已到账 - if(!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("2")) { + if (!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("2")) { String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); - PackageOrderDTO packageInfoDTO = operatorPluginRemoteService.getByNo(systemApiPathProperties.getOperatorPlugin(), accountRechargeId , accessToken); + PackageOrderDTO packageInfoDTO = operatorPluginRemoteService.getByNo(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accessToken); // 远程更改套餐包的付款到账状态 String accountItemId1 = UUIDUtil.getUUID(); // 获取用户余额 , 如果不够 , 则不购买 AccountDTO accountDTO = iAccountService.get(dto.getAccountId()); - if(accountDTO.getAccountMoney() >= packageInfoDTO.getPackageTotalMoney()) { + if (accountDTO.getAccountMoney() >= packageInfoDTO.getPackageTotalMoney()) { SuccessResultData result = operatorPluginRemoteService.updatePay(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accountItemId1, accessToken); if (result.getData().equals("Success")) { AccountDTO accountDTO2 = iAccountService.get(dto.getAccountId()); - if(accountDTO2.getAccountMoney() >= packageInfoDTO.getPackageTotalMoney()) { + if (accountDTO2.getAccountMoney() >= packageInfoDTO.getPackageTotalMoney()) { /** * 1. 创建流水 */ @@ -402,13 +399,13 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA vo.setDescription("购买" + (packageInfoDTO.getPackageInfoAppDTO().getPackageType().equals("ALL") ? "全托管" : "写材料") + "套餐包 " + packageInfoDTO.getPackageInfoAppDTO().getPackageCount() + " 件:" + packageInfoDTO.getPackageInfoAppDTO().getPackageName()); iAccountItemService.saveReturnId(vo); } - }else{ + } else { System.out.println("调用套餐包到账结果 : " + result); } } } // 绑定了套餐包 & 已对账 & 已关闭 - if(!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("-1")) { + if (!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("-1")) { String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); SuccessResultData result = operatorPluginRemoteService.updateClose(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accessToken); if (!result.getData().equals("Success")) { @@ -422,69 +419,69 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA public AccountRechargePayDTO saveAccount(String thirdParty, AccountRechargeVO accountRechargeVO) { AccountRechargePayDTO payDTO = new AccountRechargePayDTO(); // synchronized (lock) { - String userId = accountRechargeVO.getUserId(); - // 未支付的订单 - Integer count = countByUserIdAndRechargeCheck(userId, RechargeCheckEnum.UN_RECHARGE); + String userId = accountRechargeVO.getUserId(); + // 未支付的订单 + Integer count = countByUserIdAndRechargeCheck(userId, RechargeCheckEnum.UN_RECHARGE); /* if (count > ProjectConfigUtil.getInt("ToDayMaxRechargeCount")) { throw new SaveException("超过创建订单数量上限"); }*/ - accountRechargeVO.setThirdParty(thirdParty); - accountRechargeVO.setAccountId(userId); - accountRechargeVO.setRechargeCheck(RechargeCheckEnum.UN_RECHARGE.getValue()); - accountRechargeVO.setReconciliationStatus(ReconciliationStatusEnum.UN_RECONCILIATION.getValue()); - Integer totalMoney = PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney()); - String currentDate = DateUtil.getTime(); + accountRechargeVO.setThirdParty(thirdParty); + accountRechargeVO.setAccountId(userId); + accountRechargeVO.setRechargeCheck(RechargeCheckEnum.UN_RECHARGE.getValue()); + accountRechargeVO.setReconciliationStatus(ReconciliationStatusEnum.UN_RECONCILIATION.getValue()); + Integer totalMoney = PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney()); + String currentDate = DateUtil.getTime(); - Map params = HashMapUtil.beanToMap(accountRechargeVO); - if (ThirdPartyEnum.WX.getValue().equals(thirdParty)) { - String accountRechargeId = getUUID("wx"); - params.put("rechargeType", RechargeTypeEnum.ONLINE.getValue()); - params.put("accountRechargeId", accountRechargeId); - params.put("rechargeFinalTime", currentDate); + Map params = HashMapUtil.beanToMap(accountRechargeVO); + if (ThirdPartyEnum.WX.getValue().equals(thirdParty)) { + String accountRechargeId = getUUID("wx"); + params.put("rechargeType", RechargeTypeEnum.ONLINE.getValue()); + params.put("accountRechargeId", accountRechargeId); + params.put("rechargeFinalTime", currentDate); - String brcode = WXPay.createPay(accountRechargeId, totalMoney, ProjectConfigUtil.getText("RechargePayTitle")); - payDTO.setAccountRechargeId(accountRechargeId); - payDTO.setThirdParty(thirdParty); - payDTO.setThirdPartyPayUrl(brcode); - } else if (ThirdPartyEnum.ZFB.getValue().equals(thirdParty)) { - String accountRechargeId = getUUID("zfb"); - params.put("rechargeType", RechargeTypeEnum.ONLINE.getValue()); - params.put("accountRechargeId", accountRechargeId); - params.put("rechargeFinalTime", currentDate); + String brcode = WXPay.createPay(accountRechargeId, totalMoney, ProjectConfigUtil.getText("RechargePayTitle")); + payDTO.setAccountRechargeId(accountRechargeId); + payDTO.setThirdParty(thirdParty); + payDTO.setThirdPartyPayUrl(brcode); + } else if (ThirdPartyEnum.ZFB.getValue().equals(thirdParty)) { + String accountRechargeId = getUUID("zfb"); + params.put("rechargeType", RechargeTypeEnum.ONLINE.getValue()); + params.put("accountRechargeId", accountRechargeId); + params.put("rechargeFinalTime", currentDate); - String brcode = ALiPay.createPay(accountRechargeId, totalMoney, ProjectConfigUtil.getText("RechargePayTitle")); - payDTO.setAccountRechargeId(accountRechargeId); - payDTO.setThirdParty(thirdParty); - payDTO.setThirdPartyPayUrl(brcode); - } else if (ThirdPartyEnum.DGZZ.getValue().equals(thirdParty)) { - String accountRechargeId = getUUID("oto"); - params.put("rechargeType", RechargeTypeEnum.OFFLINE.getValue()); - params.put("accountRechargeId", accountRechargeId); - payDTO.setAccountRechargeId(accountRechargeId); - } else { - throw new ParamsException("充值类型错误"); - } - params.put("creator", userId); - params.put("gmtCreate", currentDate); - params.put("modifier", userId); - params.put("gmtModified", currentDate); - params.put("isDelete", 0); - accountRechargeDao.save(params); - - // 创建套餐包购买记录 - if(!StringUtils.isEmpty(accountRechargeVO.getPackageInfoId())) { - PackageOrderAppVO appVO = new PackageOrderAppVO(); - appVO.setPackageInfoId(accountRechargeVO.getPackageInfoId()); - appVO.setUserId(userId); - appVO.setAccountRechargeId(payDTO.getAccountRechargeId()); - - String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); - SuccessResultData result = operatorPluginRemoteService.saveOrder(systemApiPathProperties.getOperatorPlugin(), appVO, accessToken); - if (!result.getData().equals("Success")) { - System.out.println("调用套餐包创建结果 : " + result); - throw new SaveException(result.getData()); - } + String brcode = ALiPay.createPay(accountRechargeId, totalMoney, ProjectConfigUtil.getText("RechargePayTitle")); + payDTO.setAccountRechargeId(accountRechargeId); + payDTO.setThirdParty(thirdParty); + payDTO.setThirdPartyPayUrl(brcode); + } else if (ThirdPartyEnum.DGZZ.getValue().equals(thirdParty)) { + String accountRechargeId = getUUID("oto"); + params.put("rechargeType", RechargeTypeEnum.OFFLINE.getValue()); + params.put("accountRechargeId", accountRechargeId); + payDTO.setAccountRechargeId(accountRechargeId); + } else { + throw new ParamsException("充值类型错误"); + } + params.put("creator", userId); + params.put("gmtCreate", currentDate); + params.put("modifier", userId); + params.put("gmtModified", currentDate); + params.put("isDelete", 0); + accountRechargeDao.save(params); + + // 创建套餐包购买记录 + if (!StringUtils.isEmpty(accountRechargeVO.getPackageInfoId())) { + PackageOrderAppVO appVO = new PackageOrderAppVO(); + appVO.setPackageInfoId(accountRechargeVO.getPackageInfoId()); + appVO.setUserId(userId); + appVO.setAccountRechargeId(payDTO.getAccountRechargeId()); + + String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); + SuccessResultData result = operatorPluginRemoteService.saveOrder(systemApiPathProperties.getOperatorPlugin(), appVO, accessToken); + if (!result.getData().equals("Success")) { + System.out.println("调用套餐包创建结果 : " + result); + throw new SaveException(result.getData()); } + } // } return payDTO; @@ -533,6 +530,40 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA return WXPay.createPrepayId(po.getWxMiniappOpenId(), accountRechargeId, totalMoney, ProjectConfigUtil.getText("RechargePayTitle")); } + @Override + public AccountRechargeBdOrderInfoDTO saveBdOrderInfo(AccountRechargeBdOrderInfoVO accountRechargeBdOrderInfoVO) { + String userId = securityComponent.getCurrentUser().getUserId(); + UserExpandPO po = userExpandServiceImpl.getPO(userId); + if (po == null) { + throw new SearchException("用户小程序信息不存在"); + } + AccountRechargeVO accountRechargeVO = new AccountRechargeVO(); + accountRechargeVO.setUserId(userId); + accountRechargeVO.setThirdParty("百度"); + accountRechargeVO.setAccountId(userId); + accountRechargeVO.setRechargeCheck(RechargeCheckEnum.UN_RECHARGE.getValue()); + accountRechargeVO.setReconciliationStatus(ReconciliationStatusEnum.UN_RECONCILIATION.getValue()); + accountRechargeVO.setRechargeMoney(accountRechargeBdOrderInfoVO.getRechargeMoney()); + accountRechargeVO.setPackageInfoId(accountRechargeBdOrderInfoVO.getPackageInfoId()); + String accountRechargeId = getUUID("bd"); + Integer totalMoney = PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney()); + String currentDate = DateUtil.getTime(); + + Map params = HashMapUtil.beanToMap(accountRechargeVO); + params.put("userId", userId); + params.put("rechargeType", RechargeTypeEnum.ONLINE.getValue()); + params.put("accountRechargeId", accountRechargeId); + params.put("rechargeFinalTime", currentDate); + params.put("creator", userId); + params.put("gmtCreate", currentDate); + params.put("modifier", userId); + params.put("gmtModified", currentDate); + params.put("isDelete", 0); + accountRechargeDao.save(params); + savePackageInfo(accountRechargeId, accountRechargeVO); + return baiduPay.getBdOrderInfo("用户充值", accountRechargeId, totalMoney); + } + /** * 保存套餐包记录 * @@ -640,7 +671,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA AccountRechargeDTO accountRechargeDTO = get(accountRechargeId); JSONArray phoneArray = new JSONArray(); String[] phones = ProjectConfigUtil.getText("HandleRechargePhones").split(","); - for(String phone : phones) { + for (String phone : phones) { com.alibaba.fastjson.JSONObject obj1 = new JSONObject(); obj1.put("phone", phone); phoneArray.add(obj1); @@ -648,7 +679,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA Map templateParams = new HashMap<>(); templateParams.put("count", 1 + ""); templateParams.put("money", accountRechargeDTO.getRechargeMoney() + ""); - TenlionSMS.sendMessage(UUIDUtil.getUUID(), "M00005", templateParams, phoneArray); + TenlionSMS.sendMessage(UUIDUtil.getUUID(), "M00005", templateParams, phoneArray); accountRechargeDao.update(params); } @@ -673,7 +704,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA rechargePayResultDTO.setOrderMessage("付款信息已提交, 请等待平台核对"); updateOrgData(accountRechargeId, accountRechargeVO); return rechargePayResultDTO; - } else if(dto.getThirdParty().equals(ThirdPartyEnum.XT.getValue())) { + } else if (dto.getThirdParty().equals(ThirdPartyEnum.XT.getValue())) { /** * 保存充值信息 * 2025年3月24日14:12:44 @@ -745,7 +776,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA public synchronized void saveConfirmOnline(String id, String orderId, String successTime) { AccountRechargeDTO dto = get(id); if (StringUtils.isEmpty(dto.getAccountItemId()) && - dto.getReconciliationStatus().equals(ReconciliationStatusEnum.UN_RECONCILIATION.getValue())) { + dto.getReconciliationStatus().equals(ReconciliationStatusEnum.UN_RECONCILIATION.getValue())) { // 1. 生成流水记录 AccountItemVO vo = new AccountItemVO(); vo.setType(1); @@ -758,9 +789,9 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA updateCheck(dto.getAccountRechargeId(), RechargeCheckEnum.RECHARGE_SUCCESS, "线上充值", accountItemId, orderId, successTime); // 套餐包购买的不通知 - if(StringUtils.isEmpty(dto.getPackageInfoId())) { + if (StringUtils.isEmpty(dto.getPackageInfoId())) { // 3. 平台通知到账 - JSONObject jsonobject =new JSONObject(); + JSONObject jsonobject = new JSONObject(); jsonobject.put("money", dto.getRechargeMoney()); sysCallbackService.save("对公充值到账", systemApiPathProperties.getCopyright() + "api/pay/recharge-success/user-id/" + dto.getAccountId(), jsonobject); } diff --git a/src/main/java/cn/com/tenlion/operator/util/pay/BaiduPay.java b/src/main/java/cn/com/tenlion/operator/util/pay/BaiduPay.java new file mode 100644 index 0000000..0720458 --- /dev/null +++ b/src/main/java/cn/com/tenlion/operator/util/pay/BaiduPay.java @@ -0,0 +1,174 @@ +package cn.com.tenlion.operator.util.pay; + +import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeBdOrderInfoDTO; +import ink.wgink.exceptions.base.SystemException; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.security.*; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.*; + +@Component +public class BaiduPay { + + private static final String CHARSET = "UTF-8"; + private static final String SIGN_TYPE_RSA = "RSA"; + private static final String SIGN_ALGORITHMS = "SHA1WithRSA"; + private static final String SIGN_KEY = "rsaSign"; + @Autowired + private BaiduProperties baiduProperties; + + /** + * 签名 + * + * @param dealTitle + * @param tpOrderId + * @param totalAmount + * @return + * @throws Exception + */ + public AccountRechargeBdOrderInfoDTO getBdOrderInfo(String dealTitle, String tpOrderId, long totalAmount) { + try { + + String privateKey = FileUtils.readFileToString(new File(baiduProperties.getPrivateKey()), "UTF-8"); + privateKey = privateKey.replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", "").replace("\r", "").replace("\n", ""); + String rsaSign = sign(new HashMap() {{ + put("appKey", baiduProperties.getAppKey()); + put("dealId", baiduProperties.getDealId()); + put("tpOrderId", tpOrderId); + put("totalAmount", totalAmount); + }}, privateKey); + AccountRechargeBdOrderInfoDTO accountRechargeBdOrderInfoDTO = new AccountRechargeBdOrderInfoDTO(); + accountRechargeBdOrderInfoDTO.setDealId(baiduProperties.getDealId()); + accountRechargeBdOrderInfoDTO.setAppKey(baiduProperties.getAppKey()); + accountRechargeBdOrderInfoDTO.setTotalAmount(String.valueOf(totalAmount)); + accountRechargeBdOrderInfoDTO.setTpOrderId(tpOrderId); + accountRechargeBdOrderInfoDTO.setNotifyUrl(baiduProperties.getNotifyUrl()); + accountRechargeBdOrderInfoDTO.setDealTitle(dealTitle); + accountRechargeBdOrderInfoDTO.setSignFieldsRange("1"); + accountRechargeBdOrderInfoDTO.setRsaSign(rsaSign); + return accountRechargeBdOrderInfoDTO; + } catch (Exception e) { + throw new SystemException(e); + } + } + + /** + * 使用私钥生成签名字符串 + * + * @param params 待签名参数集合 + * @param privateKey 私钥原始字符串 + * @return 签名结果字符串 + * @throws Exception + */ + private static String sign(Map params, String privateKey) throws Exception { + String signContent = signContent(params); + Signature signature = Signature.getInstance(SIGN_ALGORITHMS); + signature.initSign(getPrivateKeyPKCS8(privateKey)); + signature.update(signContent.getBytes(CHARSET)); + byte[] signed = signature.sign(); + + return new String(Base64.getEncoder().encode(signed)); + } + + /** + * 使用公钥校验签名 + * + * @param params 入参数据,签名属性名固定为rsaSign + * @param publicKey 公钥原始字符串 + * @return true 验签通过 | false 验签不通过 + * @throws Exception + */ + private static boolean checkSign(Map params, String publicKey) throws Exception { + // sign & content + String content = signContent(params); + String rsaSign = params.get(SIGN_KEY).toString(); + + // verify + Signature signature = Signature.getInstance(SIGN_ALGORITHMS); + signature.initVerify(getPublicKeyX509(publicKey)); + signature.update(content.getBytes(CHARSET)); + + return signature.verify(Base64.getDecoder().decode(rsaSign.getBytes(CHARSET))); + } + + /** + * 对输入参数进行key过滤排序和字符串拼接 + * + * @param params 待签名参数集合 + * @return 待签名内容 + * @throws UnsupportedEncodingException + */ + private static String signContent(Map params) throws UnsupportedEncodingException { + Map sortedParams = new TreeMap<>(Comparator.naturalOrder()); + for (Map.Entry entry : params.entrySet()) { + String key = entry.getKey(); + if (legalKey(key)) { + sortedParams.put(key, entry.getValue().toString()); + } + } + + StringBuilder builder = new StringBuilder(); + for (Map.Entry entry : sortedParams.entrySet()) { + builder.append(entry.getKey()); + builder.append("="); + builder.append(entry.getValue()); + builder.append("&"); + } + builder.deleteCharAt(builder.length() - 1); + return builder.toString(); + } + + /** + * 将公钥字符串进行Base64 decode之后,生成X509标准公钥 + * + * @param publicKey 公钥原始字符串 + * @return X509标准公钥 + * @throws InvalidKeySpecException + * @throws NoSuchAlgorithmException + */ + private static PublicKey getPublicKeyX509(String publicKey) throws InvalidKeySpecException, + NoSuchAlgorithmException, UnsupportedEncodingException { + if (StringUtils.isEmpty(publicKey)) { + return null; + } + KeyFactory keyFactory = KeyFactory.getInstance(SIGN_TYPE_RSA); + byte[] decodedKey = Base64.getDecoder().decode(publicKey.getBytes(CHARSET)); + return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey)); + } + + /** + * 将私钥字符串进行Base64 decode之后,生成PKCS #8标准的私钥 + * + * @param privateKey 私钥原始字符串 + * @return PKCS #8标准的私钥 + * @throws Exception + */ + private static PrivateKey getPrivateKeyPKCS8(String privateKey) throws Exception { + if (StringUtils.isEmpty(privateKey)) { + return null; + } + KeyFactory keyFactory = KeyFactory.getInstance(SIGN_TYPE_RSA); + byte[] decodedKey = Base64.getDecoder().decode(privateKey.getBytes(CHARSET)); + return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(decodedKey)); + } + + /** + * 有效的待签名参数key值 + * 非空、且非签名字段 + * + * @param key 待签名参数key值 + * @return true | false + */ + private static boolean legalKey(String key) { + return StringUtils.isNotBlank(key) && !SIGN_KEY.equalsIgnoreCase(key); + } + +} diff --git a/src/main/java/cn/com/tenlion/operator/util/pay/BaiduProperties.java b/src/main/java/cn/com/tenlion/operator/util/pay/BaiduProperties.java new file mode 100644 index 0000000..bd9d93a --- /dev/null +++ b/src/main/java/cn/com/tenlion/operator/util/pay/BaiduProperties.java @@ -0,0 +1,88 @@ +package cn.com.tenlion.operator.util.pay; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix = "pay.baidu-pay") +public class BaiduProperties { + + private String dealId; + private String appId; + private String appKey; + private String publicKey; + private String privateKey; + private String notifyUrl; + + public String getDealId() { + return dealId == null ? "" : dealId.trim(); + } + + public void setDealId(String dealId) { + this.dealId = dealId; + } + + public String getAppId() { + return appId == null ? "" : appId.trim(); + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getAppKey() { + return appKey == null ? "" : appKey.trim(); + } + + public void setAppKey(String appKey) { + this.appKey = appKey; + } + + public String getPublicKey() { + return publicKey == null ? "" : publicKey.trim(); + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public String getPrivateKey() { + return privateKey == null ? "" : privateKey.trim(); + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + public String getNotifyUrl() { + return notifyUrl == null ? "" : notifyUrl.trim(); + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + @Override + public String toString() { + return "{" + + "\"dealId\":\"" + + dealId + '\"' + + + ",\"appId\":\"" + + appId + '\"' + + + ",\"appKey\":\"" + + appKey + '\"' + + + ",\"publicKey\":\"" + + publicKey + '\"' + + + ",\"privateKey\":\"" + + privateKey + '\"' + + + ",\"notifyUrl\":\"" + + notifyUrl + '\"' + + + "}"; + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 6ff182a..44b2650 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -202,6 +202,13 @@ pay: max-money: 20000 # 单笔最小金额 min-money: 0.1 + baidu-pay: + deal-id: 1561190752 + app-id: 687042 + app-key: MMa5Lo + public-key: D:\BdPayRsa\rsa_public_key.pem + private-key: D:\BdPayRsa\rsa_private_key_pkcs8.pem + notify-url: http://121.36.71.250:58038/operator/api/account/pay-bd app-token: has-role: true diff --git a/src/main/resources/static/assets/images/login/wx-miniapp-code.jpg b/src/main/resources/static/assets/images/login/wx-miniapp-code.jpg new file mode 100644 index 0000000..82555d4 Binary files /dev/null and b/src/main/resources/static/assets/images/login/wx-miniapp-code.jpg differ diff --git a/src/main/resources/templates/systemuser/login-old2.html b/src/main/resources/templates/systemuser/login-old2.html new file mode 100644 index 0000000..a7266ef --- /dev/null +++ b/src/main/resources/templates/systemuser/login-old2.html @@ -0,0 +1,537 @@ + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
用户登录
+
+
+ +
+ +
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+ +
+
+
+
+ + + + +
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+
忘记密码
+
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+ +
+ + +
+
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/systemuser/login.html b/src/main/resources/templates/systemuser/login.html index a7266ef..847511c 100644 --- a/src/main/resources/templates/systemuser/login.html +++ b/src/main/resources/templates/systemuser/login.html @@ -52,8 +52,7 @@ align-items: center; } #app .container { - width: 300px; - padding: 15px; + padding: 30px; background-color: #FFF; border-radius: 10px; box-shadow: 0 0 5px rgba(0,0,0,0.3); @@ -65,43 +64,178 @@ } #app .container .body { margin-top: 15px; + display: flex; + justify-content: space-between; } - #app .container .body .layui-form-item .layui-input { + #app .container .body .left { + width: 300px; + display: flex; + flex-direction: column; + align-items: center; + border-right: 1px solid #E1E1E1; + .title { + font-size: 20px; + font-weight: bold; + } + .miniapp-code { + width: 240px; + height: 240px; + margin: 15px 0; + } + .miniapp-code img { + width: 100%; + height: 100%; + } + } + #app .container .body .right { + width: 400px; + padding: 0 30px; + .login-type { + display: flex; + justify-content: center; + } + .login-type .login-type-item { + width: 150px; + font-size: 18px; + text-align: center; + cursor: pointer; + } + .login-type .login-type-item.active { + color: rgb(253, 166, 51); + } + .login-type .login-type-item:first-child { + border-right: 1px solid #E1E1E1; + } + .login-form { + margin-top: 15px; + } + .login-form .login-input-container { + border: 1px solid #E1E1E1; + border-radius: 10px; + padding: 5px 0; + } + .login-form .login-input-container .form-input-item { + border-bottom: 1px solid #E1E1E1; + } + .login-form .login-input-container .form-input-item:last-child { + border-bottom: none; + } + .login-form .login-input-container .form-input-item .form-input-label { + display: inline-block; + width: 70px; + text-align: center; + } + .login-form .login-input-container .form-input-item .form-input { + width: 200px; + padding: 5px; + border: none; + } + .login-form .login-input-container .form-input-item .form-input input { + height: 32px; + line-height: 32px; + } + .login-form .login-input-container .form-input-item .layui-icon-vercode { + line-height: 32px; + width: 60px; + } + .login-form .login-input-container .form-input-item .vercode-input { + height: 32px; + line-height: 32px; + padding-left: 75px; + border: none; + } + .login-form .login-input-container .form-input-item .vercode-input:focus { + box-shadow: none; + } + .login-form .login-input-container .form-input-item .forget-username-password { + padding-top: 2px; + color: rgb(253, 166, 51); + } + .login-form .login-input-container .form-input-item .layadmin-user-login-codeimg { + width: 120px; + height: 32px; + } + .login-form .remember-username { + margin: 15px; + } + .login-form .btn-container { + display: flex; + justify-content: center; + } + .login-form .btn-container .login-btn { + border-radius: 10px; + } + .login-form .form-input-item .verify-code { + display: flex; + align-items: center; + height: 32px; + } + .login-form .form-input-item .verify-code .sms-verify-code { + color: rgb(253, 166, 51); + } + .login-form .other-login-type { + margin-top: 15px; + color: #9499a0; + } + .login-form .other-login-type .title { + text-align: center; + } + .login-form .other-login-type .login-type { + margin-top: 15px; + display: flex; + justify-content: center; + } + .login-form .other-login-type .login-type .login-item { + cursor: pointer; + } + .login-form .other-login-type .login-type .login-item img { + width: 28px; + height: 28px; + } + } + #app .register-container { + padding: 30px; + background-color: #FFF; + border-radius: 10px; + box-shadow: 0 0 5px rgba(0,0,0,0.3); + } + #app .register-container .header { + font-size: 16px; + border-left: 5px solid #fda633; + padding-left: 10px; + } + #app .register-container .body .layui-form-item .layui-input { padding-left: 35px; } - #app .container .body .layui-form-item .verify-code { + #app .register-container .body .layui-form-item .verify-code { height: 38px; - display: flex; - justify-content: center; - align-items: center; + line-height: 38px; } - #app .container .body .layui-form-item .verify-code a { - color: #1e9fff; + #app .register-container .body .layui-form-item .verify-code a { + margin-left: 5px; + color: rgb(253, 166, 51); } - #app .remember-username { - margin-bottom: 10px; - } - #app .container .footer { + #app .register-container .footer { font-size: 12px; } - #app .container .footer .login-type { + #app .register-container .footer .login-type { display: flex; justify-content: space-between; align-items: center; } - #app .container .footer .login-type .third-login .logo { + #app .register-container .footer .login-type .third-login .logo { width: 28px; height: 28px; display: block; } - #app .container .footer .login-type .third-login .logo img { + #app .register-container .footer .login-type .third-login .logo img { width: 100%; height: 100%; } - #app .container .footer a { - color: #1e9fff; + #app .register-container .footer a { + color: rgb(253, 166, 51); } - #app .container .footer .other { + #app .register-container .footer .other { margin-top: 10px; display: flex; justify-content: space-between; @@ -127,86 +261,88 @@
-
用户登录
-
- -
- -
- - +
+
打开微信小程序
+
+ 加载失败 +
+
请使用微信扫码
+
+
+ + + -
- - -
-
- -
-
- - + -
-
+
忘记密码
-
+
@@ -445,19 +581,6 @@ } }); }, - onLoginTypeClick: function(type) { - this.loginType = type; - var self = this; - if(type === 'username') { - this.activeAction = pageParams.loginFormAction; - } else if(type === 'sms') { - this.activeAction = pageParams.loginPhoneAction; - } else if(type === 'wx') { - this.$nextTick(function() { - self.initWxQrcode(); - }) - } - }, showErrorMessage: function() { var self = this; if(self.pageParams.errorMessage) { @@ -519,6 +642,10 @@ loginTypeChange: function(type) { this.loginType = type; }, + onWxQrLogin: function() { + var redirectUri = encodeURIComponent(this.pageParams.wxRedirectUri); + window.open(`https://open.weixin.qq.com/connect/qrconnect?appid=${this.pageParams.wxAppid}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`, '_self'); + } }, mounted: function() { var self = this;