This commit is contained in:
gaojiuqi 2022-03-03 19:29:26 +08:00
parent 21bbaa9b1f
commit 70c2b7a04e
50 changed files with 9511 additions and 66 deletions

BIN
front/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
front/icon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

38
front/index.html Normal file
View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="ch" manifest="IGNORE.manifest">
<head>
<meta charset="utf-8" />
<!--no-cache浏览器会缓存但刷新页面或者重新打开时 会请求服务器服务器可以响应304如果文件有改动就会响应200-->
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="apple-touch-fullscreen" content="YES" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,viewport-fit=cover" />
<link rel="icon" href="favicon.ico">
<title>
平安业绩发布会邀请函
</title>
<link href="static/js/Web3Library.js" rel="prefetch"><link href="static/js/chunk-vendors.js" rel="preload" as="script"><link href="static/js/index.js" rel="preload" as="script"></head>
<body>
<noscript>
<strong>We're sorry but 平安业绩发布会邀请函 doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- loading -->
<div class="loading-container" id="loadingContainer">
<div class="loader"></div>
</div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="static/js/chunk-vendors.js"></script><script type="text/javascript" src="static/js/index.js"></script></body>
</html>

BIN
front/other/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

BIN
front/other/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1202
front/static/js/index.js Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -116,6 +116,10 @@
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@ -54,6 +54,7 @@ public class NFTPhotoController {
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);
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失败");
@ -82,10 +83,16 @@ public class NFTPhotoController {
} }
//获取用户的手机号和图片hash值 //获取用户的手机号和图片hash值
Map<String,Object> map = nftPhotoService.getPhoneAndHash(openid); Map<String,Object> map = nftPhotoService.getPhoneAndHash(openid);
String format = String.format("{'seed':'%s','walletAddr':'%s','paintingHash':'%s','message':'%s'}",map.get("phone"),walletAddr, map.get("painting_hash"),nickname); if(map == null ){
return R.error("openid不存在");
}
String phone = (String)map.get("phone");
phone = encrypt(phone);
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);
//第三方备份用户和NFT图片对应关系操作成功 //第三方备份用户和NFT图片对应关系操作成功
if("SUCCESS".equals(json.get("code"))){ if("SUCCESS".equals(json.get("code"))){
//绑定用户昵称 //绑定用户昵称
@ -95,7 +102,7 @@ public class NFTPhotoController {
} }
/** /**
* 领取数字藏品展示页面 * 领取数字藏品展示页面和数字藏品详情
* @return * @return
*/ */
@PostMapping("/getNftPhoto") @PostMapping("/getNftPhoto")
@ -105,20 +112,27 @@ public class NFTPhotoController {
log.error("openid为空"+openid); log.error("openid为空"+openid);
return R.error("openid为空"); return R.error("openid为空");
} }
//查询数字藏品详情
Map<String, Object> map = nftPhotoService.getNftPhotoUrl(openid); Map<String, Object> map = nftPhotoService.getNftPhotoUrl(openid);
if(map != null ){
int status = (int)map.get("status"); int status = (int)map.get("status");
String name = (String) map.get("name"); String url = (String) map.get("url");
if(status == 1 ){ if(status == 1 ){
name = String.format("https://cdn.xglpa.com/pars-nft/directional200/%s.png",name); url = String.format("https://cdn.xglpa.com/pars-nft/directional200/%s.png",url);
}else if(status == 2){ }else if(status == 2){
name = String.format("https://cdn.xglpa.com/pars-nft/scene200/%s.png",name); url = String.format("https://cdn.xglpa.com/pars-nft/scene200/%s.png",url);
}else if(status == 3 ){ }else if(status == 3 ){
name = String.format("https://cdn.xglpa.com/pars-nft/nonDirectional500/%s.png",name); url = String.format("https://cdn.xglpa.com/pars-nft/nonDirectional500/%s.png",url);
} }
map.remove("status"); map.remove("status");
map.put("name",name); map.put("url",url);
//获取数字藏品数量
int count = nftPhotoService.getNftCount();
map.put("count",count);
return R.ok(map); return R.ok(map);
} }
return R.ok("openid不存在");
}
//字符串加密 //字符串加密

View File

