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
15796978
Commit
15796978
authored
Mar 24, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
7704bd18
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
1 deletions
+179
-1
xggsve-merchant/app/base/api/impl/op/action.js
+4
-1
xggsve-merchant/app/base/db/impl/merchant/saasmerchantsettingsDao.js
+116
-0
xggsve-merchant/app/base/db/models/merchant/saasmerchantsettings.js
+50
-0
xggsve-merchant/app/base/service/impl/merchant/saasmerchantSve.js
+9
-0
No files found.
xggsve-merchant/app/base/api/impl/op/action.js
View file @
15796978
...
...
@@ -101,7 +101,10 @@ class ActionAPI extends APIBase {
case
"mchtSign"
:
opResult
=
await
this
.
saasmerchantSve
.
sign
(
action_body
);
break
;
case
"mchtSettings"
:
opResult
=
await
this
.
saasmerchantSve
.
getSettings
(
action_body
);
break
;
// ------------------------------以下api为历史将要弃用的---------------------------------------
// 商户api
// case "infoList":
...
...
xggsve-merchant/app/base/db/impl/merchant/saasmerchantsettingsDao.js
0 → 100644
View file @
15796978
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
SaasmerchantSettingsDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
SaasmerchantSettingsDao
));
}
async
listByIds
(
ids
,
attrs
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
attrs
=
attrs
||
"*"
;
let
sql
=
`SELECT
${
attrs
}
FROM
${
this
.
model
.
tableName
}
WHERE id IN (:ids) `
;
return
await
this
.
customQuery
(
sql
,
{
ids
:
ids
});
}
async
mapByIds
(
ids
,
attrs
)
{
let
result
=
{};
let
list
=
await
this
.
listByIds
(
ids
,
attrs
);
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
async
bySaasId
(
saasId
,
attrs
)
{
attrs
=
attrs
||
"*"
;
let
sql
=
`SELECT
${
attrs
}
FROM
${
this
.
model
.
tableName
}
WHERE saas_id = :saasId `
;
return
await
this
.
customQuery
(
sql
,
{
saasId
:
saasId
});
}
async
byChannelId
(
channelId
,
attrs
)
{
attrs
=
attrs
||
"*"
;
let
sql
=
`SELECT
${
attrs
}
FROM
${
this
.
model
.
tableName
}
WHERE channel_id = :channelId `
;
return
await
this
.
customQuery
(
sql
,
{
channelId
:
channelId
});
}
async
countByCondition
(
params
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"count(1) as num"
);
sql
.
push
(
"FROM saas_merchant t1"
);
sql
.
push
(
"INNER JOIN saas_merchant_sign t2 ON t1.id = t2.id"
);
sql
.
push
(
"WHERE 1 = 1 "
);
this
.
setCondition
(
sql
,
params
);
var
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
if
(
!
list
||
list
.
length
==
0
)
{
return
0
;
}
return
list
[
0
].
num
;
}
async
listByCondition
(
params
)
{
params
.
startRow
=
Number
(
params
.
startRow
||
0
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"t1.*,"
);
sql
.
push
(
"t2.main_id, t2.begin_date, t2.end_date, t2.bm_reg_price, t2.invoice_service_rate, t2.trans_service_rate "
);
sql
.
push
(
"FROM saas_merchant t1"
);
sql
.
push
(
"INNER JOIN saas_merchant_sign t2 ON t1.id = t2.id"
);
sql
.
push
(
"WHERE 1 = 1 "
);
this
.
setCondition
(
sql
,
params
);
sql
.
push
(
"ORDER BY t1.id DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
setCondition
(
sql
,
params
)
{
if
(
!
params
||
!
sql
)
{
return
;
}
if
(
params
.
saas_id
)
{
sql
.
push
(
"AND t1.saas_id = :saas_id"
);
}
if
(
params
.
channel_id
)
{
sql
.
push
(
"AND t1.channel_id = :channel_id"
);
}
if
(
params
.
name
)
{
params
.
nameLike
=
`%
${
params
.
name
}
%`
;
sql
.
push
(
"AND t1.name LIKE :nameLike"
);
}
if
(
params
.
credit_code
)
{
sql
.
push
(
"AND t1.credit_code LIKE :credit_code"
);
}
if
(
typeof
params
.
is_sign
!=
"undefined"
&&
(
params
.
is_sign
===
1
||
params
.
is_sign
===
0
))
{
sql
.
push
(
"AND t1.is_sign LIKE :is_sign"
);
}
if
(
params
.
createBegin
)
{
sql
.
push
(
"AND t1.created_at >= :createBegin"
);
}
if
(
params
.
createEnd
)
{
sql
.
push
(
"AND t1.created_at <= :createEnd"
);
}
}
}
module
.
exports
=
SaasmerchantSettingsDao
;
xggsve-merchant/app/base/db/models/merchant/saasmerchantsettings.js
0 → 100644
View file @
15796978
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"saasmerchantsettings"
,
{
appid
:
DataTypes
.
STRING
,
secret
:
DataTypes
.
STRING
,
},{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'saas_merchant_settings'
,
validate
:
{
},
indexes
:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
xggsve-merchant/app/base/service/impl/merchant/saasmerchantSve.js
View file @
15796978
...
...
@@ -6,6 +6,7 @@ class SaasMerchantService extends ServiceBase {
super
(
"merchant"
,
ServiceBase
.
getDaoName
(
SaasMerchantService
));
this
.
saasmerchantsignDao
=
system
.
getObject
(
"db.merchant.saasmerchantsignDao"
);
this
.
saasmerchantsettingsDao
=
system
.
getObject
(
"db.merchant.saasmerchantsettingsDao"
);
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
...
...
@@ -240,6 +241,14 @@ class SaasMerchantService extends ServiceBase {
await
merchant
.
save
();
return
system
.
getResultSuccess
();
}
async
getSettings
(
params
)
{
let
rs
=
await
this
.
saasmerchantsettingsDao
.
getById
(
params
.
id
);
return
system
.
getResultSuccess
({
appid
:
rs
.
appid
,
secret
:
rs
.
secret
,
});
}
}
module
.
exports
=
SaasMerchantService
;
// var task=new UserService();
...
...
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