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
ce5094f1
Commit
ce5094f1
authored
Mar 20, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
fc307087
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
242 additions
and
2 deletions
+242
-2
.vscode/launch.json
+15
-0
xggsve-merchant/app/base/api/impl/op/action.js
+20
-2
xggsve-merchant/app/base/db/impl/main/saasmainDao.js
+52
-0
xggsve-merchant/app/base/db/models/main/saasmain.js
+57
-0
xggsve-merchant/app/base/service/impl/main/saasmainSve.js
+98
-0
No files found.
.vscode/launch.json
0 → 100644
View file @
ce5094f1
{
//
Use
IntelliSense
to
learn
about
possible
attributes.
//
Hover
to
view
descriptions
of
existing
attributes.
//
For
more
information
,
visit
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"type"
:
"node"
,
"request"
:
"launch"
,
"name"
:
"Launch Program"
,
"program"
:
"${workspaceFolder}/xggsve-merchant/main.js"
}
]
}
\ No newline at end of file
xggsve-merchant/app/base/api/impl/op/action.js
View file @
ce5094f1
...
@@ -4,14 +4,18 @@ var settings = require("../../../../config/settings");
...
@@ -4,14 +4,18 @@ var settings = require("../../../../config/settings");
class
ActionAPI
extends
APIBase
{
class
ActionAPI
extends
APIBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
saasmainSve
=
system
.
getObject
(
"service.main.saasmainSve"
);
// -------------------------------将要弃用------------------------------------------
this
.
merchantSve
=
system
.
getObject
(
"service.merchant.merchantSve"
);
this
.
merchantSve
=
system
.
getObject
(
"service.merchant.merchantSve"
);
this
.
merchantsignedSve
=
system
.
getObject
(
"service.merchant.merchantsignedSve"
);
this
.
merchantsignedSve
=
system
.
getObject
(
"service.merchant.merchantsignedSve"
);
this
.
merchantaccountSve
=
system
.
getObject
(
"service.merchant.merchantaccountSve"
);
this
.
merchantaccountSve
=
system
.
getObject
(
"service.merchant.merchantaccountSve"
);
this
.
merchantrechargeSve
=
system
.
getObject
(
"service.merchant.merchantrechargeSve"
);
this
.
merchantrechargeSve
=
system
.
getObject
(
"service.merchant.merchantrechargeSve"
);
this
.
merchanttitleSve
=
system
.
getObject
(
"service.merchant.merchanttitleSve"
);
this
.
merchanttitleSve
=
system
.
getObject
(
"service.merchant.merchanttitleSve"
);
this
.
merchantaddressSve
=
system
.
getObject
(
"service.merchant.merchantaddressSve"
);
this
.
merchantaddressSve
=
system
.
getObject
(
"service.merchant.merchantaddressSve"
);
}
}
/**
/**
* 接口跳转
* 接口跳转
...
@@ -39,6 +43,20 @@ class ActionAPI extends APIBase {
...
@@ -39,6 +43,20 @@ class ActionAPI extends APIBase {
async
handleRequest
(
action_process
,
action_type
,
action_body
)
{
async
handleRequest
(
action_process
,
action_type
,
action_body
)
{
var
opResult
=
null
;
var
opResult
=
null
;
switch
(
action_type
)
{
switch
(
action_type
)
{
case
"mainDics"
:
opResult
=
await
this
.
saasmainSve
.
dics
(
action_body
);
break
;
case
"mainPage"
:
opResult
=
await
this
.
saasmainSve
.
pageByCondition
(
action_body
);
break
;
case
"mainInfo"
:
opResult
=
await
this
.
saasmainSve
.
info
(
action_body
);
break
;
case
"mainSave"
:
opResult
=
await
this
.
saasmainSve
.
save
(
action_body
);
break
;
// ------------------------------以下api为历史将要弃用的---------------------------------------
// 商户api
// 商户api
case
"infoList"
:
case
"infoList"
:
opResult
=
await
this
.
merchantSve
.
apiInfoList
(
action_body
);
opResult
=
await
this
.
merchantSve
.
apiInfoList
(
action_body
);
...
...
xggsve-merchant/app/base/db/impl/main/saasmainDao.js
0 → 100644
View file @
ce5094f1
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
SaasMainDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
SaasMainDao
));
}
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
,
{
ids
:
ids
});
}
}
module
.
exports
=
SaasMainDao
;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
\ No newline at end of file
xggsve-merchant/app/base/db/models/main/saasmain.js
0 → 100644
View file @
ce5094f1
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"saasmain"
,
{
name
:
DataTypes
.
STRING
,
bank_account
:
DataTypes
.
STRING
,
bank_name
:
DataTypes
.
STRING
,
bank_no
:
DataTypes
.
STRING
,
is_enabled
:
{
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
true
},
saas_id
:
DataTypes
.
INTEGER
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'saas_main'
,
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/main/saasmainSve.js
0 → 100644
View file @
ce5094f1
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
settings
=
require
(
"../../../../config/settings"
)
class
SaasMainService
extends
ServiceBase
{
constructor
()
{
super
(
"main"
,
ServiceBase
.
getDaoName
(
SaasMainService
));
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
async
dics
(
params
)
{
let
saas_id
=
Number
(
this
.
trim
(
params
.
saas_id
)
||
0
);
if
(
!
saas_id
)
{
return
system
.
getResultSuccess
([]);
}
let
list
=
await
this
.
dao
.
bySaasId
(
Number
(
params
.
saas_id
));
return
system
.
getResultSuccess
(
list
);
}
async
info
(
params
)
{
if
(
!
params
.
id
)
{
return
getResult
(
null
,
"id不存在"
);
}
let
main
=
await
this
.
dao
.
getById
(
params
.
id
);
if
(
!
main
)
{
return
getResult
(
null
,
"签约主体不存在"
);
}
this
.
handleDate
(
main
,
[
"created_at"
],
null
,
-
8
);
return
system
.
getResultSuccess
(
main
);
}
async
save
(
params
)
{
let
id
=
Number
(
params
.
id
||
0
);
let
saas_id
=
Number
(
params
.
saas_id
||
0
);
let
name
=
this
.
trim
(
params
.
name
);
let
bank_account
=
this
.
trim
(
params
.
bank_account
);
let
bank_name
=
this
.
trim
(
params
.
bank_name
);
let
bank_no
=
this
.
trim
(
params
.
bank_no
);
let
main
;
if
(
id
)
{
main
=
await
this
.
dao
.
findById
(
id
);
main
.
name
=
name
;
main
.
bank_account
=
bank_account
;
main
.
bank_name
=
bank_name
;
main
.
bank_no
=
bank_no
;
await
main
.
save
();
}
else
{
main
=
{
name
:
name
,
bank_account
:
bank_account
,
bank_name
:
bank_name
,
bank_no
:
bank_no
,
is_enabled
:
true
,
saas_id
:
saas_id
,
};
main
=
await
this
.
dao
.
model
.
create
(
main
);
}
return
system
.
getResultSuccess
(
main
);
}
async
pageByCondition
(
params
)
{
var
currentPage
=
Number
(
params
.
currentPage
||
0
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
var
where
=
{
saas_id
:
params
.
saas_id
,
};
if
(
params
.
name
)
{
where
.
name
=
{
[
this
.
db
.
Op
.
like
]:
"%"
+
params
.
name
+
"%"
};
}
// this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd, true);
var
orderby
=
[
[
"id"
,
'desc'
]
];
var
page
=
await
this
.
getPageList
(
currentPage
,
pageSize
,
where
,
orderby
,
null
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"created_at"
],
null
,
-
8
);
}
}
return
system
.
getResultSuccess
(
page
);
}
}
module
.
exports
=
SaasMainService
;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
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