Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sb_h5
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data_server
sb_h5
Commits
a682ce4b
Commit
a682ce4b
authored
Aug 27, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sbh5
parent
2871a40b
Pipeline
#12951
passed with stage
in 17 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
245 additions
and
10 deletions
+245
-10
.travis.yml
.travis.yml
+3
-1
order.js
app/controller/order.js
+1
-1
task.js
app/controller/task.js
+1
-0
nodeCusdata.js
app/model/nodegjj/nodeCusdata.js
+77
-0
sbStatus.js
app/model/nodegjj/sbStatus.js
+110
-0
order.js
app/service/order.js
+29
-0
storage.js
app/service/storage.js
+6
-1
config.local.js
config/config.local.js
+7
-7
config.prod.js
config/config.prod.js
+11
-0
No files found.
.travis.yml
View file @
a682ce4b
...
...
@@ -2,8 +2,10 @@ sudo: false
language
:
node_js
node_js
:
-
'
8'
before_install
:
-
npm i npminstall -g
install
:
-
npm
i npminstall && npm
install
-
npminstall
script
:
-
npm run ci
after_script
:
...
...
app/controller/order.js
View file @
a682ce4b
...
...
@@ -146,7 +146,7 @@ class OrderController extends Controller {
const
{
ctx
,
service
}
=
this
;
const
{
appKey
,
orderId
}
=
ctx
.
params
;
const
appKeyInfo
=
await
service
.
partner
.
fetchInfo
(
appKey
);
if
(
!
(
appKeyInfo
&&
appKeyInfo
.
valid
===
true
&&
appKeyInfo
.
enable
Hf
View
===
true
))
{
if
(
!
(
appKeyInfo
&&
appKeyInfo
.
valid
===
true
&&
appKeyInfo
.
enable
Ss
View
===
true
))
{
return
ctx
.
fail
(
'未开通此服务'
);
}
const
data
=
await
service
.
order
.
getOneByOrderId
({
orderId
});
...
...
app/controller/task.js
View file @
a682ce4b
...
...
@@ -150,6 +150,7 @@ class TaskController extends Controller {
insertData
.
appKey
=
appKey
;
delete
insertData
.
code
;
await
service
.
storage
.
write
(
insertData
);
await
service
.
order
.
oldsbStatus
({
orderId
,
status
:
'success'
});
await
service
.
partner
.
notify
(
order
);
}
catch
(
err
)
{
ctx
.
logger
.
error
(
`【controller/task/handleCallback err】:
${
err
}${
JSON
.
stringify
(
result
)}
`
);
...
...
app/model/nodegjj/nodeCusdata.js
0 → 100644
View file @
a682ce4b
'use strict'
;
module
.
exports
=
app
=>
{
const
{
DataTypes
}
=
app
.
Sequelize
;
const
cusDatas
=
app
.
nodemodel
.
define
(
'cusDatas'
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
autoIncrement
:
true
,
primaryKey
:
true
,
field
:
'id'
,
},
orderSn
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
false
,
field
:
'orderSn'
,
},
appkey
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
false
,
field
:
'appkey'
,
},
type
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'type'
,
},
date
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
defaultValue
:
app
.
Sequelize
.
literal
(
'CURRENT_TIMESTAMP'
),
field
:
'date'
,
},
// text1: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text1',
// },
// text2: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text2',
// },
// text3: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text3',
// },
// text4: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text4',
// },
// date1: {
// type: DataTypes.DATE,
// allowNull: true,
// field: 'date1',
// },
// date2: {
// type: DataTypes.DATE,
// allowNull: true,
// field: 'date2',
// },
},
{
tableName
:
'cus_data'
,
timestamps
:
false
,
});
return
cusDatas
;
};
app/model/nodegjj/sbStatus.js
0 → 100644
View file @
a682ce4b
'use strict'
;
module
.
exports
=
app
=>
{
const
{
DataTypes
}
=
app
.
Sequelize
;
const
sbStatus
=
app
.
nodemodel
.
define
(
'sbStatus'
,
{
orderId
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
false
,
primaryKey
:
true
,
field
:
'orderId'
,
},
taskId
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
false
,
defaultValue
:
''
,
field
:
'taskId'
,
},
userId
:
{
type
:
DataTypes
.
STRING
(
500
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'userId'
,
},
cityId
:
{
type
:
DataTypes
.
STRING
(
10
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'cityId'
,
},
appkey
:
{
type
:
DataTypes
.
STRING
(
50
),
allowNull
:
false
,
field
:
'appkey'
,
},
callbackUrl
:
{
type
:
DataTypes
.
STRING
(
500
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'callbackUrl'
,
},
status
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'status'
,
},
note
:
{
type
:
DataTypes
.
STRING
(
8000
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'note'
,
get
()
{
const
note
=
this
.
getDataValue
(
'note'
);
if
(
note
)
{
try
{
return
JSON
.
parse
(
note
);
}
catch
(
error
)
{
return
{};
}
}
return
{};
},
set
(
val
)
{
this
.
setDataValue
(
'note'
,
JSON
.
stringify
(
val
));
},
},
created_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
false
,
defaultValue
:
app
.
Sequelize
.
literal
(
'CURRENT_TIMESTAMP'
),
field
:
'createDate'
,
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
false
,
defaultValue
:
app
.
Sequelize
.
literal
(
'CURRENT_TIMESTAMP'
),
field
:
'updateDate'
,
},
text2
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'text2'
,
},
text3
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'text3'
,
},
text4
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'text4'
,
},
text5
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
defaultValue
:
''
,
field
:
'text5'
,
},
},
{
tableName
:
'sbh5_status'
,
});
return
sbStatus
;
};
app/service/order.js
View file @
a682ce4b
...
...
@@ -46,8 +46,37 @@ class OrderService extends Service {
}
else
{
await
order
[
0
].
update
(
params
);
}
await
ctx
.
nodemodel
.
SbStatus
.
findOrCreate
({
where
:
{
orderId
:
params
.
orderId
,
},
defaults
:
{
appkey
:
appKey
,
orderId
:
params
.
orderId
,
callbackUrl
:
notifyUrl
,
taskId
:
params
.
taskId
,
cityId
:
params
.
cityId
,
userId
,
status
:
'init'
,
},
})
.
spread
(
async
(
info
,
created
)
=>
{
if
(
created
===
false
)
{
await
info
.
update
({
taskId
,
cityId
:
params
.
cityId
,
status
:
'init'
});
}
});
return
order
[
0
];
}
async
oldsbStatus
(
params
)
{
const
{
ctx
}
=
this
;
await
ctx
.
nodemodel
.
SbStatus
.
update
({
status
:
params
.
status
},
{
where
:
{
orderId
:
params
.
orderId
,
},
limit
:
1
,
});
}
}
module
.
exports
=
OrderService
;
app/service/storage.js
View file @
a682ce4b
...
...
@@ -58,7 +58,12 @@ class StorageService extends Service {
await
ctx
.
model
.
Cusdata
.
create
({
appKey
,
orderId
,
type
:
'shebao'
,
type
:
'sbH5'
,
});
await
ctx
.
nodemodel
.
Cusdata
.
create
({
appkey
:
appKey
,
orderSn
:
orderId
,
type
:
'sbH5'
,
});
return
result
.
data
.
data
[
readDataKey
];
}
...
...
config/config.local.js
View file @
a682ce4b
...
...
@@ -87,33 +87,33 @@ module.exports = () => {
datasources
:
[{
// 东八时区
timezone
:
'+08:00'
,
delegate
:
'model'
,
baseDir
:
'model'
,
delegate
:
'
node
model'
,
baseDir
:
'model
/nodegjj
'
,
dialect
:
'mysql'
,
host
:
'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com'
,
database
:
'
data_service_dev
'
,
database
:
'
nodetest
'
,
username
:
'hexin'
,
password
:
'gYUHszn9#q'
,
port
:
3306
,
},
{
// 东八时区
timezone
:
'+08:00'
,
delegate
:
'
javaSb
'
,
delegate
:
'
model
'
,
baseDir
:
'model'
,
dialect
:
'mysql'
,
host
:
'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com'
,
database
:
'
java_sb
'
,
database
:
'
data_service_dev
'
,
username
:
'hexin'
,
password
:
'gYUHszn9#q'
,
port
:
3306
,
},
{
// 东八时区
timezone
:
'+08:00'
,
delegate
:
'
nodeGjj
'
,
delegate
:
'
javaSb
'
,
baseDir
:
'model'
,
dialect
:
'mysql'
,
host
:
'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com'
,
database
:
'
nodetest
'
,
database
:
'
java_sb
'
,
username
:
'hexin'
,
password
:
'gYUHszn9#q'
,
port
:
3306
,
...
...
config/config.prod.js
View file @
a682ce4b
...
...
@@ -78,6 +78,17 @@ module.exports = () => {
datasources
:
[{
// 东八时区
timezone
:
'+08:00'
,
delegate
:
'nodemodel'
,
baseDir
:
'model/nodegjj'
,
dialect
:
'mysql'
,
host
:
process
.
env
.
MYSQL_PACHONG_HOST
,
database
:
process
.
env
.
MYSQL_NODE_DB_NAME
||
'node_gjj'
,
username
:
process
.
env
.
MYSQL_USER
,
password
:
process
.
env
.
MYSQL_PWD
,
port
:
process
.
env
.
MYSQL_PORT
,
},
{
// 东八时区
timezone
:
'+08:00'
,
delegate
:
'model'
,
baseDir
:
'model'
,
dialect
:
'mysql'
,
...
...
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