Beispiel #1
0
 def tran_delete(self, pks):
     """删除多条记录
     @param pks: 主键列表
     """
     url = build_url(self.base_url, 'tran_delete')
     resp = requests.post(url,
                          data={'pks': '|'.join(pks)},
                          headers=self.token_header)
     return resp
Beispiel #2
0
    def get_page_query(self, limit, offset, sort=None, order=None):
        """获取分页记录"""
        url = build_url(self.base_url, 'pager')
        payload = {'limit': limit, 'offset': offset}

        if sort:
            payload['sort'] = sort
        if order:
            payload['order'] = order
        return requests.get(url, params=payload, headers=self.token_header)
Beispiel #3
0
 def clear_expired(self):
     """清除过期数据"""
     url = build_url(self.base_url, 'clear_expired')
     resp = requests.post(url, headers=self.token_header)
     return resp
Beispiel #4
0
 def clear(self):
     """清空数据,删除所有数据"""
     url = build_url(self.base_url, 'clear')
     resp = requests.post(url, headers=self.token_header)
     return resp
Beispiel #5
0
 def exist_modify(self, entity):
     """数据存在修改,不存在新增"""
     url = build_url(self.base_url, 'exists_modify')
     resp = requests.post(url, data=entity, headers=self.token_header)
     return resp
Beispiel #6
0
 def modify(self, entity):
     """修改数据"""
     url = build_url(self.base_url, entity.get('session_key'))
     resp = requests.put(url, data=entity, headers=self.token_header)
     return resp
Beispiel #7
0
 def delete(self, session_key):
     """删除一条数据"""
     url = build_url(self.base_url, session_key)
     resp = requests.delete(url, headers=self.token_header)
     return resp
Beispiel #8
0
 def get_one(self, session_key):
     """获取一条数据"""
     url = build_url(self.base_url, session_key)
     return requests.get(url, headers=self.token_header)
Beispiel #9
0
 def modify_pwd(self, user_id, old_pwd, new_pwd):
     url = build_url(self.base_url, [user_id, 'modify_pwd'])
     data = {'old_pwd': old_pwd, 'new_pwd': new_pwd}
     return requests.post(url, data=data, headers=self.token_header)
Beispiel #10
0
 def authenticate(self, login_name, login_pwd):
     url = build_url(self.base_url, 'authenticate')
     data = {'login_name': login_name, 'login_pwd': login_pwd}
     return requests.post(url, data=data, headers=self.token_header)
Beispiel #11
0
 def get_one(self, user_id):
     url = build_url(self.base_url, user_id)
     return requests.get(url, headers=self.token_header)
Beispiel #12
0
 def get_permissions(self, user_id):
     url = build_url(self.base_url, [user_id, 'permissions'])
     return requests.get(url, headers=self.token_header)