12345678910111213141516171819202122232425262728293031 |
- # -*- coding: utf-8 -*-
- #!/usr/bin/env python
- """
- """
- import sys
- import os
- #: current_dir - 2
- PROJECT_ROOT = os.path.join(os.path.abspath(os.path.split(os.path.realpath(__file__))[0] + "/.."), '..')
- sys.path.insert(0, PROJECT_ROOT)
- from script.base import init_env, get_logger
- logger = get_logger(__name__)
- init_env(interactive=True)
- from apps.web.ad.models import Advertisement
- from apps.web.ad.utils import set_directed_ad_to_devices
- for ad in Advertisement.objects(status=True, fansType='official'):
- print 'ad %s ' % (ad.adId,)
- logicalCodes = [ _['logicalCode'] for _ in ad.devList ]
- set_directed_ad_to_devices(logicalCodes, ad)
- print 'finished'
|