import json

from django.core.management import BaseCommand

from doris.models import WordsRecomend


class Command(BaseCommand):

    def handle(self, *args, **options):
        wordsrecomend = WordsRecomend.objects.filter(tab='3')
        for w in wordsrecomend:
            words_list = []
            try:
                for i in json.loads(w.words):
                    if i != u"\u66f4\u7f8e\u6d4b\u8bd5":
                        words_list.append(i)
                w.words = json.dumps(words_list)
                w.save()
                print ('更新:{0}成功!'.format(w.id))
            except Exception as e:
                print (e)
                print ('更新:{0}失败!'.format(w.id))
