Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
ec0be88d
Commit
ec0be88d
authored
Dec 04, 2019
by
王栋源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wdy
parent
0fa0defa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
29 deletions
+65
-29
igirl-channel/app/base/api/impl/action/tradetransfer.js
+65
-29
No files found.
igirl-channel/app/base/api/impl/action/tradetransfer.js
View file @
ec0be88d
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
var
APIBase
=
require
(
"../../api.base"
);
var
APIBase
=
require
(
"../../api.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
moment
=
require
(
'moment'
)
class
TradetransferAPI
extends
APIBase
{
class
TradetransferAPI
extends
APIBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
aliclient
=
system
.
getObject
(
"util.aliyunClient"
);
this
.
aliclient
=
system
.
getObject
(
"util.aliyunClient"
);
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
transferurl
=
settings
.
reqTransferurl
();
this
.
transferurl
=
settings
.
reqTransferurl
();
this
.
corderSve
=
system
.
getObject
(
"service.dbcorder.orderinfoSve"
);
}
}
//订单创建
//订单创建
async
createtransfer
(
obj
)
{
async
createtransfer
(
p
,
obj
,
req
)
{
if
(
!
obj
.
BizId
)
{
if
(
!
obj
.
actionBody
.
BizId
)
{
return
{
return
{
"errorCode"
:
"error"
,
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"errorMsg"
:
"订单号不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requesti
d
,
"requestId"
:
req
.
requestI
d
,
"success"
:
false
"success"
:
false
}
}
}
}
if
(
!
obj
.
UserName
)
{
if
(
!
obj
.
actionBody
.
UserName
)
{
return
{
return
{
"errorCode"
:
"error"
,
"errorCode"
:
"error"
,
"errorMsg"
:
"用户不能为空"
,
"errorMsg"
:
"用户不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requesti
d
,
"requestId"
:
req
.
requestI
d
,
"success"
:
false
"success"
:
false
}
}
}
}
if
(
!
obj
.
Mobile
)
{
if
(
!
obj
.
actionBody
.
Mobile
)
{
return
{
return
{
"errorCode"
:
"error"
,
"errorCode"
:
"error"
,
"errorMsg"
:
"用户手机号不能为空"
,
"errorMsg"
:
"用户手机号不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requesti
d
,
"requestId"
:
req
.
requestI
d
,
"success"
:
false
"success"
:
false
}
}
}
}
if
(
!
obj
.
Price
)
{
if
(
!
obj
.
actionBody
.
Price
)
{
return
{
return
{
"errorCode"
:
"error"
,
"errorCode"
:
"error"
,
"errorMsg"
:
"价格不能为空"
,
"errorMsg"
:
"价格不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requesti
d
,
"requestId"
:
req
.
requestI
d
,
"success"
:
false
"success"
:
false
}
}
}
}
var
a
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
);
var
orderinfo
=
await
this
.
orderSve
.
findOne
({
ali_bizid
:
obj
.
BizId
});
var
orderc
=
{
if
(
orderinfo
)
{
"actionProcess"
:
"ali"
,
return
{
"actionType"
:
"addOrder"
,
"errorCode"
:
"OK"
,
"isUser"
:
"yes"
,
"errorMsg"
:
"订单已存在"
,
"actionBody"
:
"module"
:
{
"orderId"
:
orderinfo
.
dataValue
.
fq_ordernum
},
{
"requestId"
:
obj
.
requestid
,
"itemCode"
:
"alitmtt"
,
"success"
:
true
"channelParams"
:
obj
.
actionBody
,
"channelUser"
:
{
"channelUserId"
:
obj
.
actionBody
.
Mobile
,
"channelUserName"
:
obj
.
actionBody
.
UserName
,
"channelUserMoblie"
:
obj
.
actionBody
.
Mobile
,
"nickname"
:
""
,
"orgName"
:
""
,
"orgPath"
:
""
},
"channelOrder"
:
{
"channelServiceNo"
:
obj
.
actionBody
.
BizId
,
"channelOrderNo"
:
""
,
"needNo"
:
obj
.
actionBody
.
BizId
,
"quantity"
:
1
,
"totalSum"
:
parseInt
(
obj
.
actionBody
.
Price
),
"payTotalSum"
:
parseInt
(
obj
.
actionBody
.
Price
)
*
0.2
,
"payStatus"
:
"yfk"
,
"payTime"
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
}
}
}
}
else
{
}
var
orderinfo
=
await
this
.
orderSve
.
create
(
obj
);
var
orderinfo
=
await
this
.
corderSve
.
createOrder
(
orderc
.
actionBody
,
req
);
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/closeOrder"
;
if
(
orderinfo
)
{
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
,
url
);
if
(
orderinfo
.
status
==
"1"
)
{
if
(
transferinfo
)
{
return
{
return
{
"errorCode"
:
"OK"
,
"errorCode"
:
"OK"
,
"errorMsg"
:
""
,
"errorMsg"
:
""
,
"module"
:
{
"orderNumber"
:
orderinfo
.
dataValue
.
fq_ordernum
},
"module"
:
{
"orderNumber"
:
orderinfo
.
dataValue
.
fq_ordernum
},
"requestId"
:
obj
.
requesti
d
,
"requestId"
:
req
.
requestI
d
,
"success"
:
true
"success"
:
true
}
}
}
else
if
(
orderinfo
.
status
==
"2"
)
{
return
{
"errorCode"
:
"OK"
,
"errorMsg"
:
"订单已存在"
,
"module"
:
{
"orderId"
:
orderinfo
.
dataValue
.
fq_ordernum
},
"requestId"
:
req
.
requestId
,
"success"
:
true
}
}
}
else
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
""
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
req
.
requestId
,
"success"
:
false
}
}
}
}
}
}
//订单查询
//订单查询
async
ordersel
(
p
,
obj
)
{
async
ordersel
(
p
,
obj
)
{
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/queryOrderState"
;
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/queryOrderState"
;
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
.
actionBody
,
url
);
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
.
actionBody
,
url
);
var
a
=
JSON
.
parse
(
transferinfo
.
stdout
)
var
a
=
JSON
.
parse
(
transferinfo
.
stdout
)
return
a
;
return
a
;
}
}
...
@@ -85,7 +121,7 @@ class TradetransferAPI extends APIBase {
...
@@ -85,7 +121,7 @@ class TradetransferAPI extends APIBase {
async
orderclose
(
obj
)
{
async
orderclose
(
obj
)
{
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/closeOrder"
;
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/closeOrder"
;
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
,
url
);
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
,
url
);
var
a
=
JSON
.
parse
(
transferinfo
.
stdout
)
var
a
=
JSON
.
parse
(
transferinfo
.
stdout
)
return
a
;
return
a
;
}
}
...
@@ -96,7 +132,7 @@ class TradetransferAPI extends APIBase {
...
@@ -96,7 +132,7 @@ class TradetransferAPI extends APIBase {
return
{
return
{
"errorCode"
:
"error"
,
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"errorMsg"
:
"订单号不能为空"
,
"requestId"
:
obj
.
request
i
d
,
"requestId"
:
obj
.
request
I
d
,
"success"
:
false
"success"
:
false
}
}
}
}
...
...
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