Commit 24b53533 by Ngô Trung Hưng

create top id1

parent 2dfce383
......@@ -23,6 +23,7 @@ gem 'jbuilder', '~> 2.5'
gem 'nokogiri'
gem 'rubyzip'
gem 'whenever'
gem 'rails-asset-jqueryui'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
......
......@@ -86,6 +86,10 @@ GEM
io-like (0.3.1)
jbuilder (2.10.0)
activesupport (>= 5.0.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
libv8 (3.16.14.19)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
......@@ -133,6 +137,8 @@ GEM
bundler (>= 1.3.0)
railties (= 5.2.4.3)
sprockets-rails (>= 2.0.0)
rails-asset-jqueryui (0.0.3)
jquery-rails
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
......@@ -240,6 +246,7 @@ DEPENDENCIES
pry
puma (~> 3.11)
rails (~> 5.2.4, >= 5.2.4.3)
rails-asset-jqueryui
rails_12factor
rubocop
rubyzip
......
$(document).on("turbolinks:load", function(){
// => btn-favorite
$('.btn_favorite_outline').click(function (e) {
$(this).toggleClass('active');
});
});
\ No newline at end of file
// => end
// => scroll to top
$(window).scroll(function(){
if ($(this).scrollTop() > 550) {
$(".btn-scroll-top").css('opacity',1);
$(".btn-scroll-top").fadeIn(400);
} else {
$(".btn-scroll-top").fadeOut(400);
}
});
$(".btn-scroll-top").click(function (e){
var body = $("html, body");
body.stop().animate({scrollTop:0}, 700, 'swing')
});
// => end
});
......@@ -7,6 +7,34 @@ body {
overflow: hidden;
// background-color: #f0f0f0;
}
// scroll to top
.btn-scroll-top {
position: fixed;
bottom: 30px;
right: 30px;
height: 50px;
width: 50px;
border-radius: 5px;
background-color: rgba($color: #000000, $alpha: 0.2);
cursor: pointer;
padding: 12px;
z-index: 2000;
transition: 0.3;
opacity: 0;
&:hover {
background-color: rgba($color: #000000, $alpha: 0.7);
transition: 0.3;
}
}
.box-btn-scroll-top {
height: 30px;
transform: translateY(-5px);
.icon-scroll {
font-size: 40px;
color: rgba($color: #636363, $alpha: 0.8);
}
}
$breakpoint-tablet: 992px;
$main-color: #23303D;
......@@ -14,7 +42,7 @@ $main-color: #23303D;
.cus_header {
height: 52px;
width: 100%;
background-image: linear-gradient(30deg, #434343, #000000);
background-image: linear-gradient(20deg, #434343, #000000);
position: fixed;
border-bottom: 1px solid #333;
// box-shadow: 0px 2px 4px 2px #999;
......
......@@ -7,5 +7,6 @@
<%= render 'shared/box_five_job' %>
<%= render 'shared/box_nine_city' %>
<%= render 'shared/box_nine_industries' %>
<%= render 'shared/scroll_top' %>
......@@ -6,7 +6,6 @@
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.7/css/all.css">
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@200&display=swap" rel="stylesheet">
......
<div class="btn-scroll-top">
<div class="box-btn-scroll-top">
<i class="fas fa-caret-up icon-scroll"></i>
</div>
</div>
\ No newline at end of file
......@@ -14,7 +14,7 @@ default: &default
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password: '12345678'
password: '1'
socket: /var/run/mysqld/mysqld.sock
......
env :PATH, ENV['PATH']
every 10.minutes do
rake "crawler:populate"
rake "crawler:populate", output: {error: 'error.log', standard: 'cron.log'}
end
every :day, at: "19:00pm"do
......
=> 2020-07-23 22:40:02 +0700
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
rake aborted!
ActiveRecord::StatementInvalid: Mysql2::Error::ConnectionError: MySQL server has gone away: SELECT `industries`.* FROM `industries` WHERE `industries`.`name` = 'Ngân hàng' LIMIT 1
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:186:in `block in make_foreign_industries_table'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:184:in `each'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:184:in `make_foreign_industries_table'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:98:in `add_data'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:130:in `crawl_data_jobs_interface_1'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:212:in `block in make_data'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:209:in `each'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:209:in `each_with_index'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:209:in `make_data'
/home/hungnt/hungnt_venjob/lib/tasks/crawler.rake:9:in `block (2 levels) in <main>'
/home/hungnt/.rbenv/versions/2.6.6/bin/bundle:23:in `load'
/home/hungnt/.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'
Caused by:
Mysql2::Error::ConnectionError: MySQL server has gone away
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:186:in `block in make_foreign_industries_table'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:184:in `each'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:184:in `make_foreign_industries_table'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:98:in `add_data'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:130:in `crawl_data_jobs_interface_1'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:212:in `block in make_data'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:209:in `each'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:209:in `each_with_index'
/home/hungnt/hungnt_venjob/lib/src/interface_web.rb:209:in `make_data'
/home/hungnt/hungnt_venjob/lib/tasks/crawler.rake:9:in `block (2 levels) in <main>'
/home/hungnt/.rbenv/versions/2.6.6/bin/bundle:23:in `load'
/home/hungnt/.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'
Tasks: TOP => crawler:populate
(See full trace by running task with --trace)
......@@ -28,9 +28,6 @@ class FtpSever
def self.parse_csv_industries(data)
puts 'Import data industries . . .'
industries = []
# data['category'].each do |val|
# industries << val.strip
# end
industries += data['category'].map(&:strip)
industries.each do |val|
val.gsub!(',','/') if val.include?(',')
......
......@@ -29,7 +29,7 @@ class InterfaceWeb
end
def self.get_link_job_and_companies
@crawl_link_for_companies_jobs ||= crawl_link_for_companies_jobs(1)
@crawl_link_for_companies_jobs ||= crawl_link_for_companies_jobs(10)
end
def self.safe_link(url)
......@@ -206,8 +206,7 @@ class InterfaceWeb
break if @@stop_crawl == val
arr_link << val
end
arr_link.reverse.each_with_index do |path,i|
break if @@stop_crawl == path
arr_link.reverse!.each_with_index do |path,i|
page = Nokogiri::HTML(URI.open(URI.parse(URI.escape(path))))
if page.search(".item-blue .detail-box:nth-child(1) ul li:nth-child(1) p")[0] != nil
crawl_data_jobs_interface_1(page)
......
hello 2020-07-23 17:03:02 +0700
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment