diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/CustomerRewardLogService.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/CustomerRewardLogService.java new file mode 100644 index 000000000..929a4ad32 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/CustomerRewardLogService.java @@ -0,0 +1,15 @@ +package au.com.royalpay.payment.manage.customers.core; + +import com.alibaba.fastjson.JSONObject; + +import javax.servlet.http.HttpServletRequest; + +public interface CustomerRewardLogService { + JSONObject takeReward(String openid,String channel); + + JSONObject getRewardDetail(String reward_id); + + void saveReward(int type2,int type3,String type1,String date); + + void checkRedpacksStatus(String rewardId); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerRewardLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerRewardLogServiceImpl.java new file mode 100644 index 000000000..da119b81e --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerRewardLogServiceImpl.java @@ -0,0 +1,222 @@ +package au.com.royalpay.payment.manage.customers.core.impls; + +import au.com.royalpay.payment.manage.customers.core.CustomerRewardLogService; +import au.com.royalpay.payment.manage.mappers.customers.CusRewardConfigMapper; +import au.com.royalpay.payment.manage.mappers.customers.CusRewardCouponMapper; +import au.com.royalpay.payment.manage.mappers.customers.CusRewardLogsMapper; +import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; +import au.com.royalpay.payment.manage.mappers.system.CustomerMapper; +import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; +import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; +import au.com.royalpay.payment.tools.connections.mpsupport.beans.WechatRedpack; +import au.com.royalpay.payment.tools.env.PlatformEnvironment; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.exceptions.ForbiddenException; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.util.Date; +import java.util.List; + + +/** + * @Author: james7whm + * @Date: 2019/1/17 16:56 + */ +@Service +public class CustomerRewardLogServiceImpl implements CustomerRewardLogService { + private Logger logger = LoggerFactory.getLogger(getClass()); + @Resource + private MpWechatApiProvider mpWechatApiProvider; + @Resource + private OrderMapper orderMapper; + @Resource + private CusRewardConfigMapper cusRewardConfigMapper; + @Resource + private CusRewardLogsMapper cusRewardLogsMapper; + @Resource + private CusRewardCouponMapper cusRewardCouponMapper; + @Resource + private CustomerMapper customerMapper; + @Override + public JSONObject takeReward(String openid,String channel) { + String redpack_openid = openid; + if(channel.equals("Wechat")){ + JSONObject customerRelation = customerMapper.findCustomerByOpenId(openid); + if (customerRelation == null) { + customerRelation = customerMapper.findCustomerGlobalpayByOpenId(openid); + } + redpack_openid = customerRelation.getString("redpack_openid"); + } + try { + Date now = new Date(); + Date begin = DateUtils.parseDate(cusRewardConfigMapper.getValue("begin").getString("value"),"yyyy-MM-dd"); + if(begin.after(now)){ + throw new ForbiddenException("活动尚未开始"); + } + Date end = DateUtils.parseDate(cusRewardConfigMapper.getValue("end").getString("value"),"yyyy-MM-dd"); + if(end.before(now)){ + throw new ForbiddenException("活动已结束"); + } + List orders = orderMapper.listNewYearOrdersByOpenId(openid, DateFormatUtils.format(now,"yyyy-MM-dd")); + if(orders.isEmpty()){ + throw new ForbiddenException("请至少使用微信或支付宝线下支付一笔"); + } + int limit = cusRewardConfigMapper.getValue("limit").getIntValue("value"); + int currentDayCounts = cusRewardLogsMapper.openIdReceivedCount(redpack_openid,DateUtils.parseDate(DateFormatUtils.format(now,"yyyy-MM-dd")+" 00:00:00","yyyy-MM-dd HH:mm:ss")); + if((limit-currentDayCounts)<=0){ + throw new ForbiddenException("您今日已达到抽奖次数上限"); + }; + //抽完一次后,还想抽下一次 + if((orders.size()-currentDayCounts)<=0){ + throw new ForbiddenException("请使用微信或支付宝再支付一笔"); + }; + String fakeOpenId = redpack_openid + DateFormatUtils.format(now, "HHmmssSSS"); + if(channel.equals("Wechat")){ + if(cusRewardLogsMapper.takeReward(now,fakeOpenId,DateFormatUtils.format(now,"yyyy-MM-dd")) > 0){ + JSONObject reward = cusRewardLogsMapper.findRewardByFakeOpenId(fakeOpenId); + Assert.notNull(reward, "reward is null"); + String rewardId = reward.getString("reward_id"); + reward.put("openid",redpack_openid); + cusRewardLogsMapper.update(reward); + if (reward.getIntValue("type") == 2 || reward.getIntValue("type") == 3) { + reward.put("status",1); + cusRewardLogsMapper.update(reward); + } else { + String sendName = "RoyalPay"; + String actName = cusRewardConfigMapper.getValue("act_name").getString("value"); + String wishing = cusRewardConfigMapper.getValue("wishing").getString("value"); + String notifyUrl = PlatformEnvironment.getEnv().concatUrl("/act/new_year/redpacks/"+rewardId); + MpWechatApi redpackApi = mpWechatApiProvider.getApi("redpack"); + WechatRedpack wechatRedpack = new WechatRedpack(); + wechatRedpack.setSendName(sendName).setOpenId(redpack_openid).setActName(actName) + .setRemark(actName).setAmount(reward.getBigDecimal("amount").divide(new BigDecimal(100))).setWishing(wishing).setNotifyUrl(notifyUrl); + JSONObject res = redpackApi.sendRedpack(wechatRedpack); + logger.info("2019新年活动获取的红包信息==>"+res.toJSONString()); + reward.put("status",0); + reward.put("send_listid",res.getString("redpack_id")); + cusRewardLogsMapper.update(reward); + } + return reward; + } + } + if(channel.equals("Alipay")){ + if(cusRewardLogsMapper.takeRewardNotWechat(now,openid,DateFormatUtils.format(now,"yyyy-MM-dd")) > 0){ + JSONObject reward = cusRewardLogsMapper.findRewardByFakeOpenId(fakeOpenId); + Assert.notNull(reward, "reward is null"); + reward.put("openid",openid); + reward.put("status",1); + cusRewardLogsMapper.update(reward); + return reward; + } + } + } catch (ParseException e) { + e.printStackTrace(); + } + return getRandomReward(channel.equals("Wechat")?redpack_openid:openid); + } + + @Override + public JSONObject getRewardDetail(String reward_id) { + return cusRewardLogsMapper.findRewardByRewardId(reward_id); + } + + @Override + public void saveReward(int type2, int type3, String type1,String date) { + if(type1!=null){ + String[] configs = type1.split(","); + NumberFormat format = new DecimalFormat("00000"); + int i = 0; + for (String config : configs) { + config = StringUtils.trim(config); + String[] detail = config.split("x"); + int count = Integer.parseInt(detail[1]); + int amount = new BigDecimal(detail[0]).intValue(); + for (int num = 0; num < count; num++) { + JSONObject redpack = new JSONObject(); + String idPrefix = "C"+ DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS") + format.format(i++); + redpack.put("reward_id", idPrefix + RandomStringUtils.random(28 - idPrefix.length(), true, true)); + redpack.put("amount", amount); + redpack.put("status", 0); + redpack.put("date", date); + redpack.put("type", 1); + cusRewardLogsMapper.save(redpack); + } + } + } + if(type2!=0){ + JSONObject coupon = cusRewardCouponMapper.getCoupon(2); + NumberFormat format = new DecimalFormat("00000"); + for (int i = 0; i < type2; i++) { + JSONObject log = new JSONObject(); + String prefix = "C" + DateFormatUtils.format(new Date(), "MMddHHmmssSSS") + format.format(i); + log.put("reward_id", prefix + RandomStringUtils.random(28 - prefix.length(), false, true)); + log.put("type", 2); + log.put("date", date); + log.put("coupon_id", coupon.getString("coupon_id")); + cusRewardLogsMapper.save(log); + } + } + if(type3!=0){ + JSONObject coupon = cusRewardCouponMapper.getCoupon(3); + NumberFormat format = new DecimalFormat("00000"); + for (int i = 0; i < type2; i++) { + JSONObject log = new JSONObject(); + String prefix = "C" + DateFormatUtils.format(new Date(), "MMddHHmmssSSS") + format.format(i); + log.put("reward_id", prefix + RandomStringUtils.random(28 - prefix.length(), false, true)); + log.put("type", 3); + log.put("date", date); + log.put("coupon_id", coupon.getString("coupon_id")); + cusRewardLogsMapper.save(log); + } + } + + + } + + @Override + public void checkRedpacksStatus(String rewardId) { + MpWechatApi redpackApi = mpWechatApiProvider.getApi("redpack"); + JSONObject redpack = redpackApi.redpackStatus(rewardId); + int status = redpack.getIntValue("status"); + JSONObject params = new JSONObject(); + if(status == 2){ + params.put("status",status); + params.put("reward_id",rewardId); + params.put("error_code",redpack.getString("err_code")); + params.put("error_msg",redpack.getString("err_msg")); + cusRewardLogsMapper.update(params); + }else { + params.put("status",status); + params.put("reward_id",rewardId); + cusRewardLogsMapper.update(params); + } + } + + + private JSONObject getRandomReward(String openid){ + JSONObject reward = cusRewardCouponMapper.randomType(); + reward.remove("title"); + String prefix = "C" + DateFormatUtils.format(new Date(), "MMddHHmmssSSS"); + reward.put("reward_id", prefix + RandomStringUtils.random(28 - prefix.length(), false, true)); + reward.put("openid",openid); + reward.put("date",DateFormatUtils.format(new Date(),"yyyy-MM-dd")); + reward.put("send_time",new Date()); + reward.put("status",1); + cusRewardLogsMapper.save(reward); + return reward; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/task/RedpackSendingTask.java b/src/main/java/au/com/royalpay/payment/manage/customers/task/RedpackSendingTask.java new file mode 100644 index 000000000..3aca45c85 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/customers/task/RedpackSendingTask.java @@ -0,0 +1,30 @@ +package au.com.royalpay.payment.manage.customers.task; + +import au.com.royalpay.payment.manage.customers.core.CustomerRewardLogService; +import au.com.royalpay.payment.manage.mappers.customers.CusRewardLogsMapper; +import com.alibaba.fastjson.JSONObject; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @Author: james7whm + * @Date: 2019/2/3 20:26 + */ +@Component +public class RedpackSendingTask { + @Resource + private CustomerRewardLogService customerRewardLogService; + @Resource + private CusRewardLogsMapper cusRewardLogsMapper; + + @Scheduled(cron = "0 0 0/1 * * ?") + public void checkRedpacks() { + List unConfirmedRedpacks = cusRewardLogsMapper.listUnconfirmRewards(); + for (JSONObject redpack : unConfirmedRedpacks) { + customerRewardLogService.checkRedpacksStatus(redpack.getString("send_listid")); + } + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/web/NewYearRedPacketController.java b/src/main/java/au/com/royalpay/payment/manage/customers/web/NewYearRedPacketController.java new file mode 100644 index 000000000..7ef011fa5 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/customers/web/NewYearRedPacketController.java @@ -0,0 +1,77 @@ +package au.com.royalpay.payment.manage.customers.web; + +import au.com.royalpay.payment.manage.customers.core.CustomerRewardLogService; +import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.exceptions.ForbiddenException; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +/** + * @Author: james7whm + * @Date: 2019/1/16 14:35 + */ +@Controller +@RequestMapping("/act/new_year") +public class NewYearRedPacketController { +// @Resource +// private MpWechatApi mpWechatApi; + @Resource + private CustomerRewardLogService customerRewardLogService; + + @RequestMapping(value = "/reward", method = RequestMethod.GET) + public String takeReward(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser, + @ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) { +// String user_id = "o32MzuA5H8KNIYAO2a__BGS-3iXs"; + String user_id = ""; + String channel=""; + if(aliuser == null && wxUser == null){ + throw new ForbiddenException("请使用微信或支付宝客户端打开"); + } + if (aliuser != null) { + user_id = aliuser.getString("user_id"); + channel = "Alipay"; + } + if (wxUser != null) { + user_id = wxUser.getString("openid"); + channel = "Wechat"; + } + JSONObject reward = customerRewardLogService.takeReward(user_id,channel); +// ModelAndView mav = new ModelAndView("activity/new_year_reward/reward"); +// JSONObject reward = new JSONObject(); +// reward.put("type",2); +// mav.addObject("reward", reward); + return "redirect:/act/new_year/"+reward.getString("reward_id"); +// return encourageService.takeEncourageMoney(orderId, user_id); + } + + @RequestMapping(value = "/{reward_id}", method = RequestMethod.GET) + public ModelAndView getReward(@PathVariable String reward_id){ + ModelAndView mav = new ModelAndView("activity/new_year_reward/reward"); + JSONObject reward = customerRewardLogService.getRewardDetail(reward_id); + mav.addObject("reward", reward); + return mav; + } + + @RequestMapping(value = "/description", method = RequestMethod.GET) + public ModelAndView takeDescription(){ + ModelAndView mav = new ModelAndView("activity/new_year_reward/description"); + return mav; + } + + @ResponseBody + @RequestMapping(value = "/coupons", method = RequestMethod.GET) + public void saveCoupons(@RequestParam("type2")int type2,@RequestParam("type3")int type3,@RequestParam("type1")String type1,@RequestParam("date")String date){ + customerRewardLogService.saveReward(type2,type3,type1,date); + } + + @RequestMapping(value = "/redpacks/{rewardId}", method = RequestMethod.POST) + public void updateRedpackStatus(HttpServletRequest request, @RequestHeader String sign, @RequestHeader long timestamp, @PathVariable String rewardId) { +// mpWechatApi(request.getRequestURI(), sign, timestamp); +// redpackSupport.checkRedpack(rewardId); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardConfigMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardConfigMapper.java new file mode 100644 index 000000000..23f1606fe --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardConfigMapper.java @@ -0,0 +1,18 @@ +package au.com.royalpay.payment.manage.mappers.customers; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + + +/** + * @Author: james7whm + * @Date: 2019/1/17 17:34 + */ +@AutoMapper(tablename = "cus_reward_config",pkName = "key") +public interface CusRewardConfigMapper { + @AutoSql(type = SqlType.SELECT) + JSONObject getValue(@Param("key") String key); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardCouponMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardCouponMapper.java new file mode 100644 index 000000000..131976b23 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardCouponMapper.java @@ -0,0 +1,19 @@ +package au.com.royalpay.payment.manage.mappers.customers; + +import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect; +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +@AutoMapper(tablename = "cus_reward_coupon",pkName = "coupon_id") +public interface CusRewardCouponMapper { + + @Select("SELECT * FROM cus_reward_coupon WHERE type =2 or type =3 order by rand() limit 1") + JSONObject randomType(); + + @AutoSql(type = SqlType.SELECT) + JSONObject getCoupon(@Param("type") int type); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardLogsMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardLogsMapper.java new file mode 100644 index 000000000..dfb3c8385 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CusRewardLogsMapper.java @@ -0,0 +1,36 @@ +package au.com.royalpay.payment.manage.mappers.customers; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.Date; +import java.util.List; + + +@AutoMapper(tablename = "cus_reward_log",pkName = "reward_id") +public interface CusRewardLogsMapper { + @AutoSql(type = SqlType.INSERT) + void save(JSONObject params); + + @AutoSql(type = SqlType.SELECT) + JSONObject findRewardByFakeOpenId(@Param("openid")String fakeOpenId); + + @AutoSql(type = SqlType.SELECT) + JSONObject findRewardByRewardId(@Param("reward_id")String reward_id); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject params); + + int openIdReceivedCount(@Param("openid") String openid, @Param("send_time") Date send_time); + + int takeReward(@Param("send_time")Date sendTime, @Param("openid")String openid, @Param("date")String date); + + int takeRewardNotWechat(@Param("send_time")Date sendTime, @Param("openid")String openid, @Param("date")String date); + + @Select("SELECT * FROM cus_reward_log WHERE type=1 AND (`status`=0 OR `status`=1) AND openid IS NOT NULL ORDER BY send_time ASC") + List listUnconfirmRewards(); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java index 0b400d7dd..ce4eb6c6e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java @@ -83,4 +83,10 @@ public interface OrderMapper { JSONObject findOrderById(@Param("order_id") String orderId,@Param("client_id") int clientId); List listHalloweenActOrder(JSONObject param); + + @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "status in (5,6,7) AND channel in('Wechat','Alipay')") + List listNewYearOrdersByOpenId(@Param("customer_id") String open_id,@Param("transaction_date") String date); + + } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CusRewardLogsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CusRewardLogsMapper.xml new file mode 100644 index 000000000..068ac0efb --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CusRewardLogsMapper.xml @@ -0,0 +1,13 @@ + + + + + + UPDATE cus_reward_log SET send_time=#{send_time},openid=#{openid} WHERE date <=#{date} AND openid IS NULL ORDER BY rand() LIMIT 1 + + + UPDATE cus_reward_log SET send_time=#{send_time},openid=#{openid} WHERE date <=#{date} AND openid IS NULL AND type in(2,3) ORDER BY rand() LIMIT 1 + + diff --git a/src/main/resources/templates/activity/new_year_reward/description.html b/src/main/resources/templates/activity/new_year_reward/description.html new file mode 100644 index 000000000..fdfad0390 --- /dev/null +++ b/src/main/resources/templates/activity/new_year_reward/description.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + Pay Successful + + + +
+

活动说明

+

1、用户通过支付宝或微信完成支付后,支付成功页面出现“RoyalPay2019年春节红包抽奖”活动弹窗,点击进入即可参与抽奖,没人每天有2次抽奖机会; +

+

2、用户每天有2次抽奖机会。同一手机号,同一手机终端,同一账户,符合以上任一条件,均视为同一用户; +

+

3、参与本次活动需通过支付成功页面入口参加活动(需用户主扫二维码支付); +

+

4、本次活动只针对线下场景支付行为; +

+

5、用户需满18岁周岁;

+

6、如用户出现违规行为(如虚假交易、作弊、刷单等),RoyalPay将撤销违规用户活动参加资格,并有权回收违规用户获得的福利; +

+

7、本次活动最终解释权归RoyalPay所有。 +

+
+ + diff --git a/src/main/resources/templates/activity/new_year_reward/reward.html b/src/main/resources/templates/activity/new_year_reward/reward.html new file mode 100644 index 000000000..5d85af02e --- /dev/null +++ b/src/main/resources/templates/activity/new_year_reward/reward.html @@ -0,0 +1,71 @@ + + + + + + + + + + + + + Pay Successful + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
恭喜您获得RoyalPay新春红包
+
.00
红包将自动转入您的钱包
+
+
+
+ +
恭喜您获得RoyalPay新春好礼
+
+
+ +
+
AU8口气清新剂一瓶
+

地址:1/550 George St Sydney NSW 2000

+

有效期: 2019年2月4日-2019年2月9日

+

使用说明:到店领取,先到先得

+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/src/main/ui/static/images/act/new_year_redpack/au8.png b/src/main/ui/static/images/act/new_year_redpack/au8.png new file mode 100644 index 000000000..7687fe503 Binary files /dev/null and b/src/main/ui/static/images/act/new_year_redpack/au8.png differ diff --git a/src/main/ui/static/images/act/new_year_redpack/coupon_content.png b/src/main/ui/static/images/act/new_year_redpack/coupon_content.png new file mode 100644 index 000000000..f5de75fc1 Binary files /dev/null and b/src/main/ui/static/images/act/new_year_redpack/coupon_content.png differ diff --git a/src/main/ui/static/images/act/new_year_redpack/new_year_2019.png b/src/main/ui/static/images/act/new_year_redpack/new_year_2019.png new file mode 100644 index 000000000..eecf1983e Binary files /dev/null and b/src/main/ui/static/images/act/new_year_redpack/new_year_2019.png differ diff --git a/src/main/ui/static/images/act/new_year_redpack/new_year_banner.png b/src/main/ui/static/images/act/new_year_redpack/new_year_banner.png new file mode 100644 index 000000000..471b0fa65 Binary files /dev/null and b/src/main/ui/static/images/act/new_year_redpack/new_year_banner.png differ diff --git a/src/main/ui/static/images/act/new_year_redpack/new_year_coupon.png b/src/main/ui/static/images/act/new_year_redpack/new_year_coupon.png new file mode 100644 index 000000000..762463378 Binary files /dev/null and b/src/main/ui/static/images/act/new_year_redpack/new_year_coupon.png differ diff --git a/src/main/ui/static/images/act/new_year_redpack/reward_top.png b/src/main/ui/static/images/act/new_year_redpack/reward_top.png new file mode 100644 index 000000000..aaf7bf98a Binary files /dev/null and b/src/main/ui/static/images/act/new_year_redpack/reward_top.png differ diff --git a/src/main/ui/static/templates/activity/new_year_reward/my.css b/src/main/ui/static/templates/activity/new_year_reward/my.css new file mode 100644 index 000000000..dcfa16c1d --- /dev/null +++ b/src/main/ui/static/templates/activity/new_year_reward/my.css @@ -0,0 +1,343 @@ +div,span,a,img{ + box-sizing:border-box; +} + +.main-container { + position: absolute; + top: 0; + left: 20px; + right: 20px; + bottom: 28px; + background-color: #FCF7EB; + text-align: center; +} + + +@media screen and (max-height:670px){ + .main-container { + position: absolute; + top: 0; + left: 20px; + right: 20px; + bottom: 26px; + background-color: #FCF7EB; + text-align: center; + } +} + +@media screen and (max-height: 520px){ + .main-container { + position: absolute; + top: 0; + left: 20px; + right: 20px; + bottom: 22px; + background-color: #FCF7EB; + text-align: center; + } +} + +.img-top { + width: 100%; + background: url(/static/images/reward_top.png) no-repeat center; + background-size: contain; + height: 57px; + position: absolute; + top: -4px; +} + +@media screen and (max-height:670px){ + .img-top { + width: 100%; + background: url(/static/images/reward_top.png) no-repeat center; + background-size: contain; + height: 52px; + position: absolute; + top: -2px; + } +} + +@media screen and (max-height:520px){ + .img-top { + width: 100%; + background: url(/static/images/reward_top.png) no-repeat center; + background-size: contain; + height: 44px; + position: absolute; + top: 0px; + } +} + + + +.img-bottom { + width: 100%; + height: 58px; + background: url(/static/images/reward_bottom.png) no-repeat center; + background-size: contain; + position: absolute; + bottom: 0px; +} + +@media screen and (max-height:670px){ + .img-bottom { + width: 100%; + height: 53px; + background: url(/static/images/reward_bottom.png) no-repeat center; + background-size: contain; + position: absolute; + bottom: 0px; + } +} + +@media screen and (max-height:520px){ + .img-bottom { + width: 100%; + height: 45px; + background: url(/static/images/reward_bottom.png) no-repeat center; + background-size: contain; + position: absolute; + bottom: 0px; + } +} + +.wish { + font-size: 18px; + color: #B99B6A; +} +.redpack { + padding:20px; + color: #EC421F; +} + +.redpack .amount{ + font-size: 45px; +} + +.redpack .currency{ + font-size: 20px; +} + +.redpack .description{ + font-size: 14px; +} + +.desc-container { + position: absolute; + top: 0; + left: 20px; + right: 20px; + bottom: 0; + background-color: #FCF7EB; + color:#B99B6A; +} + +.desc-container .desc-title{ + text-align: center; + font-size: 18px; +} +.desc-container .desc-content{ + font-size: 14px; +} + +.banner { + width: 100%; + margin-top: 15%; + padding: 20px; + background-size: contain; +} + + +.banner .head-box { + width: 65px; + height: 65px; + border: 3px solid #fe783b; + border-radius: 50%; + display: block; + margin: auto; +} + +.desc { + width: 100%; + text-align: center; + font-size: 14px; + color: #fff; + margin: 5px 0; +} + +.detail-box { + position: absolute; + top: 120px; + bottom: 40px; + left: 20px; + right: 20px; + border-radius: 5px; + background: #fff; + overflow: hidden; +} + +.detail-box .detail-heading { + height: 54px; + padding: 18px 20px; + border-bottom: 1px solid #f1f1f1; + position: absolute; + top: 0; + width: 100%; + font-size: 14px; +} +.detail-box .detail-heading:after{ + content:''; + clear:both; + display:block; +} + +.detail-box .detail-heading .date-range { + color: #000; + float: left; + font-size: 14px; +} + +.detail-box .balance-log-container { + position: absolute; + top: 55px; + bottom: 100px; + width: 100%; + left: 0; + padding: 0 20px 15px; + overflow-y: auto; + overflow-x: hidden; +} + +.detail-box .balance-log-container .item { + height: 50px; + width: 100%; + position: relative; + padding-left: 15px; +} + +.detail-box .balance-log-container .item:before { + content: ''; + width: 10px; + height: 10px; + position: absolute; + left: -5px; + border-radius: 50%; + top: 20px; + background: #30af69; +} + +.detail-box .balance-log-container .item:after { + content: ''; + height: 100%; + top: 50%; + left: -1px; + border-left: 2px solid #30af69; + width: 0; + position: absolute; +} + +.detail-box .balance-log-container .item:last-child:after{ + display: none; +} + +.detail-box .balance-log-container .item .date-box{ + font-size: 16px; + float: left; + line-height: 50px; + color: #888888; +} + +.detail-box .balance-log-container .item.today .date-box{ + color: #30af69; +} + +.detail-box .balance-log-container .item .amount{ + color: #30af69; + font-size: 20px; + line-height: 50px; + float: right; + text-align: right; +} + +.detail-box .balance-log-container .item .amount:before{ + content: '$'; +} + +.detail-box .balance-log-container .item .amount.debit{ + color: #888888; + text-decoration: line-through; +} + +.detail-box .balance-log-container .item .factor{ + font-size: 12px; + color: #888888; + text-align: right; + float: right; + line-height: 12px; + clear:both; + margin-top: -12px; +} + +.detail-box .balance-footer{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100px; + padding: 20px; + background: #f1f1f1; +} + +.detail-box .balance-footer .row{ + width: 100%; + line-height: 30px; + height: 30px; +} +.detail-box .balance-footer .row:after{ + display: block; + content: ''; + clear: both; +} + +.detail-box .balance-footer .row .label{ + font-size: 16px; + color: #888888; + float: left; +} + +.detail-box .balance-footer .row .amount{ + color: #888888; + font-size: 16px; + float: right; +} + +.detail-box .balance-footer .row .amount:before{ + content: '$'; +} + +.detail-box .balance-footer .row .amount.available{ + color: #30af69; + font-size: 28px; +} + +.link-box{ + width: 100%; + color: #fff; + left: 0; + bottom: 10px; + position: absolute; + font-size: 16px; + text-align: center; +} + +.link-box a{ + color: #fff; +} + +data-box-amount{ + width: 30%; + text-align: center; +} +.used{ + text-decoration: line-through; +} diff --git a/src/main/ui/static/templates/activity/new_year_reward/redpack.css b/src/main/ui/static/templates/activity/new_year_reward/redpack.css new file mode 100644 index 000000000..1adc41dba --- /dev/null +++ b/src/main/ui/static/templates/activity/new_year_reward/redpack.css @@ -0,0 +1,118 @@ +.main-body{ + height:92.3%; + width:100%; + /*left: 20px;*/ + /*right: 20px;*/ + position: fixed; + /*background-color: #FCF7EB;*/ + /*bottom: 11.6%;*/ + /*text-align: center;*/ +} +.body{ + width: 90%; + left: 5%;; + height: 100%; + background-color: #FCF7EB; + position: relative; + z-index: 1000; + text-align: center; +} +.head{ + width:100%; +} +.banner{ + margin-top: 15%; + padding: 20px; + background-size: contain; +} +.wish { + font-size: 18px; + color: #B99B6A; +} +.redpack { + padding:20px; + color: #EC421F; +} + +.redpack .amount{ + font-size: 45px; +} + +.redpack .currency{ + font-size: 20px; +} + +.redpack .description{ + font-size: 14px; +} + +p { + color: #8C754F; + font-size: 14px; + text-align:left; +} +.coupon{ +} +.coupon-back{ + position: relative; +} +.coupon-desc{ + position: absolute; + padding: 20px; + top: 0; +} +.coupon-au8{ + color: #EC421F; + font-size: 16px; +} +.coupon-head{ + padding: 20px 0; +} +.coupon-img{ + width: 50px; + vertical-align: middle; +} +@media screen and (max-height: 520px){ + p { + color: #8C754F; + font-size: 11px; + text-align:left; + } + .coupon-au8{ + color: #EC421F; + font-size: 15px; + } + .coupon-head{ + padding: 10px 0; + } +} +.coupon_content{ + +} +/*.foot1{*/ + /*width: 100%;*/ + /*position: fixed;*/ + /*bottom: 7.7%;*/ + /*background-color: #D51727;*/ + /*height: 3.9%;*/ + /*border-radius: 20px 20px 0 0;*/ +/*}*/ +.body-bottom { + width: 100%; + position: absolute; + height: 3.9%; + bottom: 0; + border-radius: 20px 20px 0 0; + background-color: #D51727; +} +.foot{ + width: 100%; + position:fixed; + height:7.7%; + bottom:0; + background-color: #F5504B; + text-align: center; + font-size: 14px; + color: #FDADAA; + line-height: 50px; +} diff --git a/src/main/ui/static/templates/payment/success.css b/src/main/ui/static/templates/payment/success.css index 4abfb0e03..7da6d6e13 100644 --- a/src/main/ui/static/templates/payment/success.css +++ b/src/main/ui/static/templates/payment/success.css @@ -410,3 +410,127 @@ background: url(/static/images/button@2x.png) no-repeat; background-size: 100% 100%; } + +.redpack-dialog { + position: fixed; + display: block; + top: 0; + right: 0; + left: 0; + bottom: 0; + padding: 0 80px; +} +.redpack-dialog.hide { + display: none; +} + +.redpack-dialog .mask { + position: absolute; + top: 0; + right: 0; + left: 0; + bottom: 0; + background: rgba(0,0,0, .4); +} + +.redpack-dialog .dialog-content { + width: 100%; + display: block; + position: relative; + margin-top: 50px; + /*padding-top: 25px;*/ + padding-bottom: 19px; + border-radius: 5px; + /*background: -webkit-linear-gradient(top, rgb(253, 99, 1), rgb(251, 120, 4));*/ + /*box-shadow: rgba(0,0,0,.3) 5px 5px 10px;*/ + animation:0.5s showDialog; +} + +.redpack-dialog .dialog-content .redpack-content { + position: relative; + width: 100%; + color: #fff; + text-align: center; +} + + +.redpack-dialog .close-btn { + position: absolute; + top: -60px; + right: 0; + display: block; + width: 30px; + height: 114px; +} + +.redpack-dialog .close-btn:after { + display: block; + content: ''; + width: 0; + border-left: 2px solid #fff; + position: absolute; + left: 16px; + bottom: 0; + height: 56px; +} + +.redpack-dialog .close-btn .close-circle { + display: block; + position: relative; + border: 2px solid #fff; + border-radius: 50%; + width: 30px; + height: 30px; + margin-top: 24px; +} + +.redpack-dialog .close-btn .close-circle:before { + content: ''; + display: block; + position: absolute; + top: 10px; + right: 17px; + width: 10px; + height: 10px; + transform-origin: center; + border-top: 1px solid #fff; + border-right: 1px solid #fff; + transform: rotate(45deg); +} + +.redpack-dialog .close-btn .close-circle:after { + content: ''; + display: block; + position: absolute; + top: 10px; + left: 16px; + width: 10px; + height: 10px; + border-top: 1px solid #fff; + border-left: 1px solid #fff; + transform: rotate(-45deg); +} + +.redpack-content .redpack-img{ + position: relative; + width: 100%; +} +.redpack-click { + margin-top: -128px; + position: relative; +} +.redpack-royalpay{ + margin-bottom: 20px; +} +.redpack-click .link{ + width: 130px; + height: 33px; + margin: auto; + display: block; + font-size: 14px; + line-height: 33px; + border-radius: 15px; + /*border: 2px solid #fff;*/ + color: #835B23; + background-color: #FBE214; +} diff --git a/src/main/ui/static/templates/payment/success.js b/src/main/ui/static/templates/payment/success.js index f9d447709..a0590a154 100644 --- a/src/main/ui/static/templates/payment/success.js +++ b/src/main/ui/static/templates/payment/success.js @@ -94,5 +94,21 @@ $(function () { }); $('.points-dialog .close-circle').click(function () { $('.points-dialog').addClass('hide'); - }) -}); \ No newline at end of file + }); + + //2019新春红包活动 + function loadRedpack(){ + var currentDate = new Date(); + var actEndDate = new Date("2019/2/10"); + var actStartDate = new Date("2019/2/3"); + if ((currentDate >= actStartDate) && (currentDate <= actEndDate)) { + $(".redpack-dialog").removeClass('hide'); + } + } + loadRedpack(); + + $('.redpack-dialog .close-circle').click(function () { + $('.redpack-dialog').addClass('hide'); + }); + +});