| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
| | | @RequestMapping("api/apph5/v1/618")
|
| | | public class H5S618Controller {
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | /**
|
| | | * 获取超级红包分享口令
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSuperHongBaoToken")
|
| | | public void getSuperHongBaoToken(String sign, Long uid, String callback, PrintWriter out) {
|
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误")));
|
| | | return;
|
| | | }
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录")));
|
| | | return;
|
| | | }
|
| | | /**
|
| | | * 获取超级红包分享口令
|
| | | *
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSuperHongBaoToken")
|
| | | public void getSuperHongBaoToken(String sign, Long uid, String callback, PrintWriter out) {
|
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误")));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号")));
|
| | | return;
|
| | | }
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录")));
|
| | | return;
|
| | | }
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() + "");
|
| | | String token = null;
|
| | | token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253",
|
| | | "20150318019998255", info.getRelationId());
|
| | | String link = dto.getClick_url();
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号")));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | token = TaoKeApiUtil.getTKToken("https://gw.alicdn.com/tfs/TB1alz7HYY1gK0jSZTEXXXDQVXa-800-450.jpg", "天猫618活动上亿红包等你来抢",
|
| | | link);
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() + "");
|
| | | String token = null;
|
| | | token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253",
|
| | | "20150318019998255", info.getRelationId());
|
| | | String link = dto.getClick_url();
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")));
|
| | | return;
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | token = TaoKeApiUtil.getTKToken("https://gw.alicdn.com/tfs/TB1alz7HYY1gK0jSZTEXXXDQVXa-800-450.jpg", "天猫618活动上亿红包等你来抢",
|
| | | link);
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | String desc = configService.get(ConfigKeyEnum.superHongBaoShareDesc.getKey());
|
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token));
|
| | | try {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc))));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误")));
|
| | | }
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")));
|
| | | return;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getYuShouToken")
|
| | | public void getYuShouToken(String sign, Long uid, String callback, PrintWriter out) {
|
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误")));
|
| | | return;
|
| | | }
|
| | | SystemEnum system = userInfoService.getUserSystem(uid);
|
| | |
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录")));
|
| | | return;
|
| | | }
|
| | | String desc = configService.getValue(ConfigKeyEnum.superHongBaoShareDesc.getKey(), system);
|
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token));
|
| | | try {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc))));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误")));
|
| | | }
|
| | | }
|
| | |
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号")));
|
| | | return;
|
| | | }
|
| | | @RequestMapping(value = "getYuShouToken")
|
| | | public void getYuShouToken(String sign, Long uid, String callback, PrintWriter out) {
|
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误")));
|
| | | return;
|
| | | }
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11YuShou, info.getRelationId() + "");
|
| | | String token = null;
|
| | | if (Constant.IS_OUTNET)
|
| | | token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253",
|
| | | "1574926757600", info.getRelationId());
|
| | | String link = dto.getShort_click_url();
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "预售商品付定金,得奖金!",
|
| | | link);
|
| | | if (Constant.IS_OUTNET)
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录")));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")));
|
| | | return;
|
| | | }
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号")));
|
| | | return;
|
| | | }
|
| | |
|
| | | String desc = configService.get(ConfigKeyEnum.superYuShouShareDesc.getKey());
|
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token));
|
| | | try {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc))));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误")));
|
| | | }
|
| | | }
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11YuShou, info.getRelationId() + "");
|
| | | String token = null;
|
| | | if (Constant.IS_OUTNET)
|
| | | token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253",
|
| | | "1574926757600", info.getRelationId());
|
| | | String link = dto.getShort_click_url();
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "预售商品付定金,得奖金!",
|
| | | link);
|
| | | if (Constant.IS_OUTNET)
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")));
|
| | | return;
|
| | | }
|
| | |
|
| | | SystemEnum system = userInfoService.getUserSystem(uid);
|
| | | String desc = configService.getValue(ConfigKeyEnum.superYuShouShareDesc.getKey(), system);
|
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token));
|
| | | try {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc))));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误")));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|