Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wenHuaBu_adminServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
wenHuaBu_adminServer
Commits
c3990f6c
Commit
c3990f6c
authored
Mar 20, 2024
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
2e762403
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
4 deletions
+62
-4
cost.ts
src/biz/member/cost.ts
+12
-4
http_server.ts
src/net/http_server.ts
+1
-0
router.ts
src/routers/cost/router.ts
+39
-0
router.ts
src/routers/router.ts
+10
-0
No files found.
src/biz/member/cost.ts
View file @
c3990f6c
...
...
@@ -17,6 +17,7 @@ import moment = require("moment");
const
AppId
=
'wx96c0cf11b3babcf6'
;
const
MchId
=
'1614605859'
;
const
V3Key
=
'c0338804d0c6a60cced9cad83a9a0402'
;
const
pay
=
new
WxPay
({
appid
:
AppId
,
mchid
:
MchId
,
...
...
@@ -48,9 +49,10 @@ export async function placeAnOrder({id}) {
description
:
desc
,
out_trade_no
,
//订单号
amount
:{
//金额
total
:
orderInfo
.
money
// total:orderInfo.money
total
:
0.01
},
notify_url
:
'
'
,
//测试时先设置白名单地址
notify_url
:
'
http://7ggz2y.natappfree.cc/pay/wechart/callback'
,
//订单回调
};
const
result
=
await
pay
.
transactions_native
(
Param
);
if
(
result
.
status
!=
200
)
throw
new
BizError
(
ERRORENUM
.
调起微信支付失败
);
...
...
@@ -94,4 +96,10 @@ export async function orderClose({id, weChartPR}) {
}
// export async function
\ No newline at end of file
/**
* 微信回调函数【微信用】
*/
export
async
function
payCallback
(
body
)
{
console
.
log
(
body
);
}
\ No newline at end of file
src/net/http_server.ts
View file @
c3990f6c
...
...
@@ -39,6 +39,7 @@ export class httpServer {
httpServer
.
use
(
watch
);
httpServer
.
use
(
bodyParser
.
json
({
limit
:
"5000kb"
}));
routers
.
setRouter
(
httpServer
);
routers
.
setAdditionalRouter
(
httpServer
);
//测试
httpServer
.
use
(
httpErrorHandler
);
httpServer
.
listen
(
port
);
...
...
src/routers/cost/router.ts
0 → 100644
View file @
c3990f6c
/**
* 支付
*/
import
*
as
costBiz
from
"../../biz/member/cost"
;
export
const
FirstName
=
'支付'
;
export
const
FirstRouter
=
'/manage/cost'
;
export
const
Config
=
{
"微信支付"
:[
{
apiName
:
"发起支付"
,
subUrl
:
'/fees/wechart/pay'
,
param
:[
{
key
:
"id"
,
type
:
"String"
,
desc
:
"订单id"
}
],
bindBiz
:
costBiz
.
placeAnOrder
},
{
apiName
:
"订单查询状态"
,
subUrl
:
'/fees/wechart/find/state'
,
param
:[
{
key
:
"id"
,
type
:
"String"
,
desc
:
"订单id"
},
{
key
:
"weChartPR"
,
type
:
"String"
,
desc
:
"微信订单id 创建订单是下发"
}
],
bindBiz
:
costBiz
.
orderState
},
{
apiName
:
"关闭订单"
,
subUrl
:
'/fees/wechart/close'
,
param
:[
{
key
:
"id"
,
type
:
"String"
,
desc
:
"订单id"
},
{
key
:
"weChartPR"
,
type
:
"String"
,
desc
:
"微信订单id 创建订单是下发"
}
],
bindBiz
:
costBiz
.
orderClose
}
]
}
\ No newline at end of file
src/routers/router.ts
View file @
c3990f6c
...
...
@@ -11,9 +11,11 @@ import { eccFormParam, eccReqParamater } from "../util/verificationParam";
import
*
as
portalRouter
from
"./portal/router"
;
import
*
as
publicRouter
from
"./public/router"
;
import
*
as
memberRouter
from
"./member/router"
;
import
*
as
costRouter
from
"./cost/router"
;
import
*
as
officalWebsiteRouter
from
"./officalWebsite/router"
;
import
*
as
orderRouter
from
"./order/router"
;
import
*
as
asyncHandler
from
'express-async-handler'
;
import
{
payCallback
}
from
"../biz/member/cost"
;
const
Look
=
false
;
//true更新文档
...
...
@@ -25,12 +27,14 @@ export async function setRouter(httpServer){
await
initDoc
(
memberRouter
.
FirstName
,
memberRouter
.
Config
,
memberRouter
.
FirstRouter
);
//用户路由
await
initDoc
(
officalWebsiteRouter
.
FirstName
,
officalWebsiteRouter
.
Config
,
officalWebsiteRouter
.
FirstRouter
);
//官网路由
await
initDoc
(
orderRouter
.
FirstName
,
orderRouter
.
Config
,
orderRouter
.
FirstRouter
);
//会费相关
await
initDoc
(
costRouter
.
FirstName
,
costRouter
.
Config
,
costRouter
.
FirstRouter
);
//支付
}
await
analysisRouter
(
httpServer
,
portalRouter
.
Config
,
portalRouter
.
FirstRouter
);
//网站编辑
await
analysisRouter
(
httpServer
,
publicRouter
.
Config
,
publicRouter
.
FirstRouter
);
//公用组件
await
analysisRouter
(
httpServer
,
memberRouter
.
Config
,
memberRouter
.
FirstRouter
);
//用户路由
await
analysisRouter
(
httpServer
,
officalWebsiteRouter
.
Config
,
officalWebsiteRouter
.
FirstRouter
);
//官网路由
await
analysisRouter
(
httpServer
,
orderRouter
.
Config
,
orderRouter
.
FirstRouter
);
//会费相关
await
analysisRouter
(
httpServer
,
costRouter
.
Config
,
costRouter
.
FirstRouter
);
//支付
}
async
function
analysisRouter
(
httpServer
,
config
,
firstRouter
)
{
...
...
@@ -79,3 +83,9 @@ async function analysisRouter(httpServer, config, firstRouter) {
}
export
async
function
setAdditionalRouter
(
httpServer
)
{
httpServer
.
post
(
'/pay/wechart/callback'
,
asyncHandler
(
async
(
req
,
res
)
=>
{
await
payCallback
(
req
.
body
);
res
.
success
({});
}));
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment