Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yizhi_server
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
yizhi_server
Commits
aa24657c
Commit
aa24657c
authored
Dec 18, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add type
parent
80c8e433
Pipeline
#18270
passed with stage
in 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
recharge.js
app/controller/recharge.js
+17
-4
recharge.js
app/model/yizhi/recharge.js
+13
-0
No files found.
app/controller/recharge.js
View file @
aa24657c
/*
* @Descripttion:
* @version:
* @Author: jd
* @Date: 2019-06-10 19:49:32
* @LastEditors: jd
* @LastEditTime: 2019-12-18 13:56:06
*/
'use strict'
;
'use strict'
;
const
Controller
=
require
(
'egg'
).
Controller
;
const
Controller
=
require
(
'egg'
).
Controller
;
...
@@ -24,6 +32,11 @@ class RechargeController extends Controller {
...
@@ -24,6 +32,11 @@ class RechargeController extends Controller {
required
:
true
,
required
:
true
,
type
:
'date'
,
type
:
'date'
,
},
},
type
:
{
required
:
true
,
type
:
'enum'
,
value
:
[
'包年'
,
'预充'
,
'后付'
,
'抵扣'
,
'退款'
,
'其他'
],
},
remark
:
{
remark
:
{
required
:
false
,
required
:
false
,
type
:
'string'
,
type
:
'string'
,
...
@@ -36,7 +49,7 @@ class RechargeController extends Controller {
...
@@ -36,7 +49,7 @@ class RechargeController extends Controller {
const
{
ctx
,
service
}
=
this
;
const
{
ctx
,
service
}
=
this
;
ctx
.
validate
(
this
.
indexRule
,
ctx
.
query
);
ctx
.
validate
(
this
.
indexRule
,
ctx
.
query
);
await
service
.
user
.
getUserInfo
();
await
service
.
user
.
getUserInfo
();
const
ret
=
await
service
.
userDetail
.
findAll
(
this
.
model
,
{
user_id
:
ctx
.
query
.
user_id
},
[
'id'
,
'user_id'
,
'money'
,
'receive_time'
,
'remark'
,
'operator'
],
ctx
.
pagination
);
const
ret
=
await
service
.
userDetail
.
findAll
(
this
.
model
,
{
user_id
:
ctx
.
query
.
user_id
},
[
'id'
,
'user_id'
,
'money'
,
'receive_time'
,
'remark'
,
'operator'
],
ctx
.
pagination
);
const
total
=
await
service
.
userDetail
.
count
(
this
.
model
,
{
user_id
:
ctx
.
query
.
user_id
});
const
total
=
await
service
.
userDetail
.
count
(
this
.
model
,
{
user_id
:
ctx
.
query
.
user_id
});
ctx
.
success
({
data
:
ret
,
total
,
...
ctx
.
pagination
});
ctx
.
success
({
data
:
ret
,
total
,
...
ctx
.
pagination
});
}
}
...
@@ -44,13 +57,13 @@ class RechargeController extends Controller {
...
@@ -44,13 +57,13 @@ class RechargeController extends Controller {
async
create
()
{
async
create
()
{
const
{
ctx
,
service
}
=
this
;
const
{
ctx
,
service
}
=
this
;
ctx
.
validate
(
this
.
createRule
,
ctx
.
request
.
body
);
ctx
.
validate
(
this
.
createRule
,
ctx
.
request
.
body
);
const
{
user_id
,
money
,
receive_time
,
remark
}
=
ctx
.
request
.
body
;
const
{
user_id
,
money
,
receive_time
,
remark
,
type
}
=
ctx
.
request
.
body
;
const
user
=
await
service
.
user
.
getUserInfo
();
const
user
=
await
service
.
user
.
getUserInfo
();
const
ret
=
await
service
.
userDetail
.
findOne
(
this
.
usermodel
,
{
user_id
},
[
'user_id'
]);
const
ret
=
await
service
.
userDetail
.
findOne
(
this
.
usermodel
,
{
user_id
},
[
'user_id'
]);
if
(
!
ret
)
{
if
(
!
ret
)
{
ctx
.
throw
(
400
,
'无效的user_id'
);
ctx
.
throw
(
400
,
'无效的user_id'
);
}
}
await
service
.
userDetail
.
create
(
this
.
model
,
{
user_id
,
money
,
receive_time
,
remark
,
operator
:
user
.
name
});
await
service
.
userDetail
.
create
(
this
.
model
,
{
user_id
,
money
,
receive_time
,
remark
,
operator
:
user
.
name
,
type
});
ctx
.
success
({
user_id
});
ctx
.
success
({
user_id
});
}
}
}
}
...
...
app/model/yizhi/recharge.js
View file @
aa24657c
/*
* @Descripttion:
* @version:
* @Author: jd
* @Date: 2019-06-13 20:14:12
* @LastEditors: jd
* @LastEditTime: 2019-12-18 18:54:34
*/
'use strict'
;
'use strict'
;
const
moment
=
require
(
'moment'
);
const
moment
=
require
(
'moment'
);
...
@@ -55,6 +63,11 @@ module.exports = app => {
...
@@ -55,6 +63,11 @@ module.exports = app => {
},
},
field
:
'receive_time'
,
field
:
'receive_time'
,
},
},
type
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
field
:
'type'
,
},
},
{
},
{
tableName
:
'recharge_detail'
,
tableName
:
'recharge_detail'
,
timestamps
:
false
,
timestamps
:
false
,
...
...
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