当前位置: 首页 > 工具软件 > Javashop > 使用案例 >

Javashop 7.0 增加小程序支付(二次开发)

邹昊
2023-12-01

本文仅适合Javashop 7.0 版本

需求:拿到商城代码之后小程序无法使用支付

说明:下面内容属于二次开发内容,不受技术支持。

说明:7.0 版本不支持小程序支付,下面全部都是我自己修改的。

小程序支付修改

官方说了,7.02 才有https小程序,之前没有小程序支付,需要修改/增加地方

可以参考7.02代码

需要增加/修改下面地方

luozhuang/src/main/java/com/enation/app/javashop/core/member/plugin/wechat/WechatAbstractConnectLoginPlugin.java

luozhuang/src/main/java/com/enation/app/javashop/core/member/service/impl/ConnectManagerImpl.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/model/dos/PaymentMethodDO.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/model/enums/ClientType.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/WeixinPayPlugin.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/service/impl/OrderPayManagerImpl.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/service/impl/PaymentMethodManagerImpl.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/exception

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/exception/WeixinSignatrueExceprion.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/executor/WeixinPaymentMiniExecutor.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/model

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/model/SignatureParams.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/model/WechatAccessToken.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/model/WechatJsapiTicket.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/SHA1.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/SignUtil.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/WechatTypeEnmu.java

luozhuang/src/main/java/com/enation/app/javashop/core/payment/plugin/weixin/signaturer/WeixinSignaturer.java

 

修改思路:

找到7.02 ‘MINI’ 字符,对照7.0 增加相应内容

特别注意退款什么的都需要修改

表结构有变动:es_payment_method

因7.02 增加了

plugin/weixin/exception

/plugin/weixin/signaturer

需要从源代码里面移动过来

 

数据库修改

小程序支付和登录前台Admin UI 直到7.02都尚未有设置界面,需要修改数据

需要修改下面地方

  1. es_payment_method 表增加字段mini_config (longtext),添加支付参数

注意:这里经常犯的错误就是填了公众号一模一样的参数,小程序支付必须使用小程序APPID。

 

 

  1. 修改表 es_connect_setting

 

Config 字段里面内容增加为(粗体部分)

[{"name":"PC网页端参数","configList":[{"key":"wechat_pc_app_id","name":"app_id","value":"luozhuang"},{"key":"wechat_pc_app_key","name":"app_key","value":"luozhuang"}]},{"name":"微信网页端参数","configList":[{"key":"wechat_wechat_app_id","name":"app_id","value":"luozhuang"},{"key":"wechat_wechat_app_key","name":"app_key","value":"luozhuang"}]},{"name":"原生-APP参数","configList":[{"key":"wechat_app_app_id","name":"app_id","value":"luozhuang"},{"key":"wechat_app_app_key","name":"app_key","value":"luozhuang"}]},{"name":"RN-APP参数","configList":[{"key":"wechat_rn_app_id","name":"app_id","value":"luozhuang"},{"key":"wechat_rn_app_key","name":"app_key","value":"luozhuang"}]},{"name":"小程序参数","configList":[{"key":"wechat_miniprogram_app_id","name":"app_id","value":"luozhuang"},{"key":"wechat_miniprogram_app_key","name":"app_key","value":"luozhuang"}]}]

 类似资料: