mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-29 04:51:58 +08:00
赛会功能代码
This commit is contained in:
@@ -4,6 +4,9 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 认证授权中心
|
* 认证授权中心
|
||||||
|
|||||||
@@ -52,8 +52,29 @@ public class CacheConstants
|
|||||||
*/
|
*/
|
||||||
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赛会推广的二维码缓存地址key
|
||||||
|
*/
|
||||||
|
public static final String COMPETITION_SPREAD_AQR_CODE="competition:spread:aqr:code:";
|
||||||
/**
|
/**
|
||||||
* 存放赛程循环赛的锁的key
|
* 存放赛程循环赛的锁的key
|
||||||
*/
|
*/
|
||||||
public static final String ARRANGE_TEAM_GROUP_SCHEDULE="arrange:team:group:schedule:";
|
public static final String ARRANGE_TEAM_GROUP_SCHEDULE="arrange:team:group:schedule:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序ACCESS_TOKEN缓存key
|
||||||
|
*/
|
||||||
|
public static final String WX_APPLETS_REDIS_ACCESS_TOKEN_KEY="wx.applets.access.token.key";
|
||||||
|
/**
|
||||||
|
* 微信小程序--服务器验证专用token
|
||||||
|
*/
|
||||||
|
public static final String WX_APPLETS_TOKEN="oHDqn56DWSxUHyiOnqLAyawfUj0k";
|
||||||
|
/**
|
||||||
|
* 微信小程序--开发者账号的appid
|
||||||
|
*/
|
||||||
|
public static final String WX_APPLETS_APP_ID="wxd4300820f84a6d6b";
|
||||||
|
/**
|
||||||
|
* 微信小程序--开发者账号的AppSecret
|
||||||
|
*/
|
||||||
|
public static final String WX_APPLETS_APP_SERCERT="16daf686025b3d9755976d79615b254f";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统模块
|
* 系统模块
|
||||||
@@ -31,4 +34,9 @@ public class RuoYiSystemApplication
|
|||||||
" | | \\ / \\ / \n" +
|
" | | \\ / \\ / \n" +
|
||||||
" ''-' `'-' `-..-' ");
|
" ''-' `'-' `-..-' ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate(RestTemplateBuilder builder) {
|
||||||
|
// Do any additional configuration here
|
||||||
|
return builder.build(); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.ruoyi.system.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.system.api.domain.vo.WxAppletsCodeVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -81,6 +83,14 @@ public class CompetitionController extends BaseController
|
|||||||
return toAjax(competitionService.insertCompetition(competition));
|
return toAjax(competitionService.insertCompetition(competition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:competition:genCompetitionCommonAqrSpread")
|
||||||
|
@Log(title = "生成赛会普通微信推广码", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/genCompetitionCommonAqrSpread")
|
||||||
|
public AjaxResult genCompetitionCommonAqrSpread(@RequestBody WxAppletsCodeVo wxAppletsCodeVo)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(competitionService.genCompetitionCommonAqrSpread(wxAppletsCodeVo));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改比赛信息
|
* 修改比赛信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.ruoyi.system.api.domain.vo.WxAppletsCodeVo;
|
||||||
|
import com.ruoyi.system.domain.UserWxAqrCode;
|
||||||
|
import com.ruoyi.system.domain.vo.UserWxAqrCodeVo;
|
||||||
|
import com.ruoyi.system.service.IWxUserService;
|
||||||
|
import com.ruoyi.system.service.WxApplesCodeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 吴一博
|
||||||
|
* @date 2022年11月17日 17:10
|
||||||
|
* @Description 微信小程序代码控制
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wxApplesCode")
|
||||||
|
public class WxApplesCodeController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private WxApplesCodeService wxApplesCodeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:wxApplesCode:getWxApplesAccessToken")
|
||||||
|
@GetMapping("/getWxApplesAccessToken")
|
||||||
|
public AjaxResult getWxApplesAccessToken()
|
||||||
|
{
|
||||||
|
return AjaxResult.success(wxApplesCodeService.getWxApplesAccessToken());
|
||||||
|
}
|
||||||
|
@RequiresPermissions("system:wxApplesCode:genWxApplesAqrCode")
|
||||||
|
@Log(title = "生成微信小程序二维码", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/genWxApplesAqrCode")
|
||||||
|
public AjaxResult genWxApplesAqrCode(@RequestBody WxAppletsCodeVo wxAppletsCodeVo)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(wxApplesCodeService.genWxApplesAqrCode(wxAppletsCodeVo));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.system.api.domain.vo.WxAppletsCodeVo;
|
||||||
import com.ruoyi.system.domain.Competition;
|
import com.ruoyi.system.domain.Competition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,4 +60,6 @@ public interface ICompetitionService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteCompetitionById(Long id);
|
public int deleteCompetitionById(Long id);
|
||||||
|
|
||||||
|
WxAppletsCodeVo genCompetitionCommonAqrSpread(WxAppletsCodeVo wxAppletsCodeVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.system.api.domain.vo.WxAppletsCodeVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 吴一博
|
||||||
|
* @date 2022年11月17日 17:11
|
||||||
|
* @Description
|
||||||
|
*/
|
||||||
|
public interface WxApplesCodeService {
|
||||||
|
/**
|
||||||
|
* @description 获取微信小程序AccessToken
|
||||||
|
* @author 吴一博
|
||||||
|
* @date 2022/11/17 17:13
|
||||||
|
* @return java.lang.String
|
||||||
|
*/
|
||||||
|
String getWxApplesAccessToken();
|
||||||
|
|
||||||
|
WxAppletsCodeVo genWxApplesAqrCode(WxAppletsCodeVo wxAppletsCodeVo);
|
||||||
|
}
|
||||||
@@ -1,12 +1,21 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.constant.CacheConstants;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
import com.ruoyi.system.api.domain.vo.WxAppletsCodeVo;
|
||||||
|
import com.ruoyi.system.service.WxApplesCodeService;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.system.mapper.CompetitionMapper;
|
import com.ruoyi.system.mapper.CompetitionMapper;
|
||||||
import com.ruoyi.system.domain.Competition;
|
import com.ruoyi.system.domain.Competition;
|
||||||
import com.ruoyi.system.service.ICompetitionService;
|
import com.ruoyi.system.service.ICompetitionService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 比赛信息Service业务层处理
|
* 比赛信息Service业务层处理
|
||||||
*
|
*
|
||||||
@@ -16,9 +25,12 @@ import com.ruoyi.system.service.ICompetitionService;
|
|||||||
@Service
|
@Service
|
||||||
public class CompetitionServiceImpl implements ICompetitionService
|
public class CompetitionServiceImpl implements ICompetitionService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Resource
|
||||||
private CompetitionMapper competitionMapper;
|
private CompetitionMapper competitionMapper;
|
||||||
|
@Resource
|
||||||
|
private WxApplesCodeService wxApplesCodeService;
|
||||||
|
@Resource
|
||||||
|
private RedisService redisService;
|
||||||
/**
|
/**
|
||||||
* 查询比赛信息
|
* 查询比赛信息
|
||||||
*
|
*
|
||||||
@@ -90,4 +102,16 @@ public class CompetitionServiceImpl implements ICompetitionService
|
|||||||
{
|
{
|
||||||
return competitionMapper.deleteCompetitionById(id);
|
return competitionMapper.deleteCompetitionById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxAppletsCodeVo genCompetitionCommonAqrSpread(WxAppletsCodeVo wxAppletsCodeVo) {
|
||||||
|
Object key = redisService.getCacheObject(CacheConstants.COMPETITION_SPREAD_AQR_CODE + wxAppletsCodeVo.getScene());
|
||||||
|
if(ObjectUtils.isEmpty(key)){
|
||||||
|
wxAppletsCodeVo = wxApplesCodeService.genWxApplesAqrCode(wxAppletsCodeVo);
|
||||||
|
redisService.setCacheObject(CacheConstants.COMPETITION_SPREAD_AQR_CODE + wxAppletsCodeVo.getScene(),wxAppletsCodeVo.getCodeImgUrl(),30L, TimeUnit.DAYS);
|
||||||
|
}else {
|
||||||
|
wxAppletsCodeVo.setCodeImgUrl((String) key);
|
||||||
|
}
|
||||||
|
return wxAppletsCodeVo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.core.constant.CacheConstants;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
|
import com.ruoyi.system.api.domain.vo.WxAppletsCodeVo;
|
||||||
|
import com.ruoyi.system.service.WxApplesCodeService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.*;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 吴一博
|
||||||
|
* @date 2022年11月17日 17:12
|
||||||
|
* @Description
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
public class WxApplesCodeServiceImpl implements WxApplesCodeService {
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
@Resource
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Value("${image.location.linux}")
|
||||||
|
private String linuxLocation;
|
||||||
|
@Value("${image.domainName}")
|
||||||
|
private String domainName;
|
||||||
|
@Override
|
||||||
|
public String getWxApplesAccessToken() {
|
||||||
|
String accessToken=null;
|
||||||
|
//如果已经获取就不需要再次请求了
|
||||||
|
if(ObjectUtils.isEmpty(redisService.getCacheObject(CacheConstants.WX_APPLETS_REDIS_ACCESS_TOKEN_KEY))) {
|
||||||
|
//获取access_token
|
||||||
|
String appid = CacheConstants.WX_APPLETS_APP_ID;
|
||||||
|
String appsecret = CacheConstants.WX_APPLETS_APP_SERCERT;
|
||||||
|
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential" +
|
||||||
|
"&appid=" + appid + "&secret=" + appsecret;
|
||||||
|
if (restTemplate == null) {
|
||||||
|
restTemplate = new RestTemplate();
|
||||||
|
}
|
||||||
|
String json = restTemplate.getForObject(url, String.class);
|
||||||
|
JSONObject myJson = JSONObject.parseObject(json);
|
||||||
|
log.info("获取AccessToken={}", JSON.toJSONString(myJson));
|
||||||
|
//保存到缓存
|
||||||
|
accessToken = myJson.get("access_token").toString();
|
||||||
|
Long expires_in=myJson.getLong("expires_in");
|
||||||
|
redisService.setCacheObject(CacheConstants.WX_APPLETS_REDIS_ACCESS_TOKEN_KEY,accessToken,expires_in-100, TimeUnit.SECONDS);
|
||||||
|
return accessToken;
|
||||||
|
}else {
|
||||||
|
return (String) redisService.getCacheObject(CacheConstants.WX_APPLETS_REDIS_ACCESS_TOKEN_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxAppletsCodeVo genWxApplesAqrCode(WxAppletsCodeVo wxAppletsCodeVo) {
|
||||||
|
if(restTemplate==null){
|
||||||
|
restTemplate = new RestTemplate();
|
||||||
|
}
|
||||||
|
InputStream inputStream = null;
|
||||||
|
OutputStream outputStream = null;
|
||||||
|
//根据APPid和密钥获取存取令牌
|
||||||
|
try {
|
||||||
|
String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + this.getWxApplesAccessToken();
|
||||||
|
//定义生产二维码所需的参数、样式
|
||||||
|
Map<String, Object> param = new HashMap<>();
|
||||||
|
param.put("scene", wxAppletsCodeVo.getScene());
|
||||||
|
param.put("page", wxAppletsCodeVo.getPage());
|
||||||
|
param.put("width", org.apache.commons.lang3.StringUtils.isEmpty(wxAppletsCodeVo.getPage())?10:wxAppletsCodeVo.getPage());
|
||||||
|
param.put("auto_color", wxAppletsCodeVo.getAutoColor()==null?false:wxAppletsCodeVo.getAutoColor());
|
||||||
|
param.put("is_hyaline",wxAppletsCodeVo.getIsHyaline()==null?false:wxAppletsCodeVo.getIsHyaline());
|
||||||
|
Map<String, Object> line_color = new HashMap<>();
|
||||||
|
line_color.put("r", 0);
|
||||||
|
line_color.put("g", 0);
|
||||||
|
line_color.put("b", 0);
|
||||||
|
param.put("line_color", line_color);
|
||||||
|
System.out.println(param+"调用微信URL传参");
|
||||||
|
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
|
||||||
|
HttpEntity requestEntity = new HttpEntity(param, headers);
|
||||||
|
// System.out.println("协议请求头"+headers+""+requestEntity);
|
||||||
|
ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]);
|
||||||
|
// LOG.info("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody());
|
||||||
|
// System.out.println("返回结果"+entity.getBody()+".."+entity);
|
||||||
|
byte[] result = entity.getBody();
|
||||||
|
// LOG.info(Base64.encodeBase64String(result));
|
||||||
|
// System.out.println("不知道是什么:"+Base64.encodeBase64String(result));
|
||||||
|
inputStream = new ByteArrayInputStream(result);
|
||||||
|
// 生成随机数命名图片
|
||||||
|
String filename = UUID.randomUUID().toString();
|
||||||
|
// System.out.println(filename);
|
||||||
|
Date date = new Date();
|
||||||
|
String time = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
||||||
|
String[] str = time.split("-");//根据‘-’进行拆分字符串 拆分出来的日期有,年,日,月,根据年日月创建文件夹
|
||||||
|
String datePath="/"+str[0]+"/"+str[1]+"/"+str[2]+"/";
|
||||||
|
//创建文件夹
|
||||||
|
String xdpath = datePath+filename+".png";
|
||||||
|
String filePath = linuxLocation+datePath+filename+".png";
|
||||||
|
// 服务器存放位置
|
||||||
|
File file = new File(filePath);
|
||||||
|
//文件目录不存在需要先创建
|
||||||
|
if(!file.getParentFile().exists()){
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
outputStream = new FileOutputStream(file);
|
||||||
|
int len = 0;
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
while ((len = inputStream.read(buf, 0, 1024)) != -1) {
|
||||||
|
outputStream.write(buf, 0, len);
|
||||||
|
}
|
||||||
|
outputStream.flush();
|
||||||
|
wxAppletsCodeVo.setCodeImgUrl(domainName+xdpath);
|
||||||
|
return wxAppletsCodeVo;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// LOG.error("调用小程序生成微信永久小程序码URL接口异常", e);
|
||||||
|
} finally {
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (outputStream != null) {
|
||||||
|
try {
|
||||||
|
outputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("获取二维码");
|
||||||
|
return wxAppletsCodeVo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,3 +10,10 @@ spring:
|
|||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: ruoyi-system
|
name: ruoyi-system
|
||||||
|
|
||||||
|
image:
|
||||||
|
#图片域名
|
||||||
|
domainName: "https://adu.shjmall.cn/liguanghui/image/"
|
||||||
|
location:
|
||||||
|
linux: /bt/pic/
|
||||||
|
windows: D://test//
|
||||||
|
|||||||
@@ -25,7 +25,13 @@ export function addCompetition(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function genCompetitionCommonAqrSpread(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/competition/genCompetitionCommonAqrSpread',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
// 修改比赛信息
|
// 修改比赛信息
|
||||||
export function updateCompetition(data) {
|
export function updateCompetition(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
20
ruoyi-ui/src/api/system/wxApplesCode.js
Normal file
20
ruoyi-ui/src/api/system/wxApplesCode.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 获取微信accessToken
|
||||||
|
export function getWxApplesAccessToken(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/wxApplesCode/getWxApplesAccessToken',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询约战详细
|
||||||
|
export function genWxApplesAqrCode(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/wxApplesCode/genWxApplesAqrCode',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
<el-tag size="small" v-if="competitionObj.heightHide==1" type='info' >隐藏</el-tag>
|
<el-tag size="small" v-if="competitionObj.heightHide==1" type='info' >隐藏</el-tag>
|
||||||
<el-tag size="small" v-else type='success' >显示</el-tag>
|
<el-tag size="small" v-else type='success' >显示</el-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="报名起止时间">{{competitionObj.enrollBeginTime}}-{{competitionObj.enrollEndTime}}</el-descriptions-item>
|
<el-descriptions-item label="报名起止时间">{{competitionObj.enrollBeginTime}} 至 {{competitionObj.enrollEndTime}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="比赛起止时间">{{competitionObj.competitionBeginTime}}-{{competitionObj.competitionEndTime}}</el-descriptions-item>
|
<el-descriptions-item label="比赛起止时间">{{competitionObj.competitionBeginTime}} 至 {{competitionObj.competitionEndTime}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="比赛主办方">{{competitionObj.organizer}}</el-descriptions-item>
|
<el-descriptions-item label="比赛主办方">{{competitionObj.organizer}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="比赛承办商">{{competitionObj.undertake}}</el-descriptions-item>
|
<el-descriptions-item label="比赛承办商">{{competitionObj.undertake}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="赛事联系人">{{competitionObj.contacts}}</el-descriptions-item>
|
<el-descriptions-item label="赛事联系人">{{competitionObj.contacts}}</el-descriptions-item>
|
||||||
@@ -252,7 +252,83 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="赛会推广" name="competitionSpread"> <span slot="label"><i class="el-icon-s-promotion"></i> 赛会推广</span> 赛会推广</el-tab-pane>
|
<el-tab-pane label="赛会推广" name="competitionSpread"> <span slot="label"><i class="el-icon-s-promotion"></i> 赛会推广</span>
|
||||||
|
<el-tabs type="border-card" tab-position="top" >
|
||||||
|
<el-tab-pane label="普通海报" >
|
||||||
|
<el-row >
|
||||||
|
<el-col :span="8" >
|
||||||
|
<el-card :body-style="{ padding: '0px' }" >
|
||||||
|
<img :src="competitionObj.competitionBackImg" class="image">
|
||||||
|
<div style="padding: 14px;">
|
||||||
|
<span>赛会名称:{{competitionObj.competitionName}}</span>
|
||||||
|
<div class="bottom clearfix">
|
||||||
|
<time class="time">报名时间:{{competitionObj.enrollBeginTime}} 至 {{competitionObj.enrollEndTime}}</time>
|
||||||
|
<el-button type="text" @click="genCompetitionCommonAqrCode(competitionObj.id)" class="button">获取赛会推广码</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-divider><i class="el-icon-caret-bottom">推广二维码</i></el-divider>
|
||||||
|
<div style="width: 100%;text-align: center">
|
||||||
|
<el-image
|
||||||
|
class="s-image"
|
||||||
|
:src="spreadImgurl"
|
||||||
|
:preview-src-list="[spreadImgurl]"
|
||||||
|
:fit="imgfit"></el-image>
|
||||||
|
</div>
|
||||||
|
<el-divider content-position="center"> <span style="color: #ae192a">注:点击预览可以分享或者保存哦</span></el-divider>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="自定义海报">
|
||||||
|
<el-row >
|
||||||
|
<el-col :span="8" >
|
||||||
|
<el-card :body-style="{ padding: '0px' }" >
|
||||||
|
<img :src="competitionObj.competitionBackImg" class="image">
|
||||||
|
<div style="padding: 14px;">
|
||||||
|
<span>赛会名称:{{competitionObj.competitionName}}</span>
|
||||||
|
<div class="bottom clearfix">
|
||||||
|
<time class="time">报名时间:{{competitionObj.enrollBeginTime}} 至 {{competitionObj.enrollEndTime}}</time>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<el-divider><i class="el-icon-caret-bottom">推广海报</i></el-divider>
|
||||||
|
<el-carousel :interval="0" type="card" height="400px" style="margin-top: 20px"
|
||||||
|
:autoplay="false"
|
||||||
|
trigger="click" @change="clickCarousel">
|
||||||
|
<el-carousel-item v-for="item in autoSpreadCardImgs" :key="item.id">
|
||||||
|
<el-image style="width: 300px; height: 400px" :src="item.img" :fit="imgfit"></el-image>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-divider><i class="el-icon-caret-right"></i></el-divider>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" >
|
||||||
|
<el-card :body-style="{ padding: '0px' }" >
|
||||||
|
<div class='invite-head'>
|
||||||
|
<div class='card-com' bindtap='saveImageToPhotos'>
|
||||||
|
<div class='inv-card'>
|
||||||
|
<div class='pic'>
|
||||||
|
<el-image class='img' id='card-img' :src="spreadAdImg" />
|
||||||
|
</div>
|
||||||
|
<div class='info' id='card-info'>
|
||||||
|
<div class='u-name'><label class='n'>
|
||||||
|
无篮球,不兄弟
|
||||||
|
</label></div>
|
||||||
|
<div class='u-des'>邀请你和我一起做篮球兄弟!</div>
|
||||||
|
<div class='pp'>长按二维码,开启你的篮球之旅</div>
|
||||||
|
<el-image class='ewm-img' id='ewm-img' :src="spreadImgurl" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-divider content-position="center"> <span style="color: #ae192a">注:请截图保存或者分享哦</span></el-divider>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
<el-drawer
|
<el-drawer
|
||||||
@@ -623,7 +699,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listCompetition, getCompetition, delCompetition, addCompetition, updateCompetition } from "@/api/system/competition";
|
import { listCompetition, getCompetition, genCompetitionCommonAqrSpread, addCompetition, updateCompetition } from "@/api/system/competition";
|
||||||
import { listCompetitionOfTeam, batchEditById, intoTeamGroup, removeTeamGroup, updateCompetitionOfTeam } from "@/api/system/competitionOfTeam";
|
import { listCompetitionOfTeam, batchEditById, intoTeamGroup, removeTeamGroup, updateCompetitionOfTeam } from "@/api/system/competitionOfTeam";
|
||||||
import { listCompetitionMembers, getCompetitionMembers, delCompetitionMembers, addCompetitionMembers, updateCompetitionMembers } from "@/api/system/competitionMembers";
|
import { listCompetitionMembers, getCompetitionMembers, delCompetitionMembers, addCompetitionMembers, updateCompetitionMembers } from "@/api/system/competitionMembers";
|
||||||
import { listCompetitionTeamGroup, arrangeTeamGroupSchedule, delCompetitionTeamGroup, addCompetitionTeamGroup, updateCompetitionTeamGroup } from "@/api/system/competitionTeamGroup";
|
import { listCompetitionTeamGroup, arrangeTeamGroupSchedule, delCompetitionTeamGroup, addCompetitionTeamGroup, updateCompetitionTeamGroup } from "@/api/system/competitionTeamGroup";
|
||||||
@@ -631,12 +707,50 @@ import { listCompetitionTeamVsTeam,getCompetitionVsRecordById, delCompetitionTea
|
|||||||
import { listWxBuilding, getWxBuilding, delWxBuilding, addWxBuilding, updateWxBuilding } from "@/api/system/WxBuilding";
|
import { listWxBuilding, getWxBuilding, delWxBuilding, addWxBuilding, updateWxBuilding } from "@/api/system/WxBuilding";
|
||||||
import { listCompetitionResult, getCompetitionResult, editDataCompetitionResult, batchUpdateCompetitionResult, updateCompetitionResult } from "@/api/system/competitionResult";
|
import { listCompetitionResult, getCompetitionResult, editDataCompetitionResult, batchUpdateCompetitionResult, updateCompetitionResult } from "@/api/system/competitionResult";
|
||||||
import { listCompetitionMemberScore, getCompetitionMemberScore, delCompetitionMemberScore, addCompetitionMemberScore, updateCompetitionMemberScore } from "@/api/system/competitionMemberScore";
|
import { listCompetitionMemberScore, getCompetitionMemberScore, delCompetitionMemberScore, addCompetitionMemberScore, updateCompetitionMemberScore } from "@/api/system/competitionMemberScore";
|
||||||
|
import {getWxApplesAccessToken, genWxApplesAqrCode} from "@/api/system/wxApplesCode";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CompetitionSet",
|
name: "CompetitionSet",
|
||||||
dicts: ['competition_status'],
|
dicts: ['competition_status'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
spreadImgurl:null,
|
||||||
|
spreadPage:"pages/competition/competitiondetail/competitiondetail",
|
||||||
|
spreadAdImg:"https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg0.jpg",
|
||||||
|
autoSpreadCardImgs: [
|
||||||
|
{
|
||||||
|
id: '0',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg0.jpg'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg1.jpg'
|
||||||
|
}, {
|
||||||
|
id: '2',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg2.jpg'
|
||||||
|
}, {
|
||||||
|
id: '3',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg3.jpg'
|
||||||
|
}, {
|
||||||
|
id: '4',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg4.jpg'
|
||||||
|
}, {
|
||||||
|
id: '5',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg5.jpg'
|
||||||
|
}, {
|
||||||
|
id: '6',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg6.png'
|
||||||
|
}, {
|
||||||
|
id: '7',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg7.png'
|
||||||
|
}, {
|
||||||
|
id: '8',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg8.png'
|
||||||
|
}, {
|
||||||
|
id: '9',
|
||||||
|
img: 'https://adu.shjmall.cn/liguanghui/image/wxIcon/spreadTempImg/timg9.png'
|
||||||
|
}
|
||||||
|
],
|
||||||
mindVisible:false,
|
mindVisible:false,
|
||||||
selectGroupValue:null,
|
selectGroupValue:null,
|
||||||
imgfit:"fill",
|
imgfit:"fill",
|
||||||
@@ -957,7 +1071,7 @@ export default {
|
|||||||
this.competitionTeamVsTeamList = response.rows;
|
this.competitionTeamVsTeamList = response.rows;
|
||||||
});
|
});
|
||||||
}else if(tab.name=='competitionSpread'){
|
}else if(tab.name=='competitionSpread'){
|
||||||
|
this.genCompetitionCommonAqrCode(this.competitionObj.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 关闭按钮 */
|
/** 关闭按钮 */
|
||||||
@@ -1256,6 +1370,24 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//获取普通赛会推广二维码
|
||||||
|
genCompetitionCommonAqrCode(id){
|
||||||
|
let data ={
|
||||||
|
"page":this.spreadPage,
|
||||||
|
"scene":id
|
||||||
|
};
|
||||||
|
genCompetitionCommonAqrSpread(data).then(response => {
|
||||||
|
this.$modal.msgSuccess("生成普通推广二维码成功");
|
||||||
|
this.spreadImgurl = response.data.codeImgUrl;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
clickCarousel(data){
|
||||||
|
console.info(data)
|
||||||
|
if(this.spreadImgurl===null){
|
||||||
|
this.genCompetitionCommonAqrCode(this.competitionObj.id);
|
||||||
|
}
|
||||||
|
this.spreadAdImg = this.autoSpreadCardImgs[data].img;
|
||||||
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('system/competition/export', {
|
this.download('system/competition/export', {
|
||||||
@@ -1326,4 +1458,91 @@ export default {
|
|||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
background-color: #f9fafc;
|
background-color: #f9fafc;
|
||||||
}
|
}
|
||||||
|
.time {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
margin-top: 13px;
|
||||||
|
line-height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
padding: 0;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image {
|
||||||
|
width: 510px;
|
||||||
|
max-height: 300px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.image2{
|
||||||
|
width: 500px;
|
||||||
|
height: 710px;
|
||||||
|
padding: 5px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.s-image {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
.clearfix:before,
|
||||||
|
.clearfix:after {
|
||||||
|
display: table;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
.clearfix:after {
|
||||||
|
clear: both
|
||||||
|
}
|
||||||
|
.el-carousel__item h3 {
|
||||||
|
color: #475669;
|
||||||
|
font-size: 14px;
|
||||||
|
opacity: 0.75;
|
||||||
|
line-height: 200px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-carousel__item:nth-child(2n) {
|
||||||
|
background-color: #99a9bf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-carousel__item:nth-child(2n+1) {
|
||||||
|
background-color: #d3dce6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.canvas{ width:400px; height:690px; background-color: #fff; position: fixed; left: -100%; top: -100%; }
|
||||||
|
.invite-head{ width: 100%; height: 725px; background-color: #f5f5f5; position: relative;}
|
||||||
|
.invite-head .share-btn{ width: 114px; height: 60px; background-color: #e94579;
|
||||||
|
position: absolute; right: 0; bottom: 38px; border-radius: 40px 0 0 40px; display: flex;
|
||||||
|
justify-content: center; align-items: center;}
|
||||||
|
.invite-head .share-btn .i{ width: 48px; height: 24px; background-repeat: no-repeat; background-size: cover;
|
||||||
|
display: inline-block; background-image:url('https://7830-x01-a0804c-1258524456.tcb.qcloud.la/icons/i-ffxx-ico.png')}
|
||||||
|
.card-com,.renew-com{ width: 400px; height: 690px; background-color: #fff;overflow: hidden;
|
||||||
|
position: absolute; left: 50%; transform: translateX(-50%); top: 15px;}
|
||||||
|
.inv-card{ width: 100%; height: 100%; }
|
||||||
|
.inv-card .pic{ width: 100%; height: 570px; }
|
||||||
|
.inv-card .pic .img{ width: 100%; height: 100%; display: inline-block;}
|
||||||
|
.inv-card .info{ width: 100%; height: 120px; padding: 15px 0 0 15px; box-sizing: border-box;
|
||||||
|
background-color: #fff; position: relative;}
|
||||||
|
.inv-card .info .u-name{ color: #333; font-size: 24px;}
|
||||||
|
.inv-card .info .u-des{ color: #333; font-size: 22px; margin-top: 2px; }
|
||||||
|
.inv-card .info .pp{ color: #999; font-size:16px; margin-top: 5px;}
|
||||||
|
.inv-card .info .ewm-img{ width: 80px; height: 80px; position: absolute; right: 15px; bottom: 20px;}
|
||||||
|
.inv-tip{ width: 100%; text-align: center;color: #333; font-size: 24px; position: absolute; bottom: 135px;}
|
||||||
|
.query{ position: fixed; left: 100%; bottom: -100%;}
|
||||||
|
.pd{ width: 15px; height: 40px;}
|
||||||
|
.ewm-leftTop{ width:306px; height:590px;}
|
||||||
|
.pt1{ height: 610px;}
|
||||||
|
.pt2{ height: 640px;}
|
||||||
|
.pt3{ height: 668px;}
|
||||||
|
.invite-modle{ width: 100%; height: 240px; background-color:#fff; box-shadow:0,0,0 rgba(170,170,170, .38);
|
||||||
|
padding: 48px 0 0 28px; box-sizing: border-box; position: fixed; bottom: 0; left: 0;}
|
||||||
|
.poster-mod{ width: 100%; height: 150px; overflow: hidden; background: #fff; white-space: nowrap;}
|
||||||
|
.poster-item{ height: 144px; background-color: #f0f0f0; border-radius: 6px; border:1.5px solid transparent; display: inline-block; overflow: hidden; margin-right: 35px;}
|
||||||
|
.poster-item.cur{ border-color: #e94579;}
|
||||||
|
.poster-item .img{ width: 144px; height: 144px;}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user