g
This commit is contained in:
@@ -20,6 +20,7 @@ class CooperationMind(AbstractModel):
|
||||
client_id = models.CharField(verbose_name='客户端ID', max_length=64, null=False, blank=False)
|
||||
snapshot_data = models.TextField(verbose_name='脑图数据', null=True, )
|
||||
log_id = models.BigIntegerField(verbose_name='data对应的操作日志(cooperation_mind_log)ID', null=True, )
|
||||
data_format = models.CharField(verbose_name='数据格式化类型', max_length=32, null=False, blank=False)
|
||||
|
||||
class Meta:
|
||||
db_table = 'cooperation_mind'
|
||||
|
||||
@@ -6,6 +6,7 @@ urlpatterns = [
|
||||
path('', to_list), # 跳转列表界面
|
||||
path('detail', to_detail), # 跳转详情界面
|
||||
path('create', JsMindView.as_view()), # 创建思维导图
|
||||
path('delete', JsMindView.as_view()), # 删除思维导图
|
||||
path('list', JsMindView.as_view()), # 查询思维导图
|
||||
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志
|
||||
]
|
||||
|
||||
+16
-7
@@ -37,6 +37,9 @@ class JsMindView(ListAPIView):
|
||||
pagination_class = NewPagination
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
"""
|
||||
查询思维导图
|
||||
"""
|
||||
pk = request.GET.get('id')
|
||||
if pk is not None:
|
||||
mind = CooperationMind.objects.filter(id=pk).first()
|
||||
@@ -47,26 +50,31 @@ class JsMindView(ListAPIView):
|
||||
|
||||
def post(self, request):
|
||||
"""
|
||||
查询思维导图
|
||||
创建思维导图
|
||||
"""
|
||||
coop_mind_name = request.data.get('mind_name')
|
||||
snapshot_data = request.data.get('snapshot_data')
|
||||
mind = CooperationMind(coop_mind_name=coop_mind_name, client_id='', snapshot_log_id=-1, creator=9527, snapshot_data=snapshot_data)
|
||||
data_format = request.data.get('data_format')
|
||||
mind = CooperationMind(coop_mind_name=coop_mind_name, client_id='', log_id=-1, creator=9527, snapshot_data=snapshot_data, data_format=data_format)
|
||||
mind.save()
|
||||
return build_response(data=mind.id)
|
||||
|
||||
def delete(self, request, pk):
|
||||
# 删除
|
||||
pk = request.GET.get('id')
|
||||
CooperationMind.objects.filter(id=pk).delete()
|
||||
return build_response()
|
||||
|
||||
|
||||
# Create your views here.
|
||||
class JsMindLogView(APIView):
|
||||
"""
|
||||
|
||||
日志获取,快照保存
|
||||
"""
|
||||
|
||||
def get(self, request):
|
||||
"""
|
||||
|
||||
:param request:
|
||||
:return:
|
||||
查询日志
|
||||
"""
|
||||
param = request.GET
|
||||
coop_mind_id = param.get('coop_mind_id')
|
||||
@@ -88,5 +96,6 @@ class JsMindLogView(APIView):
|
||||
coop_mind_id = post_body.get('coop_mind_id')
|
||||
data = post_body.get('data')
|
||||
coop_mind_log_id = post_body.get('coop_mind_log_id')
|
||||
CooperationMind.objects.filter(id=coop_mind_id, log_id__lt=coop_mind_log_id).update(snapshot_data=data, log_id=coop_mind_log_id, update_time=dt.now(), client_id=client_id)
|
||||
data_format = post_body.get('data_format')
|
||||
CooperationMind.objects.filter(id=coop_mind_id, log_id__lt=coop_mind_log_id).update(data_format=data_format, snapshot_data=data, log_id=coop_mind_log_id, update_time=dt.now(), client_id=client_id)
|
||||
return build_response()
|
||||
|
||||
Reference in New Issue
Block a user