コード例 #1
0
 def logic(self, client_ids):
     if len(client_ids)<=1:
         self.resp_error(content="At least two client_id is required.")
         return
     try_same = None
     for i in client_ids:
         if not i or try_same==i:
             self.resp_args_error()
             return
         try_same = i
     qs = Query(_Conversation)
     try:
         obj = qs.contains_all("m", client_ids).first() # FIXME 当前只是包含, 如果今后出现了群聊,此处务必修改
         the_id = obj.id
     except LeanCloudError:
         conv_obj = _Conversation()
         conv_obj.set("m", client_ids)
         conv_obj.set("sys", False)
         conv_obj.save()
         the_id = conv_obj.id
     return the_id