修改红包发放功能

1 个父辈 fdd6d1b0
mch_appid = wxbe75806d33ab8a2e mch_appid = wx64e56457ec5c6338
mchid = 1496014382 mchid = 1493581312
key = glSPm08OiR82CfXyZ3HQECFeiwS7np5t key = Bnzihl9t8zId5qKL70bmKDuUpPklMpXB
spbill_create_ip=127.0.0.1 spbill_create_ip=127.0.0.1
cert_file=/theyeasy/weixin_cert/zzhnc_apiclient_cert.p12
#cert_file=C:\\weixin_cert\\zzhnc_apiclient_cert.p12
\ No newline at end of file \ No newline at end of file
cert_file=/theyeasy/weixin_cert/dvmini_apiclient_cert.p12
\ No newline at end of file \ No newline at end of file
...@@ -106,4 +106,11 @@ public class AutoreplyController extends BaseController { ...@@ -106,4 +106,11 @@ public class AutoreplyController extends BaseController {
replyService.init(true); replyService.init(true);
return new Vo_msg(0, "ok"); return new Vo_msg(0, "ok");
} }
@RequestMapping(value = "/autureply", method = RequestMethod.GET)
@ResponseBody
public Object autureply(@RequestParam(value = "content", required = true)String content) {
Autoreply autoreply = replyService.autoreply(content);
return new Vo_msg(0, autoreply.getContents());
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -18,10 +18,12 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,10 +18,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.theyeasy.weixin.model.WxMiniSessionInfo; import org.theyeasy.weixin.model.WxMiniSessionInfo;
import org.theyeasy.weixin.service.WxMiniService; import org.theyeasy.weixin.service.WxMiniService;
import org.theyeasy.weixin.util.WxMiniUtil; import org.theyeasy.weixin.util.WxMiniUtil;
...@@ -293,7 +295,7 @@ public class WxMiniController extends BaseController { ...@@ -293,7 +295,7 @@ public class WxMiniController extends BaseController {
try { try {
Map<String, Object> result = Maps.newHashMap(); Map<String, Object> result = Maps.newHashMap();
List<Banner> bannerList = bannerService.getAll(); List<Banner> bannerList = bannerService.getAll();
PageResults<Goods> seacrh = goodsService.seacrh(null, key, null, page, size,1); PageResults<Goods> seacrh = goodsService.seacrh(null, key, null, page, size, 1);
List<Goods> rows = seacrh.getRows(); List<Goods> rows = seacrh.getRows();
result.put("banner", bannerList); result.put("banner", bannerList);
result.put("data", rows); result.put("data", rows);
...@@ -344,6 +346,9 @@ public class WxMiniController extends BaseController { ...@@ -344,6 +346,9 @@ public class WxMiniController extends BaseController {
public Object changes(@RequestParam(value = "openId") String openId) { public Object changes(@RequestParam(value = "openId") String openId) {
Fans fans = fansService.getFansByMiniOpenid(openId); Fans fans = fansService.getFansByMiniOpenid(openId);
Integer changes = prizeService.changes(fans.getId()); Integer changes = prizeService.changes(fans.getId());
if (changes < 0) {
changes = 0;
}
return new Vo_msg(0, changes); return new Vo_msg(0, changes);
} }
...@@ -382,7 +387,7 @@ public class WxMiniController extends BaseController { ...@@ -382,7 +387,7 @@ public class WxMiniController extends BaseController {
@RequestMapping(value = "/goods/{id}", method = RequestMethod.GET) @RequestMapping(value = "/goods/{id}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public Object goods(@RequestParam(value = "openId") String openId, @PathVariable(value = "id") Integer id) { public Object goods(@RequestParam(value = "openId") String openId, @PathVariable(value = "id") Integer id) {
PageResults<Goods> seacrh = goodsService.seacrh(id, null, null, null, null,0); PageResults<Goods> seacrh = goodsService.seacrh(id, null, null, null, null, 0);
return new Vo_msg(0, seacrh); return new Vo_msg(0, seacrh);
} }
...@@ -390,7 +395,7 @@ public class WxMiniController extends BaseController { ...@@ -390,7 +395,7 @@ public class WxMiniController extends BaseController {
@ResponseBody @ResponseBody
public Object goodsShare(@RequestParam(value = "openId") String openId, @PathVariable(value = "id") Integer id) { public Object goodsShare(@RequestParam(value = "openId") String openId, @PathVariable(value = "id") Integer id) {
if (id > 0) { if (id > 0) {
PageResults<Goods> seacrh = goodsService.seacrh(id, null, null, null, null,0); PageResults<Goods> seacrh = goodsService.seacrh(id, null, null, null, null, 0);
Goods goods = seacrh.getRows().get(0); Goods goods = seacrh.getRows().get(0);
goods.setShareCount(goods.getShareCount() + 1); goods.setShareCount(goods.getShareCount() + 1);
goodsService.update(goods); goodsService.update(goods);
...@@ -401,4 +406,16 @@ public class WxMiniController extends BaseController { ...@@ -401,4 +406,16 @@ public class WxMiniController extends BaseController {
return new Vo_msg(0, null); return new Vo_msg(0, null);
} }
@RequestMapping(value = "/prizes/pass/{id}", method = RequestMethod.GET)
public ModelAndView pass(@RequestParam(value = "openId") String openId, @PathVariable(value = "id") Integer id) {
Fans fans = fansService.getFansByMiniOpenid(openId);
Lotterylog log = prizeService.getLog(id);
System.out.println("log == " + log.getPrizeUrl());
if (log.getPrizeUrl() != null) {
return new ModelAndView("redirect:" + log.getPrizeUrl());
}
return new ModelAndView("redirect:" + "https://dvmini.w1hd.com");
}
} }
...@@ -16,7 +16,9 @@ public class Lotterylog implements Serializable { ...@@ -16,7 +16,9 @@ public class Lotterylog implements Serializable {
private Integer fansid; private Integer fansid;
private String prizeName; private String prizeName;
private BigDecimal mny; private BigDecimal mny;
/** 1 未兑奖 2.已对奖 3.谢谢参与*/
private Integer status; private Integer status;
private Integer turn; private Integer turn;
private Integer prizeId; private Integer prizeId;
private Date createdtime; private Date createdtime;
......
...@@ -32,6 +32,9 @@ public class Prize implements Serializable { ...@@ -32,6 +32,9 @@ public class Prize implements Serializable {
} }
public Integer getProbability() { public Integer getProbability() {
if (probability == null) {
return 0;
}
return probability; return probability;
} }
......
...@@ -4,11 +4,14 @@ import java.math.BigDecimal; ...@@ -4,11 +4,14 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.hamcrest.core.IsInstanceOf;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.testng.collections.Lists; import org.testng.collections.Lists;
import org.testng.util.Strings; import org.testng.util.Strings;
import org.theyeasy.weixin.service.WxPayService;
import com.w1hd.zzhnc.dao.LotteryLogDao; import com.w1hd.zzhnc.dao.LotteryLogDao;
import com.w1hd.zzhnc.enums.ActivityStatus; import com.w1hd.zzhnc.enums.ActivityStatus;
...@@ -33,6 +36,8 @@ public class ActivityService { ...@@ -33,6 +36,8 @@ public class ActivityService {
final String ACTIVITY_SETTING = RedisUtil.PROJECTNAME.concat("_").concat("ACTIVITY_SETTING");// 娲诲姩璁剧疆淇濆瓨key final String ACTIVITY_SETTING = RedisUtil.PROJECTNAME.concat("_").concat("ACTIVITY_SETTING");// 娲诲姩璁剧疆淇濆瓨key
final String SEND_REDPACKAGE_ID = RedisUtil.PROJECTNAME.concat("_").concat("SEND_REDPACKAGE_ID_");
@Autowired @Autowired
LotteryLogDao logDao; LotteryLogDao logDao;
...@@ -178,5 +183,20 @@ public class ActivityService { ...@@ -178,5 +183,20 @@ public class ActivityService {
return newArrayList; return newArrayList;
} }
@Autowired
WxPayService wxPayService;
public void sendRedPackage(String miniOpenId, Integer mny) {
Integer count = 1;
Object object = redisTemplate.opsForValue().get(SEND_REDPACKAGE_ID + miniOpenId);
if (object != null && object instanceof Integer) {
count = (Integer) object;
System.out.println("注意 !" + miniOpenId + " 已中过奖 " + count + " 次");
count++;
}
wxPayService.payMoney("pay" + DateTime.now().getMillis(), miniOpenId, mny, "来自【东莞万科万小二】的红包奖励");
redisTemplate.opsForValue().set(SEND_REDPACKAGE_ID + miniOpenId, count);
}
} }
...@@ -74,21 +74,24 @@ public class AutoreplyService { ...@@ -74,21 +74,24 @@ public class AutoreplyService {
Logger log = LoggerFactory.getLogger(AutoreplyService.class); Logger log = LoggerFactory.getLogger(AutoreplyService.class);
@Autowired @Autowired
AutoreplyDao autoreplyDao; AutoreplyDao autoreplyDao;
List<RegexKeywordFilter> filterList;
static List<RegexKeywordFilter> filterList = Lists.newArrayList();
static boolean inited = false; static boolean inited = false;
public void init(boolean hard) { public void init(boolean hard) {
if (hard) { if (hard) {
inited = false; inited = false;
filterList = Lists.newArrayList();
} }
init(); init();
} }
public void init() { public void init() {
if (inited) if (inited) {
return; return;
}
filterList = Lists.newArrayList();
System.out.println("强制重新获得关键词");
Example example = new Example(Autoreply.class); Example example = new Example(Autoreply.class);
example.createCriteria().andEqualTo("deleted", 0); example.createCriteria().andEqualTo("deleted", 0);
List<Autoreply> autoreplyList = autoreplyDao.selectByExample(example); List<Autoreply> autoreplyList = autoreplyDao.selectByExample(example);
...@@ -96,6 +99,7 @@ public class AutoreplyService { ...@@ -96,6 +99,7 @@ public class AutoreplyService {
String[] keys = e.getKeywords().split("\\|"); String[] keys = e.getKeywords().split("\\|");
RegexKeywordFilter filter = new RegexKeywordFilter(); RegexKeywordFilter filter = new RegexKeywordFilter();
for (String key : keys) { for (String key : keys) {
System.out.println("keys" + key);
filter.add(key); filter.add(key);
} }
filter.compile(); filter.compile();
...@@ -107,10 +111,9 @@ public class AutoreplyService { ...@@ -107,10 +111,9 @@ public class AutoreplyService {
@Autowired @Autowired
RedisTemplate<String, String> redisTemplate; RedisTemplate<String, String> redisTemplate;
public Autoreply autoreply(String string) { public Autoreply autoreply(String string) {
System.out.println("关键字查找 ————>" + string);
List<Set> sets = Lists.newArrayList(); List<Set> sets = Lists.newArrayList();
for (RegexKeywordFilter filter : filterList) { for (RegexKeywordFilter filter : filterList) {
...@@ -120,6 +123,7 @@ public class AutoreplyService { ...@@ -120,6 +123,7 @@ public class AutoreplyService {
public String replaceWith(String keyword) { public String replaceWith(String keyword) {
keys.add(keyword); keys.add(keyword);
sets.add(keys); sets.add(keys);
return ""; return "";
} }
}); });
...@@ -137,14 +141,31 @@ public class AutoreplyService { ...@@ -137,14 +141,31 @@ public class AutoreplyService {
return 1; return 1;
} }
}); });
boolean eques = false;
log.info("sets:{}", sets); log.info("sets:{}", sets);
if (sets.isEmpty())
if (sets.isEmpty()) {
return null; return null;
}
for (Set s : sets) {
if (s.contains(string)) {
eques = true;
}
}
List<String> list = Lists.newArrayList(); List<String> list = Lists.newArrayList();
Set<String> set = sets.get(0);
if (!eques) {
list.addAll(sets.get(0)); list.addAll(sets.get(0));
} else {
list.add(string);
}
List<Autoreply> autoreplys = autoreplyDao.findByKeys(list, null); List<Autoreply> autoreplys = autoreplyDao.findByKeys(list, null);
if (autoreplys.isEmpty()) if (autoreplys.isEmpty()) {
return null; return null;
}
if (autoreplys.size() == 1) { if (autoreplys.size() == 1) {
return autoreplys.get(0); return autoreplys.get(0);
...@@ -167,7 +188,6 @@ public class AutoreplyService { ...@@ -167,7 +188,6 @@ public class AutoreplyService {
} }
public PageResults<Autoreply> getAutoReplyList(Integer page, String keyword, Boolean isRedirectStaff, public PageResults<Autoreply> getAutoReplyList(Integer page, String keyword, Boolean isRedirectStaff,
Integer projectId) { Integer projectId) {
Example example = new Example(Autoreply.class); Example example = new Example(Autoreply.class);
...@@ -220,7 +240,6 @@ public class AutoreplyService { ...@@ -220,7 +240,6 @@ public class AutoreplyService {
return row > 0 ? "ok" : "添加失败,数据异常"; return row > 0 ? "ok" : "添加失败,数据异常";
} }
public String updateAutoReply(Integer id, String keywords, boolean isRedirectStaff, String content, public String updateAutoReply(Integer id, String keywords, boolean isRedirectStaff, String content,
Integer projectId, String projectName, Integer sort) { Integer projectId, String projectName, Integer sort) {
if (StringUtil.isZearoOrNull(id)) if (StringUtil.isZearoOrNull(id))
...@@ -241,7 +260,6 @@ public class AutoreplyService { ...@@ -241,7 +260,6 @@ public class AutoreplyService {
return row > 0 ? "ok" : "修改失败,数据异常"; return row > 0 ? "ok" : "修改失败,数据异常";
} }
public String deleteAutoReply(Integer id) { public String deleteAutoReply(Integer id) {
if (StringUtil.isZearoOrNull(id)) if (StringUtil.isZearoOrNull(id))
return "id 不能为空"; return "id 不能为空";
...@@ -253,14 +271,12 @@ public class AutoreplyService { ...@@ -253,14 +271,12 @@ public class AutoreplyService {
return row > 0 ? "ok" : "删除失败,数据异常"; return row > 0 ? "ok" : "删除失败,数据异常";
} }
public Autoreply getAutoReply(Integer id) { public Autoreply getAutoReply(Integer id) {
if (StringUtil.isZearoOrNull(id)) if (StringUtil.isZearoOrNull(id))
return null; return null;
return autoreplyDao.selectByPrimaryKey(id); return autoreplyDao.selectByPrimaryKey(id);
} }
public String KeywordsToString() { public String KeywordsToString() {
Example example = new Example(Autoreply.class); Example example = new Example(Autoreply.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
......
...@@ -38,6 +38,7 @@ public class PrizeService { ...@@ -38,6 +38,7 @@ public class PrizeService {
final String LotteryLogID_ = RedisUtil.PROJECTNAME.concat("_").concat("lotteryLog_");// 中奖记录 final String LotteryLogID_ = RedisUtil.PROJECTNAME.concat("_").concat("lotteryLog_");// 中奖记录
final String PRIZE_KILL_FANSID = RedisUtil.PROJECTNAME.concat("_").concat("PRIZE_KILL_FANSID_");// 保存粉丝中奖的日志 final String PRIZE_KILL_FANSID = RedisUtil.PROJECTNAME.concat("_").concat("PRIZE_KILL_FANSID_");// 保存粉丝中奖的日志
final String PRIZE_KILL_FANSID_COUNT = RedisUtil.PROJECTNAME.concat("_").concat("PRIZE_KILL_FANSID_COUNT_");// 保存粉丝中奖的日志
@Autowired @Autowired
PrizeDao prizeDao; PrizeDao prizeDao;
...@@ -79,14 +80,9 @@ public class PrizeService { ...@@ -79,14 +80,9 @@ public class PrizeService {
return prizeDao.deleteByPrimaryKey(id) > 0; return prizeDao.deleteByPrimaryKey(id) > 0;
} }
/** public Integer insert(Integer fansId, Integer pType, BigDecimal mny, Integer status) {
* 增加一条奖项记录
*
* @return
*/
@SuppressWarnings("unchecked")
public Integer insert(Integer fansId, Integer pType, BigDecimal mny) {
Activity setting = activityService.getActivitySetting(); Activity setting = activityService.getActivitySetting();
System.out.println("中奖id号:" + pType);
Prize p = null; Prize p = null;
switch (pType) { switch (pType) {
case 1: case 1:
...@@ -140,16 +136,20 @@ public class PrizeService { ...@@ -140,16 +136,20 @@ public class PrizeService {
lotterylog.setPrizeName(p.getName()); lotterylog.setPrizeName(p.getName());
lotterylog.setPrizeId(pType); lotterylog.setPrizeId(pType);
lotterylog.setMny(new BigDecimal(0)); lotterylog.setMny(new BigDecimal(0));
if ("谢谢".equals(p.getName())) { if (p.getName().startsWith("谢谢") || status == 3) {
lotterylog.setStatus(3); lotterylog.setStatus(3);
} else { } else {
lotterylog.setStatus(1); lotterylog.setStatus(1);
if (mny.doubleValue() >= 1.0) { if (mny.doubleValue() >= 1.0) {
lotterylog.setStatus(2);
String order = creatOrder(fansId, (int) (mny.doubleValue() * 100)); String order = creatOrder(fansId, (int) (mny.doubleValue() * 100));
System.out.println("抽中一个红包 >" + order); System.out.println("抽中一个红包 >" + order);
lotterylog.setPrizeUrl(order); lotterylog.setPrizeUrl(order);
lotterylog.setMny(mny); lotterylog.setMny(mny);
// lotterylog.setStatus(2);
// Fans fans = fansService.getFansById(fansId);
// activityService.sendRedPackage(fans.getMiniopenid(), (int) (mny.doubleValue()
// * 100));
} }
} }
...@@ -159,10 +159,19 @@ public class PrizeService { ...@@ -159,10 +159,19 @@ public class PrizeService {
return lotterylog.getId(); return lotterylog.getId();
} }
/**
* 增加一条奖项记录
*
* @return
*/
@SuppressWarnings("unchecked")
public Integer insert(Integer fansId, Integer pType, BigDecimal mny) {
return insert(fansId, pType, mny, -1);
}
@Autowired @Autowired
WxMiniService wxMiniService; WxMiniService wxMiniService;
/** 获取我的奖品 */ /** 获取我的奖品 */
public List<Lotterylog> getMyLotteryLog(Integer fansId) { public List<Lotterylog> getMyLotteryLog(Integer fansId) {
...@@ -177,6 +186,18 @@ public class PrizeService { ...@@ -177,6 +186,18 @@ public class PrizeService {
return list; return list;
} }
/** 获取我的红包奖品 */
public List<Lotterylog> getMyMnyLog(Integer fansId) {
Example ex = new Example(Lotterylog.class);
Criteria c = ex.createCriteria();
c.andEqualTo("fansid", fansId);
c.andEqualTo("status", 1);
c.andGreaterThan("mny", 0);
c.andIsNotNull("prizeUrl");
List<Lotterylog> list = lotteryLogDao.selectByExample(ex);
return list;
}
/** 核销一个奖品记录 */ /** 核销一个奖品记录 */
public Lotterylog updateLotteryLog(Integer id, Integer fansId) { public Lotterylog updateLotteryLog(Integer id, Integer fansId) {
Lotterylog lotterylog = lotteryLogDao.selectByPrimaryKey(id); Lotterylog lotterylog = lotteryLogDao.selectByPrimaryKey(id);
...@@ -196,10 +217,19 @@ public class PrizeService { ...@@ -196,10 +217,19 @@ public class PrizeService {
Integer lotteryLog = (Integer) redisTemplate.opsForValue().get(PRIZE_KILL_FANSID + fansId); Integer lotteryLog = (Integer) redisTemplate.opsForValue().get(PRIZE_KILL_FANSID + fansId);
if (fansId <= 10) { if (fansId <= 10) {
Integer count = (Integer) redisTemplate.opsForValue().get(PRIZE_KILL_FANSID_COUNT + fansId);
if (count == null) {
count = 99;
}
if (count < 100) {
lotteryLog = null; lotteryLog = null;
count = count - 1;
return count;
} }
}
if (lotteryLog == null) { if (lotteryLog == null) {
return 1; return 1;
} else { } else {
Activity activitySetting = activityService.getActivitySetting(); Activity activitySetting = activityService.getActivitySetting();
...@@ -221,6 +251,14 @@ public class PrizeService { ...@@ -221,6 +251,14 @@ public class PrizeService {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Integer randomKill(Integer fansId, Integer count) { public Integer randomKill(Integer fansId, Integer count) {
if (fansId <= 10) {
Integer changes = (Integer) redisTemplate.opsForValue().get(PRIZE_KILL_FANSID_COUNT + fansId);
if (changes == null) {
changes = 99;
}
changes--;
redisTemplate.opsForValue().set(PRIZE_KILL_FANSID_COUNT + fansId, changes);
}
if (count == 8) { if (count == 8) {
return 0; return 0;
...@@ -237,7 +275,7 @@ public class PrizeService { ...@@ -237,7 +275,7 @@ public class PrizeService {
if (p != null) { if (p != null) {
sumNum += p.getNum(); sumNum += p.getNum();
sumPro += p.getProbability(); sumPro += p.getProbability();
if (p.getName().contains("谢谢")) { if (!Strings.isNullOrEmpty(p.getName()) && p.getName().contains("谢谢")) {
tmp = p; tmp = p;
} }
} }
...@@ -250,7 +288,7 @@ public class PrizeService { ...@@ -250,7 +288,7 @@ public class PrizeService {
if (tmp.getIsMoney()) { if (tmp.getIsMoney()) {
mny = RandomUtils.nextInt(tmp.getMixMoney(), tmp.getMaxMoney()); mny = RandomUtils.nextInt(tmp.getMixMoney(), tmp.getMaxMoney());
} }
logId = insert(fansId, tmp.getId(), new BigDecimal(mny * 0.01).setScale(2, RoundingMode.HALF_UP)); logId = insert(fansId, tmp.getId(), new BigDecimal(mny * 0.01).setScale(2, RoundingMode.HALF_UP), 3);
} }
} else { } else {
Prize p8 = activity.getP8(); Prize p8 = activity.getP8();
...@@ -330,7 +368,7 @@ public class PrizeService { ...@@ -330,7 +368,7 @@ public class PrizeService {
public static String getAuthorizeUrl(String orderId, String activityId, int fansId) { public static String getAuthorizeUrl(String orderId, String activityId, int fansId) {
String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd06aec668fe359d1&redirect_uri=http://www.w1hd.com/api/wx/wxd06aec668fe359d1/payWxMpUser2/" String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd06aec668fe359d1&redirect_uri=http://www.w1hd.com/api/wx/wxd06aec668fe359d1/payWxMpUser2/"
+ orderId + "/" + activityId + "/nmamtf&response_type=code&scope=snsapi_userinfo&state=" + fansId + orderId + "/" + activityId + "/nmamtf&response_type=code&scope=snsapi_base&state=" + fansId
+ "&component_appid=wx79ad5a35526f26fb&connect_redirect=1#wechat_redirect"; + "&component_appid=wx79ad5a35526f26fb&connect_redirect=1#wechat_redirect";
return url; return url;
} }
...@@ -356,8 +394,6 @@ public class PrizeService { ...@@ -356,8 +394,6 @@ public class PrizeService {
} }
String url = getAuthorizeUrl(map.get("data").toString(), activityId, fansId); String url = getAuthorizeUrl(map.get("data").toString(), activityId, fansId);
WxMiniUtil.sendCustomMsgLink(fans.getMiniopenid(), "点我领红包", "点这里!点这里!点这里进行抽奖!", url,
"http://mini.weiyisz.com/dvmini/res/images/hongbao.png");
return url; return url;
} }
......
...@@ -276,14 +276,22 @@ public class WxMiniServiceImpl implements WxMiniService { ...@@ -276,14 +276,22 @@ public class WxMiniServiceImpl implements WxMiniService {
fans.setLastEnterTime(DateTime.now().toDate()); fans.setLastEnterTime(DateTime.now().toDate());
fansDao.updateByPrimaryKey(fans); fansDao.updateByPrimaryKey(fans);
for (int i = 1; i < 4; i++) { // for (int i = 1; i < 4; i++) {
String welcome = getWelcome(i); // String welcome = getWelcome(1);
//
sendResult = WxMiniUtil.sendCustomMsgText(fromUserName, welcome); // sendResult = WxMiniUtil.sendCustomMsgText(fromUserName, welcome);
saveChatLog(fans.getId(), "进入会话:" + floorname, welcome, fans.getGoodsId(), // saveChatLog(fans.getId(), "进入会话:" + floorname, welcome, fans.getGoodsId(),
ChatLogReplyType.进入会话, "", ""); // ChatLogReplyType.进入会话, "", "");
// }
List<Lotterylog> list = prizeService.getMyMnyLog(fans.getId());
if(list!=null && !list.isEmpty()) {
for(Lotterylog l:list) {
WxMiniUtil.sendCustomMsgLink(fans.getMiniopenid(), "请领取红包", "年货会获得的红包,请尽快领取。过期无效。", l.getPrizeUrl(),
"http://mini.weiyisz.com/dvmini/res/images/redpackage.png");
prizeService.updateLotteryLog(l.getId(), fans.getId());
}
} }
// 发送欢迎语 // 发送欢迎语
} }
...@@ -516,12 +524,7 @@ public class WxMiniServiceImpl implements WxMiniService { ...@@ -516,12 +524,7 @@ public class WxMiniServiceImpl implements WxMiniService {
return new Vo_msg(0, null, result); return new Vo_msg(0, null, result);
} }
public static void main(String[] arg) {
}
public static String getAuthorizeUrl(String orderId, String activityId, int fansId) { public static String getAuthorizeUrl(String orderId, String activityId, int fansId) {
String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd06aec668fe359d1&redirect_uri=http://www.w1hd.com/api/wx/wxd06aec668fe359d1/payWxMpUser2/" String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd06aec668fe359d1&redirect_uri=http://www.w1hd.com/api/wx/wxd06aec668fe359d1/payWxMpUser2/"
+ orderId + "/" + activityId + "/nmamtf&response_type=code&scope=snsapi_userinfo&state=" + fansId + orderId + "/" + activityId + "/nmamtf&response_type=code&scope=snsapi_userinfo&state=" + fansId
+ "&component_appid=wx79ad5a35526f26fb&connect_redirect=1#wechat_redirect"; + "&component_appid=wx79ad5a35526f26fb&connect_redirect=1#wechat_redirect";
......
Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
请先完成此消息的编辑!