|
|
@@ -1,15 +1,18 @@
|
|
|
package com.mokamrp.privates.service.pangu.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashOasBox;
|
|
|
import com.mokamrp.privates.mapper.pangu.FosterwxCashOasBoxMapper;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashOasBoxService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.mokamrp.privates.utils.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import com.mokamrp.privates.entity.ResHandle;
|
|
|
+
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
@@ -25,8 +28,10 @@ public class FosterwxCashOasBoxServiceImpl extends ServiceImpl<FosterwxCashOasBo
|
|
|
|
|
|
@Autowired
|
|
|
public FosterwxCashOasBoxMapper fosterwxCashOasBoxMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 获取数据列表 支持分页
|
|
|
+ *
|
|
|
* @param handle
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -40,4 +45,40 @@ public class FosterwxCashOasBoxServiceImpl extends ServiceImpl<FosterwxCashOasBo
|
|
|
res.setTotal(pageObj.getTotal());
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取一个有效的小程序
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public FosterwxCashOasBox getRandBox() {
|
|
|
+ List<FosterwxCashOasBox> list = this.list(new QueryWrapper<FosterwxCashOasBox>()
|
|
|
+ .eq("type", 1)
|
|
|
+ .eq("fobidden_status",1));
|
|
|
+ if (list == null || list.size() <= 0) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ int max = list.size()-1;
|
|
|
+ int min = 0;
|
|
|
+ Random random = new Random();
|
|
|
+ int i = random.nextInt(max) % (max - min + 1) + min;
|
|
|
+ return list.get(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取一个有效的公众号
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public FosterwxCashOasBox getRandOas() {
|
|
|
+ List<FosterwxCashOasBox> list = this.list(new QueryWrapper<FosterwxCashOasBox>()
|
|
|
+ .eq("type", 2)
|
|
|
+ .eq("fobidden_status",1));
|
|
|
+ if (list == null || list.size() <= 0) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ int max = list.size()-1;
|
|
|
+ int min = 0;
|
|
|
+ Random random = new Random();
|
|
|
+ int i = random.nextInt(max) % (max - min + 1) + min;
|
|
|
+ return list.get(i);
|
|
|
+ }
|
|
|
}
|