@ -47,6 +47,12 @@ public class UserController {
log.error("openid为空"+openid); log.error("openid为空"+openid);
return R.error("openid为空"); return R.error("openid为空");
} }
if(StringUtils.isBlank(seed)){
log.error("手机号不能为空!");
return R.error("手机号不能为空!");
}
if(StringUtils.isBlank(code)){ if(StringUtils.isBlank(code)){
log.error("验证码不能为空!"); log.error("验证码不能为空!");
return R.error("验证码不能为空!"); return R.error("验证码不能为空!");
@ -58,15 +64,27 @@ public class UserController {
} }
String s = redisUtil.get(openidCode + openid).toString(); String s = redisUtil.get(openidCode + openid).toString();
if(s.equals(code)){ if(s.equals(code)){
String replace = seed.replaceAll(" ", "");
replace = replace.replaceAll("-", "");
replace = replace.substring(4);
//用户绑定手机号 //用户绑定手机号
userService.addPhone(seed,openid); R r = userService.addPhone(replace, openid);
if("手机号已被用户绑定!".equals(r.get("msg"))){
return r;
}
//用户绑定NFT图片Hash值 //用户绑定NFT图片Hash值
nftPhotoService.addPhonePaintingHash(openid,seed,flag); nftPhotoService.addPhonePaintingHash(openid, replace, flag);
//获取图片类型
String status = nftPhotoService.getStatus(openid);
return R.ok(status);
}else { }else {
return R.error("验证码错误或者已过期!"); return R.error("验证码错误或者已过期!");
} }
// Long parseInt = Long.parseLong(seed);
return R.ok(); // for (int i = 0; i < 10; i++) {
// ++ parseInt;
// nftPhotoService.addPhonePaintingHash(openid,parseInt+"",flag);
// }
} }
@ -87,6 +105,16 @@ public class UserController {
//手机号已绑定 //手机号已绑定
map.remove("name"); map.remove("name");
map.put("flag",true); map.put("flag",true);
int status = (int)map.get("status");
String url = (String) map.get("url");
if(status == 1 ){
url = String.format("https://cdn.xglpa.com/pars-nft/directional200/%s.png",url);
}else if(status == 2){
url = String.format("https://cdn.xglpa.com/pars-nft/scene200/%s.png",url);
}else if(status == 3 ){
url = String.format("https://cdn.xglpa.com/pars-nft/nonDirectional500/%s.png",url);
}
map.put("url",url);
return R.ok(map); return R.ok(map);
}else { }else {
//手机号未绑定 //手机号未绑定

View File

@ -45,12 +45,12 @@ public class VerificationCodeController {
//获取验证码 //获取验证码
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);

View File

@ -17,4 +17,9 @@ public interface NftPhotoMapper extends BaseMapper<NftPhotoDO> {
Map<String,Object> getNftPhotoUrl(String openid); Map<String,Object> getNftPhotoUrl(String openid);
Map<String, Object> getPhoneAndHash(String openid); Map<String, Object> getPhoneAndHash(String openid);
int getNftCount();
String getStatus(String openid);
} }

View File

@ -13,4 +13,8 @@ public interface NftPhotoService {
Map<String,Object> getNftPhotoUrl(String seed); Map<String,Object> getNftPhotoUrl(String seed);
Map<String, Object> getPhoneAndHash(String openid); Map<String, Object> getPhoneAndHash(String openid);
int getNftCount();
String getStatus(String openid);
} }

View File

@ -1,7 +0,0 @@
package com.szxgl.nft.service;
public interface UserNftPhotoService {
}

View File

@ -1,6 +1,7 @@
package com.szxgl.nft.service.impl; package com.szxgl.nft.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.szxgl.nft.entity.NftPhotoDO;
import com.szxgl.nft.entity.UserNftPhoto; import com.szxgl.nft.entity.UserNftPhoto;
import com.szxgl.nft.mapper.NftPhotoMapper; import com.szxgl.nft.mapper.NftPhotoMapper;
import com.szxgl.nft.mapper.UserNftPhotoMapper; import com.szxgl.nft.mapper.UserNftPhotoMapper;
@ -53,4 +54,14 @@ public class NftPhotoServiceImpl implements NftPhotoService {
return nftPhotoMapper.getPhoneAndHash(openid); return nftPhotoMapper.getPhoneAndHash(openid);
} }
@Override
public int getNftCount() {
return nftPhotoMapper.getNftCount();
}
@Override
public String getStatus(String openid) {
return nftPhotoMapper.getStatus(openid);
}
} }

View File

@ -1,9 +0,0 @@
package com.szxgl.nft.service.impl;
import com.szxgl.nft.service.UserNftPhotoService;
import org.springframework.stereotype.Service;
@Service
public class UserNftPhotoServiceImpl implements UserNftPhotoService {
}

View File

