master-sf1.0

This commit is contained in:
qihao.gong@jikimo.com
2023-05-06 16:03:00 +08:00
parent fcf0354a1e
commit 0077d97cfa
307 changed files with 20636 additions and 0 deletions

28
sf_base/commons/common.py Normal file
View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from odoo import fields, models, api
import time
import hashlib
class Common(models.Model):
_name = 'sf.sync.common'
_description = u'公用类'
def get_headers(self,token, secret_key):
'''
获取requests中的heardes参数
'''
timestamp = int(time.time())
check_str = '%s%s%s' % (token, timestamp, secret_key)
check_sf_str = hashlib.sha1(check_str.encode('utf-8')).hexdigest()
headers = {'TOKEN': token,
'TIMESTAMP': str(timestamp),
'checkstr': check_sf_str}
return headers