# coding=utf-8
import datetime
import os
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',
}

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

DEBUG = True
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*']
# MEDIA_ROOT = '/srv/media/backend/media'
STATIC_ROOT = '/srv/apps/ship/frontend/mobile/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.gmei.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)


# ====================================================================================================
# ============================================分期付款=================================================
# ====================================================================================================
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-service.default/"
HTTPS_HOST = 'https://backend-service.default/'
WEB_API_HOST = "http://ship-service.default"
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-service.default/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}
REDIS = {'host': '192.168.168.142', 'port': 6379, 'db': 0, }
# BROKER_URL = 'redis://test-redis:6379/3'
BROKER_URL = 'redis://192.168.168.142: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://ship-service.default/ticket_share/',
    },
    'wechat_moments': {
        'title': '更美CEO刘迪来给我的好朋友们送“美元”啦！',
        'text': '更美CEO刘迪来给我的好朋友们送“美元”啦！',
        'icon': 'http://hera.s.gmei.com/liudi_portrait.png',
        'share_url': 'http://ship-service.default/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': '192.168.168.142', '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-service.default'
#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,
}

PROMOTE_AREA_SERVICE = []
IS_ACCEPT_CALL = True
COUPON_GIFT_URL = 'http://ship-service.default/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"
    }

]

# TEMPLATES = [
#     {
#         "BACKEND": "django_jinja.backend.Jinja2",
#         "APP_DIRS": True,
#         "DIRS": [os.path.join(BASE_DIR, 'doctor_client', 'templates'), ],
#         "OPTIONS": {
#             "match_extension": ".jinja.html",
#             "newstyle_gettext": True,
#             "auto_reload": DEBUG,
#             "context_processors": [
#                 "django.contrib.auth.context_processors.auth",
#                 "django.template.context_processors.debug",
#                 "django.template.context_processors.i18n",
#                 "django.template.context_processors.media",
#                 "django.template.context_processors.static",
#                 "django.template.context_processors.tz",
#                 "django.contrib.messages.context_processors.messages",
#             ],
#         },
#     },
#     {
#         "BACKEND": "django.template.backends.django.DjangoTemplates",
#         "DIRS": [],
#         "APP_DIRS": True,
#         "OPTIONS": {
#             "context_processors": [
#                 "django.contrib.auth.context_processors.auth",
#                 "django.template.context_processors.debug",
#                 "django.template.context_processors.i18n",
#                 "django.template.context_processors.media",
#                 "django.template.context_processors.static",
#                 "django.template.context_processors.tz",
#                 "django.contrib.messages.context_processors.messages",
#             ],
#         },
#     },
# ]

# 2017.5 分享文案开关
NEW_SHARE_DATA = True
SERVICE_DETAIL_IN_TEST = True   # 全量测试开关

# added for k8s
SESSION_REDIS_HOST = '192.168.168.142'
REDIS_CONFIG = {
    'host': '192.168.168.142',
    'port': 6379,
    'db': 0,
}

