CosPlayPlayerController.java
5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package com.pipi.qa.controller.common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.pipi.qa.bean.Player;
import com.pipi.qa.bean.Room;
import com.pipi.qa.bean.User;
import com.pipi.qa.service.CosPlayPlayerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* Created by dennis.dong on 2021/5/18
*/
@CrossOrigin(origins = "*", maxAge = 3600)
@Controller
@RequestMapping(value = "/play")
@Api(value = "", tags = "")
public class CosPlayPlayerController {
@Autowired
private CosPlayPlayerService cosPlayPlayerService;
private String token = null;
private String userId = null;
public Logger logger = LoggerFactory.getLogger(CosPlayPlayerController.class);
/**
* 申请陪玩师
* @param PlayerApply
* @return
*/
@ApiOperation(value = "申请陪玩师", notes = "输入手机号")
@RequestMapping(value = "/PlayerApply", method = RequestMethod.POST)
@ResponseBody
public JSONObject PlayerApply(@RequestBody Player player) {
String mobile = player.getMobile();
String env = player.getEnv();
JSONObject loginRes = cosPlayPlayerService.login(mobile, env);
token = loginRes.getJSONObject("data").getString("token");
userId = loginRes.getJSONObject("data").getString("id");
cosPlayPlayerService.SubmitAuthentication(token, userId, env);
JSONObject jsonObj = cosPlayPlayerService.saveUserInfo(token, userId, env);
logger.info("env:"+env+"mobile:"+mobile);
return jsonObj;
}
/**
*充钻石
* @param User
* @return
*/
@ApiOperation(value = "充钻石", notes = "输入手机号,充值金额")
@RequestMapping(value = "/virtualMoneyModify", method = RequestMethod.POST)
@ResponseBody
public JSONObject virtualMoneyModify(@RequestBody User user) {
String mobile = user.getMobile();
long money = user.getMoney();
String env = user.getEnv();
JSONObject jsonObj = cosPlayPlayerService.virtualMoneyModify(mobile, money, env);
return jsonObj;
}
/**
*充皮皮币
* @param User
* @return
*/
@ApiOperation(value = "充皮皮币", notes = "输入手机号,充值金额")
@RequestMapping(value = "/moneyDetailsSave", method = RequestMethod.POST)
@ResponseBody
public JSONObject moneyDetailsSave(@RequestBody User user) {
String mobile = user.getMobile();
long money = user.getMoney();
String env = user.getEnv();
JSONObject jsonObj = cosPlayPlayerService.moneyDetailsSave(mobile, money, env);
return jsonObj;
}
/**
*送礼物
* @param PlayerApply
* @return
*/
@ApiOperation(value = "送礼物", notes = "输入手机号,房间ID、用户")
@RequestMapping(value = "/roomGiftSend", method = RequestMethod.POST)
@ResponseBody
public JSONObject roomGiftSend(@RequestBody Room room) {
String mobile = room.getMobile();
String env = room.getEnv();
String userIds = room.getUserIds();
String productId = room.getProductId();
String roomNo = room.getRoomNo();
String amount = room.getAmount();
JSONObject jsonObj = cosPlayPlayerService.send(mobile, roomNo, productId, amount ,userIds, env);
return jsonObj;
}
/**
*查询礼物列表
* @param PlayerApply
* @return
*/
@ApiOperation(value = "查询礼物列表", notes = "选择环境")
@RequestMapping(value = "/giftList", method = RequestMethod.POST)
@ResponseBody
public JSONObject giftList(@RequestBody Room room) {
String env = room.getEnv();
JSONObject jsonObj = cosPlayPlayerService.giftList(env);
return jsonObj;
}
/**
*幸运夺宝箱列表
* @param PlayerApply
* @return
*/
@ApiOperation(value = "幸运夺宝箱列表", notes = "选择环境")
@RequestMapping(value = "/activityList", method = RequestMethod.POST)
@ResponseBody
public JSONObject activityList(@RequestBody Room room) {
String env = room.getEnv();
JSONObject jsonObj = cosPlayPlayerService.activityList(env);
return jsonObj;
}
/**
*开宝箱
* @param PlayerApply
* @return
*/
@ApiOperation(value = "开宝箱", notes = "输入手机号,房间ID、用户")
@RequestMapping(value = "/lotteryActivity", method = RequestMethod.POST)
@ResponseBody
public JSONObject lotteryActivity(@RequestBody Room room) {
String mobile = room.getMobile();
String env = room.getEnv();
String roomNo = room.getRoomNo();
String times = room.getTimes();
String activityId = room.getActivityId();
JSONObject jsonObj = cosPlayPlayerService.lotteryActivity(mobile, roomNo, activityId, times, env);
return jsonObj;
}
}