Skip to content

Commit 3c6c0e6

Browse files
author
danbai225
committed
bug修复
1 parent abf1216 commit 3c6c0e6

File tree

10 files changed

+303
-248
lines changed

10 files changed

+303
-248
lines changed

.idea/workspace.xml

Lines changed: 202 additions & 209 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py/pa.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
# ping MySQL服务端,检查是否服务可用。# 如:0 = None = never, 1 = default = whenever it is requested, 2 = when a cursor is created, 4 = when a query is executed, 7 = always
2323
host='127.0.0.1',
2424
port=3306,
25-
user='123',
26-
password='123',
27-
database='ys',
25+
user='ys',
26+
password='***',
27+
database='**',
2828
charset='utf8'
2929
)
3030
class Ji:
@@ -49,24 +49,18 @@ def getHtml(url):
4949
global proxy
5050
try:
5151
html = requests.get(url,headers=header,timeout=5)
52-
# 使用代理访问
5352
return html
5453
except Exception as e:
55-
get_proxy()
5654
print(e)
5755
run(url)
5856
def main():
59-
#get_proxy()
60-
conn = POOL.connection()
61-
cursor = conn.cursor()
62-
#获取最大id
63-
cursor.execute('SELECT MAX( id )FROM ysb')
64-
maxid=cursor.fetchone()[0]
65-
conn.close()
57+
r=getHtml("http://www.okzy.co/?m=vod-index-pg-1.html")
58+
selector=etree.HTML(r.text)
59+
list=selector.xpath("//span[@class=\"xing_vb4\"]/a/@href")
6660
#创建线程池
6761
pool = ThreadPool(20)
68-
for num in range(30000,maxid+200):
69-
url="http://www.okzyw.com/?m=vod-detail-id-{}.html".format(num)
62+
for s in list:
63+
url="http://www.okzyw.com"+s
7064
try:
7165
pool.apply_async(run, args=(url,))
7266
except Exception as e:

py/tagpa.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
setsession=[], # 开始会话前执行的命令列表。如:["set datestyle to ...", "set time zone ..."]
2020
ping=0,
2121
# ping MySQL服务端,检查是否服务可用。# 如:0 = None = never, 1 = default = whenever it is requested, 2 = when a cursor is created, 4 = when a query is executed, 7 = always
22-
host='127.0.0.1',
22+
host='39.108.110.44',
2323
port=3306,
2424
user='ys',
25-
password='123',
26-
database='123',
25+
password='***',
26+
database='ys',
2727
charset='utf8'
2828
)
2929
proxys=[]
@@ -34,13 +34,15 @@ def get_proxy():
3434
r=requests.get("http://ip.jiangxianli.com/")
3535
if(r.status_code==200):
3636
selector=etree.HTML(r.text)
37-
proxys=proxys+selector.xpath("//button[@class=\"btn btn-sm btn-copy\"]/@data-url")
37+
proxys=proxys+selector.xpath('//button[@class="layui-btn layui-btn-sm btn-copy"]/@data-url')
3838
#获取页面html
3939
def getHtml(url):
4040
global proxys
4141
p=proxys[random.randint(0,len(proxys)-1)]
4242
try:
43-
html = requests.get(url,proxies={'http':p},headers=header,timeout=5)
43+
pp=p.replace("http://","")
44+
pp=pp.replace("https://","")
45+
html = requests.get(url,proxies={'http':pp},headers=header,timeout=5)
4446
if html!=None:
4547
return html.text
4648
except Exception:
@@ -49,15 +51,14 @@ def getHtml(url):
4951
get_proxy()
5052
return getHtml(url)
5153
def main():
54+
global proxys
5255
get_proxy()
5356
conn = POOL.connection()
5457
cursor = conn.cursor()
55-
cursor.execute('SELECT MAX( id )FROM ysb')
56-
maxid=cursor.fetchone()[0]
57-
cursor.execute('SELECT id,pm,dy,lx,gkdz,xzdz FROM `ysb` WHERE id >'+str(maxid-5000))
58+
cursor.execute("SELECT id,pm,dy,lx,gkdz,xzdz FROM `ysb` ORDER BY `gxtime` DESC LIMIT 30")
5859
data = cursor.fetchall()
59-
rpool = redis.ConnectionPool(host='127.0.0.1', port=6379,db=0,password='123')
60-
pool = ThreadPool(100)
60+
rpool = redis.ConnectionPool(host='39.108.110.44', port=6379,db=0,password='***')
61+
pool = ThreadPool(30)
6162
for ys in data:
6263
try:
6364
r = redis.Redis(connection_pool=rpool)

src/main/java/com/danbai/ys/controller/MainController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ String person(HttpServletRequest request, Model model) {
165165
return "login";
166166
}
167167
List<Gkls> gkls = ysService.getGkls(user.getUsername());
168+
model.addAttribute("gks", gkls.size());
168169
if (gkls.size() > Gkls.MAX) {
169170
gkls = gkls.subList(0, 30);
170171
}
171172
model.addAttribute("gkls", gkls);
172-
model.addAttribute("gks", gkls.size());
173173
return "person";
174174
}
175175
}

