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
7855e6d6
Commit
7855e6d6
authored
Jun 04, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
92d492d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
213 additions
and
82 deletions
+213
-82
xgg-saas-merchant/app/base/api/api.base.js
+12
-1
xgg-saas-merchant/app/base/api/impl/h5/merchantApi.js
+191
-70
xgg-saas-merchant/app/base/service/svems.base.js
+5
-6
xgg-saas-merchant/app/base/system.js
+5
-5
No files found.
xgg-saas-merchant/app/base/api/api.base.js
View file @
7855e6d6
...
@@ -9,6 +9,17 @@ class APIBase extends DocBase {
...
@@ -9,6 +9,17 @@ class APIBase extends DocBase {
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
this
.
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
this
.
oplogSve
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
oplogSve
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
merchantappletuserSve
=
system
.
getObject
(
"service.uc.merchantappletuserSve"
);
}
async
getLoginUser
(
merchant_id
,
openid
,
forceUpdate
)
{
return
await
this
.
merchantappletuserSve
.
getLoginUser
({
merchant_id
:
merchant_id
,
openid
:
openid
,
forceUpdate
:
forceUpdate
});
}
async
getMerchant
(
merchant_id
)
{
return
await
this
.
merchantSve
.
getMerchantWithCache
({
id
:
merchant_id
,
forceUpdate
:
true
});
}
}
getUUID
()
{
getUUID
()
{
var
uuid
=
uuidv4
();
var
uuid
=
uuidv4
();
...
@@ -17,7 +28,7 @@ class APIBase extends DocBase {
...
@@ -17,7 +28,7 @@ class APIBase extends DocBase {
}
}
/**
/**
* 验证签名
* 验证签名
* @param {*} params 要验证的参数
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
* @param {*} app_key 应用的校验key
*/
*/
async
verifySign
(
params
,
app_key
)
{
async
verifySign
(
params
,
app_key
)
{
...
...
xgg-saas-merchant/app/base/api/impl/h5/merchantApi.js
View file @
7855e6d6
var
APIBase
=
require
(
"../../api.base"
);
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
system
=
require
(
"../../../system"
);
const
axios
=
require
(
"axios"
);
const
validation
=
system
.
getObject
(
"util.validation"
);
const
md5
=
require
(
"MD5"
);
class
TestAPI
extends
APIBase
{
class
TestAPI
extends
APIBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
@@ -22,27 +26,68 @@ class TestAPI extends APIBase {
...
@@ -22,27 +26,68 @@ class TestAPI extends APIBase {
this
.
smsClient
=
system
.
getObject
(
"util.smsClient"
);
this
.
smsClient
=
system
.
getObject
(
"util.smsClient"
);
}
}
//
async
loginUser
(
gobj
,
pobj
,
req
,
loginUser
)
{
//H5登录获取验证码
// TODO pobj.merchant_id 前端传过来,解密
async
sendMobileCode
(
obj
,
obj1
,
req
)
{
let
user
=
await
this
.
getLoginUser
(
pobj
.
merchant_id
,
pobj
.
openid
);
let
mobile
=
obj
.
mobile
;
return
this
.
returnSuccess
(
user
);
if
(
!
mobile
)
{
}
return
this
.
returnFail
(
"请先填写手机号"
);
async
uploadConfig
(
gobj
,
pobj
,
req
,
loginUser
)
{
}
if
(
validation
.
isMobile
(
mobile
))
{
return
this
.
returnFail
(
"手机号格式错误"
);
}
try
{
try
{
let
data
=
await
this
.
uploadCtl
.
getOssConfig
();
let
key
=
this
.
SMS_LOGINMOBILE_KEY
+
mobile
;
return
this
.
returnSuccess
(
data
);
let
vcode
=
await
this
.
redisClient
.
get
(
key
+
"t"
);
// let vcode;
if
(
!
vcode
)
{
vcode
=
await
this
.
getVCode
();
await
this
.
redisClient
.
setWithEx
(
key
,
vcode
,
5
*
60
);
await
this
.
redisClient
.
setWithEx
(
key
+
"t"
,
vcode
,
60
);
let
msg
=
"您的个体户注册手机验证码为"
+
vcode
+
", (切勿将验证码告知别人, 请在5分钟内输入完成验证, 如有问题请联系客服。)"
;
let
rs
=
await
this
.
smsClient
.
sendMsg
(
mobile
,
msg
);
//this.addLog(obj, "sms");
console
.
log
(
rs
);
}
return
this
.
returnSuccess
(
1
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
"接口异常:"
+
error
.
message
);
return
{
code
:
500
};
}
}
}
}
// 登录接口 post
// 登录接口 post
async
login
(
o
,
obj
,
req
)
{
async
login
(
o
bj
,
obj1
,
req
)
{
try
{
try
{
if
(
!
obj
.
mobile
)
{
return
this
.
returnFail
(
"请填写手机号"
);
}
let
noteCode
=
(
obj
.
noteCode
||
""
).
trim
();
if
(
!
noteCode
)
{
return
this
.
returnFail
(
"请填写短信验证码"
);
}
// TODO 手机号验证码登录
// TODO 手机号验证码登录
let
key
=
this
.
SMS_LOGINMOBILE_KEY
+
obj
.
mobile
;
let
vcode
=
await
this
.
redisClient
.
get
(
key
+
"t"
);
if
(
!
vcode
)
{
return
this
.
returnFail
(
"短信验证码已过期,请重新发送"
);
}
if
(
vcode
!=
noteCode
)
{
return
this
.
returnFail
(
"短信验证码错误,请重新填写"
);
}
let
openID
=
"gtbh5_"
+
obj
.
mobile
;
let
merchant_id
=
decodeURIComponent
(
obj
.
merchant_id
);
let
params
=
{
saas_merchant_id
:
merchant_id
,
saas_id
:
null
,
openid
:
openID
,
nickName
:
obj
.
mobile
,
avatarUrl
:
""
,
ucname
:
obj
.
mobile
,
mobile
:
obj
.
mobile
,
};
let
res
=
await
this
.
merchantappletuserSve
.
login
(
params
);
let
res
=
await
this
.
merchantappletuserSve
.
login
(
params
);
if
(
res
.
status
===
0
)
{
if
(
res
.
status
===
0
)
{
return
this
.
returnSuccess
(
res
.
data
);
return
this
.
returnSuccess
(
res
.
data
);
...
@@ -54,19 +99,34 @@ class TestAPI extends APIBase {
...
@@ -54,19 +99,34 @@ class TestAPI extends APIBase {
}
}
}
}
async
addLog
(
pobj
,
consume_type
)
{
let
user
=
await
this
.
getLoginUser
(
pobj
.
merchant_id
,
pobj
.
openid
);
//验证登录
let
log
=
{
saas_id
:
user
.
saas_id
,
saas_merchant_id
:
user
.
saas_merchant_id
,
consume_type
:
consume_type
,
consume_id
:
user
.
id
};
async
loginUser
(
obj
)
{
let
rs
=
await
this
.
merchantSve
.
addConsumeLog
({
log
:
log
});
let
merchant_id
=
decodeURIComponent
(
obj
.
merchant_id
);
console
.
log
(
"log rs : "
,
rs
);
let
user
=
await
this
.
getLoginUser
(
merchant_id
,
obj
.
openid
);
return
this
.
returnSuccess
(
user
);
}
async
uploadConfig
(
obj
,
obj1
,
req
)
{
try
{
let
data
=
await
this
.
uploadCtl
.
getOssConfig
();
return
this
.
returnSuccess
(
data
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
{
code
:
500
};
}
}
}
// 保存订单信息
// 保存订单信息
async
saveOrder
(
gobj
,
pobj
,
req
,
loginUser
)
{
async
saveOrder
(
obj
,
obj1
,
req
)
{
try
{
try
{
// TODO this.loginUser();
// TODO this.loginUser();
let
loginUser
=
await
this
.
loginUser
(
obj
);
let
rs
=
await
this
.
buildOrder
(
pobj
);
if
(
!
loginUser
)
{
return
this
.
returnFail
(
"订单保存失败"
);
}
let
rs
=
await
this
.
buildOrder
(
obj
);
if
(
rs
.
code
===
0
)
{
if
(
rs
.
code
===
0
)
{
return
rs
;
return
rs
;
}
}
...
@@ -78,18 +138,18 @@ class TestAPI extends APIBase {
...
@@ -78,18 +138,18 @@ class TestAPI extends APIBase {
userBankNo
:
bminfo
.
bank_no
,
userBankNo
:
bminfo
.
bank_no
,
userMobile
:
bminfo
.
bank_mobile
,
userMobile
:
bminfo
.
bank_mobile
,
});
});
this
.
addLog
(
p
obj
,
"bankfour"
);
// this.addLog(
obj, "bankfour");
if
(
bf
.
code
!==
0
)
{
if
(
bf
.
code
!==
0
)
{
return
this
.
returnFail
(
"银行卡四要素验证失败,请检查法人姓名,身份证,银行卡号,银行卡预留手机号正确"
);
return
this
.
returnFail
(
"银行卡四要素验证失败,请检查法人姓名,身份证,银行卡号,银行卡预留手机号正确"
);
}
}
let
merchant
=
await
this
.
getMerchant
(
p
obj
.
merchant_id
);
let
merchant
=
await
this
.
getMerchant
(
obj
.
merchant_id
);
let
loginUser
=
await
this
.
getLoginUser
(
pobj
.
merchant_id
,
pobj
.
openid
);
//
let loginUser = await this.getLoginUser(pobj.merchant_id, pobj.openid);
let
order
=
{
let
order
=
{
saas_id
:
merchant
.
saas_id
,
saas_id
:
merchant
.
saas_id
,
merchant_id
:
merchant
.
id
,
merchant_id
:
merchant
.
id
,
product_id
:
"10020000"
,
product_id
:
"10020000"
,
merchant_app_user_id
:
loginUser
.
id
,
merchant_app_user_id
:
loginUser
.
data
.
id
,
price
:
system
.
y2f
(
merchant
.
sign
.
bm_reg_price
)
||
0
,
price
:
system
.
y2f
(
merchant
.
sign
.
bm_reg_price
)
||
0
,
bminfo
:
rs
.
data
bminfo
:
rs
.
data
};
};
...
@@ -157,13 +217,13 @@ class TestAPI extends APIBase {
...
@@ -157,13 +217,13 @@ class TestAPI extends APIBase {
return
this
.
returnFail
(
"请填写短信验证码"
);
return
this
.
returnFail
(
"请填写短信验证码"
);
}
}
let
vcode
=
await
this
.
redisClient
.
get
(
this
.
SMS_BANK
MOBILE_KEY
+
obj
.
bank_mobile
);
// let vcode = await this.redisClient.get(this.SMS_LOGIN
MOBILE_KEY + obj.bank_mobile);
if
(
!
vcode
)
{
//
if (!vcode) {
return
this
.
returnFail
(
"短信验证码已过期,请重新发送"
);
//
return this.returnFail("短信验证码已过期,请重新发送");
}
//
}
if
(
vcode
!=
noteCode
)
{
//
if (vcode != noteCode) {
return
this
.
returnFail
(
"短信验证码错误,请重新填写"
);
//
return this.returnFail("短信验证码错误,请重新填写");
}
//
}
let
bminfo
=
{
let
bminfo
=
{
idcard_front
:
obj
.
idcard_front
,
idcard_front
:
obj
.
idcard_front
,
idcard_back
:
obj
.
idcard_back
,
idcard_back
:
obj
.
idcard_back
,
...
@@ -181,19 +241,18 @@ class TestAPI extends APIBase {
...
@@ -181,19 +241,18 @@ class TestAPI extends APIBase {
return
this
.
returnSuccess
(
bminfo
);
return
this
.
returnSuccess
(
bminfo
);
}
}
async
myOrders
(
gobj
,
pobj
,
req
)
{
async
myOrders
(
obj
,
obj1
,
req
)
{
// TODO this.loginUser();
// TODO this.loginUser();
let
loginUser
=
await
this
.
loginUser
(
obj
);
let
loginUser
=
await
this
.
getLoginUser
(
pobj
.
merchant_id
,
pobj
.
openid
);
if
(
!
loginUser
)
{
if
(
!
loginUser
)
{
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
}
}
try
{
try
{
let
params
=
{
let
params
=
{
pageSize
:
Number
(
p
obj
.
pageSize
||
10
),
pageSize
:
Number
(
obj
.
pageSize
||
10
),
currentPage
:
Number
(
p
obj
.
currentPage
||
1
),
currentPage
:
Number
(
obj
.
currentPage
||
1
),
merchant_app_user_id
:
loginUser
.
id
,
merchant_app_user_id
:
loginUser
.
data
.
id
,
merchant_id
:
loginUser
.
merchant_id
,
merchant_id
:
loginUser
.
data
.
saas_
merchant_id
,
}
}
let
page
=
await
this
.
orderSve
.
page
(
params
);
let
page
=
await
this
.
orderSve
.
page
(
params
);
...
@@ -223,19 +282,19 @@ class TestAPI extends APIBase {
...
@@ -223,19 +282,19 @@ class TestAPI extends APIBase {
* @param {*} req
* @param {*} req
* @param {*} loginUser
* @param {*} loginUser
*/
*/
async
orderInfo
(
gobj
,
pobj
,
req
)
{
async
orderInfo
(
obj
,
obj1
,
req
)
{
// TODO this.loginUser();
// TODO this.loginUser();
let
loginUser
=
await
this
.
getLoginUser
(
pobj
.
merchant_id
,
pobj
.
openid
);
let
loginUser
=
await
this
.
loginUser
(
obj
);
if
(
!
loginUser
)
{
if
(
!
loginUser
)
{
return
this
.
returnSuccess
({});
return
this
.
returnSuccess
({});
}
}
try
{
try
{
let
rs
=
await
this
.
orderSve
.
orderInfo
(
p
obj
);
let
rs
=
await
this
.
orderSve
.
orderInfo
(
obj
);
if
(
rs
.
status
===
0
)
{
if
(
rs
.
status
===
0
)
{
return
this
.
returnSuccess
(
rs
.
data
);
return
this
.
returnSuccess
(
rs
.
data
);
}
else
{
}
else
{
return
this
.
returnFail
(
page
.
msg
);
return
this
.
returnFail
(
rs
.
msg
);
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -243,9 +302,9 @@ class TestAPI extends APIBase {
...
@@ -243,9 +302,9 @@ class TestAPI extends APIBase {
}
}
}
}
async
idNoValid
(
gobj
,
pobj
,
req
,
loginUser
)
{
async
idNoValid
(
obj
,
obj1
,
req
)
{
try
{
try
{
let
idno
=
(
p
obj
.
idno
||
""
).
trim
();
let
idno
=
(
obj
.
idno
||
""
).
trim
();
if
(
!
idno
)
{
if
(
!
idno
)
{
return
{
code
:
0
,
msg
:
"请填写身份证号码"
};
return
{
code
:
0
,
msg
:
"请填写身份证号码"
};
}
}
...
@@ -271,9 +330,9 @@ class TestAPI extends APIBase {
...
@@ -271,9 +330,9 @@ class TestAPI extends APIBase {
async
saasorderbusinessmenPage
(
params
,
pobj2
,
req
)
{
async
saasorderbusinessmenPage
(
params
,
pobj2
,
req
)
{
// TODO this.loginUser();
// TODO this.loginUser();
let
loginUser
=
await
this
.
getLoginUser
(
pobj2
.
merchant_id
,
pobj2
.
openid
);
let
loginUser
=
await
this
.
loginUser
(
params
);
p
obj2
.
merchant_app_user_id
=
loginUser
.
id
;
p
arams
.
merchant_app_user_id
=
loginUser
.
data
.
id
;
let
res
=
await
this
.
businessmenSve
.
saasorderbusinessmenPage
(
p
obj2
);
let
res
=
await
this
.
businessmenSve
.
saasorderbusinessmenPage
(
p
arams
);
if
(
res
.
status
==
0
)
{
if
(
res
.
status
==
0
)
{
return
this
.
returnSuccess
(
res
.
data
);
return
this
.
returnSuccess
(
res
.
data
);
}
else
{
}
else
{
...
@@ -288,16 +347,16 @@ class TestAPI extends APIBase {
...
@@ -288,16 +347,16 @@ class TestAPI extends APIBase {
* @param req
* @param req
* @returns {Promise<{msg: string, data: (*|null), bizmsg: string, status: number}>}
* @returns {Promise<{msg: string, data: (*|null), bizmsg: string, status: number}>}
*/
*/
async
saasTradeBusinessmenPage
(
pobj1
,
pobj2
,
req
)
{
async
saasTradeBusinessmenPage
(
obj
,
obj1
,
req
)
{
// TODO this.loginUser();
// TODO this.loginUser();
let
loginUser
=
await
this
.
getLoginUser
(
pobj2
.
merchant_id
,
pobj2
.
openid
);
let
loginUser
=
await
this
.
loginUser
(
obj
);
pobj2
.
merchant_app_user_id
=
loginUser
.
id
;
obj
.
merchant_app_user_id
=
loginUser
.
data
.
id
;
pobj2
.
attrs
=
[
"credit_code"
];
obj
.
attrs
=
[
"credit_code"
];
if
(
!
pobj2
.
merchant_app_user_id
)
{
if
(
!
obj
.
merchant_app_user_id
)
{
return
system
.
getResult
(
null
,
`登录失效,请重新登录`
);
return
system
.
getResult
(
null
,
`登录失效,请重新登录`
);
}
}
try
{
try
{
let
creditCodeArray
=
await
this
.
businessmenSve
.
assorderBusinessmenInfo
(
pobj2
);
let
creditCodeArray
=
await
this
.
businessmenSve
.
assorderBusinessmenInfo
(
obj
);
if
(
creditCodeArray
.
status
!=
0
)
{
if
(
creditCodeArray
.
status
!=
0
)
{
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
}
}
...
@@ -308,8 +367,8 @@ class TestAPI extends APIBase {
...
@@ -308,8 +367,8 @@ class TestAPI extends APIBase {
if
(
!
creditCodes
||
creditCodes
.
length
==
0
)
{
if
(
!
creditCodes
||
creditCodes
.
length
==
0
)
{
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
}
}
pobj2
.
credit_code_array
=
creditCodes
;
obj
.
credit_code_array
=
creditCodes
;
let
res
=
await
this
.
tradeSve
.
tradeItemBycreditCode
(
pobj2
);
let
res
=
await
this
.
tradeSve
.
tradeItemBycreditCode
(
obj
);
if
(
res
.
status
==
0
)
{
if
(
res
.
status
==
0
)
{
return
this
.
returnSuccess
(
res
.
data
);
return
this
.
returnSuccess
(
res
.
data
);
}
else
{
}
else
{
...
@@ -328,16 +387,16 @@ class TestAPI extends APIBase {
...
@@ -328,16 +387,16 @@ class TestAPI extends APIBase {
* @param req
* @param req
* @returns {Promise<void>}
* @returns {Promise<void>}
*/
*/
async
invoiceBycreditCode
(
pobj1
,
pobj2
,
req
)
{
async
invoiceBycreditCode
(
obj
,
obj1
,
req
)
{
// TODO this.loginUser();
// TODO this.loginUser();
let
loginUser
=
await
this
.
getLoginUser
(
pobj2
.
merchant_id
,
pobj2
.
openid
);
let
loginUser
=
await
this
.
loginUser
(
obj
);
pobj2
.
merchant_app_user_id
=
loginUser
.
id
;
obj
.
merchant_app_user_id
=
loginUser
.
data
.
id
;
pobj2
.
attrs
=
[
"credit_code"
];
obj
.
attrs
=
[
"credit_code"
];
if
(
!
pobj2
.
merchant_app_user_id
)
{
if
(
!
obj
.
merchant_app_user_id
)
{
return
system
.
getResult
(
null
,
`登录失效,请重新登录`
);
return
system
.
getResult
(
null
,
`登录失效,请重新登录`
);
}
}
try
{
try
{
let
creditCodeArray
=
await
this
.
businessmenSve
.
assorderBusinessmenInfo
(
pobj2
);
let
creditCodeArray
=
await
this
.
businessmenSve
.
assorderBusinessmenInfo
(
obj
);
if
(
creditCodeArray
.
status
!=
0
)
{
if
(
creditCodeArray
.
status
!=
0
)
{
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
...
@@ -349,9 +408,9 @@ class TestAPI extends APIBase {
...
@@ -349,9 +408,9 @@ class TestAPI extends APIBase {
if
(
!
creditCodes
||
creditCodes
.
length
==
0
)
{
if
(
!
creditCodes
||
creditCodes
.
length
==
0
)
{
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
return
this
.
returnSuccess
({
count
:
0
,
rows
:
[]});
}
}
pobj2
.
credit_code_array
=
creditCodes
;
obj
.
credit_code_array
=
creditCodes
;
let
res
=
await
this
.
saasInvoiceSve
.
invoiceBycreditCode
(
pobj2
);
let
res
=
await
this
.
saasInvoiceSve
.
invoiceBycreditCode
(
obj
);
if
(
res
.
status
==
0
)
{
if
(
res
.
status
==
0
)
{
return
this
.
returnSuccess
(
res
.
data
);
return
this
.
returnSuccess
(
res
.
data
);
}
else
{
}
else
{
...
@@ -370,10 +429,10 @@ class TestAPI extends APIBase {
...
@@ -370,10 +429,10 @@ class TestAPI extends APIBase {
* @param req
* @param req
* @returns {Promise<void>}
* @returns {Promise<void>}
*/
*/
async
sendBankMobileCode
(
pobj1
,
pobj
,
req
)
{
async
sendBankMobileCode
(
obj
,
obj1
,
req
)
{
// TODO this.loginUser();
// TODO this.loginUser();
let
loginUser
=
await
this
.
getLoginUser
(
pobj
.
merchant_id
,
pobj
.
openid
);
let
loginUser
=
await
this
.
loginUser
(
obj
);
let
mobile
=
p
obj
.
mobile
;
let
mobile
=
obj
.
mobile
;
if
(
!
mobile
)
{
if
(
!
mobile
)
{
return
this
.
returnFail
(
"请先填写银行卡预留手机号"
);
return
this
.
returnFail
(
"请先填写银行卡预留手机号"
);
}
}
...
@@ -390,7 +449,7 @@ class TestAPI extends APIBase {
...
@@ -390,7 +449,7 @@ class TestAPI extends APIBase {
await
this
.
redisClient
.
setWithEx
(
key
+
"t"
,
vcode
,
60
);
await
this
.
redisClient
.
setWithEx
(
key
+
"t"
,
vcode
,
60
);
let
msg
=
"您的个体户注册手机验证码为"
+
vcode
+
", (切勿将验证码告知别人, 请在5分钟内输入完成验证, 如有问题请联系客服。)"
;
let
msg
=
"您的个体户注册手机验证码为"
+
vcode
+
", (切勿将验证码告知别人, 请在5分钟内输入完成验证, 如有问题请联系客服。)"
;
let
rs
=
await
this
.
smsClient
.
sendMsg
(
mobile
,
msg
);
let
rs
=
await
this
.
smsClient
.
sendMsg
(
mobile
,
msg
);
this
.
addLog
(
pobj
,
"sms"
);
//
this.addLog(pobj, "sms");
console
.
log
(
rs
);
console
.
log
(
rs
);
}
}
return
this
.
returnSuccess
(
1
);
return
this
.
returnSuccess
(
1
);
...
@@ -399,6 +458,7 @@ class TestAPI extends APIBase {
...
@@ -399,6 +458,7 @@ class TestAPI extends APIBase {
}
}
}
}
getVCode
()
{
getVCode
()
{
var
randomNum
=
""
+
Math
.
round
(
Math
.
random
()
*
1000000
);
var
randomNum
=
""
+
Math
.
round
(
Math
.
random
()
*
1000000
);
while
(
randomNum
.
length
<
6
)
{
while
(
randomNum
.
length
<
6
)
{
...
@@ -447,9 +507,69 @@ class TestAPI extends APIBase {
...
@@ -447,9 +507,69 @@ class TestAPI extends APIBase {
return
rs
.
data
||
{};
return
rs
.
data
||
{};
}
}
//日志
async
addLog
(
obj
,
consume_type
)
{
let
user
=
await
this
.
getLoginUser
(
obj
.
merchant_id
,
obj
.
openid
);
let
log
=
{
// saas_id: user.saas_id,
saas_merchant_id
:
user
.
saas_merchant_id
,
consume_type
:
consume_type
,
consume_id
:
user
.
id
};
let
rs
=
await
this
.
merchantSve
.
addConsumeLog
({
log
:
log
});
console
.
log
(
"log rs : "
,
rs
);
}
returnResult
(
code
,
msg
,
data
)
{
return
{
code
:
code
||
0
,
msg
:
msg
||
""
,
data
:
data
}
}
returnSuccess
(
data
)
{
return
this
.
returnResult
(
1
,
"success"
,
data
)
}
returnFail
(
msg
,
data
)
{
return
this
.
returnResult
(
0
,
msg
,
data
);
}
trim
(
o
)
{
if
(
!
o
)
{
return
""
;
}
return
o
.
toString
().
trim
();
}
getUidStr
(
len
,
radix
)
{
var
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
var
uuid
=
[],
i
;
radix
=
radix
||
chars
.
length
;
if
(
len
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
var
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
r
=
0
|
Math
.
random
()
*
16
;
uuid
[
i
]
=
chars
[(
i
==
19
)
?
(
r
&
0x3
)
|
0x8
:
r
];
}
}
}
return
uuid
.
join
(
''
);
}
exam
()
{
exam
()
{
return
""
;
return
""
;
}
}
classDesc
()
{
classDesc
()
{
return
{
return
{
groupName
:
""
,
groupName
:
""
,
...
@@ -459,6 +579,7 @@ class TestAPI extends APIBase {
...
@@ -459,6 +579,7 @@ class TestAPI extends APIBase {
exam
:
""
,
exam
:
""
,
};
};
}
}
methodDescs
()
{
methodDescs
()
{
return
[
return
[
{
{
...
@@ -478,4 +599,5 @@ class TestAPI extends APIBase {
...
@@ -478,4 +599,5 @@ class TestAPI extends APIBase {
];
];
}
}
}
}
module
.
exports
=
TestAPI
;
\ No newline at end of file
module
.
exports
=
TestAPI
;
xgg-saas-merchant/app/base/service/svems.base.js
View file @
7855e6d6
...
@@ -22,7 +22,7 @@ class ServiceBase {
...
@@ -22,7 +22,7 @@ class ServiceBase {
/**
/**
* 验证签名
* 验证签名
* @param {*} params 要验证的参数
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
* @param {*} app_key 应用的校验key
*/
*/
async
verifySign
(
params
,
app_key
)
{
async
verifySign
(
params
,
app_key
)
{
...
@@ -55,7 +55,7 @@ class ServiceBase {
...
@@ -55,7 +55,7 @@ class ServiceBase {
}
}
/**
/**
* 创建签名
* 创建签名
* @param {*} params 要验证的参数
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
* @param {*} app_key 应用的校验key
*/
*/
async
createSign
(
params
,
app_key
)
{
async
createSign
(
params
,
app_key
)
{
...
@@ -220,7 +220,7 @@ class ServiceBase {
...
@@ -220,7 +220,7 @@ class ServiceBase {
}
}
try
{
try
{
var
params
=
{
var
params
=
{
"action_process"
:
"
xgg-saas-platform
"
,
"action_process"
:
"
sijibao
"
,
"action_type"
:
apiName
,
"action_type"
:
apiName
,
"action_body"
:
params
||
{},
"action_body"
:
params
||
{},
}
}
...
@@ -231,7 +231,7 @@ class ServiceBase {
...
@@ -231,7 +231,7 @@ class ServiceBase {
url
:
reqUrl
,
url
:
reqUrl
,
data
:
params
data
:
params
});
});
console
.
log
(
rs
);
console
.
log
(
rs
);
return
rs
.
data
;
return
rs
.
data
;
}
}
...
@@ -293,4 +293,4 @@ class ServiceBase {
...
@@ -293,4 +293,4 @@ class ServiceBase {
return
o
.
toString
().
trim
();
return
o
.
toString
().
trim
();
}
}
}
}
module
.
exports
=
ServiceBase
;
module
.
exports
=
ServiceBase
;
\ No newline at end of file
xgg-saas-merchant/app/base/system.js
View file @
7855e6d6
...
@@ -188,22 +188,22 @@ class System {
...
@@ -188,22 +188,22 @@ class System {
let
dev
=
"http://39.107.234.14"
;
let
dev
=
"http://39.107.234.14"
;
return
{
return
{
// 公共服务
// 公共服务
common
:
local
+
":3102"
+
path
,
common
:
dev
+
":3102"
+
path
,
// 商户服务
// 商户服务
merchant
:
local
+
":3101"
+
path
,
merchant
:
dev
+
":3101"
+
path
,
// 订单服务
// 订单服务
order
:
local
+
":3103"
+
path
,
order
:
dev
+
":3103"
+
path
,
// 发票服务
// 发票服务
invoice
:
dev
+
":3105"
+
path
,
invoice
:
dev
+
":3105"
+
path
,
// 用户服务
// 用户服务
uc
:
local
+
":3106"
+
path
,
uc
:
dev
+
":3106"
+
path
,
// 交易
// 交易
trade
:
local
+
":3107"
+
path
,
trade
:
dev
+
":3107"
+
path
,
}
}
}
else
{
}
else
{
return
{
return
{
...
...
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