1. Chao Yang
  2. zpage

Commits

Chao Yang  committed 10a5fee Draft

fix

  • Participants
  • Parent commits 5e5e0cd
  • Branches yangchao_20120604_task

Comments (0)

Files changed (4)

File config/privilege.py

View file
 PRIVILEGE_FEED_IMPORT = 1
 PRIVILEGE_TAG = 2
 PRIVILEGE_VPS = 3
+PRIVILEGE_LIBRARIAN = 4
 
 

File ctrl/zsite/po_event.py

View file
 from zkit.errtip import Errtip
 from zkit.jsdict import JsDict
 from zkit.earth import pid_city
-from model.days import today_ymd_int, ymd2minute, minute2ymd, ONE_DAY_MINUTE
+from model.days import today_ymd_int, ymdhm2minute, minute2ymd, ONE_DAY_MINUTE
 from model.pic import Pic
 from model.cid import CID_EVENT, CID_EVENT_FEEDBACK, CID_NOTICE_EVENT_JOINER_FEEDBACK, CID_NOTICE_EVENT_ORGANIZER_SUMMARY
 from model.state import STATE_RM, STATE_SECRET, STATE_ACTIVE
     if not can_change:
         city_pid = end = begin = None
     else:
-        begin_time_hour = int(begin_time_hour)
-        begin_time_minute = int(begin_time_minute)
-
-        end_time_hour = int(end_time_hour)
-        end_time_minute = int(end_time_minute)
-
-        if begin_time_hour > 23 or begin_time_hour < 0:
-            begin_time_hour = 10
-
-        if end_time_hour > 23 or end_time_hour < 0:
-            end_time_hour = 11
-
-        if begin_time_minute > 59 or begin_time_minute < 0:
-            begin_time_minute = 0
-
-        if end_time_minute > 59 or end_time_minute < 0:
-            end_time_minute = 30
-
         if begin_time:
             begin_time = int(begin_time)
 
             errtip.begin_time = '这个时间 , 属于过去'
 
 
-        begin = ymd2minute(begin_time)+begin_time_hour*60+begin_time_minute
-        end = ymd2minute(end_time)+end_time_hour*60+end_time_minute
+        begin = ymdhm2minute(begin_time, begin_time_hour, begin_time_minute)
+        end = ymdhm2minute(end_time, end_time_hour, end_time_minute)
 
         if not event_cid.isdigit():
             errtip.event_cid = '请选择类型'

File ctrl/zsite/po_task.py

View file
 # -*- coding: utf-8 -*-
 from _handler import ZsiteBase, LoginBase, login
 from ctrl._urlmap.zsite import urlmap
-from model.days import ymdhm2minutes
+from model.days import ymdhm2minute
 from model.po_task import po_task_new
 
 @urlmap('/po/task')
         limit = int(self.get_argument('limit',0))
 
         address = self.get_argument('address','')
-        end_time = ymdhm2minutes(int(self.get_argument('end_time',0)))
+        end_time = ymdhm2minute(
+            self.get_argument('end_time',0), 
+            self.get_argument('end_hour',0),
+            self.get_argument('end_minute',0),
+        )
         cost = self.get_argument('cost',0) 
         price = int(self.get_argument('price',0))
         reward = self.get_argument('reward','') 

File model/days.py

View file
         return t.year*10000 + t.month*100 + t.day
     return 0
 
-def ymdhm2minutes(ymdhm):
-    if ymdhm:
-        return ymd2days(ymd//10000)+ymdhm//100*60+ymdhm%100
-    return 0
+def ymdhm2minute(ymd, hour, minute):
+    hour = int(hour)
+    minute = int(minute)
+    if minute > 59 or minute < 0:
+        minute = 30
+    if hour > 23 or hour < 0:
+        hour = 12 
+    return ymd2minute(ymd)+hour*60+minute
 
 
 def minute2date(minute):