src/main/java/com/danbai/ys/controller/YsController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ String search(String gjc, Model model) {
147147
if ("".equals(gjc)) {
148148
return "/index";
149149
}
150-
model.addAttribute("ysb", ysService.selectYsByGjc(gjc));
150+
if(gjc.length()>1){
151+
model.addAttribute("ysb", ysService.selectYsByGjc(gjc));
152+
}else {
153+
model.addAttribute("ysb", ysService.selectYsByPm(gjc));
154+
}
151155
model.addAttribute("gjc", gjc);
152156
return "search";
153157
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.danbai.ys.controller.restful.v1;
2+
3+
import com.alibaba.fastjson.JSONObject;
4+
import com.danbai.ys.entity.BaseResult;
5+
import com.danbai.ys.entity.UpdateInfo;
6+
import com.danbai.ys.utils.ResultUtil;
7+
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.data.redis.core.RedisTemplate;
9+
import org.springframework.web.bind.annotation.GetMapping;
10+
import org.springframework.web.bind.annotation.RequestMapping;
11+
import org.springframework.web.bind.annotation.RestController;
12+
13+
14+
/**
15+
* @author danbai
16+
* @date 2019-11-14 17:53
17+
*/
18+
@RestController
19+
@RequestMapping("/api/v1")
20+
public class App {
21+
@Autowired
22+
RedisTemplate redisTemplate;
23+
@GetMapping("/update")
24+
public BaseResult thisUser() {
25+
String appupdate = (String) redisTemplate.opsForValue().get("appupdate");
26+
if(appupdate!=null){
27+
return ResultUtil.success(JSONObject.parseObject(appupdate, UpdateInfo.class));
28+
}
29+
return ResultUtil.success(new UpdateInfo());
30+
}
31+
}

src/main/java/com/danbai/ys/controller/restful/v1/Ys.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ public BaseResult ysOne(@PathVariable int id) {
4747
*/
4848
@GetMapping("/ys/search/{gjc}")
4949
public BaseResult search(@PathVariable String gjc) {
50-
return ResultUtil.success(ysService.qcsy(ysService.selectYsByGjc(gjc)));
50+
if(gjc.length()>1){
51+
return ResultUtil.success(ysService.qcsy(ysService.selectYsByGjc(gjc)));
52+
}
53+
return ResultUtil.success(ysService.qcsy(ysService.selectYsByPm(gjc)));
5154
}
5255
@GetMapping("/ys/tv")
5356
public BaseResult tv(){
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.danbai.ys.entity;
2+
/**
3+
* @author danbai
4+
* @date 2019-11-14 17:50
5+
*/
6+
public class UpdateInfo {
7+
// 是否有新版本
8+
public boolean hasUpdate = false;
9+
// 是否静默下载:有新版本时不提示直接下载
10+
public boolean isSilent = false;
11+
// 是否强制安装:不安装无法使用app
12+
public boolean isForce = false;
13+
// 是否下载完成后自动安装
14+
public boolean isAutoInstall = true;
15+
// 是否可忽略该版本
16+
public boolean isIgnorable = true;
17+
// 一天内最大提示次数,<1时不限
18+
public int maxTimes = 0;
19+
public int versionCode;
20+
public String versionName;
21+
public String updateContent;
22+
public String url;
23+
public String md5;
24+
public long size;
25+
}

src/main/java/com/danbai/ys/service/impl/YsServiceImpl.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void addYsTime(VideoTime videoTime) {
158158
Example example = new Example(VideoTime.class);
159159
example.createCriteria().andEqualTo("username", videoTime2.getUsername()).andEqualTo("ysid",
160160
videoTime2.getYsid());
161-
int i = videoTimeMapper.deleteByExample(example);
161+
videoTimeMapper.deleteByExample(example);
162162
}
163163
videoTimeMapper.insert(videoTime);
164164
}
@@ -180,17 +180,19 @@ public List<Gkls> getGkls(String username) {
180180
List<VideoTime> select = videoTimeMapper.selectByExample(example);
181181
List<Gkls> list = new ArrayList<>();
182182
for (VideoTime v : select) {
183-
Gkls gkls = new Gkls();
184-
Ysb ysb = selectYsById(v.getYsid());
185-
if (ysb != null) {
186-
gkls.setPm(ysb.getPm());
187-
gkls.setYsimg(ysb.getTp());
183+
if((v.getTime()>30)){
184+
Gkls gkls = new Gkls();
185+
Ysb ysb = selectYsById(v.getYsid());
186+
if (ysb != null) {
187+
gkls.setPm(ysb.getPm());
188+
gkls.setYsimg(ysb.getTp());
189+
}
190+
gkls.setJi(v.getYsjiname());
191+
gkls.setTime(DateUtils.secondToTime(v.getTime().longValue()));
192+
gkls.setGktime(v.getGktime());
193+
gkls.setId(v.getYsid());
194+
list.add(gkls);
188195
}
189-
gkls.setJi(v.getYsjiname());
190-
gkls.setTime(DateUtils.secondToTime(v.getTime().longValue()));
191-
gkls.setGktime(v.getGktime());
192-
gkls.setId(v.getYsid());
193-
list.add(gkls);
194196
}
195197
return list;
196198
}

src/main/resources/templates/ys/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ <h4 id="jxs" th:text="${jiname}"></h4>
261261
}
262262

263263
$(document).ready(function () {
264+
getjii()
264265
gettagid();
265266
dmdsq();
266267
if (username != "user") {
@@ -283,10 +284,11 @@ <h4 id="jxs" th:text="${jiname}"></h4>
283284
}
284285

285286
function getjii() {
287+
console.log("1111")
286288
$(".dslist-group").children().each(function(i,n){
287289
var obj = $(n)
288290
if(obj.children().eq(0).html()==jiname){
289-
this.jii=i;
291+
jii=i;
290292
}
291293
});
292294
}

0 commit comments

Comments
 (0)