@ -23,8 +23,8 @@ public class AliyunSmsUtils {
static final String domain = "dysmsapi.aliyuncs.com"; static final String domain = "dysmsapi.aliyuncs.com";
// TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找) // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
static final String accessKeyId = "LTAI4G88mJUn3YzWo2eFmxVG"; // TODO 修改成自己的 static final String accessKeyId = "LTAI5t5pjd39ax3ALioZ3DaL"; // TODO 修改成自己的
static final String accessKeySecret = "iWNQskqvXC7Rm0au2W2u3AGNFEgYMl"; // TODO 修改成自己的 static final String accessKeySecret = "lHCd5tYCcF7WW8GVMxjH8v5TcuxOZi"; // TODO 修改成自己的
public static SendSmsResponse sendSms(String telephone, String code) throws ClientException { public static SendSmsResponse sendSms(String telephone, String code) throws ClientException {
//可自助调整超时时间 //可自助调整超时时间
@ -39,7 +39,7 @@ public class AliyunSmsUtils {
//必填:待发送手机号 //必填:待发送手机号
request.setPhoneNumbers(telephone); request.setPhoneNumbers(telephone);
//必填:短信签名-可在短信控制台中找到 //必填:短信签名-可在短信控制台中找到
request.setSignName("工银安盛人寿"); // TODO 修改成自己的 request.setSignName("平安银行"); // TODO 修改成自己的
//国内手机正则 //国内手机正则
String regex = "[1][3-9]\\d{9}"; String regex = "[1][3-9]\\d{9}";
@ -47,11 +47,11 @@ public class AliyunSmsUtils {
if(matches){ if(matches){
//必填:短信模板-可在短信控制台中找到 //必填:短信模板-可在短信控制台中找到
//国内短信模板 //国内短信模板
request.setTemplateCode("SMS_207745889"); // TODO 修改成自己的 request.setTemplateCode("SMS_235481516"); // TODO 修改成自己的
}else { }else {
//必填:短信模板-可在短信控制台中找到 //必填:短信模板-可在短信控制台中找到
//国际/港澳台短信模板 //国际/港澳台短信模板
request.setTemplateCode("SMS_234409577"); // TODO 修改成自己的 request.setTemplateCode("SMS_235476609"); // TODO 修改成自己的
} }
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}",此处的值为 //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}",此处的值为
@ -108,7 +108,7 @@ public class AliyunSmsUtils {
return newcode; return newcode;
} }
public static void setNewcode(){ public static void setNewcode(){
newcode = (int)(Math.random()*9999)+100; //每次调用生成一位四位数的随机数 newcode = (int)((Math.random()*9+1)*1000); //每次调用生成一位四位数的随机数
} }
@ -117,7 +117,7 @@ public class AliyunSmsUtils {
String code = Integer.toString(getNewcode()); String code = Integer.toString(getNewcode());
System.out.println("发送的验证码为:"+code); System.out.println("发送的验证码为:"+code);
//发短信 //发短信
SendSmsResponse response =sendSms("67898745",code); // TODO 填写你需要测试的手机号码 SendSmsResponse response =sendSms("15027052382",code); // TODO 填写你需要测试的手机号码
System.out.println("短信接口返回的数据----------------"); System.out.println("短信接口返回的数据----------------");
System.out.println("Code=" + response.getCode()); System.out.println("Code=" + response.getCode());
System.out.println("Message=" + response.getMessage()); System.out.println("Message=" + response.getMessage());

View File

@ -58,9 +58,14 @@ public class R extends HashMap<String, Object> {
} }
public static void main(String[] args) { public static void main(String[] args) {
// String phone = encrypt("15023451234"); String phone = encrypt("15023451234");
// System.out.println(phone); System.out.println(phone);
System.out.println(AliyunSmsUtils.getNewcode()); String s = "+852- 37123594";
String replace = s.replaceAll(" ", "");
replace = replace.replaceAll("-", "");
System.out.println(replace);
System.out.println(replace.substring(4));
} }
//字符串加密 //字符串加密

View File

@ -35,6 +35,7 @@ spring:
multipart: multipart:
max-file-size: 500MB max-file-size: 500MB
max-request-size: 500MB max-request-size: 500MB
redis: redis:
database: 0 database: 0
host: r-wz97jov3cc4roi3b1ppd.redis.rds.aliyuncs.com host: r-wz97jov3cc4roi3b1ppd.redis.rds.aliyuncs.com

View File

@ -1 +0,0 @@

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@ -37,9 +37,12 @@
<select id="getNftPhotoUrl" resultType="java.util.Map"> <select id="getNftPhotoUrl" resultType="java.util.Map">
SELECT SELECT
np.`name`, np.`name` as url,
np.painting_hash,
np.status, np.status,
u.wallet_addr u.nickname,
u.wallet_addr,
u.phone
FROM FROM
nft_photo np nft_photo np
INNER JOIN user_nft_photo up ON np.id = up.nft_photo_id INNER JOIN user_nft_photo up ON np.id = up.nft_photo_id
@ -58,4 +61,24 @@
where u.openid = #{openid} where u.openid = #{openid}
</select> </select>
<select id="getNftCount" resultType="java.lang.Integer">
SELECT
count( np.id )
FROM
nft_photo np
LEFT JOIN user_nft_photo unp ON np.id = unp.nft_photo_id
WHERE
unp.id IS NULL
</select>
<select id="getStatus" resultType="java.lang.String">
SELECT
np.status
FROM
nft_photo np
INNER JOIN user_nft_photo up ON np.id = up.nft_photo_id
INNER JOIN `user` u ON up.phone = u.phone
where u.openid = #{openid}
</select>
</mapper> </mapper>