# coding=utf-8
import datetime
from datetime import timedelta

from celery.schedules import crontab
import helios.rpc

SECRET_KEY = 'fl-lv3j^czg(dupo@hbs(+_+djby9zelwt&rh71@b1x*ptmj4#(^'
STAGGER_FLAG = True

GRAY_TEST = True
AB_TEST_LIST = []
DIARY_SORT_WHITE_LIST = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
IOS_UPDATE = True
ANDROID_UPDATE = True

RAVEN_CONFIG = {
    'dsn': 'http://97c46f2222a742a99271c70d2b9ccc67:90261dbdb8d0440d921977cd71fe170a@sentry.wanmeizhensuo.com/5',
}

DEBUG = True
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*']
MEDIA_ROOT = '/srv/media/backend/media'
#STATIC_ROOT = '/srv/static/backend/static'
STATICFILES_DIRS = (
)
ENCRYPT_KEY = 'Up[K+ub%pliOnsO5UavFBd)cw5VcyHSX'
BODYPART_ALL_ICON = 'http://hera.s.gmei.com/bodypart/2016/05/25/c95f1dd609'
SERVICE_SPECIAL_DES_ICON = 'http://hera.s.igengmei.com/2017/07/10/9950841785'
HIDE_TAGS = False
EVENT_DOCTOR_TITLES = [
    ('2015-08-05', u'自体脂肪'),
    ('2015-08-06', u'骨骼'),
    ('2015-08-07', u'美胸'),
    ('2015-08-08', u'鼻部'),
    ('2015-08-09', u'微整形'),
    ('2015-08-10', u'失败修复'),
    ('2015-08-11', u'人气医师'),
]
INTEGRAL_GDT = 'http://hermes.test.gmei.com/integralwall/record_activating'
HOT_TAG_ICON = 'http://pic.gmei.com/img/geng.jpg'
HOT_IN_24HRS_ICON = 'http://wanmeizhensuo.qiniudn.com/2015/09/18/49a291d255-thumb'
SHOW_THIRDPARTY_LOGIN_ICON = True

# ====================================================================================================
# =============================================RPC====================================================
# ====================================================================================================
# RPC_URL = 'http://rpc.test.gmei.com/api/'
RPC_URL = 'http://rpc.test.gengmei.cc/api/'
RPC_SECRET = 'basic:M21gQkp0vWmDxlB5wVsIGCgbjdcshCsYaTgl4Rq0E6ug6Ma2teM9tpGCf5TZHsCGGC4cGQ4as9N3KmrDPQ43gA=='
# RPC_INVOKER = helios.rpc.RPCFactory(RPC_URL, RPC_SECRET, debug=DEBUG, debug_unwrap_checker_raise_exception=False, debug_dump_curl=True, use_batch=False).create_invoker()
RPC_INVOKER = helios.rpc.create_default_invoker(debug=DEBUG)
#RPC_INVOKER = helios.rpc.create_default_invoker(
#    debug=DEBUG, request_timeout_times=3.0, timeout=47.9
#).with_config(dump_curl=True)

# ====================================================================================================
# ============================================分期付款=================================================
# ====================================================================================================
JIKE_URL = "http://test.geexfinance.com/merchant/service/"
JIKE_USER_ID = 12369
JIKE_SERVICE_ID = "gengmei"
JIKE_SERVICE_HASH = "3710f84987aaa4f455a10f8bbb5c55e1"


# ====================================================================================================
# ============================================七牛存储=================================================
# ====================================================================================================
QINIU_ACCESS_KEY = "UPCOYIJkZOMcdd9FDzpBqYjzWUh55fBpVi3AhWpL"
QINIU_SECRET_KEY = "z5YvpDDSam_JE345Z8J_f3TufzelOW2VOGNoBl9e"
API_HOST = "http://backend.test.env"
HTTPS_HOST = 'http://backend.test.env/'
WEB_API_HOST = "http://m.test.env"
PCWEB_API_HOST = "http://pcweb.test.gmei.com"
OPBACK_URL = "http://admin.test.gmei.com"
QINIU_HOST = "http://wanmeizhensuo.qiniudn.com"

