def tags(): """ 获取所有标签 :return: """ tags = Tag.get_all() if tags: data_tag = [] for tag in tags: sin_tag = {"id": tag.id, "tag": tag.tag} data_tag.append(sin_tag) app.logger.info("request result: {}".format(tags)) return jsonify( response.return_message({'tags': data_tag}, Message.SUCCESS.value, Code.SUCCESS.value)) return jsonify( response.return_message(None, Message.SUCCESS.value, Code.SUCCESS.value))
def gettags(message): """ 获取标签 :param message: :return: """ if message['code'] != Code.SUCCESS.value: return jsonify(message) tags = Tag.get_all() tags_value = [tag.tag for tag in tags] return jsonify( response.return_message(data={ 'tags': tags_value, 'token': Verificate.encode_auth_token( message['data']['id'], message['data']['last_login']).decode() }, msg=Message.SUCCESS.value, code=Code.SUCCESS.value))