中国本土应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5KB

  1. # -*- coding: utf-8 -*-
  2. import json
  3. import requests
  4. from datetime import datetime, timedelta
  5. import time
  6. from odoo import api, fields, models, SUPERUSER_ID, _
  7. from collections import OrderedDict
  8. class WecomClientApi(models.TransientModel):
  9. _name = "wecom.client_api"
  10. _description = "Wecom Client API"
  11. @api.model
  12. def geContactsDisplayAgentConfig(self, postDatas):
  13. """
  14. 获取企业微信通讯录展示组件的应用配置
  15. """
  16. configs = []
  17. result = {}
  18. for data in postDatas:
  19. config = {}
  20. company = self.env['res.company'].search([('id','=',data['company_id'])])
  21. self_built_app = company.self_built_app_id
  22. timestamp = int(time.time())
  23. nonceStr = self.env["wecomapi.tools.security"].random_str(8)
  24. jsapi_ticket = company.contacts_app_id.jsapi_ticket
  25. signature = self.env["wecomapi.tools.security"].generate_jsapi_signature(jsapi_ticket,nonceStr,timestamp)
  26. config.update({
  27. "company_id":company.id,
  28. "corpid":company.corpid,
  29. "agentid":self_built_app.agentid,
  30. "timestamp":timestamp,
  31. "nonceStr":nonceStr,
  32. "signature":signature,
  33. "jsApiList":['selectExternalContact'],
  34. })
  35. configs.append(config)
  36. result.update({
  37. "code":0,
  38. "msg":"ok",
  39. "configs":configs,
  40. })
  41. return result
上海开阖软件有限公司 沪ICP备12045867号-1