This commit is contained in:
doudou201703
2026-08-06 20:39:45 +08:00
parent 046fac6dc1
commit 3ff0faebb9
38 changed files with 1029 additions and 611 deletions
@@ -1,22 +0,0 @@
from django.db import models
from uuid6 import uuid8
class wecom企微员工( models.Model ):
"""城市信息表"""
objects = models.Manager( ) #
wecom企微员工_id = models.UUIDField( primary_key=True, default=uuid8 )
# id_str = models.CharField(max_length=128, default=generator.generate_str)
wecom_userid = models.CharField( max_length=128, )
wecom_department = models.CharField( max_length=128, null=True, blank=True )
dateAndTime = models.DateTimeField( auto_now_add=True, db_comment="创建时间" ) # 数据创建时间
updateTime = models.DateTimeField( auto_now=True, db_comment="更新时间" ) # 更新时间(需要用 save() )
class Meta:
db_table = "wecom企微员工" # 给数据表自定义一个名称;默认的会是在 应用名+类名
app_label = "django_app"
@@ -1,41 +0,0 @@
import threading
import pydash
import requests
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.viewsets import ViewSet
from sixGuoDjango import BaseResponse, ResData
from wechat_token.token工具包 import sixToken
from wechat_wecom_企业微信管理.企微通讯录管理.企微通讯录管理数据库.企微员工数据 import wecom企微员工
class 企微员工通讯录管理接口ViewSets( ViewSet ):
lock = threading.Lock( )
@action( detail=False, methods=[ "get", "post", "put", "delete" ], url_path="获取成员ID列表" )
def 获取成员ID列表( self, request: Request ):
pass
wecom_phone_token = sixToken.get_weom_phone_token( )
uri = f"https://qyapi.weixin.qq.com/cgi-bin/user/list_id?access_token={wecom_phone_token}"
postData = requests.post( url=uri, json={
"limit": 10000
} )
企微员工列表数据 = pydash.get( obj=postData.json( ), path="dept_user" )
print( 企微员工列表数据 )
for 员工 in 企微员工列表数据:
print( 员工 )
userid = pydash.get( obj=员工, path="userid" )
department = pydash.get( obj=员工, path="department" )
wecom企微员工.objects.get_or_create( wecom_userid=userid, wecom_department=department )
httpResData = BaseResponse( resData=ResData( listData=[ ], dictData={ } ), ).model_dump( )
return Response( data=httpResData, status=status.HTTP_200_OK )
@@ -38,9 +38,6 @@ class 客户管理接口ViewSets(ViewSet):
@action(detail=False, methods=["post"], url_path="批量获取客户详情并存储到数据库")
def 批量获取客户详情并存储到数据库(self, request: Request):
""""""
self_user_unionid = request.data.get("self_user_unionid", None)
self_mini_openid = request.data.get("self_mini_openid", None)
userid = request.data.get("userid", "YuanBao1975")
state企微员工创建时添加的唯一值 = request.data.get("state企微员工创建时添加的唯一值", None)
userid企微员工账号ID = request.data.get("userid企微员工账号ID", None)