# ====================================================================================================
# ============================================ 微 信 =================================================
# ====================================================================================================
WECHAT_APP_ID = "wx403cd28c142c7d87"
WECHAT_PARTNER_ID = "1302548401"
WECHAT_SECRET = "e821f46be6ee45e3ca80d189f989313b"
WECHAT_NOTIFY_URL = "http://backend.test.gmei.com/pay/wechat/notify"
WECHAT_KEY = "/srv/secret/apiclient_key.pem"
WECHAT_CERT = "/srv/secret/apiclient_cert.pem"


# ====================================================================================================
# ============================================邮件发送=================================================
# ====================================================================================================
EMAIL_HOST = 'smtp.exmail.qq.com'
EMAIL_HOST_USER = 'doctor@wanmeizhensuo.com'
EMAIL_HOST_PASSWORD = 'gengmei098'
STATIS_EMAIL_USER = 'youjiantongji@wanmeizhensuo.com'
STATIS_EMAIL_PSWD = 'gengmei9801'
DEFAULT_FROM_EMAIL = 'doctor@wanmeizhensuo.com'
BrokenLinkEmailsMiddleware = True
SERVER_EMAIL = 'doctor@wanmeizhensuo.com'
EMAIL_PORT = 25


# ====================================================================================================
# ============================================支付宝===================================================
# ====================================================================================================
ALIPAY_MD5_KEY = "2894fddi6kahmpj56n008le81gjnvdwp"
ALIPAY_SIGN_TYPE = 'MD5'

# ====================================================================================================
# ============================================Redis===================================================
# ====================================================================================================
REDIS = {'host': 'test-redis', 'port': 6379, 'db': 0}
BROKER_URL = 'redis://test-redis:6379/3'
BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 259200}  # 72 hours
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERYBEAT_SCHEDULE = {
    'allocate_stat_doctor': {
        'task': 'statistic.tasks.allocate_stat_doctor',
        'schedule': crontab(minute=50, hour=23),
        'args': ()
    },
    'refresh_doctorstat_task': {
        'task': 'statistic.tasks.refresh_doctorstat_task',
        'schedule': timedelta(hours=4),
        'args': ()
    },
    'share_topic_add_point': {
        'task': 'api.tasks.share_topic_add_point',
        'schedule': timedelta(minutes=30),
        'args': ()
    },
    'link_doctor': {
        'task': 'api.tasks.link_doctor',
        'schedule': timedelta(minutes=6),
        'args': ()
    },
    'send_sms_mail-9-am': {
        'task': 'api.tasks.sms_service',
        'schedule': crontab(minute=0, hour=9),
        'args': ()
    },
    'send_stat_mail': {
        'task': 'statistic.tasks.send_stat_mail',
        'schedule': crontab(minute=5, hour=0),
        'args': ()
    },
    'stat_user_daily': {
        'task': 'statistic.tasks.stat_user_daily',
        'schedule': crontab(minute=50, hour=23),
        'args': ()
    },
    'hospital_body_sub_items': {
        'task': 'api.tasks.hospital_body_sub_items',
        'schedule': timedelta(days=1),
        'args': ()
    },
    'doctors2redis': {
        'task': 'api.tasks.doctors2redis',
        'schedule': crontab(minute=0, hour=3),
        'args': ()
    },
    'hospital2redis': {
        'task': 'api.tasks.hospital2redis',
        'schedule': crontab(minute=0, hour=3),
        'args': ()
    },
    'send_conversation_stat_mail': {
        'task': 'statistic.tasks.send_conversation_stat_mail',
        'schedule': crontab(minute=10, hour=0),
        'args': ()
    },
    'send_conversation_weekly_stat_mail': {
        'task': 'statistic.tasks.send_conversation_weekly_stat_mail',
        'schedule': crontab(minute=10, hour=0, day_of_week='tue'),
        'args': ()
    },
    'doctor_tags': {
        'task': 'api.tasks.doctor_tags',
        'schedule': crontab(minute=20, hour=5),
        'args': ()
    },
    'tag2redis': {
        'task': 'api.tasks.tag2redis',
        'schedule': crontab(minute=0, hour=6),
        'args': ()
    },
    'autocomplete_words': {
          'task': 'api.tasks.autocomplete_words',
          'schedule': crontab(minute=30, hour=3, day_of_week='sunday'),
          'args': ()
    },
}

