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
571eea34
Commit
571eea34
authored
Dec 03, 2019
by
王栋源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wdy
parent
89bc05d9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
143 additions
and
0 deletions
+143
-0
igirl-channel/app/base/api/impl/action/tradetransfer.js
+114
-0
igirl-channel/app/base/utils/aliyunClient.js
+21
-0
igirl-channel/app/config/settings.js
+7
-0
igirl-channel/package-lock.json
+0
-0
igirl-channel/package.json
+1
-0
No files found.
igirl-channel/app/base/api/impl/action/tradetransfer.js
0 → 100644
View file @
571eea34
const
system
=
require
(
"../../../system"
);
var
APIBase
=
require
(
"../../api.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
TradetransferAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
aliclient
=
system
.
getObject
(
"util.aliyunClient"
);
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
transferurl
=
settings
.
reqTransferurl
();
}
//订单创建
async
createtransfer
(
obj
)
{
if
(
!
obj
.
BizId
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
UserName
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"用户不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
Mobile
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"用户手机号不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
Price
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"价格不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
var
orderinfo
=
await
this
.
orderSve
.
findOne
({
ali_bizid
:
obj
.
BizId
});
if
(
orderinfo
)
{
return
{
"errorCode"
:
"OK"
,
"errorMsg"
:
"订单已存在"
,
"module"
:
{
"orderId"
:
orderinfo
.
dataValue
.
fq_ordernum
},
"requestId"
:
obj
.
requestid
,
"success"
:
true
}
}
else
{
var
orderinfo
=
await
this
.
orderSve
.
create
(
obj
);
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/closeOrder"
;
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
,
url
);
if
(
transferinfo
)
{
return
{
"errorCode"
:
"OK"
,
"errorMsg"
:
""
,
"module"
:
{
"orderNumber"
:
orderinfo
.
dataValue
.
fq_ordernum
},
"requestId"
:
obj
.
requestid
,
"success"
:
true
}
}
}
}
//订单查询
async
ordersel
(
p
,
obj
)
{
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/queryOrderState"
;
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
.
actionBody
,
url
);
var
a
=
JSON
.
parse
(
transferinfo
.
stdout
)
return
a
;
}
//订单关闭
async
orderclose
(
obj
)
{
var
url
=
this
.
transferurl
+
"api/transfer/tradeApi/closeOrder"
;
var
transferinfo
=
await
this
.
execlient
.
execPost
(
obj
,
url
);
return
transferinfo
;
}
//业务员分配
async
fenpeiowner
(
obj
)
{
if
(
!
obj
.
BizId
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
var
transferinfo
=
await
this
.
findOne
({
ali_bizid
:
obj
.
BizId
});
}
//阿里网关
async
aliclienttransfer
(
obj
)
{
if
(
obj
.
actionBody
)
{
var
rtn
=
await
this
.
aliclient
.
reqbyget
(
obj
.
actionBody
)
return
rtn
;
}
}
}
module
.
exports
=
TradetransferAPI
;
igirl-channel/app/base/utils/aliyunClient.js
View file @
571eea34
const
Client
=
require
(
'aliyun-api-gateway'
).
Client
;
const
Client
=
require
(
'aliyun-api-gateway'
).
Client
;
var
RPCClient
=
require
(
'@alicloud/pop-core'
).
RPCClient
;
// const client = new Client('203727307', 'b6za34qem6k9a3s3jguvh24nc3ridlnh');
// const client = new Client('203727307', 'b6za34qem6k9a3s3jguvh24nc3ridlnh');
const
client
=
new
Client
(
'203756805'
,
'crkyej0xlmqa6bmvqijun6ltxparllyn'
);
const
client
=
new
Client
(
'203756805'
,
'crkyej0xlmqa6bmvqijun6ltxparllyn'
);
class
aliyunClient
{
class
aliyunClient
{
constructor
()
{
constructor
()
{
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
this
.
aliclient
=
new
RPCClient
({
accessKeyId
:
'LTAI4FvNyYTUtvfUsuoMzy7D'
,
accessKeySecret
:
'1B4YqlWxNUtMpifbtmExQwY7m3Caj4'
,
endpoint
:
'https://trademark.aliyuncs.com'
,
apiVersion
:
'2018-07-24'
});
}
}
async
post
(
aliReqUrl
,
actionBody
)
{
async
post
(
aliReqUrl
,
actionBody
)
{
// var reqParam = {};
// var reqParam = {};
...
@@ -25,6 +32,20 @@ class aliyunClient {
...
@@ -25,6 +32,20 @@ class aliyunClient {
console
.
log
(
JSON
.
stringify
(
result
),
"______________峰擎---阿里云返回结果_______"
);
console
.
log
(
JSON
.
stringify
(
result
),
"______________峰擎---阿里云返回结果_______"
);
return
result
;
return
result
;
}
}
//阿里接口
async
reqbyget
(
obj
,
cbk
)
{
var
self
=
this
;
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
return
self
.
aliclient
.
request
(
action
,
reqbody
,
{
timeout
:
3000
,
// default 3000 ms
formatAction
:
true
,
// default true, format the action to Action
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
method
:
'GET'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
});
}
// async getCreateOrderNum() {
// async getCreateOrderNum() {
// var createOrderNum = await this.getUidStr(5, 36);//====================订单号生成
// var createOrderNum = await this.getUidStr(5, 36);//====================订单号生成
...
...
igirl-channel/app/config/settings.js
View file @
571eea34
...
@@ -27,6 +27,13 @@ var settings = {
...
@@ -27,6 +27,13 @@ var settings = {
return
"http://open.gongsibao.com/"
;
return
"http://open.gongsibao.com/"
;
}
}
},
},
reqTransferurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://192.168.18.61:3003/"
;
}
else
{
return
"http://jxy-service/"
;
}
},
reqEsAddr
:
function
()
{
reqEsAddr
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
var
localsettings
=
require
(
"./localsettings"
);
...
...
igirl-channel/package-lock.json
View file @
571eea34
This source diff could not be displayed because it is too large. You can
view the blob
instead.
igirl-channel/package.json
View file @
571eea34
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
"author"
:
"jy"
,
"author"
:
"jy"
,
"license"
:
"
ISC
"
,
"license"
:
"
ISC
"
,
"dependencies"
:
{
"dependencies"
:
{
"
@alicloud/pop-core
"
:
"^1.7.7"
,
"
MD5
"
:
"^1.3.0"
,
"
MD5
"
:
"^1.3.0"
,
"
after
"
:
"^0.8.2"
,
"
after
"
:
"^0.8.2"
,
"
ali-oss
"
:
"^4.12.2"
,
"
ali-oss
"
:
"^4.12.2"
,
...
...
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