Commit 296aae7b authored by gm's avatar gm

修正循环获取上线日期,而没有及时break的问题

parent 4cef2763
......@@ -26,7 +26,7 @@ gem mail 提供了邮件能力。具体见send_email方法的实现
def login
# 登录
options = {
:body => {:os_username => "wangyang", :os_password => 'wind1988wind', :login => '%E7%99%BB%E5%BD%95' },
:body => {:os_username => " jaguar", :os_password => 'jaguar@GM123', :login => '%E7%99%BB%E5%BD%95' },
:headers => {
'Content-Type' => 'application/x-www-form-urlencoded',
'Accept' => 'application/json, text/javascript, */*; q=0.01'
......@@ -66,14 +66,14 @@ end
# 类似于“7.11开发”这样的事件名,用于对比记录邮件是否已经发送
$dev_title = ""
# 类似于“7.11客户端提交”这样的事件名,用于稍后发邮件
$title = ""
$submit_title = ""
# 类似于“7.11客户端提交”这样的事件的时间,用于稍后发邮件
$date = ""
$submit_date = ""
# 用来存储全局变量$dev_title的文件名
STORE_KEY = "sprintEmailHistory.log"
# 返回值:Deliver
def get_deliver_info
def get_submit_info
# 以后端上线时间为准,保证程序员不被其它工作量压到下一个迭代的开发周
dev_event_id = "e1c8aef8-130e-40bf-8f6c-fe0e5c5dbd9c" # 提交时间
# backend_deploy_event_id = "8389fda3-a06c-49b5-af85-788c4af12071" # 后端上线时间
......@@ -84,8 +84,9 @@ def get_deliver_info
for event in obj.events
deploy_date = Date.parse(event.start)
if deploy_date > today
$title = event.title
$date = deploy_date
$submit_title = event.title
$submit_date = deploy_date
break
end
end
end
......@@ -114,7 +115,6 @@ def should_send_email_today
puts "history #{history}"
for event in obj.events
puts "#{event.title} #{event.start}"
start = Date.parse(event.start)
if start == today
......@@ -122,6 +122,7 @@ def should_send_email_today
puts "#{event.title} 版本已经发过邮件"
return false
else
puts "dev_title #{$dev_title}, event_title #{event.title}"
$dev_title = event.title
puts "可以发送邮件"
return true
......@@ -149,28 +150,37 @@ def send_email()
mail = Mail.deliver do
# 其实下面都是方法调用,不要被迷惑了
to ['hualu@igengmei.com', 'wangjun@igengmei.com', 'sunwenhui@igengmei.com', 'zhucuicui@igengmei.com', 'huchunhe@igengmei.com', 'dongqiang@igengmei.com', 'SJ-liuxiao@igengmei.com', 'client-rd@igengmei.com']
# to ['jaguar@igengmei.com']
to ['hualu@igengmei.com', 'wangjun@igengmei.com', 'sunwenhui@igengmei.com', 'zhucuicui@igengmei.com', 'huchunhe@igengmei.com', 'dongqiang@igengmei.com', 'SJ-liuxiao@igengmei.com', 'client-rd@igengmei.com', 'wanghongying@igengmei.com', 'liuxiaojie@igengmei.com']
#to ['jaguar@igengmei.com']
bcc 'jaguar@igengmei.com' # 抄送
from 'jaguar@igengmei.com' # 发件人
subject "更美app#{$title}商店物料信息"
subject "更美app#{$submit_title}商店物料信息"
text_part do
content_type "text/plain; charset=utf-8"
body <<-EOF
Hi,All
#{$title}时间为#{$date.to_s},请准备商店相关的物料信息(是否更换APP icon和商店海报),谢谢~
#{$submit_title}时间为#{$submit_date.to_s},请准备商店相关的物料信息(是否更换APP icon和商店海报),谢谢~
EOF
end
end
end
def test_email_body()
puts <<-EOF
Hi,All
#{$submit_title}时间为#{$submit_date.to_s},请准备商店相关的物料信息(是否更换APP icon和商店海报),谢谢~
EOF
end
login
if should_send_email_today
get_deliver_info
get_submit_info
begin
# test_email_body
# 邮件发送成功后,再存储数据
send_email
set_store_value(STORE_KEY, $dev_title)
......
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