# ====================================================================================================
# ============================================美券====================================================
# ====================================================================================================
COUPON_SHARE_SECRET = 'kOMro0bJ.,D*YccA^b]i[)difDe!@llH'
COUPON_SHARE = {
    'show_share': True,
    'slogan': u'更美CEO刘迪送您“美元”啦！',
    'title': '恭喜您获得更美<ems>现金劵!</ems>',
    'image': 'http://hera.s.gmei.com/liudi_portrait@2x.png',
    'content': u'分享红包给小伙伴，你和朋友都可以获得<ems>1000</ems>元大礼包！',
    'wechat': {
        'title': '更美CEO刘迪来给我的好朋友们送“美元”啦！',
        'text': '8.5更美大促! 800个医美项目免费送，91场0元秒杀，全场低至1折！',
        'icon': 'http://hera.s.gmei.com/liudi_portrait.png',
        'share_url': 'http://m.test.gmei.com/ticket_share/',
    },
    'wechat_moments': {
        'title': '更美CEO刘迪来给我的好朋友们送“美元”啦！',
        'text': '更美CEO刘迪来给我的好朋友们送“美元”啦！',
        'icon': 'http://hera.s.gmei.com/liudi_portrait.png',
        'share_url': 'http://m.test.gmei.com/ticket_share/',
    },
}

SERVICE_HOME_SECKILL_ICON = 'http://wanmeizhensuo.qiniudn.com/2015/11/28/0fa3033388'
ANONYMOUS_USER_ID = 19634221

ORDER_ARBIT_TIMEOUT_DELTA=60

GAIA_REDIS = {'host': 'localhost', 'port': 6379, 'db': 0}

ANDROID_CURRENT_VERSION_DATA = {
    'version': '5.9.2',
    'version_code': 592,
    'minimum_support_version': '5.5.0',
    'description': u'''更美APP，中国第一美容整形与健康服务平台。\n1.新年，新颜，新气象~更美陪你过大年！\n2.首页内容展示焕然一新！are you ready? \n3.部分页面设计大变身，快来>看看我是不是更美了~ \n4. 程序猿GG又一次打败了小怪兽！对不起，让宝宝们受惊了~ \n5. 欢迎你的任何冷酷批评或热烈表白：hi@gmei.com''',
    'apk': 'http://dl.gmei.com/apk/gengmei.apk?version=5.9.3',
}

IOS_CURRENT_VERSION_DATA = {
    'version': '5.9.2',
    'version_code': 11,
    'minimum_support_version': '5.5.0',
    'apps_latest_support_version': '5.9.2',
    'description': u'',
    'apk': ''
}

