123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- # -*- coding: utf-8 -*-
- #!/usr/bin/env python
- import datetime
- from apps.web.constant import AdType
- from apps.web.core.validation import Schema, Required, Coerce, In, Boolean, Any, Url, REMOVE_EXTRA
- getAdPreAllocatedDevice_query_schema = Schema(
- {
- Required("devCondition"): Schema([{"agentIdList": list,"dealerIdList":list,"groupIdList":list}]),
- Required("addressTypeList"): list,
- Required("devTypeList"): list
- })
- advertisementSchema = Schema(
- {
- #: 广告基本属性
- #:: 编辑时需要广告ID
- 'id': basestring,
- Required('name') : basestring,
- 'adType': In(AdType.choices()),
- 'online': Boolean(),
- 'img': basestring,
- 'word': basestring,
- 'link': Any(Url(), None, ""),
- 'startTime': lambda _: datetime.datetime.strptime(_, "%Y-%m-%d %H:%M:%S"),
- 'endTime': lambda _: datetime.datetime.strptime(_, "%Y-%m-%d %H:%M:%S"),
- 'script': Any(basestring, None),
- 'scriptType': Any(basestring, None),
- #: 过滤器
- 'devCondition': list,
- 'devTypeList': list,
- 'addressTypeList': list,
- #: 接受广告投递的设备
- 'devList': list,
- #:: 面向用户的广告过滤器
- 'targetSex': In([u'男', u'女', '*']),
- 'targetPhoneOS': In([[], [u'iOS'], [u'Android'],[u'iOS', u'Android']]),
- 'gateway': In([[], [u'wechat'], [u'alipay'], [u'wechat', u'alipay']]),
- #: 定价
- 'price': Coerce(float),
- 'agentPrice': Coerce(float),
- 'dealerPrice': Coerce(float),
- #: 配置项
- 'configs': dict,
- 'fansType': In(['person', 'official']),
- 'offlineFansNumber': int,
- 'PIN': basestring,
- }, extra=REMOVE_EXTRA)
|