考勤接口

This commit is contained in:
pengyuthon
2026-02-08 22:58:09 +08:00
parent 5b5800476a
commit af23c08443
2 changed files with 11 additions and 10 deletions
+6 -6
View File
@@ -29,12 +29,12 @@ class preview(http.Controller):
if attach.mimetype in image or attach.mimetype in video or attach.mimetype in pdf or attach.mimetype in html or attach.mimetype in txt: if attach.mimetype in image or attach.mimetype in video or attach.mimetype in pdf or attach.mimetype in html or attach.mimetype in txt:
headers = [('Content-Type', attach.mimetype)] headers = [('Content-Type', attach.mimetype)]
return werkzeug.wrappers.Response(attach.raw, status=200, headers=headers) return werkzeug.wrappers.Response(attach.raw, status=200, headers=headers)
elif attach.mimetype in word: # elif attach.mimetype in word:
with io.BytesIO(attach.raw) as file: # with io.BytesIO(attach.raw) as file:
result = mammoth.convert_to_html(file) # result = mammoth.convert_to_html(file)
html = result.value # html = result.value
return template.render(html=html) # return template.render(html=html)
elif attach.mimetype in excel: elif attach.mimetype in excel or word:
# 'http://view.officeapps.live.com/op/view.aspx?src=https://oa.thtzjt.com/web/content/office_preview/' # 'http://view.officeapps.live.com/op/view.aspx?src=https://oa.thtzjt.com/web/content/office_preview/'
office_view_url = 'http://view.officeapps.live.com/op/view.aspx?src=' office_view_url = 'http://view.officeapps.live.com/op/view.aspx?src='
base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url') base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url')
@@ -192,7 +192,8 @@ class AppletAttendance(Controller):
wifi_name_list = [] wifi_name_list = []
for wifi_mac in address_ids: for wifi_mac in address_ids:
for mac in wifi_mac.wifi_name_ids: for mac in wifi_mac.wifi_name_ids:
wifi_name_list.append(mac.mac) if mac.name not in wifi_name_list:
wifi_name_list.append(mac.name)
# for address_id in address_ids: # for address_id in address_ids:
# if '天成大厦' in self_address['formatted_address']: # if '天成大厦' in self_address['formatted_address']:
# message = '可以打卡' # message = '可以打卡'
@@ -202,9 +203,9 @@ class AppletAttendance(Controller):
# card_rice = address_id.card_rice * 0.001 # 打卡范围 # card_rice = address_id.card_rice * 0.001 # 打卡范围
# if self.is_within_radius_geopy(kw['att_latitude'], kw['att_longitude'], address_id.latitude, address_id.longitude, card_rice) or kw['wifi_name'] in wifi_name_list: # if self.is_within_radius_geopy(kw['att_latitude'], kw['att_longitude'], address_id.latitude, address_id.longitude, card_rice) or kw['wifi_name'] in wifi_name_list:
wifi = kw['wifi_name'] wifi = kw['wifi_name']
_logger.info(f'{wifi}-------------') # _logger.info(f'{wifi}-------------')
_logger.info(f'{wifi}-------------') # _logger.info(f'{wifi}-------------')
_logger.info(f'{wifi}-------------') # _logger.info(f'{wifi}-------------')
if kw['wifi_name'] in wifi_name_list: if kw['wifi_name'] in wifi_name_list:
message = '可以打卡' message = '可以打卡'
state = 'yes' state = 'yes'