PK_TOPICS = {
    24568: {
        'title': u'中韩医生pk1',
        'start_time': '2016-03-31',
        'end_time': '2016-04-30',
        'doctors': {
            '02adf94ef1a711e5903d0242c0a8001f': {
                'flag': 'http://7d9qwy.com2.z0.glb.qiniucdn.com/2016/03/24/5119e449eb',
            },
            '02adf94ef1a711e5903d0242c0a8001f': {
                'flag': 'http://7d9qwy.com2.z0.glb.qiniucdn.com/2016/03/24/b0762d446e',
            }
        },
        'share_data': {
            'image': 'http://hera.s.gmei.com/share9.9.jpg',
            'wechat_title': u'微信分享标题',
            'wechat_content': u'微信分享文案',
            'wechat_line': u'微信分享朋友圈文案',
            'weibo': u'分享到微博文案 http://xxxxxxx @更美App',
        }
    },
    12177482: {
        'title': u'中韩医生pk1',
        'start_time': '2016-03-30',
        'end_time': '2016-04-04',
        'doctors': {
            '100001': {
                'flag': 'http://7d9qwy.com2.z0.glb.qiniucdn.com/2016/03/24/5119e449eb',
            },
            '100002': {
                'flag': 'http://7d9qwy.com2.z0.glb.qiniucdn.com/2016/03/24/b0762d446e',
            }
        },
        'share_data': {
            'image': 'http://hera.s.gmei.com/share9.9.jpg',
            'wechat_title': u'中韩医生PK',
            'wechat_content': u'快来给自己支持的医生投票了',
            'wechat_line': u'中韩医生pk',
            'weibo': u'#中韩医生#双眼皮技术谁最好？快来投票→http://m.gmei.com/topic/12177482/ @更美APP',
        },
    },
    12177487: {
        'title': u'中韩医生pk1',
        'start_time': '2016-03-30',
        'end_time': '2016-04-04',
        'doctors': {
            '100001': {
                'flag': 'http://7d9qwy.com2.z0.glb.qiniucdn.com/2016/03/24/5119e449eb',
            },
            '100002': {
                'flag': 'http://7d9qwy.com2.z0.glb.qiniucdn.com/2016/03/24/b0762d446e',
            }
        },
        'share_data': {
            'image': 'http://hera.s.gmei.com/share9.9.jpg',
            'wechat_title': u'中韩医生PK',
            'wechat_content': u'快来给自己支持的医生投票了',
            'wechat_line': u'中韩医生pk',
            'weibo': u'#中韩医生#双眼皮技术谁最好？快来投票→http://m.gmei.com/topic/12177482/ @更美APP',
        },
    },

}
PK_TOPICS={}

TIME_CAN_ACCEPT_CALL = (datetime.time(9, 0, 0), datetime.time(15, 0, 0))

GENGMEI_TENANT_ID = 'b2119c17665b4f509ddade8397d58e84'
GENGMEI_KEFU_USER_ID = 20889691
GENGMEI_KEFU_PERSON_ID = '2b64c68727cb11e68181f45c899f3b33'
FEEDBACK_CS_GROUP = '455979578157409fab1ca83f4f824e87'

#SESSION_COOKIE_DOMAIN_GENGMEI = 'backend.test.gengmei.cc'
SESSION_COOKIE_DOMAIN_BACKEND_GENGMEI = 'backend.test.env'
SESSION_COOKIE_DOMAIN_IGENGMEI = '.test.env'
SESSION_COOKIE_DOMAIN = '.test.env'  # since 6.0
PUSH_NOTIFICATION_AFTER_FOLLOW_USER = True
ORDER_COMPLETE_SHARE_COUPONGIFT_ID = 40

PAY_TOGGLE = {
    'alipay': True,
    'wechat': True,
    'applepay': True,
    'xiaoying': True,
    'yinuo': True,
    'renmai': True,
    'maidan': True,
    'zhongan': True,
    'yirendai': True,
    'renmai_credit': True,
    'huabei': True,
}

PROMOTE_AREA_SERVICE = []
IS_ACCEPT_CALL = True
COUPON_GIFT_URL = 'http://m.test.gmei.env/coupon_gift'

## UNION ##
#CUSTOM_SERVICE_PHONE = 'tel://4006999227,,6666#'
#
#CSC_400_EXT_LITERAL = u'4006-999-227转6666#'
#CSC_400_CALL_URL = 'tel://4006999227,,6666#'

## ZHHT ##
# CUSTOM_SERVICE_PHONE_CALL_TIP = u'如不能接通，请按提示输入分机号 {ext}'
CUSTOM_SERVICE_PHONE = 'tel://01059658065,,6666'
CSC_400_EXT_LITERAL = u'010-5965-8065转6666'
CSC_400_CALL_URL = 'tel://01059658065,,6666'

# 买单分期开关
MAIDAN_INSTALLMENT_TOGGLE = True

