package com.yeshi.fanli.controller.admin.config; import com.yeshi.fanli.entity.SystemPIDInfo; import com.yeshi.fanli.entity.accept.AdminAcceptData; import com.yeshi.fanli.service.inter.pdd.PDDAuthService; import com.yeshi.fanli.service.manger.PIDManager; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.yeshi.utils.JsonUtil; import javax.annotation.Resource; import java.io.PrintWriter; @Controller @RequestMapping("admin/new/api/v1/pddauth") public class PDDAuthAdminController { @Resource private PDDAuthService pddAuthService; @Resource private PIDManager pidManager; @RequestMapping("getAuthLink") public void getAuthLink(AdminAcceptData acceptData, Long uid, String callback, PrintWriter out) { if (uid == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户ID为空")); } try { String link = pddAuthService.createPDDAuthLink(uid, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli)); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(link)); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); } } }