Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b68a89e963 | ||
|
c42b1d277f | ||
|
789973efac | ||
|
aa244c1c58 | ||
|
795479921a | ||
|
32d2c358c8 | ||
|
f02e327613 |
@ -1,3 +1,18 @@
|
||||
# 20250528 (已上线)
|
||||
|
||||
## 新增配置
|
||||
|
||||
```yaml
|
||||
pay:
|
||||
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
|
||||
```
|
||||
|
||||
# 20250409(已上线20250424)
|
||||
|
||||
## 微信oauth2扫码登录
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
@ -12,7 +12,7 @@ public enum ThirdPartyEnum {
|
||||
DGZZ("对公转账"),
|
||||
WX("微信"),
|
||||
ZFB("支付宝"),
|
||||
|
||||
BD("百度"),
|
||||
XT("系统"); /** 2025年3月24日14:11:30 CBC 新增了 系统充值 */
|
||||
|
||||
private final String value;
|
||||
|
@ -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 + '\"'
|
||||
|
||||
+ "}";
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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<String> accountRechargeIds);
|
||||
@ -211,5 +211,4 @@ public interface IAccountRechargeService {
|
||||
|
||||
SuccessResultList<List<AccountRechargeBO>> listPageBO(ListPage page);
|
||||
|
||||
|
||||
}
|
@ -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<String> 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<String> 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<String> 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<String, Object> 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<String, Object> 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<String> 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<String> 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<String, Object> 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<String, String> 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);
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package cn.com.tenlion.operator.service.verify.code;
|
||||
|
||||
import cn.com.tenlion.operator.util.TenlionSMS;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.exceptions.base.SystemException;
|
||||
@ -10,9 +13,13 @@ import ink.wgink.module.sms.manager.VerifyCodeManager;
|
||||
import ink.wgink.module.sms.pojo.vos.sms.SmsVO;
|
||||
import ink.wgink.module.sms.service.sms.ISmsService;
|
||||
import ink.wgink.properties.sms.SmsProperties;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class VerifyCodeService extends DefaultBaseService {
|
||||
|
||||
@ -32,26 +39,14 @@ public class VerifyCodeService extends DefaultBaseService {
|
||||
String currentTimeStr = String.valueOf(System.currentTimeMillis());
|
||||
String code = currentTimeStr.substring(currentTimeStr.length() - 6);
|
||||
LOG.info(">>>>> 向手机号:{},发送验证码:{}", phone, code);
|
||||
|
||||
|
||||
SmsVO smsVO = new SmsVO();
|
||||
smsVO.setPhone(phone);
|
||||
smsVO.setContent(code);
|
||||
try {
|
||||
if (smsProperties.getActive()) {
|
||||
ISmsSend smsSend = new TencentSmsSendImpl(smsProperties.getTencentSms());
|
||||
smsSend.code(phone, code);
|
||||
}
|
||||
verifyCodeManager.setVerificationCode(phone, code);
|
||||
smsVO.setSendStatus(1);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage());
|
||||
String errorMessage = e.getMessage();
|
||||
smsVO.setSendStatus(0);
|
||||
smsVO.setErrorMessage(errorMessage);
|
||||
throw new SystemException("短信发送失败");
|
||||
} finally {
|
||||
smsService.save(smsVO);
|
||||
}
|
||||
Map<String, String> templateParams = new HashMap<>();
|
||||
templateParams.put("code", code);
|
||||
templateParams.put("time", "2");
|
||||
JSONArray phoneArray = new JSONArray();
|
||||
JSONObject phoneObject = new JSONObject();
|
||||
phoneObject.put("phone", phone);
|
||||
phoneArray.add(phoneObject);
|
||||
TenlionSMS.sendMessage(UUIDUtil.getUUID(), "M00001", templateParams, phoneArray);
|
||||
verifyCodeManager.setVerificationCode(phone, code);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package cn.com.tenlion.operator.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class WaveFileCleaner {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String basePath = "D:/UP20230404/Server/apache-tomcat-8-8083/webapps/baotou/uploadFiles/";
|
||||
String startDir = "20221231";
|
||||
String endDir = "20181102"; // 已修改为2018年
|
||||
|
||||
String minDir = startDir.compareTo(endDir) < 0 ? startDir : endDir;
|
||||
String maxDir = startDir.compareTo(endDir) < 0 ? endDir : startDir;
|
||||
System.out.println("开始日期" + minDir);
|
||||
System.out.println("结束日期" + maxDir);
|
||||
Pattern fileNamePattern = Pattern.compile("^\\d{14}\\w{3}\\.wav$");
|
||||
File root = new File(basePath);
|
||||
if (root.exists() && root.isDirectory()) {
|
||||
processDirectories(root, minDir, maxDir, fileNamePattern);
|
||||
}
|
||||
}
|
||||
|
||||
private static void processDirectories(File root, String minDir, String maxDir, Pattern pattern) {
|
||||
File[] dirs = root.listFiles(File::isDirectory);
|
||||
if (dirs == null) return;
|
||||
|
||||
for (File dir : dirs) {
|
||||
String dirName = dir.getName();
|
||||
if (dirName.compareTo(minDir) >= 0 && dirName.compareTo(maxDir) <= 0) {
|
||||
System.out.println("正在访问文件夹" + dirName);
|
||||
cleanWaveFiles(dir, pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void cleanWaveFiles(File directory, Pattern pattern) {
|
||||
File[] files = directory.listFiles();
|
||||
if (files == null) return;
|
||||
|
||||
for (File file : files) {
|
||||
System.out.println("正在访问文件" + file.getName());
|
||||
if (file.isFile() && pattern.matcher(file.getName()).matches()) {
|
||||
boolean deleted = file.delete();
|
||||
System.out.println((deleted ? "已删除:" : "删除失败:") + file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
174
src/main/java/cn/com/tenlion/operator/util/pay/BaiduPay.java
Normal file
174
src/main/java/cn/com/tenlion/operator/util/pay/BaiduPay.java
Normal file
@ -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<String, Object>() {{
|
||||
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<String, Object> 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<String, Object> 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<String, Object> params) throws UnsupportedEncodingException {
|
||||
Map<String, String> sortedParams = new TreeMap<>(Comparator.naturalOrder());
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (legalKey(key)) {
|
||||
sortedParams.put(key, entry.getValue().toString());
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (Map.Entry<String, String> 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);
|
||||
}
|
||||
|
||||
}
|
@ -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 + '\"'
|
||||
|
||||
+ "}";
|
||||
}
|
||||
}
|
@ -202,12 +202,19 @@ 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
|
||||
|
||||
wx-miniapp:
|
||||
activate: false
|
||||
activate: true
|
||||
appid: wxe17874894f7ff27b
|
||||
appsecret: 0c2b1371e4fb32514030233da4ef094d
|
||||
wx-oauth2:
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 268 KiB |
537
src/main/resources/templates/systemuser/login-old2.html
Normal file
537
src/main/resources/templates/systemuser/login-old2.html
Normal file
@ -0,0 +1,537 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<title th:text="${pageParams.systemTitle}"></title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="icon" type="image/svg" href="assets/favicon.svg"/>
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css?v=4" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css?v=4" media="all">
|
||||
<link rel="stylesheet" href="assets/css/supersized.css?v=3">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/login.css?v=4" media="all">
|
||||
<style>[v-cloak] {display: none;}</style>
|
||||
</head>
|
||||
|
||||
<style>
|
||||
.nav {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.nav .logo {
|
||||
padding: 15px;
|
||||
}
|
||||
.nav .logo a img {
|
||||
height: 60px;
|
||||
width: 186px;
|
||||
}
|
||||
.nav .go-page {
|
||||
padding: 15px;
|
||||
}
|
||||
.nav .go-page a {
|
||||
background-color: rgba(255, 255, 255, .4);
|
||||
padding: 5px 15px;
|
||||
border-radius: 50px;
|
||||
}
|
||||
.nav .go-page a:hover {
|
||||
background-color: #42210B;
|
||||
font-weight: bold;
|
||||
color: #FFF;
|
||||
}
|
||||
#app {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
#app .container {
|
||||
width: 300px;
|
||||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 0 5px rgba(0,0,0,0.3);
|
||||
}
|
||||
#app .container .header {
|
||||
font-size: 16px;
|
||||
border-left: 5px solid #fda633;
|
||||
padding-left: 10px;
|
||||
}
|
||||
#app .container .body {
|
||||
margin-top: 15px;
|
||||
}
|
||||
#app .container .body .layui-form-item .layui-input {
|
||||
padding-left: 35px;
|
||||
}
|
||||
#app .container .body .layui-form-item .verify-code {
|
||||
height: 38px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
#app .container .body .layui-form-item .verify-code a {
|
||||
color: #1e9fff;
|
||||
}
|
||||
#app .remember-username {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#app .container .footer {
|
||||
font-size: 12px;
|
||||
}
|
||||
#app .container .footer .login-type {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
#app .container .footer .login-type .third-login .logo {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
display: block;
|
||||
}
|
||||
#app .container .footer .login-type .third-login .logo img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#app .container .footer a {
|
||||
color: #1e9fff;
|
||||
}
|
||||
#app .container .footer .other {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
#app .forget-password-box {
|
||||
width: 300px;
|
||||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div class="nav">
|
||||
<div class="logo">
|
||||
<a th:href="${ HomeServerUrl }">
|
||||
<img src="assets/images/headicon1.png?v=4" alt="">
|
||||
</a>
|
||||
</div>
|
||||
<div class="go-page">
|
||||
<a th:href="${ HomeServerUrl + 'Register.html'}">注册</a>
|
||||
<a th:href="${ HomeServerUrl }">去首页</a>
|
||||
</div>
|
||||
</div>
|
||||
<div v-cloak>
|
||||
<div class="container" v-if="isLogin">
|
||||
<div class="header">用户登录</div>
|
||||
<div class="body">
|
||||
<form id="loginForm" :action="activeAction" method="post" @submit.prevent="submitForm">
|
||||
<input type="hidden" name="referToken" v-model="formData.referToken"/>
|
||||
<div v-if="loginType !== 'wx'">
|
||||
<!-- 用户名密码登录 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="username"></label>
|
||||
<input type="text" v-model="formData.username" id="username" name="username" lay-verify="username" placeholder="用户名 / 手机号" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item" v-if="loginType === 'username'">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
|
||||
<input type="password" v-model="formData.password" id="password" name="password" lay-verify="password" placeholder="密码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item" v-if="loginType === 'username' && pageParams.verificationCode == 'true'" >
|
||||
<!-- 验证码 -->
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs7">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="verificationCode"></label>
|
||||
<input type="text" v-model="formData.verificationCode" id="verificationCode" name="verificationCode" lay-verify="verificationCode" placeholder="图形验证码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-col-xs5">
|
||||
<div style="margin-left: 10px;">
|
||||
<img src="oauth/verification-code/png" class="layadmin-user-login-codeimg" @click="refreshVerificationCode($event)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 用户名密码登录 end -->
|
||||
<!-- 短信登录 start -->
|
||||
<div class="layui-form-item" v-if="loginType === 'sms'">
|
||||
<div class="layui-col-xs7">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="verificationCode"></label>
|
||||
<input type="text" v-model="sms.smsCode" id="smsCode" name="smsCode" placeholder="验证码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-col-xs5 verify-code">
|
||||
<a href="javascript:void(0);" v-if="!sms.isCountingDown" @click="onLoginSmsCodeClick" style="font-size: 13px;">获取验证码</a>
|
||||
<a href="javascript:void(0);" style="color: #d2d2d2; font-size: 13px;" v-if="sms.isCountingDown">{{sms.countDownSeconds}}秒后重试</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 短信登录 end -->
|
||||
<div class="layui-form remember-username" v-if="loginType !== 'wx'">
|
||||
<input type="checkbox" v-model="formData.remember" name="remember" lay-skin="primary" title="记住账号" lay-filter="rememberFilter">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn layui-btn-fluid login-btn" lay-submit style="background-color: #fda633;">登录</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 微信登录 start -->
|
||||
<div class="layui-form-item" v-if="loginType === 'wx'">
|
||||
<div id="wxQrcode"></div>
|
||||
</div>
|
||||
<!-- 微信登录 end -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="login-type">
|
||||
<div class="third-login">
|
||||
<a href="javascript:void(0);" class="wx-login logo" @click="onLoginTypeClick('wx')" v-if="pageParams.wxOauth === 'true' && loginType !== 'wx'">
|
||||
<img src="assets/images/wx-login.png" alt="加载失败"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="self-login">
|
||||
<a href="javascript:void(0);" v-if="loginType === 'sms' || loginType === 'wx'" @click="onLoginTypeClick('username')">账号密码登录 <i class="fa fa-angle-right"></i></a>
|
||||
<a href="javascript:void(0);" v-if="loginType === 'username'" @click="onLoginTypeClick('sms')">短信登录 <i class="fa fa-angle-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="other">
|
||||
<div>
|
||||
<a href="javascript:void(0)" class="forget-username-password" @click="onForgetPasswordClick">忘记密码?</a>
|
||||
</div>
|
||||
<div>
|
||||
没有账号?<a th:href="${ HomeServerUrl + 'Register.html'}">立即注册</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" v-if="!isLogin">
|
||||
<div class="header">忘记密码</div>
|
||||
<div class="body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="username"></label>
|
||||
<input type="text" v-model="forgetPassword.username" id="cpUsername" placeholder="用户名 / 手机号" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
|
||||
<input type="password" v-model="forgetPassword.newPassword" id="cpNewPassword" placeholder="新密码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
|
||||
<input type="password" v-model="forgetPassword.confirmNewPassword" id="cpConfirmNewPassword" placeholder="确认新密码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-xs7">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="verificationCode"></label>
|
||||
<input type="text" v-model="sms.smsCode" id="cpSmsCode" placeholder="验证码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-col-xs5 verify-code">
|
||||
<a href="javascript:void(0);" v-if="!sms.isCountingDown" @click="onForgetPasswordSmsCodeClick" style="font-size: 13px;">获取验证码</a>
|
||||
<a href="javascript:void(0);" style="color: #d2d2d2; font-size: 13px;" v-if="sms.isCountingDown">{{sms.countDownSeconds}}秒后重试</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="button" class="layui-btn layui-btn-fluid login-btn" style="background-color: #fda633;" @click="onForgetPasswordUpdateClick">修改</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="login-type" style="text-align: left;">
|
||||
<a href="javascript:void(0);" @click="isLogin = true"><i class="fa fa-angle-left"></i> 去登录</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-trans layadmin-user-login-footer footer-text">
|
||||
<p v-if="pageParams.copyRightYear"><span>{{'© '+ pageParams.copyRightYear +' '}}</span><a href="javascript:void(0);" v-if="pageParams.copyleft">{{pageParams.copyleft}}</a></p>
|
||||
<p v-if="pageParams.officialUrl">
|
||||
<span><a :href="pageParams.officialUrl" target="_blank">前往官网</a></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="assets/js/wxLogin.js"></script>
|
||||
<script type="text/javascript" src="assets/js/vue.min.js"></script>
|
||||
<script type="text/javascript" src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script type="text/javascript" th:inline="javascript">
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'form', 'cookie', 'md5', 'dialog', 'base64', 'supersized', 'common', 'ftukey', 'restajax'], function () {
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var cookie = layui.cookie;
|
||||
var md5 = layui.md5;
|
||||
var base64 = layui.base64;
|
||||
var restAjax = layui.restajax;
|
||||
var dialog = layui.dialog;
|
||||
|
||||
var pageParams = [[${pageParams}]];
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
isLogin: true,
|
||||
pageParams: pageParams,
|
||||
loginType: 'username',
|
||||
activeAction: pageParams.loginFormAction,
|
||||
formData: {
|
||||
referToken: pageParams.referToken,
|
||||
verificationCode: '',
|
||||
username: pageParams.loginUsername,
|
||||
password: '',
|
||||
remember: false
|
||||
},
|
||||
forgetPassword: {
|
||||
username: '',
|
||||
smsCode: '',
|
||||
newPassword: '',
|
||||
confirmNewPassword: '',
|
||||
},
|
||||
sms: {
|
||||
smsCode: '',
|
||||
countDownInterval: null,
|
||||
countDownSeconds: 120,
|
||||
isCountingDown: false,
|
||||
isCountClick: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 提交表单
|
||||
submitForm: function() {
|
||||
var self = this;
|
||||
if(!self.formData.username) {
|
||||
layer.msg('用户名不能为空');
|
||||
$('#username').focus();
|
||||
return;
|
||||
}
|
||||
if(self.loginType === 'username') {
|
||||
if(!self.formData.password) {
|
||||
layer.msg('密码不能为空');
|
||||
$('#password').focus();
|
||||
return;
|
||||
}
|
||||
if(self.pageParams.verificationCode == 'true' && !self.formData.verificationCode) {
|
||||
layer.msg('验证码不能为空');
|
||||
$('#verificationCode').focus();
|
||||
return;
|
||||
}
|
||||
} else if(self.loginType === 'sms') {
|
||||
if(!self.sms.smsCode) {
|
||||
layer.msg('短信验证码不能为空');
|
||||
$('#smsCode').focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(self.loginType === 'username') {
|
||||
self.activeAction = self.pageParams.loginFormAction;
|
||||
}
|
||||
if(self.loginType === 'sms') {
|
||||
self.activeAction = self.pageParams.loginPhoneAction;
|
||||
}
|
||||
if(self.formData.remember) {
|
||||
cookie.setCookie('rememberMe', self.formData.username, 30);
|
||||
} else {
|
||||
cookie.setCookie('rememberMe', '', 0);
|
||||
}
|
||||
layer.msg('正在登录,请稍后...', {icon: 16, shade: 0.1, time: 0});
|
||||
self.formData.password = md5(md5(md5(self.formData.password)));
|
||||
self.$nextTick(function() {
|
||||
$('#loginForm').submit();
|
||||
})
|
||||
},
|
||||
onForgetPasswordUpdateClick: function() {
|
||||
var self = this;
|
||||
if(!self.forgetPassword.username) {
|
||||
layer.msg('用户名不能为空');
|
||||
$('#cpUsername').focus();
|
||||
return;
|
||||
}
|
||||
if(!self.forgetPassword.newPassword) {
|
||||
layer.msg('新密码不能为空');
|
||||
$('#cpNewPassword').focus();
|
||||
return;
|
||||
}
|
||||
if(!self.forgetPassword.confirmNewPassword) {
|
||||
layer.msg('确认新密码不能为空');
|
||||
$('#cpConfirmNewPassword').focus();
|
||||
return;
|
||||
}
|
||||
if(self.forgetPassword.newPassword !== self.forgetPassword.confirmNewPassword) {
|
||||
layer.msg('两次密码不一致');
|
||||
$('#cpConfirmNewPassword').focus();
|
||||
return;
|
||||
}
|
||||
if(!self.sms.smsCode) {
|
||||
layer.msg('短信验证码不能为空');
|
||||
$('#cpSmsCode').focus();
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
restAjax.put(restAjax.path('app/user/forget-phone-password', []), {
|
||||
phone: self.forgetPassword.username,
|
||||
newPassword: md5(md5(md5(self.forgetPassword.newPassword))),
|
||||
verificationCode: self.sms.smsCode
|
||||
}, null, function(code, data) {
|
||||
layer.msg("密码修改成功,请登录");
|
||||
self.loginType = 'username';
|
||||
self.isLogin = true;
|
||||
}, function(code, data) {
|
||||
dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = dialog.msg('正在提交修改信息...', {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
dialog.close(loadLayerIndex);
|
||||
});
|
||||
},
|
||||
onForgetPasswordClick: function() {
|
||||
this.isLogin = false;
|
||||
},
|
||||
onLoginClick: function() {
|
||||
this.isLogin = true;
|
||||
},
|
||||
onLoginSmsCodeClick: function() {
|
||||
this.sendSmsCode(this.formData.username)
|
||||
},
|
||||
onForgetPasswordSmsCodeClick: function() {
|
||||
this.sendSmsCode(this.forgetPassword.username)
|
||||
},
|
||||
sendSmsCode: function(phone) {
|
||||
if(this.sms.isCountClick) {
|
||||
return;
|
||||
}
|
||||
if(!phone) {
|
||||
layer.msg('请输入手机号');
|
||||
return;
|
||||
}
|
||||
if(!/^1[3456789]\d{9}$/.test(phone)) {
|
||||
layer.msg('手机号格式不正确');
|
||||
return;
|
||||
}
|
||||
var self = this;
|
||||
restAjax.get('api/verify/code/send/'+ phone, {}, null, function(code, data) {
|
||||
layer.msg('验证码发送成功');
|
||||
self.sms.isCountingDown = true;
|
||||
self.sms.countDownInterval = setInterval(function() {
|
||||
self.sms.countDownSeconds -= 1;
|
||||
if(self.sms.countDownSeconds <= 0) {
|
||||
clearInterval(self.sms.countDownInterval);
|
||||
self.sms.countDownInterval = null;
|
||||
self.sms.isCountingDown = false;
|
||||
}
|
||||
}, 1000);
|
||||
}, function(code, data) {
|
||||
layer.msg(data.msg);
|
||||
}, function() {
|
||||
self.isCountClick = true;
|
||||
}, function() {
|
||||
self.isCountClick = false;
|
||||
})
|
||||
},
|
||||
initWxQrcode: function() {
|
||||
if(this.pageParams.wxOauth === 'false') {
|
||||
return;
|
||||
}
|
||||
// var layIndex = layer.msg('正在加载二维码,请稍后...', {icon: 16, shade: 0.1, time: 0});
|
||||
var obj = new WxLogin({
|
||||
self_redirect: false,
|
||||
id: 'wxQrcode',
|
||||
appid: this.pageParams.wxAppid,
|
||||
redirect_uri: this.pageParams.wxRedirectUri,
|
||||
scope: 'snsapi_login',
|
||||
state: '',
|
||||
style: 'black',
|
||||
onReady: function(isReady) {
|
||||
// layer.close(layIndex);
|
||||
}
|
||||
});
|
||||
},
|
||||
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) {
|
||||
layer.msg(self.pageParams.errorMessage);
|
||||
}
|
||||
},
|
||||
initBackground: function() {
|
||||
var self = this;
|
||||
var loginBackgroundImages = self.pageParams.loginBackgroundImages;
|
||||
var photos = [];
|
||||
if(loginBackgroundImages) {
|
||||
var loginBackgroundImageArray = loginBackgroundImages.split(',');
|
||||
for(var i = 0, item = loginBackgroundImageArray[i]; item = loginBackgroundImageArray[i++];) {
|
||||
photos.push({
|
||||
image: 'route/file/download/true/'+ item
|
||||
})
|
||||
}
|
||||
} else {
|
||||
for(var i = 1; i <= 9; i++) {
|
||||
photos.push({
|
||||
image: 'assets/images/backgrounds/'+ i +'.jpg'
|
||||
})
|
||||
}
|
||||
}
|
||||
$.supersized({
|
||||
slide_interval : 4000, // Length between transitions
|
||||
transition : 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
|
||||
transition_speed : 1000, // Speed of transition
|
||||
performance : 1, // 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
|
||||
// Size & Position
|
||||
min_width : 0, // Min width allowed (in pixels)
|
||||
min_height : 0, // Min height allowed (in pixels)
|
||||
vertical_center : 1, // Vertically center background
|
||||
horizontal_center : 1, // Horizontally center background
|
||||
fit_always : 0, // Image will never exceed browser width or height (Ignores min. dimensions)
|
||||
fit_portrait : 1, // Portrait images will not exceed browser height
|
||||
fit_landscape : 0, // Landscape images will not exceed browser width
|
||||
// Components
|
||||
slide_links : 'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank')
|
||||
slides : photos
|
||||
});
|
||||
},
|
||||
// 刷新验证码
|
||||
refreshVerificationCode: function(event) {
|
||||
event.target.src = event.target.src + '?t='+ new Date().getTime();
|
||||
},
|
||||
// 记住我
|
||||
rememberMe: function() {
|
||||
var self = this;
|
||||
var rememberMe = cookie.getCookie('rememberMe');
|
||||
if(rememberMe) {
|
||||
self.formData.username = rememberMe;
|
||||
self.formData.remember = true;
|
||||
}
|
||||
self.$nextTick(function() {
|
||||
form.render();
|
||||
});
|
||||
},
|
||||
loginTypeChange: function(type) {
|
||||
this.loginType = type;
|
||||
},
|
||||
},
|
||||
mounted: function() {
|
||||
var self = this;
|
||||
self.showErrorMessage();
|
||||
self.initBackground();
|
||||
self.rememberMe();
|
||||
// 复选框勾选事件
|
||||
form.on('checkbox(rememberFilter)', function(data) {
|
||||
self.formData.remember = data.elem.checked;
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</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 @@
|
||||
</div>
|
||||
<div v-cloak>
|
||||
<div class="container" v-if="isLogin">
|
||||
<div class="header">用户登录</div>
|
||||
<div class="body">
|
||||
<form id="loginForm" :action="activeAction" method="post" @submit.prevent="submitForm">
|
||||
<input type="hidden" name="referToken" v-model="formData.referToken"/>
|
||||
<div v-if="loginType !== 'wx'">
|
||||
<!-- 用户名密码登录 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="username"></label>
|
||||
<input type="text" v-model="formData.username" id="username" name="username" lay-verify="username" placeholder="用户名 / 手机号" class="layui-input">
|
||||
<div class="left">
|
||||
<div class="title">打开微信小程序</div>
|
||||
<div class="miniapp-code">
|
||||
<img src="assets/images/login/wx-miniapp-code.jpg" alt="加载失败"/>
|
||||
</div>
|
||||
<div class="message">请使用微信扫码</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<form id="loginForm" :action="activeAction" method="post" @submit.prevent="submitForm">
|
||||
<input type="hidden" name="referToken" v-model="formData.referToken"/>
|
||||
<div class="login-type">
|
||||
<div class="login-type-item" :class="{'active': loginType === 'username'}" @click="loginType = 'username'">密码登录</div>
|
||||
<div class="login-type-item" :class="{'active': loginType === 'sms'}" @click="loginType = 'sms'">短信登录</div>
|
||||
</div>
|
||||
<div class="layui-form-item" v-if="loginType === 'username'">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
|
||||
<input type="password" v-model="formData.password" id="password" name="password" lay-verify="password" placeholder="密码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item" v-if="loginType === 'username' && pageParams.verificationCode == 'true'" >
|
||||
<!-- 验证码 -->
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs7">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="verificationCode"></label>
|
||||
<input type="text" v-model="formData.verificationCode" id="verificationCode" name="verificationCode" lay-verify="verificationCode" placeholder="图形验证码" class="layui-input">
|
||||
<div class="login-form">
|
||||
<div class="login-input-container" v-if="loginType === 'username'">
|
||||
<div class="form-input-item" style="padding-bottom: 5px;">
|
||||
<label class="form-input-label" for="username">账号</label>
|
||||
<input type="text" v-model="formData.username" id="username" name="username" lay-verify="username" placeholder="请输入账号" class="form-input">
|
||||
</div>
|
||||
<div class="layui-col-xs5">
|
||||
<div style="margin-left: 10px;">
|
||||
<img src="oauth/verification-code/png" class="layadmin-user-login-codeimg" @click="refreshVerificationCode($event)">
|
||||
<div class="form-input-item" style="padding: 5px 0;">
|
||||
<label class="form-input-label" for="password">密码</label>
|
||||
<input type="password" v-model="formData.password" id="password" name="password" lay-verify="password" placeholder="请输入密码" class="form-input">
|
||||
<a href="javascript:void(0)" class="forget-username-password" @click="onForgetPasswordClick">忘记密码?</a>
|
||||
</div>
|
||||
<div class="form-input-item" style="padding: 5px 5px 0 5px;">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs7">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="verificationCode"></label>
|
||||
<input type="text" v-model="formData.verificationCode" id="verificationCode" name="verificationCode" lay-verify="verificationCode" placeholder="图形验证码" class="vercode-input layui-input">
|
||||
</div>
|
||||
<div class="layui-col-xs5">
|
||||
<div style="margin-left: 10px;">
|
||||
<img src="oauth/verification-code/png" class="layadmin-user-login-codeimg" @click="refreshVerificationCode($event)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="login-input-container" v-if="loginType === 'sms'">
|
||||
<div class="form-input-item" style="padding-bottom: 5px;">
|
||||
<label class="form-input-label" for="username">手机号</label>
|
||||
<input type="text" v-model="formData.username" id="username" name="username" lay-verify="username" placeholder="请输入手机号" class="form-input">
|
||||
</div>
|
||||
<div class="form-input-item" style="padding: 5px 5px 0 5px;">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs7">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="verificationCode"></label>
|
||||
<input type="text" v-model="sms.smsCode" id="smsCode" name="smsCode" placeholder="短信验证码" class="vercode-input layui-input">
|
||||
</div>
|
||||
<div class="layui-col-xs5 verify-code">
|
||||
<a href="javascript:void(0);" v-if="!sms.isCountingDown" @click="onLoginSmsCodeClick" class="sms-verify-code">获取验证码</a>
|
||||
<a href="javascript:void(0);" style="color: #d2d2d2; font-size: 13px;" v-if="sms.isCountingDown" class="sms-verify-code">{{sms.countDownSeconds}}秒后重试</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form remember-username">
|
||||
<input type="checkbox" v-model="formData.remember" name="remember" lay-skin="primary" title="记住账号" lay-filter="rememberFilter">
|
||||
</div>
|
||||
<div class="btn-container">
|
||||
<a th:href="${ HomeServerUrl + 'Register.html'}" type="button" class="layui-btn layui-btn-fluid login-btn layui-btn-primary">注册</a>
|
||||
<button type="submit" class="layui-btn layui-btn-fluid login-btn" lay-submit style="background-color: #fda633;">登录</button>
|
||||
</div>
|
||||
<div class="other-login-type">
|
||||
<div class="title">其他登录方式</div>
|
||||
<div class="login-type">
|
||||
<div class="login-item" @click="onWxQrLogin" v-if="pageParams.wxOauth === 'true'">
|
||||
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAMAAACfWMssAAAAgVBMVEUAAABXu0BYt0BQt0BXu0BWu0BXu0BXu0BXu0BWukBWukBXvEBXu0BXvEBXvEBYukBVukBXu0BWt0BXukBXuEBXu0D////1+/Pq9+fV7s/A5rer3aBsw1jg89uBzHBiwEy14auL0Xug2ZOW1YeBzG93yGSW1YjL6sO14azL6cN2yGP3XpzOAAAAFXRSTlMA3yAQ78+/r5+AUI9w74BgYEBAkHDBb56KAAACF0lEQVRIx52W6XKDIBRGwT3GZmsRUXFP0vb9H7AKGS8aiCXnR0TCmU/gOoh0uJck8jEZwUGYXND/cOPggyz4CE//0HZgKeDIsdSA3Qs1Bk2XejLF7ckGe1fnOT7ZBDsaDxNiZ4Jna4Jnb7rgbeKrK7QnFuzBOxIrYrsJAth9iIdl/9CwLE0pv/elqfoegWpfXdAUYINW9GRkRIBWakBemiOVGRbpE1lpijwaPDANCxvCc8qBbcVF47vq5EQ1YjCK3nyXiXE3QqrpSseeu+jptc96XgWmHSGDEGtCmDHygpK5nUuRdr2MvvfNdMvzXCN+KVNk6RO0qOpr37fXJzFCwdzmT9532THZovmqFHxlF3/WcdWQGUsBI2g3K/G3WG3o4oEVsVqOK4RHaTpfaKkXCVsWzPTL65pPN7X4kxnEX6qIXS4mJqfOH5tVKSJWzJsiXqlcklxe5AI0yuL4RDUpiKkGphRrRFRK+lLk88AQSg4KXVC9TvwSRQ4MU5m1xZ2xlmnEm1LkrqeKTVbU5rcaNtJDCAWqCOutq90CpjiKMTFQZuuah/9Oo+h6ZtPkYTSxI0YKReWLtxFBpJ5bzjOasWYsoBp6HQSRW5R5tz4C4HS0PltjO/H05sH6iQDXtz0d3/94ANPes/9Asjd9572PwE8X6Tm+DPViZMQ5mLUDxGnVCFtqwDH0VlYQS22bcxIGIhn7UXLWWn+10s6FZo+4YQAAAABJRU5ErkJggg=="/>
|
||||
<span style="margin-left: 5px;">微信登录</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 用户名密码登录 end -->
|
||||
<!-- 短信登录 start -->
|
||||
<div class="layui-form-item" v-if="loginType === 'sms'">
|
||||
<div class="layui-col-xs7">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="verificationCode"></label>
|
||||
<input type="text" v-model="sms.smsCode" id="smsCode" name="smsCode" placeholder="验证码" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-col-xs5 verify-code">
|
||||
<a href="javascript:void(0);" v-if="!sms.isCountingDown" @click="onLoginSmsCodeClick" style="font-size: 13px;">获取验证码</a>
|
||||
<a href="javascript:void(0);" style="color: #d2d2d2; font-size: 13px;" v-if="sms.isCountingDown">{{sms.countDownSeconds}}秒后重试</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 短信登录 end -->
|
||||
<div class="layui-form remember-username" v-if="loginType !== 'wx'">
|
||||
<input type="checkbox" v-model="formData.remember" name="remember" lay-skin="primary" title="记住账号" lay-filter="rememberFilter">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn layui-btn-fluid login-btn" lay-submit style="background-color: #fda633;">登录</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 微信登录 start -->
|
||||
<div class="layui-form-item" v-if="loginType === 'wx'">
|
||||
<div id="wxQrcode"></div>
|
||||
</div>
|
||||
<!-- 微信登录 end -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="login-type">
|
||||
<div class="third-login">
|
||||
<a href="javascript:void(0);" class="wx-login logo" @click="onLoginTypeClick('wx')" v-if="pageParams.wxOauth === 'true' && loginType !== 'wx'">
|
||||
<img src="assets/images/wx-login.png" alt="加载失败"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="self-login">
|
||||
<a href="javascript:void(0);" v-if="loginType === 'sms' || loginType === 'wx'" @click="onLoginTypeClick('username')">账号密码登录 <i class="fa fa-angle-right"></i></a>
|
||||
<a href="javascript:void(0);" v-if="loginType === 'username'" @click="onLoginTypeClick('sms')">短信登录 <i class="fa fa-angle-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="other">
|
||||
<div>
|
||||
<a href="javascript:void(0)" class="forget-username-password" @click="onForgetPasswordClick">忘记密码?</a>
|
||||
</div>
|
||||
<div>
|
||||
没有账号?<a th:href="${ HomeServerUrl + 'Register.html'}">立即注册</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" v-if="!isLogin">
|
||||
<div class="register-container" v-if="!isLogin">
|
||||
<div class="header">忘记密码</div>
|
||||
<div class="body">
|
||||
<div class="body" style="margin-top: 15px;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="username"></label>
|
||||
<input type="text" v-model="forgetPassword.username" id="cpUsername" placeholder="用户名 / 手机号" class="layui-input">
|
||||
@ -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;
|
||||
|
@ -35,6 +35,10 @@
|
||||
<div class="logo"></div>
|
||||
<div class="title">喵著系统</div>
|
||||
</div>
|
||||
<div class="system" data-href="/aishop">
|
||||
<div class="logo"></div>
|
||||
<div class="title">商城</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user