Commit e7834fe4 authored by 赵然's avatar 赵然

'zr'

parent ed887bac
package main.com.atguigu.springmvc.handlers;
import io.restassured.response.Response;
import main.com.atguigu.springmvc.common.MatcherString;
import main.com.atguigu.springmvc.common.MysqlUtils;
import main.com.atguigu.springmvc.service.Authorization;
import main.com.atguigu.springmvc.service.NewActivityService;
import io.restassured.response.Response;
import main.com.atguigu.springmvc.service.SqlService;
import main.com.atguigu.springmvc.service.ViewService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,8 +18,6 @@ import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
//@RequestMapping("/Sign")
@Controller
......@@ -330,69 +328,4 @@ public class CollectModule {
return map;
}
/**
* 功能:星宿台设置卡片数量操作
* @return
*/
@RequestMapping(value = "/setQuantity", method= RequestMethod.POST)
@ResponseBody
public Map setQuantity(HttpServletRequest request) throws Exception {
java.net.URLDecoder urlDecoder=new java.net.URLDecoder();
String userId = urlDecoder.decode(request.getParameter("userId"),"utf-8");
String projectId = request.getParameter("projectId");
String spId = request.getParameter("spId");
String quantity = request.getParameter("quantity");
System.out.println("用户id:" + userId);
System.out.println("项目id:" + projectId);
System.out.println("道具id:" + spId);
//userid转consumerid
Map<String,String> login_map = authorization.dafuwengLogin(Integer.parseInt(userId));
System.out.println("用户login_map为:" + login_map.toString());
String consumer_base64 = String.valueOf(login_map.get("_ac"));
System.out.println("用户consumer_base64为:" + consumer_base64);
String decodedText = new String(decoder.decode(consumer_base64));
System.out.println("助力者consumer_base64转码后为:" + decodedText);
String consumerId = MatcherString.getString(decodedText, "cid\":(.*?)}", 1);
System.out.println("用户consumer_id为:" + consumerId);
Map<String, String> map = new HashMap<>();
String sql = "SELECT * FROM projectx.tb_user_sp where user_id = '"+consumerId+"' and project_id = '"+projectId+"' and sp_id = '"+spId+"' ";
Response response = sqlService.findSimpleResult(sql);
System.out.println("查询结果为:" + response.asString());
if (response.asString().equals("{}")) {
try {
String sqlAdd = "INSERT INTO projectx.tb_user_sp (project_id, user_id, sp_id, quantity, gmt_create, gmt_modified) values ('"+projectId+"', '"+consumerId+"', '"+spId+"', "+quantity+", '2019-09-25 15:58:11', '2019-09-27 14:23:57')";
System.out.println("sql为:" + sqlAdd);
sqlService.update(sqlAdd);
System.out.println("如果道具原本为空,重置成功!");
map.put("success", "true");
map.put("message", "道具数设置成功,用户"+userId+"的"+spId+"数量为:"+quantity);
} catch (Exception e) {
map.put("success", "false");
map.put("message", "道具数设置失败!");
}
}else {
try {
sqlService.update("update projectx.tb_user_sp set quantity = '"+quantity+"' where user_id = '"+consumerId+"' and project_id = '"+projectId+"' and sp_id = '"+spId+"'");
System.out.println("如果道具原本有值,重置成功!");
map.put("success", "true");
map.put("message", "道具数设置成功,用户"+userId+"的"+spId+"数量为:"+quantity);
} catch (Exception e) {
map.put("success", "false");
map.put("message", "道具数设置失败!");
}
}
return map;
}
}
......@@ -69,6 +69,8 @@ public class CreatUrlModule {
Map<String, String> params=new HashMap<String, String>();
params.put("uid",userId);
params.put("credits",credits);
params.put("timestamp",String.valueOf(System.currentTimeMillis() + 240 * 60 * 1000));
if(dcustom!=null&&dcustom!=""&&dcustom != "null") {
if(type == null || type.equals("1")) {
params.put("dcustom", dcustom);
......
package main.com.atguigu.springmvc.handlers;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.restassured.response.Response;
import main.com.atguigu.springmvc.common.MatcherString;
import main.com.atguigu.springmvc.service.Authorization;
import main.com.atguigu.springmvc.service.NewActivityService;
import main.com.atguigu.springmvc.service.SqlService;
import main.com.atguigu.springmvc.service.ViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Controller
public class NewCollectModule {
@Autowired
NewActivityService newActivityService;
@Autowired
Authorization authorization;
@Autowired
SqlService sqlService;
@Autowired
ViewService viewService;
final Base64.Decoder decoder = Base64.getDecoder();
private String consumer_base64 = null ;
/**
* 功能:星宿台设置卡片数量操作
* @return
*/
@RequestMapping(value = "/setQuantity", method= RequestMethod.POST)
@ResponseBody
public Map setQuantity(HttpServletRequest request) throws Exception {
java.net.URLDecoder urlDecoder=new java.net.URLDecoder();
String userId = urlDecoder.decode(request.getParameter("userId"),"utf-8");
String projectId = request.getParameter("projectId");
String quantity = request.getParameter("quantity");
String spId = request.getParameter("spId");
String[] spIds = spId.split(",");
System.out.println("用户id:" + userId);
System.out.println("项目id:" + projectId);
System.out.println("道具id:" + spId);
//userid转consumerid
Map<String,String> login_map = authorization.dafuwengLogin(Integer.parseInt(userId));
System.out.println("用户login_map为:" + login_map.toString());
String consumer_base64 = String.valueOf(login_map.get("_ac"));
System.out.println("用户consumer_base64为:" + consumer_base64);
String decodedText = new String(decoder.decode(consumer_base64));
System.out.println("助力者consumer_base64转码后为:" + decodedText);
String consumerId = MatcherString.getString(decodedText, "cid\":(.*?)}", 1);
System.out.println("用户consumer_id为:" + consumerId);
Map<String, String> map = new HashMap<>();
//开始修改卡片数值
for (int n = 0; n < spIds.length; n++) {
String sql = "SELECT * FROM projectx.tb_user_sp where user_id = '" + consumerId + "' and project_id = '" + projectId + "' and sp_id = '" + spIds[n] + "' ";
Response response = sqlService.findSimpleResult(sql);
System.out.println("查询结果为:" + response.asString());
if (response.asString().equals("{}")) {
String sqlAdd = "INSERT INTO projectx.tb_user_sp (project_id, user_id, sp_id, quantity) values ('" + projectId + "', '" + consumerId + "', '" + spIds[n] + "', " + quantity + ")";
System.out.println("sql为:" + sqlAdd);
sqlService.update(sqlAdd);
System.out.println("卡片数修改成功!");
} else {
sqlService.update("update projectx.tb_user_sp set quantity = '" + quantity + "' where user_id = '" + consumerId + "' and project_id = '" + projectId + "' and sp_id = '" + spIds[n] + "'");
System.out.println("如果卡片原本有值,重置成功!");
}
}
map.put("success", "true");
map.put("message", "道具数设置成功,用户" + userId + "的" + spId + "数量为:" + quantity);
return map;
}
/**
* 功能:批量助力操作
* @return
*/
@RequestMapping(value = "/assist", method= RequestMethod.POST)
@ResponseBody
public JSONObject assist(HttpServletRequest request) throws Exception {
String projectId = request.getParameter("projectId");
String sharer_id = request.getParameter("sharerId");
String helper_id = request.getParameter("helperId");
System.out.println("项目id:" + projectId);
System.out.println("分享者uid为:" + sharer_id);
System.out.println("助力者uid为:" + helper_id);
//Map<String, String> map = new HashMap<>();
//获取分享者的分享码
Response response = newActivityService.getShareCodeNew( Integer.parseInt(sharer_id),projectId);
String shareCode = String.valueOf(response.jsonPath().getString("data.raw.shareCode"));
//map.put("shareCode", shareCode);
JSONObject out = new JSONObject();
out.put("shareCode", "分享者"+sharer_id+"的分享码为:"+shareCode);
//解析助力者
String[] helpers = helper_id.split(",");
List list = new ArrayList();
//助力者依次助力
for (int i = 0; i < helpers.length; i++) {
Map map = new HashMap();
Response response2 = newActivityService.assist( Integer.parseInt(helpers[i]),shareCode,projectId);
String assistMessage = String.valueOf(response2.jsonPath().getString("data.errorMessage"));
String assistErrorCode = String.valueOf(response2.jsonPath().getString("data.errorCode"));
if(assistErrorCode.equals("0")){
String message = helpers[i]+"为"+sharer_id+"助力成功!";
map.put("message", message);
}else{
String message = helpers[i]+"为"+sharer_id+"助力失败!";
map.put("message", message);
}
map.put("assistMessage", assistMessage);
map.put("assistErrorCode", assistErrorCode);
list.add(map);
}
out.put("assistResult",list);
return out;
}
/**
* 功能:分享者角度——查哪些人为我助力成功
* @return
*/
@RequestMapping(value = "/helperlist", method= RequestMethod.POST)
@ResponseBody
public JSONObject helperlist(HttpServletRequest request) throws Exception {
String projectId = request.getParameter("projectId");
String share_id = request.getParameter("sharerId");
//userid转consumerid
Map<String,String> login_map = authorization.dafuwengLogin(Integer.parseInt(share_id));
System.out.println("用户login_map为:" + login_map.toString());
String consumer_base64 = String.valueOf(login_map.get("_ac"));
System.out.println("用户consumer_base64为:" + consumer_base64);
String decodedText = new String(decoder.decode(consumer_base64));
System.out.println("助力者consumer_base64转码后为:" + decodedText);
String consumerId = MatcherString.getString(decodedText, "cid\":(.*?)}", 1);
System.out.println("用户consumer_id为:" + consumerId);
JSONObject out = new JSONObject();
//助力记录表
String sql ="SELECT ext2,gmt_create FROM projectx.tb_querytable WHERE project_id = '"+projectId+"' and group_id = 'asssitRecordGroup' and ext1 = "+consumerId+" ORDER BY id DESC";
Response response = sqlService.findModeResult(sql);
System.out.println(response.asString());
if (response.asString().equals("[]")) {
out.put("success", "false");
out.put("message", "任何人均未帮此用户助力过!");
}else{
JSONArray ar = JSONArray.parseArray(response.asString());
List list = new ArrayList();
for (int i =0;i<ar.size();i++) {
Map map = new HashMap();
String helper = ar.getJSONObject(i).getString("ext2");
int num = (int)Math.floor(Long.parseLong(helper) / 10000000L);
System.out.println("用户consumer_id取整为:" + num);
String tag = String.format("%04d", num);
System.out.println("用户consumer_id的分表tag为:" + tag);
Response sqlresul = sqlService.findSimpleResult("select partner_user_id from new_consumer.consumer_"+tag+" where id = "+helper);
String partnerId = String.valueOf(sqlresul.jsonPath().getString("partner_user_id"));
map.put("helper", partnerId);
map.put("helpTime", ar.getJSONObject(i).getString("gmt_create"));
list.add(map);
}
out.put("success", "true");
out.put("message", list);
}
return out;
}
/**
* 功能:助力者角度——查我为哪些人助力成功
* @return
*/
@RequestMapping(value = "/sharerlist", method= RequestMethod.POST)
@ResponseBody
public JSONObject sharerlist(HttpServletRequest request) throws Exception {
String projectId = request.getParameter("projectId");
String helper_id = request.getParameter("helperId");
//userid转consumerid
Map<String,String> login_map = authorization.dafuwengLogin(Integer.parseInt(helper_id));
System.out.println("用户login_map为:" + login_map.toString());
String consumer_base64 = String.valueOf(login_map.get("_ac"));
System.out.println("用户consumer_base64为:" + consumer_base64);
String decodedText = new String(decoder.decode(consumer_base64));
System.out.println("助力者consumer_base64转码后为:" + decodedText);
String consumerId = MatcherString.getString(decodedText, "cid\":(.*?)}", 1);
System.out.println("用户consumer_id为:" + consumerId);
JSONObject out = new JSONObject();
//助力记录表
String sql ="SELECT ext1,gmt_create FROM projectx.tb_querytable WHERE project_id = '"+projectId+"' and group_id = 'asssitRecordGroup' and ext2 = "+consumerId+" ORDER BY id DESC";
Response response = sqlService.findModeResult(sql);
System.out.println(response.asString());
if (response.asString().equals("[]")) {
out.put("success", "false");
out.put("message", "对应用户未帮任何人助力!");
}else{
JSONArray ar = JSONArray.parseArray(response.asString());
List list = new ArrayList();
for (int i =0;i<ar.size();i++) {
Map map = new HashMap();
String sharerId = ar.getJSONObject(i).getString("ext1");
int num = (int)Math.floor(Long.parseLong(sharerId) / 10000000L);
System.out.println("用户consumer_id取整为:" + num);
String tag = String.format("%04d", num);
System.out.println("用户consumer_id的分表tag为:" + tag);
Response sqlresul2 = sqlService.findSimpleResult("select partner_user_id from new_consumer.consumer_"+tag+" where id = "+sharerId);
String partnerId = String.valueOf(sqlresul2.jsonPath().getString("partner_user_id"));
map.put("sharer", partnerId);
map.put("helpTime", ar.getJSONObject(i).getString("gmt_create"));
list.add(map);
}
out.put("success", "true");
out.put("message", list);
}
return out;
}
/**
* 功能:索卡操作
* @return
*/
@RequestMapping(value = "/requestCard", method= RequestMethod.POST)
@ResponseBody
public JSONObject requestCard(HttpServletRequest request) throws Exception {
String projectId = request.getParameter("projectId");
String asker_id = request.getParameter("askerId");
String giver_id = request.getParameter("giverId");
String cardId = request.getParameter("cardId");
String cardIdtag = String.valueOf(Integer.valueOf(cardId)-1);
System.out.println("项目id:" + projectId);
System.out.println("索要者uid为:" + asker_id);
System.out.println("赠送者uid为:" + giver_id);
//获取卡片对应的道具id
Response cardsInfo = newActivityService.getCards( Integer.parseInt(asker_id),projectId);
String sp_id = String.valueOf(cardsInfo.jsonPath().getString("data.raw.cards["+cardIdtag+"].id"));
System.out.println("道具id为:"+sp_id);
//获取对应卡片的索要码
Response response = newActivityService.askCode( Integer.parseInt(asker_id),projectId,sp_id);
String shareCode = String.valueOf(response.jsonPath().getString("data.raw.shareCode"));
JSONObject out = new JSONObject();
if(shareCode.equals("null")){
out.put("message", "索要者"+asker_id+"已经有了第"+cardId+"张卡,无法索要");
out.put("success", "false");
}else {
out.put("shareCode", "索要者" + asker_id + "第" + cardId + "张卡的索要码为:" + shareCode);
//索要者赠卡操作
Response response2 = newActivityService.grantCard(Integer.parseInt(giver_id), shareCode, projectId);
String grantCardMessage = String.valueOf(response2.jsonPath().getString("data.errorMessage"));
String grantCardErrorCode = String.valueOf(response2.jsonPath().getString("data.errorCode"));
if (grantCardErrorCode.equals("0")) {
String message = asker_id + "对" + giver_id + "索要第" + cardId + "张卡成功!";
out.put("message", message);
} else {
String message = asker_id + "对" + giver_id + "索要第" + cardId + "张卡失败!";
out.put("message", message);
}
out.put("grantCardMessage", grantCardMessage);
out.put("grantCardErrorCode", grantCardErrorCode);
out.put("success", "true");
}
return out;
}
/**
* 功能:赠卡操作
* @return
*/
@RequestMapping(value = "/giveCard", method= RequestMethod.POST)
@ResponseBody
public JSONObject giveCard(HttpServletRequest request) throws Exception {
String projectId = request.getParameter("projectId");
String giver_id = request.getParameter("giverId");
String geter_id = request.getParameter("geterId");
String cardId = request.getParameter("cardId");
String cardIdtag = String.valueOf(Integer.valueOf(cardId)-1);
System.out.println("项目id:" + projectId);
System.out.println("赠送者uid为:" + giver_id);
System.out.println("接受者uid为:" + geter_id);
//获取卡片对应的道具id
Response cardsInfo = newActivityService.getCards( Integer.parseInt(giver_id),projectId);
String sp_id = String.valueOf(cardsInfo.jsonPath().getString("data.raw.cards["+cardIdtag+"].id"));
System.out.println("道具id为:"+sp_id);
//获取对应卡片的赠送码
Response response = newActivityService.giveCard( Integer.parseInt(giver_id),projectId,sp_id);
String shareCode = String.valueOf(response.jsonPath().getString("data.raw.shareCode"));
JSONObject out = new JSONObject();
if(shareCode.equals("null")){
out.put("message", "赠送者"+giver_id+"没有第"+cardId+"张卡,无法赠送");
out.put("success", "false");
}else {
out.put("shareCode", "赠送者" + giver_id + "第" + cardId + "张卡的赠送码为:" + shareCode);
//接受者收卡操作
Response response2 = newActivityService.acceptCard(Integer.parseInt(geter_id), shareCode, projectId);
String acceptCardMessage = String.valueOf(response2.jsonPath().getString("data.errorMessage"));
String acceptCardErrorCode = String.valueOf(response2.jsonPath().getString("data.errorCode"));
if (acceptCardErrorCode.equals("0")) {
String message = geter_id + "收到" + giver_id + "赠送的第" + cardId + "张卡成功!";
out.put("message", message);
} else {
String message = geter_id + "收到" + giver_id + "赠送的第" + cardId + "张卡失败!";
out.put("message", message);
}
out.put("acceptCardMessage", acceptCardMessage);
out.put("acceptCardErrorCode", acceptCardErrorCode);
out.put("success", "true");
}
return out;
}
}
package main.com.atguigu.springmvc.handlers;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.restassured.response.Response;
import main.com.atguigu.springmvc.common.MatcherString;
import main.com.atguigu.springmvc.common.MysqlUtils;
import main.com.atguigu.springmvc.service.Authorization;
import main.com.atguigu.springmvc.service.NewActivityService;
import main.com.atguigu.springmvc.service.SqlService;
......@@ -14,7 +12,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
......@@ -211,6 +208,11 @@ public class NewSignModule {
for(int i =0;i<ar.size();i++){
SignInfo = SignInfo + ar.getJSONObject(i).getString("gmt_create") + " 签到成功\n";
}
String actionId = ar.getJSONObject(0).getString("action_id");
String playwayType = ar.getJSONObject(0).getString("playway_type");
SignInfo = SignInfo +"\n\n项目actionId为"+actionId+"\n项目playwayType为"+playwayType;
map.put("success", "true");
map.put("message", SignInfo);
......@@ -232,18 +234,20 @@ public class NewSignModule {
String projectId = request.getParameter("projectId");
String playwayId = request.getParameter("playwayId");
String actionId = request.getParameter("actionId");
String playwayType = request.getParameter("playwayType");
String continue_day = request.getParameter("days");
String discon = request.getParameter("discon");
System.out.println("用户id:" + userId);
System.out.println("项目id:" + projectId);
System.out.println("玩法id:" + playwayId);
System.out.println("连续签到天数为:" + continue_day);
System.out.println("是否断签:" + discon);
String[] temp = playwayId.split("_");
System.out.println("分割前数据为:" + temp[0] + "分割后数据为:" + temp[1]);
//String[] temp = playwayId.split("_");
//System.out.println("分割前数据为:" + temp[0] + "分割后数据为:" + temp[1]);
//userid转consumerid
Map<String,String> login_map = authorization.dafuwengLogin(Integer.parseInt(userId));
......@@ -262,7 +266,7 @@ public class NewSignModule {
while (i > 1) {
String sign_date = this.getTime(i * (-1));
Thread.sleep(500);
String sql2 = "INSERT INTO projectx.tb_action_record (project_id, playway_id, action_id, user_id, playway_type, extra, gmt_create, gmt_modified) values ( '" + projectId + "', '" + playwayId + "', '" + temp[0] + "', '" + consumerId + "', " + temp[1] + ", null, '" + sign_date + "', '2019-10-10 16:20:57')";
String sql2 = "INSERT INTO projectx.tb_action_record (project_id, playway_id, action_id, user_id, playway_type, extra, gmt_create, gmt_modified) values ( '" + projectId + "', '" + playwayId + "', '" + actionId + "', '" + consumerId + "', " + playwayType + ", null, '" + sign_date + "', '2019-10-10 16:20:57')";
sqlService.update(sql2);
i--;
}
......@@ -270,7 +274,7 @@ public class NewSignModule {
while (i > 0) {
String sign_date = this.getTime(i * (-1));
Thread.sleep(500);
String sql2 = "INSERT INTO projectx.tb_action_record (project_id, playway_id, action_id, user_id, playway_type, extra, gmt_create, gmt_modified) values ( '" + projectId + "', '" + playwayId + "', '" + temp[0] + "', '" + consumerId + "', " + temp[1] + ", null, '" + sign_date + "', '2019-10-10 16:20:57')";
String sql2 = "INSERT INTO projectx.tb_action_record (project_id, playway_id, action_id, user_id, playway_type, extra, gmt_create, gmt_modified) values ( '" + projectId + "', '" + playwayId + "', '" + actionId + "', '" + consumerId + "', " + playwayType + ", null, '" + sign_date + "', '2019-10-10 16:20:57')";
sqlService.update(sql2);
i--;
}
......
......@@ -150,7 +150,7 @@ public class RankModule {
String uids = request.getParameter("uids");
String[] uidParams = uids.split(",");
String[] consumerIds = new String[20];
String[] consumerIds = new String[uidParams.length];
for (int i = 0; i < uidParams.length; i++) {
//将userid转consumerid
Map<String, String> login_map = authorization.dafuwengLogin(Integer.parseInt(uidParams[i]));
......@@ -307,15 +307,35 @@ public class RankModule {
Response response2 = sqlService.findModeResult(sql);
JSONArray ar = JSONArray.parseArray(response2.asString());
/*for (int i =0;i<ar.size();i++) {
resultMap.put("ranking_type", ar.getJSONObject(i).getString("ranking_type"));
resultMap.put("start_time", ar.getJSONObject(i).getString("start_time"));
resultMap.put("end_time", ar.getJSONObject(i).getString("end_time"));
resultMap.put("op_status", ar.getJSONObject(i).getString("op_status"));
}*/
List list = new ArrayList();
for (int i =0;i<ar.size();i++) {
Map map = new HashMap();
map.put("ranking_type", ar.getJSONObject(i).getString("ranking_type"));
map.put("start_time", ar.getJSONObject(i).getString("start_time"));
map.put("end_time", ar.getJSONObject(i).getString("end_time"));
String op_status = ar.getJSONObject(i).getString("op_status");
if(op_status.equals("0")){
String op_status_cn = "无需开奖";
map.put("op_status", op_status_cn);
}if(op_status.equals("1")){
String op_status_cn = "未开奖";
map.put("op_status", op_status_cn);
}if(op_status.equals("2")){
String op_status_cn = "开奖中";
map.put("op_status", op_status_cn);
}if(op_status.equals("3")){
String op_status_cn = "开奖异常";
map.put("op_status", op_status_cn);
}if(op_status.equals("4")){
String op_status_cn = "已开奖";
map.put("op_status", op_status_cn);
}
list.add(map);
}
resultMap.put("success", "true");
resultMap.put("message", ar);
resultMap.put("message", list);
}
return resultMap;
}
......
......@@ -16,7 +16,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.testng.Assert;
import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
......@@ -44,9 +43,9 @@ public class UserModule {
* 功能:partnerId查询用户基本信息
* @return
*/
@RequestMapping(value = "/searchInfo", method= RequestMethod.POST)
@RequestMapping(value = "/searchInfo3", method= RequestMethod.POST)
@ResponseBody
public Map searchInfo(HttpServletRequest request) throws Exception {
public Map searchInfo3(HttpServletRequest request) throws Exception {
viewService.count();
......@@ -69,12 +68,13 @@ public class UserModule {
String appId = MatcherString.getString(decodedText, "aid\":(.*?),", 1);
System.out.println("开发者id为:" + appId);
String tag = String.format("%04d", Long.parseLong(consumer_id) % 1024);
System.out.println("用户consumer_id的取余为:" + tag);
Response sqlresul = sqlService.findSimpleResult("select * from consumer_extra.consumer_extra where consumer_id = "+consumer_id);
String nickname = String.valueOf(sqlresul.jsonPath().getString("nickname"));
String result = "开发者id为:" + appId + "\nconsumer_id为:" + consumer_id + "\nconsumer_id取模结果为:" + tag;
map.put("appId", appId);
map.put("consumerId", consumer_id);
map.put("nickname", nickname);
map.put("message", result);
return map;
}
......@@ -114,6 +114,45 @@ public class UserModule {
return map;
}
/**
* 功能:partnerId查询用户基本信息
* @return
*/
@RequestMapping(value = "/searchInfo", method= RequestMethod.POST)
@ResponseBody
public Map searchInfo(HttpServletRequest request) throws Exception {
viewService.count();
String partnerId = request.getParameter("userId");
System.out.println("用户partnerId为:" + partnerId);
Map<String, String> map = new HashMap<>();
Map<String,String> login_map = authorization.dafuwengLogin(Integer.parseInt(partnerId));
System.out.println("用户login_map为:" + login_map.toString());
String consumer_base64 = String.valueOf(login_map.get("_ac"));
System.out.println("用户consumer_base64为:" + consumer_base64);
String decodedText = new String(decoder.decode(consumer_base64));
System.out.println("助力者consumer_base64转码后为:" + decodedText);
String consumer_id = MatcherString.getString(decodedText, "cid\":(.*?)}", 1);
System.out.println("用户consumer_id为:" + consumer_id);
String appId = MatcherString.getString(decodedText, "aid\":(.*?),", 1);
System.out.println("开发者id为:" + appId);
String tag = String.format("%04d", Long.parseLong(consumer_id) % 1024);
System.out.println("用户consumer_id的取余为:" + tag);
String result = "开发者id为:" + appId + "\nconsumer_id为:" + consumer_id + "\nconsumer_id取模结果为:" + tag;
map.put("message", result);
return map;
}
/**
* 功能:查询所有用户基本信息
* @return
......
......@@ -74,7 +74,125 @@ public class NewActivityService {
return response;
}
//助力抽奖
//星速台获取用户卡片详情
public Response getCards(int uid,String projectId) throws Exception{
Response response = given().cookies(authorization.dafuwengLogin(uid)).get(url+"/projectx/"+projectId+"/clcard/getCards.do");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/clcard/getCards.do接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/clcard/getCards.do接口失败,返回信息:"+response.asString());
}
return response;
}
//星速台获取助力分享码
public Response getShareCodeNew(int uid,String projectId) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("realShare","1");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url+"/projectx/"+projectId+"/clcard/share.do");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/clcard/share.do接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/clcard/share.do接口失败,返回信息:"+response.asString());
}
return response;
}
//星速台获取索卡分享码
public Response askCode(int uid,String projectId,String cardId) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("cardId",cardId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url+"/projectx/"+projectId+"/clcard/requestCard.do");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/clcard/requestCard.do接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/clcard/requestCard.do接口失败,返回信息:"+response.asString());
}
return response;
}
//星速台获取赠卡分享码
public Response giveCard(int uid,String projectId,String cardId) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("cardId",cardId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url+"/projectx/"+projectId+"/clcard/giveCard.do");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/clcard/giveCard.do接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/clcard/giveCard.do接口失败,返回信息:"+response.asString());
}
return response;
}
//星速台助力抽奖
public Response assist(int userId,String shareCode,String projectId) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("channel","1");
map.put("shareCode",shareCode);
Response response = given().cookies(authorization.dafuwengLogin(userId,true)).params(map).get(url+"/projectx/"+projectId+"/clcard/assist.do");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200","接口请求异常");
}catch(Exception e){
throw new Exception("/clcard/assist.do接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/clcard/assist.do接口失败,返回信息:"+response.asString());
}
return response;
}
//星速台赠卡
public Response grantCard(int userId,String shareCode,String projectId) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("channel","1");
map.put("shareCode",shareCode);
Response response = given().cookies(authorization.dafuwengLogin(userId,true)).params(map).get(url+"/projectx/"+projectId+"/clcard/grantCard.do");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200","接口请求异常");
}catch(Exception e){
throw new Exception("/clcard/grantCard.do接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/clcard/grantCard.do接口失败,返回信息:"+response.asString());
}
return response;
}
//星速台收卡
public Response acceptCard(int userId,String shareCode,String projectId) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("channel","1");
map.put("shareCode",shareCode);
Response response = given().cookies(authorization.dafuwengLogin(userId,true)).params(map).get(url+"/projectx/"+projectId+"/clcard/acceptCard.do");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200","接口请求异常");
}catch(Exception e){
throw new Exception("/clcard/acceptCard.do接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/clcard/acceptCard.do接口失败,返回信息:"+response.asString());
}
return response;
}
public Response helpShareCodeV2(int userId,String clGoodsRuleId,String activityId,String activityType,String shareCode) throws Exception{
Map<String, String> map = new HashMap<>();
......@@ -91,7 +209,7 @@ public class NewActivityService {
}catch(Error er){
throw new Exception("/activtyShareCode/helpShareCodeV2接口失败,返回信息:"+response.asString());
}
// authorization.dafuwengLogin(2720,true);
// authorization.dafuwengLogin(2720,true);
return response;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment