update
This commit is contained in:
@@ -62,9 +62,8 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
"""
|
||||
coop_mind_name = request.data.get('mind_name')
|
||||
user = request.user
|
||||
snapshot_data = SNAPSHOT_JSON_DATA
|
||||
data_format = 'node_tree'
|
||||
mind = CooperationMind(coop_mind_name=coop_mind_name, client_uuid='', mind_log_id=-1, creator_user_id=user.id, snapshot_data=snapshot_data, data_format=data_format)
|
||||
mind = CooperationMind(coop_mind_name=coop_mind_name, client_uuid='', mind_log_id=-1, creator_user_id=user.id, snapshot_data=SNAPSHOT_JSON_DATA, data_format=data_format)
|
||||
mind.save()
|
||||
return build_response(data=mind.id)
|
||||
|
||||
@@ -130,6 +129,8 @@ class JsMindShareView(LoginRequiredJSONMixin, ListAPIView):
|
||||
share_uuid = request.GET.get('u')
|
||||
coop_mind_id = request.GET.get('coop_mind_id')
|
||||
user = request.user
|
||||
if user.id is None:
|
||||
return build_response(code=CODE_FAILED, msg="用户未登录")
|
||||
#
|
||||
if share_uuid_hash is not None and share_uuid is not None:
|
||||
share = CooperationMindShare.objects.filter(share_uuid_hash=share_uuid_hash, share_uuid=share_uuid).first()
|
||||
@@ -199,3 +200,20 @@ class JsMindStarView(LoginRequiredJSONMixin, ListAPIView):
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def post(self, request):
|
||||
user = request.user
|
||||
post_body = request.POST
|
||||
coop_mind_id = post_body.get('coop_mind_id')
|
||||
if coop_mind_id is None:
|
||||
return build_response(CODE_FAILED, msg="参数错误")
|
||||
|
||||
mind = CooperationMind.objects.filter(id=coop_mind_id).first()
|
||||
if mind is None:
|
||||
return build_response(CODE_FAILED, msg="导图不存在")
|
||||
|
||||
star = CooperationMindStar.objects.filter(user_id=user.id, coop_mind_id=coop_mind_id).first()
|
||||
if star is None:
|
||||
star = CooperationMindStar(user_id=user.id, coop_mind_id=coop_mind_id, coop_mind_name=mind.coop_mind_name)
|
||||
star.save()
|
||||
return build_response()
|
||||
|
||||
Reference in New Issue
Block a user