INDEX_TAB_CONFIG_2X = [
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/10/7ea40e5e4e",# 普通icon 为空则不更新
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/10/543f0d9aba",# 高亮icon 为空则不更新
    'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/10/c8566c0463",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/10/406c970989",
    'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/10/392009518b",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/10/392009518b",
    'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/10/56e5bb9217",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/10/cd7e926b40",
    'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/10/64c8969b25",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/10/da466e68ca",
    'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    }
]

INDEX_TAB_CONFIG = [
  {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/08/2d4e0f337f",# 普通icon 为空则不更新
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/08/b90918ec43",# 高亮icon 为空则不更新
        'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/08/e47f4bf721",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/08/b5a70ded46",
        'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/08/99deaba0a9",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/08/99deaba0a9",
        'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/08/60cdb44bc0",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/08/e60b5dbc39",
        'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    },
    {
        'icon_normal': "http://hera.s.gmei.com/slide/2017/02/08/19739929b6",
        'icon_pressed': "http://hera.s.gmei.com/slide/2017/02/08/34650a5c69",
        'colour_normal': "FFEC8B",
        'colour_pressed': "FF0000"
    }

]

# 2017.5 分享文案开关
NEW_SHARE_DATA = True
SERVICE_DETAIL_IN_TEST = False   # 全量测试开关
# 美购详情页ios灰度，
SERVICE_DETAIL_GRAY_IOS = ["0", "1", "2", "3", "5", "6", "8", "9", "A", "B", "C", "D", "E", "F"]
INNER_SERVICE_DETAIL_LIST = ['864325039478033','866920039414794','864370038130912']  # 新版美购详情页，增加测试灰度
GWL = [
    # 交易组
    "F3388187-75F7-4831-AA0C-1886FD332731",
    "6A99CBB1-6738-4ED1-A042-199CA80AAB22",
    "EB5AB253-6D49-4B01-943D-B9278C9F674A",
    "9C2A7797-16D3-4A9C-B19C-41A9AC186E61",

    # 社交组
    "C504140B-FACE-453D-A61C-1A056CF47A40",
    "98AAC4A9-8F69-4EBE-B8C2-39F47023DE1D",
    "AE024593-B832-4B23-BA16-DCB2B403D269",
    "4841C5E0-DCE8-4108-9432-9E46631AACA3",
    "826D4695-5D3F-40FC-8DF3-800F03CA32FB",
    "B42685C0-702F-4C54-8C9E-73AEC5F3AAEC",
    "30A24968-E6E0-429F-8BC4-91054C01F0F0",
    "19F592FE-A442-4372-A2AA-D873A8A870E9",
    "E362248A-0AA7-4ED0-856C-CBFDE0524F88",

    # 产品组
    "B268AC13-8FEA-4E1A-97FD-AEF7D13CEBC8",
    "03E3692A-DD9A-443C-9481-6E882EF5DEA4",
    "EB8B8B98-F865-494D-8D87-C323714A6F53",
    "C608EDA4-B305-4E1B-ABBD-6DDAD4EDAAF3",
    "00CA20EB-2719-4518-85CC-60E765AC526F",
    "androidid_4f7e1e999d5a0ad7",
    "CDD0756B-2DBA-43FB-93A4-8EC32A76A7CE",
    "CE5C0FF8-C830-4184-BEF6-A2F67BF9EFAA",
    "E1A4F2BF-8D0A-4465-8A3E-B8F562A38E2B",
    "865846039243795",
    "62B3D99D-F4A2-4104-BBB1-2B803F8A6943",
    "3DB03D3C-A85E-4601-A8DE-CD1757D03048",
]
IS_QA_RICHTEXT = True

# 订单尾款花呗分期开关
HOSPITAL_PAY_HUABEI_SWITCH = True

TRACE_SAMPLE_RATE = 100.0
# TRACE_FILTER_API_OK = False
# TRACE_URLPATTERN_AS_SPAN_NAME = False

DATADOG_TRACE = {
    'DEFAULT_SERVICE': 'backend',
    'TAGS': {'env': 'production'},
}