记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
d943283a
Commit
d943283a
authored
Aug 18, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽奖修改数据库
parent
2d35288a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
12 deletions
+18
-12
db_sweetsugar_structure.sql
.../liquidnet-service-sweet/docu/db_sweetsugar_structure.sql
+1
-0
SweetAppletController.java
...idnet/service/sweet/controller/SweetAppletController.java
+12
-7
RedisDataUtils.java
...ava/com/liquidnet/service/sweet/utils/RedisDataUtils.java
+4
-4
sqlmap.properties
...uidnet-service-sweet/src/main/resources/sqlmap.properties
+1
-1
No files found.
liquidnet-bus-service/liquidnet-service-sweet/docu/db_sweetsugar_structure.sql
View file @
d943283a
...
...
@@ -398,6 +398,7 @@ CREATE TABLE `sweet_luck_draw`
(
`mid`
bigint
unsigned
NOT
NULL
AUTO_INCREMENT
,
`mobile`
varchar
(
200
)
NOT
NULL
DEFAULT
''
COMMENT
'用户手机号'
,
`union_id`
varchar
(
200
)
NOT
NULL
DEFAULT
''
COMMENT
'unionId'
,
`luck_draw_num`
varchar
(
200
)
NOT
NULL
DEFAULT
''
COMMENT
'抽奖编号'
,
`status`
tinyint
NOT
NULL
DEFAULT
1
COMMENT
'1有资格 0无资格'
,
`prize`
tinyint
NOT
NULL
DEFAULT
-
1
COMMENT
'第几个奖 prize <= prize_all 则中奖 prize!=0'
,
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetAppletController.java
View file @
d943283a
...
...
@@ -325,29 +325,34 @@ public class SweetAppletController {
@GetMapping
(
"luckDraw/status"
)
@ApiOperation
(
"抽奖状态"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"
uid"
,
value
=
"用户id
"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"
mobile"
,
value
=
"用户手机号
"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"luckDrawNum"
,
value
=
"抽奖编号"
,
required
=
true
),
})
public
ResponseDto
<
Integer
>
luckDrawStatus
(
@RequestParam
String
uid
,
@RequestParam
String
luckDrawNum
)
{
if
(
uid
.
equalsIgnoreCase
(
"0"
))
{
public
ResponseDto
<
HashMap
<
String
,
Integer
>>
luckDrawStatus
(
@RequestParam
String
mobile
,
@RequestParam
String
luckDrawNum
)
{
if
(
mobile
==
null
||
mobile
.
isEmpty
(
))
{
return
ResponseDto
.
failure
();
}
return
ResponseDto
.
success
(
redisDataUtils
.
getLuckDrawStatus
(
uid
,
luckDrawNum
));
HashMap
<
String
,
Integer
>
hashMap
=
CollectionUtil
.
mapStringInteger
();
hashMap
.
put
(
"count"
,
redisDataUtils
.
getLuckDrawStatus
(
mobile
,
luckDrawNum
));
return
ResponseDto
.
success
(
hashMap
);
}
@PostMapping
(
"luckDraw"
)
@ApiOperation
(
"抽奖"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"mobile"
,
value
=
"用户手机号"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"unionId"
,
value
=
"unionId"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"luckDrawNum"
,
value
=
"抽奖编号"
,
required
=
true
),
})
public
ResponseDto
<
SweetPrizeVo
>
luckDraw
(
@RequestParam
String
mobile
,
@RequestParam
String
luckDrawNum
)
{
@RequestParam
String
unionId
,
@RequestParam
String
luckDrawNum
)
{
if
(
mobile
==
null
||
mobile
.
isEmpty
())
{
return
ResponseDto
.
failure
();
}
SweetPrizeVo
vo
=
redisDataUtils
.
changeLuckDrawStatus
(
mobile
,
luckDrawNum
);
SweetPrizeVo
vo
=
redisDataUtils
.
changeLuckDrawStatus
(
mobile
,
unionId
,
luckDrawNum
);
return
ResponseDto
.
success
(
vo
);
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/RedisDataUtils.java
View file @
d943283a
...
...
@@ -391,13 +391,13 @@ public class RedisDataUtils {
}
//获取抽奖状态
public
int
getLuckDrawStatus
(
String
uid
,
String
luckDrawNum
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW
.
concat
(
uid
).
concat
(
":luckDrawNum:"
+
luckDrawNum
);
public
int
getLuckDrawStatus
(
String
mobile
,
String
luckDrawNum
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW
.
concat
(
mobile
).
concat
(
":luckDrawNum:"
+
luckDrawNum
);
return
(
int
)
redisUtil
.
get
(
redisKey
);
}
//修改抽奖状态
public
SweetPrizeVo
changeLuckDrawStatus
(
String
mobile
,
String
luckDrawNum
)
{
public
SweetPrizeVo
changeLuckDrawStatus
(
String
mobile
,
String
unionId
,
String
luckDrawNum
)
{
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
@@ -442,7 +442,7 @@ public class RedisDataUtils {
sqls
.
add
(
SqlMapping
.
get
(
"sweet_luck_draw.insert"
));
sqlsDataA
.
add
(
new
Object
[]{
mobile
,
luckDrawNum
,
surplus
,
prize
,
now
mobile
,
unionId
,
luckDrawNum
,
surplus
,
prize
,
now
});
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
LUCK_DRAW
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/resources/sqlmap.properties
View file @
d943283a
...
...
@@ -58,7 +58,7 @@ sweet_user_relation_mdsk.insert=INSERT INTO sweet_user_relation_mdsk (user_id,ty
sweet_user_relation_mdsk.delete
=
DELETE FROM sweet_user_relation_mdsk WHERE user_id = ? and target_id = ? and manual_id = ? and type = ?
# ------------------------抽奖----------------------------
sweet_luck_draw.insert
=
INSERT INTO sweet_luck_draw (mobile,
luck_draw_num,prize,prize_all,status,created_at) VALUES (
?,?,?,?,1,?)
sweet_luck_draw.insert
=
INSERT INTO sweet_luck_draw (mobile,
union_id,luck_draw_num,prize,prize_all,status,created_at) VALUES (?,
?,?,?,?,1,?)
# --------------------------答案--------------------------
sweet_answer.insert
=
INSERT INTO sweet_answer (answer_id,phone,answer_json,img_url) VALUES (?,?,?,?)
...
...
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