| | |
| | | |
| | | import com.yeshi.buwan.controller.parser.*; |
| | | import com.yeshi.buwan.service.imp.UserService; |
| | | import com.yeshi.buwan.service.inter.baidu.BaiDuCPUService; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | |
| | | |
| | | @Resource |
| | | private ConfigParser configParser; |
| | | |
| | | |
| | | @Resource |
| | | private BaiduParser baiduParser; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | if (method.equalsIgnoreCase("getConfig")) {// 获取用户编号 |
| | | switch (method) { |
| | | case "getConfig": |
| | | configParser.getConfig(acceptData, request, out); |
| | | break; |
| | | case "getHomeConfig"://获取首页配置信息 |
| | | configParser.getHomeConfig(acceptData, request, out); |
| | | break; |
| | | } |
| | | |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/baidu", method = RequestMethod.POST) |
| | | public void baidu(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | switch (method) { |
| | | case "getNewsTypeList": |
| | | baiduParser.getNewsTypeList(acceptData, request, out); |
| | | break; |
| | | case "getVideoTypeList": |
| | | baiduParser.getVideoTypeList(acceptData, request, out); |
| | | break; |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.controller.parser; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.service.imp.ConfigService; |
| | | import com.yeshi.buwan.service.inter.baidu.BaiDuCPUService; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.baidu.BaiDuCPUTypeVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.PrintWriter; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | public class BaiduParser { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(BaiduParser.class); |
| | | @Resource |
| | | private ConfigService configService; |
| | | private BaiDuCPUService baiDuCPUService; |
| | | |
| | | |
| | | /** |
| | | * 获取百度资讯的分类 |
| | | * |
| | | * @param acceptData |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void getNewsTypeList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | List<BaiDuCPUTypeVO> list = baiDuCPUService.getNewsTypeListCache(); |
| | | out.print(JsonUtil.loadTrueJson(new Gson().toJson(list))); |
| | | } |
| | | |
| | | /** |
| | | * 获取百度视频的分类 |
| | | * |
| | | * @param acceptData |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void getVideoTypeList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | List<BaiDuCPUTypeVO> list = baiDuCPUService.getVideoTypeListCache(); |
| | | out.print(JsonUtil.loadTrueJson(new Gson().toJson(list))); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_NOVEL); |
| | | vo.setName("小说"); |
| | | typelist.add(3, vo); |
| | | typelist.add(1, vo); |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", (new StringBuilder(String.valueOf(typelist.size()))).toString()); |
| | |
| | | package com.yeshi.buwan.controller.parser; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.buwan.domain.Config; |
| | | import com.yeshi.buwan.domain.DetailSystem; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import com.yeshi.buwan.log.LogHelper; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.ad.FloatADService; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | |
| | | private ConfigService configService; |
| | | @Resource |
| | | private SystemService systemService; |
| | | |
| | | @Resource |
| | | private FloatADService floatADService; |
| | | |
| | | public String getAdShowType(String key, String channel, int version, Map<String, String> map) { |
| | | String splash = map.get(key); |
| | |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取首页配置信息 |
| | | * |
| | | * @param acceptData |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void getHomeConfig(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | List<FloatAD> adList = floatADService.listShowAD(1, 1); |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); |
| | | JSONObject data = new JSONObject(); |
| | | if (adList != null && adList.size() > 0) { |
| | | FloatAD ad = adList.get(0); |
| | | data.put("floatAD", gson.toJson(ad)); |
| | | } |
| | | |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | | |
| | | class ADConfig { |
| | | int version; |
| | | String type; |
New file |
| | |
| | | package com.yeshi.buwan.dao.jump; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Repository |
| | | public class JumpDetailDao extends MongodbBaseDao<JumpDetail> { |
| | | |
| | | /** |
| | | * 根据类型查询 |
| | | * |
| | | * @param jumpTypeEnum |
| | | * @return |
| | | */ |
| | | public JumpDetail selectByType(JumpTypeEnum jumpTypeEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(jumpTypeEnum)); |
| | | return findOne(query); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.recommend; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class FloatADDao extends MongodbBaseDao<FloatAD> { |
| | | |
| | | /** |
| | | * 根据是否显示查询 |
| | | * |
| | | * @param show |
| | | * @return |
| | | */ |
| | | public List<FloatAD> list(Boolean show, int start, int count) { |
| | | Query query = new Query(); |
| | | if (show != null) |
| | | query.addCriteria(Criteria.where("show").is(show)); |
| | | |
| | | List<Sort.Order> orders = new ArrayList<>(); |
| | | orders.add(new Sort.Order(Sort.Direction.DESC, "weight")); |
| | | query.with(new Sort(orders)); |
| | | |
| | | query.limit(count); |
| | | query.skip(start); |
| | | return findList(query); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.jump; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | @Document(collection = "jumpDetail") |
| | | public class JumpDetail { |
| | | @Expose |
| | | @Indexed |
| | | @Field |
| | | private JumpTypeEnum type; |
| | | @Expose |
| | | @Field |
| | | private String activity; |
| | | @Expose |
| | | @Field |
| | | private String controller; |
| | | |
| | | |
| | | public JumpTypeEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(JumpTypeEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getActivity() { |
| | | return activity; |
| | | } |
| | | |
| | | public void setActivity(String activity) { |
| | | this.activity = activity; |
| | | } |
| | | |
| | | public String getController() { |
| | | return controller; |
| | | } |
| | | |
| | | public void setController(String controller) { |
| | | this.controller = controller; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.jump; |
| | | |
| | | public enum JumpTypeEnum { |
| | | |
| | | baichuan("百川"), web("网页"),clazz("类"); |
| | | |
| | | private String name; |
| | | |
| | | private JumpTypeEnum(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.recommend; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | import java.util.Date; |
| | | |
| | | //悬浮大图广告 |
| | | @Document(collection = "floatAd") |
| | | public class FloatAD { |
| | | @Expose |
| | | @Id |
| | | private String id;//主键ID |
| | | |
| | | @Expose |
| | | @Field |
| | | private String picture;//图片 |
| | | |
| | | @Expose |
| | | @Field |
| | | private JumpDetail jumpDetail;//跳转方式 |
| | | |
| | | @Expose |
| | | @Field |
| | | private String params;//跳转参数 |
| | | |
| | | @Field |
| | | private Integer weight;//权重 |
| | | |
| | | @Field |
| | | private Boolean show;//是否显示 |
| | | |
| | | @Field |
| | | private Date createTime;//创建时间 |
| | | |
| | | @Field |
| | | private Date updateTime;//更新时间 |
| | | |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public JumpDetail getJumpDetail() { |
| | | return jumpDetail; |
| | | } |
| | | |
| | | public void setJumpDetail(JumpDetail jumpDetail) { |
| | | this.jumpDetail = jumpDetail; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public Boolean getShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(Boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.service.manager.SolrAlbumDataManager; |
| | | import com.yeshi.buwan.util.SolrUtil; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.LinuxRemoteCommandUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | |
| | | /** |
| | |
| | | @Component |
| | | public class SolrJob { |
| | | |
| | | @Resource |
| | | private SolrAlbumDataManager solrAlbumDataManager; |
| | | |
| | | @XxlJob("solr-watch") |
| | | public ReturnT<String> reStartSolr(String param) throws Exception { |
| | | String solrIP = "172.16.16.12"; |
| | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 同步专辑 |
| | | * |
| | | * @param param |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @XxlJob("solr-syncAlbum") |
| | | public ReturnT<String> syncAlbum(String param) throws Exception { |
| | | solrAlbumDataManager.syncAllAlbum(); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 同步常规搜索 |
| | | * |
| | | * @param param |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @XxlJob("solr-syncVideoCore") |
| | | public ReturnT<String> syncCore(String param) throws Exception { |
| | | //同步视频 |
| | | SolrUtil.dataimportVideo(param); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.ad; |
| | | |
| | | import com.yeshi.buwan.dao.recommend.FloatADDao; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import com.yeshi.buwan.service.inter.ad.FloatADService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class FloatADServiceImpl implements FloatADService { |
| | | |
| | | @Resource |
| | | private FloatADDao floatADDao; |
| | | |
| | | @Override |
| | | public List<FloatAD> listShowAD(int page, int pageSize) { |
| | | return floatADDao.list(true, (page - 1) * pageSize, pageSize); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.baidu; |
| | | |
| | | import com.yeshi.buwan.service.inter.baidu.BaiDuCPUService; |
| | | import com.yeshi.buwan.util.BaiDuCPUUtil; |
| | | import com.yeshi.buwan.vo.baidu.BaiDuCPUTypeVO; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class BaiDuCPUServiceImpl implements BaiDuCPUService { |
| | | |
| | | |
| | | @Cacheable(value = "classCache", key = "'baidu-getNewsTypeList'") |
| | | @Override |
| | | public List<BaiDuCPUTypeVO> getNewsTypeListCache() { |
| | | return BaiDuCPUUtil.getNewsTotalTypes(); |
| | | } |
| | | |
| | | @Cacheable(value = "classCache", key = "'baidu-getVideoTypeList'") |
| | | @Override |
| | | public List<BaiDuCPUTypeVO> getVideoTypeListCache() { |
| | | return BaiDuCPUUtil.getVideosTotalTypes(); |
| | | } |
| | | |
| | | @Cacheable(value = "classCache", key = "'baidu-getNewsSafeTypeList'") |
| | | @Override |
| | | public List<BaiDuCPUTypeVO> getNewsSafeTypeListCache() { |
| | | return BaiDuCPUUtil.getNewsSafeTypes(); |
| | | } |
| | | |
| | | @Cacheable(value = "classCache", key = "'baidu-getVideoSafeTypeList'") |
| | | @Override |
| | | public List<BaiDuCPUTypeVO> getVideoSafeTypeListCache() { |
| | | return BaiDuCPUUtil.getVideoSafeTypes(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.jump; |
| | | |
| | | import com.yeshi.buwan.dao.jump.JumpDetailDao; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.service.inter.jump.JumpDetailService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | public class JumpDetailServiceImpl implements JumpDetailService { |
| | | |
| | | @Resource |
| | | private JumpDetailDao jumpDetailDao; |
| | | |
| | | @Override |
| | | public JumpDetail selectByType(JumpTypeEnum type) { |
| | | return jumpDetailDao.selectByType(type); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.ad; |
| | | |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface FloatADService { |
| | | |
| | | /** |
| | | * 查询正在显示的广告 |
| | | * |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<FloatAD> listShowAD(int page, int pageSize); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.baidu; |
| | | |
| | | import com.yeshi.buwan.vo.baidu.BaiDuCPUTypeVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 百度内容联盟服务 |
| | | */ |
| | | public interface BaiDuCPUService { |
| | | |
| | | /** |
| | | * @return |
| | | */ |
| | | public List<BaiDuCPUTypeVO> getNewsTypeListCache(); |
| | | |
| | | public List<BaiDuCPUTypeVO> getVideoTypeListCache(); |
| | | |
| | | public List<BaiDuCPUTypeVO> getNewsSafeTypeListCache(); |
| | | |
| | | public List<BaiDuCPUTypeVO> getVideoSafeTypeListCache(); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.jump; |
| | | |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | |
| | | public interface JumpDetailService { |
| | | |
| | | public JumpDetail selectByType(JumpTypeEnum type); |
| | | |
| | | } |
| | |
| | | |
| | | // 全量更新 |
| | | public static void dataimportVideo() { |
| | | dataimportVideo("new_video"); |
| | | |
| | | } |
| | | |
| | | public static void dataimportVideo(String core) { |
| | | // 分页请求 |
| | | int pageSize = 10000; |
| | | for (int i = 0; i < 200; i++) { |
| | | String url = String.format("http://%s:8983/solr/new_video/dataimport?_=%s&indent=on&wt=json", |
| | | Constant.IsOutNet ? IP_IN : IP_OUT, System.currentTimeMillis() + ""); |
| | | String url = String.format("http://%s:8983/solr/%s/dataimport?_=%s&indent=on&wt=json", |
| | | Constant.IsOutNet ? IP_IN : IP_OUT, core, System.currentTimeMillis() + ""); |
| | | |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("command", "full-import"); |
| | | map.put("verbose", "false"); |
| | | map.put("clean", "false"); |
| | | map.put("commit", "true"); |
| | | map.put("core", "new_video"); |
| | | map.put("core", core); |
| | | map.put("entity", "video"); |
| | | map.put("startIndex", i * pageSize + ""); |
| | | map.put("count", pageSize + ""); |
| | | map.put("name", "dataimport"); |
| | | HttpUtil.post(url, map); |
| | | try { |
| | | Thread.sleep(1000 * 20);// 间隔1分钟 |
| | | Thread.sleep(1000 * 20);// 间隔20s |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | "http://%s:8983/solr/buwan_videotype_video/deltaimport?command=delta-import&commit=true&wt=json&indent=true&verbose=false&clean=false&optimize=false&debug=false", |
| | | Constant.IsOutNet ? IP_IN : IP_OUT); |
| | | HttpUtil.get(url); |
| | | }; |
| | | } |
| | | |
| | | ; |
| | | |
| | | } |
| | |
| | | private int id; |
| | | |
| | | public BaiDuCPUTypeVO() { |
| | | |
| | | } |
| | | |
| | | public BaiDuCPUTypeVO(String name, int id) { |
| | |
| | | <id>1060</id> |
| | | </item> |
| | | <item> |
| | | <name>小视频</name> |
| | | <id>1085</id> |
| | | </item> |
| | | <item> |
| | | <name>小品</name> |
| | | <id>1062</id> |
| | | </item> |
| | |
| | | |
| | | @Test |
| | | public void test3() { |
| | | String appId = "10409568"; |
| | | String version = AppMarketUtil.getHWLatestVersion(appId); |
| | | System.out.println(version); |
| | | SolrUtil.dataimportVideo(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hxh.spring.test.ad; |
| | | |
| | | |
| | | import com.yeshi.buwan.dao.jump.JumpDetailDao; |
| | | import com.yeshi.buwan.dao.recommend.FloatADDao; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.json.JSONObject; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class AdTest { |
| | | |
| | | @Resource |
| | | private JumpDetailDao jumpDetailDao; |
| | | |
| | | @Resource |
| | | private FloatADDao floatADDao; |
| | | |
| | | @Test |
| | | public void addJumpDetail() { |
| | | JumpDetail detail = new JumpDetail(); |
| | | detail.setActivity(""); |
| | | detail.setController(""); |
| | | detail.setType(JumpTypeEnum.baichuan); |
| | | jumpDetailDao.save(detail); |
| | | } |
| | | |
| | | @Test |
| | | public void getJumpDetail() { |
| | | JumpDetail detail = jumpDetailDao.selectByType(JumpTypeEnum.baichuan); |
| | | System.out.println(detail); |
| | | } |
| | | |
| | | @Test |
| | | public void addFloatAd() { |
| | | JumpDetail detail = jumpDetailDao.selectByType(JumpTypeEnum.baichuan); |
| | | JSONObject params = new JSONObject(); |
| | | params.put("url", "https://s.click.taobao.com/2K0Nxtv"); |
| | | FloatAD ad = new FloatAD(); |
| | | ad.setId(StringUtil.Md5(System.currentTimeMillis() + "")); |
| | | ad.setJumpDetail(detail); |
| | | ad.setParams(params.toString()); |
| | | ad.setPicture("http://ec-1255749512.file.myqcloud.com/img/FloatAD/5cba7bfd927e4c1d958808acd22bab58.png"); |
| | | ad.setShow(true); |
| | | ad.setWeight(1); |
| | | floatADDao.save(ad); |
| | | } |
| | | } |