Merge remote-tracking branch 'origin/master'
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
|
| | | import com.yeshi.fanli.exception.taobao.TaoBaoAuthException;
|
| | | import com.yeshi.fanli.exception.user.UserExtraTaoBaoInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionAuthRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionAuthRecordService taoBaoUnionAuthRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserAccountMsgNotificationService userAccountMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
| | |
|
| | | // 获取渠道ID与会员ID
|
| | | if ("share".equalsIgnoreCase(source)) {
|
| | | String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | String relationId = null;
|
| | |
|
| | | try {
|
| | | TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
|
| | | } catch (TaoBaoAuthException e) {
|
| | | if (e.getCode() == TaoBaoAuthException.CODE_NOT_REAL_NAME)
|
| | | userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(relationId))
|
| | | LogHelper.test(uid + "渠道备案失败");
|
| | | try {
|
| | |
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | String specialId = null;
|
| | | try {
|
| | | specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | } catch (TaoBaoAuthException e1) {
|
| | |
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(specialId))
|
| | | LogHelper.test(uid + "会员备案失败");
|
| | |
| | | });
|
| | |
|
| | | } else if ("zigou".equalsIgnoreCase(source)) {
|
| | | String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | String specialId = null;
|
| | |
|
| | | try {
|
| | | specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | } catch (TaoBaoAuthException e) {
|
| | | if (e.getCode() == TaoBaoAuthException.CODE_NOT_REAL_NAME)
|
| | | userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(specialId))
|
| | | LogHelper.test(uid + "会员备案失败");
|
| | |
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
|
| | | String relationId = null;
|
| | | try {
|
| | | relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | } catch (TaoBaoAuthException e1) {
|
| | | } // 渠道ID
|
| | | if (StringUtil.isNullOrEmpty(relationId))
|
| | | LogHelper.test(uid + "渠道备案失败");
|
| | | try {
|
| | |
| | |
|
| | | boolean bindInfo = true;
|
| | | // 绑定淘宝:V1.5.3
|
| | | String relationId = TaoKeApiUtil.getRelationId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
|
| | | String relationId = null;
|
| | |
|
| | | int tbErrorCode = 0;
|
| | | try {
|
| | | relationId = TaoKeApiUtil.getRelationId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
|
| | | } catch (TaoBaoAuthException e) {
|
| | | tbErrorCode = e.getCode();
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(relationId)) {
|
| | | LogHelper.test(uid + "渠道备案失败");
|
| | | bindInfo = false;
|
| | |
| | |
|
| | | String specialId = null;
|
| | | if (bindInfo) {
|
| | | try {
|
| | | specialId = TaoKeApiUtil.getSpecialId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | } catch (TaoBaoAuthException e) {
|
| | | tbErrorCode = e.getCode();
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(specialId)) {
|
| | | LogHelper.test(uid + "会员备案失败");
|
| | | bindInfo = false;
|
| | |
| | | }
|
| | |
|
| | | if (!bindInfo) {
|
| | | if (tbErrorCode == TaoBaoAuthException.CODE_NOT_REAL_NAME) {
|
| | | userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
|
| | | }
|
| | | errCode = 5;// 信息获取不全
|
| | | } else {
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | CommonContentResult result = commonTemplateContentService.getContentList(CommonContentTypeEnum.valueOf(key),
|
| | | cid, page, Constant.PAGE_SIZE);
|
| | | cid, page, 10);
|
| | |
|
| | | // 保留暂时不开启,待后续开启
|
| | | List<SwiperPicture> bannerList = new ArrayList<>();
|
| | |
| | | * @return |
| | | */ |
| | | long countAllOrder(@Param("orderNo") String orderNo); |
| | | |
| | | /** |
| | | * 根据结算时间拼排序 |
| | | * |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<TaoBaoOrder> listBySettlementTime(@Param("minTime") Long minTime, @Param("maxTime") Long maxTime, |
| | | @Param("start") long start, @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据结算时间计数 |
| | | * |
| | | * @param minTime |
| | | * @param maxTime |
| | | * @return |
| | | */ |
| | | Long countBySettlementTime(@Param("minTime") Long minTime, @Param("maxTime") Long maxTime); |
| | | } |
| | |
| | | @Table("yeshi_ec_msg_account")
|
| | | public class MsgAccountDetail {
|
| | | public enum MsgTypeAccountTypeEnum {
|
| | | bingding("账号绑定"), cancelBinding("取消绑定"), bingdingChange("绑定更换"), update("账号修改"), level("账号等级"), connect("账号合并");
|
| | | bingding("账号绑定"), cancelBinding("取消绑定"), bingdingChange("绑定更换"), update("账号修改"), level("账号等级"), connect("账号合并"),taoBaoAuthFail("账号绑定");
|
| | | private final String desc;
|
| | |
|
| | | private MsgTypeAccountTypeEnum(String desc) {
|
New file |
| | |
| | | package com.yeshi.fanli.exception.taobao; |
| | | |
| | | //淘宝商品下架 |
| | | public class TaoBaoAuthException extends Exception { |
| | | public static int CODE_NOT_REAL_NAME = 1;// 未实名 |
| | | public static int CODE_OUT_OF_RULE = 2;// 违规 |
| | | public static int CODE_OTHER = 3;// 其他错误 |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public TaoBaoAuthException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public TaoBaoAuthException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 跟新本地订单(凌晨25分更新)
|
| | | * 更新本地订单(凌晨25分更新)
|
| | | */
|
| | | @Scheduled(cron = "25 0 0 * * ? ")
|
| | | public void doLocalTaoBaoOrder() {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 更新最近的本地单(30分钟更新一次)
|
| | | */
|
| | |
|
| | | @Scheduled(cron = "0 0/30 * * * ? ")
|
| | | public void doLatestLocalTaoBaoOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | Long endTime = System.currentTimeMillis() - 1000 * 60 * 10L;
|
| | | Long startTime = endTime - 1000 * 60 * 60 * 12L;
|
| | | updateLocalTaoBaoOrder(startTime, endTime, 1, 2000);
|
| | |
|
| | | }
|
| | |
|
| | | public void updateLocalTaoBaoOrder(Long startTime, Long endTime, int page, int count) {
|
| | | List<TaoBaoOrder> list = taoBaoOrderService.listBySettlementTime(startTime, endTime, page, count);
|
| | | Set<String> orderIds = new HashSet<>();
|
| | | for (TaoBaoOrder co : list) {
|
| | | orderIds.add(co.getOrderId());
|
| | | }
|
| | |
|
| | | for (Iterator<String> its = orderIds.iterator(); its.hasNext();) {
|
| | | String orderId = its.next();
|
| | | // 查询是否有处于订单付款状态的单
|
| | | List<CommonOrder> commonOrderList = commonOrderService
|
| | | .listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO, orderId);
|
| | | boolean update = false;
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrder co : commonOrderList) {
|
| | | if (co.getState() == CommonOrder.STATE_FK && co.getPayment().compareTo(new BigDecimal(0)) > 0) {
|
| | | update = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (update) {
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | | Map<String, List<TaoBaoOrder>> orders = new HashMap<>();
|
| | | orders.put(orderId, orderList);
|
| | | orderProcessService.processOrder(orders);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(cron = "30 13 3 * * ? ")
|
| | | public void doLatest5DayLocalTaoBaoOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | Long endTime = System.currentTimeMillis() - 1000 * 60 * 60 * 12L;
|
| | | Long startTime = endTime - 1000 * 60 * 60 * 24 * 5L;
|
| | | long count = taoBaoOrderService.countBySettlementTime(startTime, endTime);
|
| | | int pageSize = 100;
|
| | | long page = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | for (int i = 0; i < page; i++) {
|
| | | updateLocalTaoBaoOrder(startTime, endTime, i + 1, pageSize);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | where to_order_id=#{orderNo} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listBySettlementTime" resultMap="BaseResultMap"> |
| | | select * from yeshi_ec_taobao_order |
| | | where 1=1 |
| | | |
| | | <if test="minTime!=null"> |
| | | and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime} |
| | | </if> |
| | | |
| | | <if test="maxTime!=null"> |
| | | and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000 |
| | | </if> |
| | | |
| | | order by to_settlement_time desc |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countBySettlementTime" resultType="java.lang.Long"> |
| | | select count(to_id) from yeshi_ec_taobao_order |
| | | where 1=1 |
| | | |
| | | <if test="minTime!=null"> |
| | | and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime} |
| | | </if> |
| | | |
| | | <if test="maxTime!=null"> |
| | | and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000 |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_taobao_order where to_id = #{id,jdbcType=BIGINT} |
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void taoBaoAuthFail(Long uid, String taoBaoNickName, String reason) {
|
| | | MsgAccountDetail detail = MsgAccountDetailFactory.createTaoBaoAuthFail(uid, taoBaoNickName, reason);
|
| | | try {
|
| | | msgAccountDetailService.addMsgAccountDetail(detail);
|
| | | } catch (MsgAccountDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | commonOrder.setCommonOrderGoods(goods);
|
| | | }
|
| | |
|
| | | CommonOrder oldCommonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(commonOrder.getOrderNo(),
|
| | | CommonOrder oldCommonOrder = null;
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(commonOrder.getTradeId()))
|
| | | oldCommonOrder = commonOrderMapper.selectBySourceTypeAndTradeId(commonOrder.getSourceType(),
|
| | | commonOrder.getTradeId());
|
| | | else
|
| | | oldCommonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType(), commonOrder.getOrderBy());
|
| | |
|
| | | if (oldCommonOrder == null)// 新增
|
| | |
| | | @Cacheable(value = "commonContentCache", key = "'tljBuy-listByDay'+#day")
|
| | | @Override
|
| | | public List<TLJBuyGoods> listByDay(String day) {
|
| | | List<TLJBuyGoods> list = listByDay(day, 30);
|
| | | if (list.size() <= 10)
|
| | | List<TLJBuyGoods> list = listByDay(day, 10);
|
| | | // if (list.size() <= 10)
|
| | | // return list;
|
| | | // else {
|
| | | // List<TLJBuyGoods> newList = new ArrayList<>();
|
| | | // for (int i = 0; i < 10; i++) {
|
| | | // newList.add(list.get(i));
|
| | | // }
|
| | | // return newList;
|
| | | // }
|
| | | return list;
|
| | | else {
|
| | | List<TLJBuyGoods> newList = new ArrayList<>();
|
| | | for (int i = 0; i < 10; i++) {
|
| | | newList.add(list.get(i));
|
| | | }
|
| | | return newList;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | return taoBaoOrderMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoOrder> listBySettlementTime(Long minTime, Long maxTime, int page, int pageSize) {
|
| | |
|
| | | return taoBaoOrderMapper.listBySettlementTime(minTime, maxTime, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countBySettlementTime(Long minTime, Long maxTime) {
|
| | | return taoBaoOrderMapper.countBySettlementTime(minTime, maxTime);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void userRank(Long uid, String orderType, int orderCount, String rankName);
|
| | |
|
| | | /**
|
| | | * 淘宝授权失败
|
| | | * |
| | | * @param uid
|
| | | * @param taoBaoNickName
|
| | | * @param reason
|
| | | */
|
| | | public void taoBaoAuthFail(Long uid, String taoBaoNickName, String reason);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public TaoBaoOrder selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 根据结算时间检索
|
| | | * |
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoOrder> listBySettlementTime(Long minTime, Long maxTime, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据结算时间计数
|
| | | * |
| | | * @param minTime
|
| | | * @param maxTime
|
| | | * @return
|
| | | */
|
| | | public Long countBySettlementTime(Long minTime, Long maxTime);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class MsgAccountDetailFactory {
|
| | | public final static int TYPE_WX = 1;// 微信
|
| | | public final static int TYPE_TB = 2;// 淘宝
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | // 淘宝授权失败
|
| | | public static MsgAccountDetail createTaoBaoAuthFail(Long uid, String taoBaoNickName, String reason) {
|
| | | if (uid == null || reason == null)
|
| | | return null;
|
| | |
|
| | | JSONArray msg = new JSONArray();
|
| | | JSONObject item = new JSONObject();
|
| | | item.put("name", "账号");
|
| | | item.put("content", String.format("淘宝昵称[%s]", taoBaoNickName));
|
| | | msg.add(item);
|
| | |
|
| | | item = new JSONObject();
|
| | | item.put("name", "原因");
|
| | | item.put("content", reason);
|
| | | msg.add(item);
|
| | |
|
| | | MsgAccountDetail detail = new MsgAccountDetail();
|
| | | detail.setBeiZhu("无");
|
| | | detail.setContent(msg.toString());
|
| | | detail.setTitle("淘宝账号授权失败");
|
| | | detail.setType(MsgTypeAccountTypeEnum.taoBaoAuthFail);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | |
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.UserMsgVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class UserMsgVOFactory {
|
| | |
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | |
|
| | | contentList.add(new ClientTextStyleVO(msg.getType().getDesc() + "", COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("事项", COLOR_TITLE), contentList));
|
| | |
|
| | | // 状态修改
|
| | |
| | | int fromIndex = 0;
|
| | | int toIndex = 0;
|
| | | String stateDesc = msg.getContent();
|
| | | if (msg.getType() == MsgTypeAccountTypeEnum.taoBaoAuthFail) {// 淘宝授权失败
|
| | | JSONArray array = JSONArray.fromObject(stateDesc);
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String name = array.optJSONObject(i).optString("name");
|
| | | String content = array.optJSONObject(i).optString("content");
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(content, i > 0 ? COLOR_HIGHLIGHT_CONTENT : COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO(name, COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | } else {
|
| | | while (stateDesc.indexOf("<highlight>") > -1) {
|
| | | fromIndex = stateDesc.indexOf("<highlight>");
|
| | | toIndex = stateDesc.indexOf("</highlight>");
|
| | |
| | | contentList.add(new ClientTextStyleVO(stateDesc, COLOR_CONTENT));
|
| | | }
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu() + "",
|
| | |
| | | new ClientTextStyleVO("¥" + filterMoney(dto.getMoney().setScale(2)), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("面额", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getReason())) {
|
| | | contentList = new ArrayList<>();
|
| | |
| | | package com.yeshi.fanli.util.pinduoduo;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.taobao.TaoBaoAuthException;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static String getRelationId(String accessToken, String appKey, String appSecret) {
|
| | | public static String getRelationId(String accessToken, String appKey, String appSecret) throws TaoBaoAuthException {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.sc.publisher.info.save");
|
| | | map.put("session", accessToken);
|
| | |
| | | return resultJSON.optJSONObject("tbk_sc_publisher_info_save_response").optJSONObject("data")
|
| | | .optString("relation_id");
|
| | | } catch (TaoKeApiException e) {
|
| | | JSONObject errorJSON = JSONObject.fromObject(e.getMsg()).optJSONObject("error_response");
|
| | | if (errorJSON.optInt("code") == 15 && errorJSON.optInt("sub_code") == 1)// 未实名
|
| | | {
|
| | | throw new TaoBaoAuthException(TaoBaoAuthException.CODE_NOT_REAL_NAME, errorJSON.optString("sub_msg"));
|
| | | } else {
|
| | | e.printStackTrace();
|
| | | LogHelper.error("渠道ID申请出错:" + e.getMsg());
|
| | | throw new TaoBaoAuthException(TaoBaoAuthException.CODE_OTHER, errorJSON.optString("sub_msg"));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static String getSpecialId(String accessToken, String appKey, String appSecret) {
|
| | | public static String getSpecialId(String accessToken, String appKey, String appSecret) throws TaoBaoAuthException {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.sc.publisher.info.save");
|
| | | map.put("session", accessToken);
|
| | |
| | | return resultJSON.optJSONObject("tbk_sc_publisher_info_save_response").optJSONObject("data")
|
| | | .optString("special_id");
|
| | | } catch (TaoKeApiException e) {
|
| | | JSONObject errorJSON = JSONObject.fromObject(e.getMsg()).optJSONObject("error_response");
|
| | | if (errorJSON.optInt("code") == 15 && errorJSON.optInt("sub_code") == 1)// 未实名
|
| | | {
|
| | | throw new TaoBaoAuthException(TaoBaoAuthException.CODE_NOT_REAL_NAME, errorJSON.optString("sub_msg"));
|
| | | } else {
|
| | | e.printStackTrace();
|
| | | LogHelper.error("会员运营ID申请出错:" + resultJSON);
|
| | | LogHelper.error("会员运营ID申请出错:" + e.getMsg());
|
| | | throw new TaoBaoAuthException(TaoBaoAuthException.CODE_OTHER, errorJSON.optString("sub_msg"));
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
|
| | | public static void specialConvertItem(Long auctionId, TaoKeAppInfo app) {
|