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
91ac22e9
Commit
91ac22e9
authored
Mar 11, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
df365e65
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
149 additions
and
8 deletions
+149
-8
bpo-channel/app/base/api/impl/op/action.js
+13
-4
bpo-channel/app/base/db/impl/channel/channelDao.js
+11
-2
bpo-channel/app/base/db/impl/channel/platformchannelDao.js
+10
-0
bpo-channel/app/base/db/models/channel/platformchannel.js
+50
-0
bpo-channel/app/base/service/impl/channel/platformchannelSve.js
+46
-0
bpo-channel/app/base/system.js
+19
-2
No files found.
bpo-channel/app/base/api/impl/op/action.js
View file @
91ac22e9
...
@@ -7,6 +7,7 @@ class ActionAPI extends APIBase {
...
@@ -7,6 +7,7 @@ class ActionAPI extends APIBase {
this
.
originSve
=
system
.
getObject
(
"service.channel.originSve"
);
this
.
originSve
=
system
.
getObject
(
"service.channel.originSve"
);
this
.
channelSve
=
system
.
getObject
(
"service.channel.channelSve"
);
this
.
channelSve
=
system
.
getObject
(
"service.channel.channelSve"
);
this
.
channelmerchantSve
=
system
.
getObject
(
"service.channel.channelmerchantSve"
);
this
.
channelmerchantSve
=
system
.
getObject
(
"service.channel.channelmerchantSve"
);
this
.
platformchannelService
=
system
.
getObject
(
"service.channel.platformchannelSve"
);
}
}
/**
/**
* 接口跳转
* 接口跳转
...
@@ -23,11 +24,11 @@ class ActionAPI extends APIBase {
...
@@ -23,11 +24,11 @@ class ActionAPI extends APIBase {
return
system
.
getResult
(
null
,
"action_type参数不能为空"
);
return
system
.
getResult
(
null
,
"action_type参数不能为空"
);
}
}
try
{
try
{
result
=
await
this
.
handleRequest
(
pobj
.
action_process
,
pobj
.
action_type
,
pobj
.
action_body
);
result
=
await
this
.
handleRequest
(
pobj
.
action_process
,
pobj
.
action_type
,
pobj
.
action_body
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
return
result
;
return
result
;
}
}
...
@@ -73,6 +74,15 @@ class ActionAPI extends APIBase {
...
@@ -73,6 +74,15 @@ class ActionAPI extends APIBase {
case
"merchantPage"
:
case
"merchantPage"
:
opResult
=
await
this
.
channelmerchantSve
.
page
(
action_body
);
opResult
=
await
this
.
channelmerchantSve
.
page
(
action_body
);
break
;
break
;
//渠道绑定
case
"bindPlatform"
:
opResult
=
await
this
.
platformchannelService
.
bindPlatform
(
action_body
);
break
;
//绑定渠道推送
case
"pushbindingchannel"
:
opResult
=
await
this
.
platformchannelService
.
pushbindingchannel
(
action_body
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
@@ -122,4 +132,4 @@ class ActionAPI extends APIBase {
...
@@ -122,4 +132,4 @@ class ActionAPI extends APIBase {
];
];
}
}
}
}
module
.
exports
=
ActionAPI
;
module
.
exports
=
ActionAPI
;
\ No newline at end of file
bpo-channel/app/base/db/impl/channel/channelDao.js
View file @
91ac22e9
...
@@ -5,6 +5,16 @@ class ChannelDao extends Dao {
...
@@ -5,6 +5,16 @@ class ChannelDao extends Dao {
super
(
Dao
.
getModelName
(
ChannelDao
));
super
(
Dao
.
getModelName
(
ChannelDao
));
}
}
async
findById
(
id
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"`id`"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE `id` = :id "
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
id
:
id
})
||
[];
}
async
suggest
(
name
)
{
async
suggest
(
name
)
{
var
sql
=
[];
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"SELECT"
);
...
@@ -73,4 +83,4 @@ module.exports = ChannelDao;
...
@@ -73,4 +83,4 @@ module.exports = ChannelDao;
// console.log(i);
// console.log(i);
// }
// }
//
//
// })();
// })();
\ No newline at end of file
bpo-channel/app/base/db/impl/channel/platformchannelDao.js
0 → 100644
View file @
91ac22e9
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
PlatformchannelDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
PlatformchannelDao
));
}
}
module
.
exports
=
PlatformchannelDao
;
bpo-channel/app/base/db/models/channel/platformchannel.js
0 → 100644
View file @
91ac22e9
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"platformchannel"
,
{
platform_id
:
DataTypes
.
INTEGER
,
channel_id
:
DataTypes
.
INTEGER
,
platform_channel_id
:
DataTypes
.
STRING
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'ch_platform_channel'
,
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}]
// }
]
});
}
bpo-channel/app/base/service/impl/channel/platformchannelSve.js
0 → 100644
View file @
91ac22e9
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
class
PlatformchannelService
extends
ServiceBase
{
constructor
()
{
super
(
"channel"
,
ServiceBase
.
getDaoName
(
PlatformchannelService
));
this
.
channelDao
=
system
.
getObject
(
"db.channel.channelDao"
);
}
async
bindPlatform
(
params
){
var
data
=
await
this
.
channelDao
.
findById
(
params
.
channel_id
);
if
(
data
.
length
==
0
){
return
system
.
getErrResult
(
"渠道ID不存在"
);
}
var
platformchannel
=
{
platform_id
:
this
.
trim
(
params
.
platform_id
),
channel_id
:
this
.
trim
(
params
.
channel_id
),
platform_channel_id
:
this
.
trim
(
params
.
platform_channel_id
)
};
var
platformchannelData
=
await
this
.
dao
.
findOne
(
platformchannel
);
if
(
platformchannelData
!=
null
){
return
system
.
getResultSuccess
(
platformchannelData
.
id
);
}
let
suData
=
await
this
.
dao
.
create
(
platformchannel
);
if
(
this
.
trim
(
suData
.
id
)){
return
system
.
getResultSuccess
(
suData
.
id
)
}
return
system
.
getErrResult
(
"绑定失败"
)
}
//绑定渠道推送
async
pushbindingchannel
(
params
){
console
.
log
(
params
)
}
trim
(
o
)
{
if
(
!
o
)
{
return
""
;
}
return
o
.
toString
().
trim
();
}
}
module
.
exports
=
PlatformchannelService
;
bpo-channel/app/base/system.js
View file @
91ac22e9
...
@@ -45,6 +45,24 @@ class System {
...
@@ -45,6 +45,24 @@ class System {
data
:
data
||
null
,
data
:
data
||
null
,
};
};
}
}
static
getErrResult
(
errmsg
)
{
return
{
status
:
-
1
,
msg
:
errmsg
,
data
:
null
};
}
static
getSuccResult
(
data
)
{
return
{
status
:
0
,
msg
:
""
,
data
:
data
};
}
/**
/**
* 请求返回失败
* 请求返回失败
* @param {*} status 操作失败状态,默认为-1
* @param {*} status 操作失败状态,默认为-1
...
@@ -234,4 +252,4 @@ System.appidFail = 1200;
...
@@ -234,4 +252,4 @@ System.appidFail = 1200;
System
.
signFail
=
1300
;
System
.
signFail
=
1300
;
//获取访问token失败
//获取访问token失败
System
.
getAppInfoFail
=
1130
;
System
.
getAppInfoFail
=
1130
;
module
.
exports
=
System
;
module
.
exports
=
System
;
\ 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