....
This commit is contained in:
parent
35d1d68a66
commit
23b2b4f107
@ -52,8 +52,8 @@ public class NFTPhotoController {
|
|||||||
JSONObject jsonObject = JSONObject.parseObject(phone);
|
JSONObject jsonObject = JSONObject.parseObject(phone);
|
||||||
System.out.println(jsonObject);
|
System.out.println(jsonObject);
|
||||||
//调用第三方接口
|
//调用第三方接口
|
||||||
JSONObject json = HttpClientUtils.httpPost("https://stg-nft-gallery.pingan.com.cn/PABankNewsConference/entropy", jsonObject);
|
//JSONObject json = HttpClientUtils.httpPost("https://stg-nft-gallery.pingan.com.cn/PABankNewsConference/entropy", jsonObject);
|
||||||
//JSONObject json = HttpClientUtils.httpPost("https://nft-gallery.pingan.com.cn/PABankNewsConference/entropy", jsonObject);
|
JSONObject json = HttpClientUtils.httpPost("https://nft-gallery.pingan.com.cn/PABankNewsConference/entropy", jsonObject);
|
||||||
if(!"SUCCESS".equals(json.get("code"))){
|
if(!"SUCCESS".equals(json.get("code"))){
|
||||||
log.error( "获取entropy失败!json:"+json);
|
log.error( "获取entropy失败!json:"+json);
|
||||||
return R.error("获取entropy失败!");
|
return R.error("获取entropy失败!");
|
||||||
@ -90,8 +90,8 @@ public class NFTPhotoController {
|
|||||||
String format = String.format("{'seed':'%s','walletAddr':'%s','paintingHash':'%s','message':'%s'}",phone,walletAddr, map.get("painting_hash"),nickname);
|
String format = String.format("{'seed':'%s','walletAddr':'%s','paintingHash':'%s','message':'%s'}",phone,walletAddr, map.get("painting_hash"),nickname);
|
||||||
System.out.println(format);
|
System.out.println(format);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(format);
|
JSONObject jsonObject = JSONObject.parseObject(format);
|
||||||
JSONObject json = HttpClientUtils.httpPost("https://stg-nft-gallery.pingan.com.cn/PABankNewsConference/nfts", jsonObject);
|
//JSONObject json = HttpClientUtils.httpPost("https://stg-nft-gallery.pingan.com.cn/PABankNewsConference/nfts", jsonObject);
|
||||||
//JSONObject json = HttpClientUtils.httpPost("https://nft-gallery.pingan.com.cn/PABankNewsConference/nfts", jsonObject);
|
JSONObject json = HttpClientUtils.httpPost("https://nft-gallery.pingan.com.cn/PABankNewsConference/nfts", jsonObject);
|
||||||
//第三方备份用户和NFT图片对应关系操作成功
|
//第三方备份用户和NFT图片对应关系操作成功
|
||||||
if("SUCCESS".equals(json.get("code"))){
|
if("SUCCESS".equals(json.get("code"))){
|
||||||
//绑定用户昵称
|
//绑定用户昵称
|
||||||
@ -123,12 +123,14 @@ public class NFTPhotoController {
|
|||||||
url = String.format("https://cdn.xglpa.com/pars-nft/scene200/%s.png",url);
|
url = String.format("https://cdn.xglpa.com/pars-nft/scene200/%s.png",url);
|
||||||
}else if(status == 3 ){
|
}else if(status == 3 ){
|
||||||
url = String.format("https://cdn.xglpa.com/pars-nft/nonDirectional500/%s.png",url);
|
url = String.format("https://cdn.xglpa.com/pars-nft/nonDirectional500/%s.png",url);
|
||||||
|
}else if(status == 4 ){
|
||||||
|
url = String.format("https://cdn.xglpa.com/pars-nft/test10/%s.png",url);
|
||||||
}
|
}
|
||||||
map.remove("status");
|
map.remove("status");
|
||||||
map.put("url",url);
|
map.put("url",url);
|
||||||
//获取数字藏品数量
|
//获取数字藏品数量
|
||||||
int count = nftPhotoService.getNftCount();
|
//int count = nftPhotoService.getNftCount();
|
||||||
map.put("count",count);
|
//map.put("count",count);
|
||||||
}
|
}
|
||||||
return R.ok(map);
|
return R.ok(map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,7 +116,10 @@ public class UserController {
|
|||||||
url = String.format("https://cdn.xglpa.com/pars-nft/scene200/%s.png",url);
|
url = String.format("https://cdn.xglpa.com/pars-nft/scene200/%s.png",url);
|
||||||
}else if(status == 3 ){
|
}else if(status == 3 ){
|
||||||
url = String.format("https://cdn.xglpa.com/pars-nft/nonDirectional500/%s.png",url);
|
url = String.format("https://cdn.xglpa.com/pars-nft/nonDirectional500/%s.png",url);
|
||||||
|
}else if(status == 4 ){
|
||||||
|
url = String.format("https://cdn.xglpa.com/pars-nft/test10/%s.png",url);
|
||||||
}
|
}
|
||||||
|
|
||||||
map.put("url",url);
|
map.put("url",url);
|
||||||
}
|
}
|
||||||
return R.ok(map);
|
return R.ok(map);
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.szxgl.nft.controller;
|
|||||||
|
|
||||||
import com.aliyuncs.exceptions.ClientException;
|
import com.aliyuncs.exceptions.ClientException;
|
||||||
import com.szxgl.nft.entity.RedisKeyName;
|
import com.szxgl.nft.entity.RedisKeyName;
|
||||||
|
import com.szxgl.nft.entity.UserNftPhoto;
|
||||||
|
import com.szxgl.nft.service.NftPhotoService;
|
||||||
import com.szxgl.nft.utils.AliyunSmsUtils;
|
import com.szxgl.nft.utils.AliyunSmsUtils;
|
||||||
import com.szxgl.nft.utils.CookieUtil;
|
import com.szxgl.nft.utils.CookieUtil;
|
||||||
import com.szxgl.nft.utils.R;
|
import com.szxgl.nft.utils.R;
|
||||||
@ -14,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/code")
|
@RequestMapping("/code")
|
||||||
@ -25,6 +30,9 @@ public class VerificationCodeController {
|
|||||||
|
|
||||||
private static final String openidCode = RedisKeyName.getOpenidCode();
|
private static final String openidCode = RedisKeyName.getOpenidCode();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NftPhotoService nftPhotoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证码
|
* 获取验证码
|
||||||
* @param seed 手机号
|
* @param seed 手机号
|
||||||
@ -42,15 +50,49 @@ public class VerificationCodeController {
|
|||||||
log.error("手机号为空:"+seed);
|
log.error("手机号为空:"+seed);
|
||||||
return R.error("手机号为空");
|
return R.error("手机号为空");
|
||||||
}
|
}
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
try {
|
||||||
|
//活动开始时间
|
||||||
|
String activityStartDate = "2022-3-6 10:00:00";
|
||||||
|
long StartDate = sdf.parse(activityStartDate).getTime();
|
||||||
|
//活动结束时间
|
||||||
|
String activityEndDate = "2022-3-7 12:00:00";
|
||||||
|
long EndDate = sdf.parse(activityEndDate).getTime();
|
||||||
|
//当前时间
|
||||||
|
long currentDate = new Date().getTime();
|
||||||
|
// String activityCurrentDate = "2022-3-6 9:00:00";
|
||||||
|
// long currentDate = sdf.parse(activityCurrentDate).getTime();
|
||||||
|
//在活动时间内
|
||||||
|
|
||||||
|
if(currentDate < StartDate){
|
||||||
|
return R.error("活动时间未开始");
|
||||||
|
}
|
||||||
|
if(currentDate >= StartDate && currentDate <= EndDate){
|
||||||
|
//香港手机号格式化:去掉区号
|
||||||
|
if(seed.contains(" ")|| seed.contains("-")){
|
||||||
|
seed = seed.replaceAll(" ", "");
|
||||||
|
seed = seed.replaceAll("-", "");
|
||||||
|
seed = seed.substring(4);
|
||||||
|
}
|
||||||
|
//判断是否为定向用户
|
||||||
|
UserNftPhoto nftPhoto = nftPhotoService.getNftPhoto(seed);
|
||||||
|
if(nftPhoto == null){
|
||||||
|
log.error("不是定向用户!");
|
||||||
|
return R.error("不是定向用户");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
//获取验证码
|
//获取验证码
|
||||||
String code = Integer.toString(AliyunSmsUtils.getNewcode());
|
String code = Integer.toString(AliyunSmsUtils.getNewcode());
|
||||||
log.info("发送的验证码为:"+code);
|
log.info("发送的验证码为:"+code);
|
||||||
// try {
|
try {
|
||||||
// //使用阿里云发送短信
|
//使用阿里云发送短信
|
||||||
// AliyunSmsUtils.sendSms(seed,code);
|
AliyunSmsUtils.sendSms(seed,code);
|
||||||
// } catch (ClientException e) {
|
} catch (ClientException e) {
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
// }
|
}
|
||||||
//把验证码存入redis中
|
//把验证码存入redis中
|
||||||
redisUtil.set(openidCode + openid, code, 300);
|
redisUtil.set(openidCode + openid, code, 300);
|
||||||
return R.ok(code);
|
return R.ok(code);
|
||||||
|
|||||||
@ -41,10 +41,15 @@ public class AliyunSmsUtils {
|
|||||||
//必填:短信签名-可在短信控制台中找到
|
//必填:短信签名-可在短信控制台中找到
|
||||||
request.setSignName("平安银行"); // TODO 修改成自己的
|
request.setSignName("平安银行"); // TODO 修改成自己的
|
||||||
|
|
||||||
|
//国际/港澳台手机号 短信发送格式:国际区号+号码
|
||||||
|
if(telephone.contains(" ") || telephone.contains("-")){
|
||||||
|
telephone = telephone.replaceAll(" ", "");
|
||||||
|
telephone = telephone.replaceAll("-", "");
|
||||||
|
System.out.println(telephone.substring(1));
|
||||||
|
}
|
||||||
//国内手机正则
|
//国内手机正则
|
||||||
String regex = "[1][3-9]\\d{9}";
|
String regex = "[1][3-9]\\d{9}";
|
||||||
boolean matches = telephone.matches(regex);
|
if(telephone.matches(regex)){
|
||||||
if(matches){
|
|
||||||
//必填:短信模板-可在短信控制台中找到
|
//必填:短信模板-可在短信控制台中找到
|
||||||
//国内短信模板
|
//国内短信模板
|
||||||
request.setTemplateCode("SMS_235481516"); // TODO 修改成自己的
|
request.setTemplateCode("SMS_235481516"); // TODO 修改成自己的
|
||||||
@ -66,7 +71,7 @@ public class AliyunSmsUtils {
|
|||||||
if(sendSmsResponse.getCode()!= null && sendSmsResponse.getCode().equals("OK")){
|
if(sendSmsResponse.getCode()!= null && sendSmsResponse.getCode().equals("OK")){
|
||||||
log.info("短信发送成功!");
|
log.info("短信发送成功!");
|
||||||
}else {
|
}else {
|
||||||
log.error("短信发送失败!");
|
log.error("短信发送失败:"+sendSmsResponse.getMessage());
|
||||||
throw new ParameterException("短信发送失败!");
|
throw new ParameterException("短信发送失败!");
|
||||||
}
|
}
|
||||||
return sendSmsResponse;
|
return sendSmsResponse;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ spring:
|
|||||||
jmx:
|
jmx:
|
||||||
default-domain: pars-nft
|
default-domain: pars-nft
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: prod
|
||||||
# mvc:
|
# mvc:
|
||||||
# static-path-pattern: /**
|
# static-path-pattern: /**
|
||||||
# web:
|
# web:
|
||||||
|
|||||||
@ -68,7 +68,7 @@
|
|||||||
nft_photo np
|
nft_photo np
|
||||||
LEFT JOIN user_nft_photo unp ON np.id = unp.nft_photo_id
|
LEFT JOIN user_nft_photo unp ON np.id = unp.nft_photo_id
|
||||||
WHERE
|
WHERE
|
||||||
unp.id IS NULL
|
unp.id IS NULL AND np.`status` != 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getStatus" resultType="java.lang.String">
|
<select id="getStatus" resultType="java.lang.String">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user