Ejemplo n.º 1
0
# coding:utf-8
'''
created on 2019/1/17

@author:sunyihuan
'''
from utils import connect_mongodb_sheji, ts2utcdatetime, id2ObjectId
import xlwt
import pymongo

mdb = connect_mongodb_sheji()

# 2018年10月1日开始
wangluo_counts = mdb.xm_hair_need.find({
    "status": 101,
    "source": 2,
    "ctime": {
        "$gt": ts2utcdatetime(1538323200)
    }
}).count()

xianchang_counts = mdb.xm_hair_need.find({"status": 101, "source": 1}).count()


def writeHead_wangluo(sh):
    sh.write(0, 2, "three_court")
    sh.write(0, 3, "face_length")
    sh.write(0, 4, "face_sense")
    sh.write(0, 5, "face_shape")
    sh.write(0, 6, "natural_style")
    sh.write(0, 7, "height")
Ejemplo n.º 2
0
def changJing_data(day_time_start):
    '''
    返回某一日数据看板中的数据
    :param day_time_start: 日期,格式为:"2018-12-21"
    :return:
    sheji_st:设计沟通场景日活,
    sheji_st_vip:设计沟通场景VIP日活,
    poster_st:营销拓客场景日活,
    poster_st_vip:营销拓客场景VIP日活,
    stylists:美助app日活,
    stylists_yes:美助app昨日留存, 
    stylists_vip:美助app中VIP日活
    '''
    mdb = connect_mongodb_sheji()  # 链接sheji
    star_timeStamp = day2timestamp(day_time_start)

    vip_st = mdb.wxuser.distinct("_id", {"expireat": {
        "$gt": star_timeStamp
    }})  # vip列表
    vip_st = list_change_type(int, vip_st)

    poster_st = mdb.log_poster.distinct(
        "uid",
        {"ctime": {
            "$gt": star_timeStamp,
            "$lt": star_timeStamp + 86400
        }})  # 使用海报发型师uv

    fxcl_st = mdb.log_material.distinct(
        "uid",
        {"ctime": {
            "$gt": star_timeStamp,
            "$lt": star_timeStamp + 86400
        }})  # 使用海报发型师uv

    poster_st = set(poster_st) | set(fxcl_st)
    poster_st = list_change_type(int, poster_st)

    stylist_one = mdb.xm_hair_scheme.distinct(
        "myid", {
            "utime": {
                "$gte": ts2utcdatetime(star_timeStamp + 0 * 86400),
                "$lt": ts2utcdatetime(star_timeStamp + 86400)
            },
            "is_finish": 1
        })  # 完成订单发型师
    stylist_one = list_change_type(int, stylist_one)
    stylist_t = mdb.xm_good_hair.distinct(
        "myid", {
            "utime": {
                "$gte": ts2utcdatetime(star_timeStamp + 0 * 86400),
                "$lt": ts2utcdatetime(star_timeStamp + 86400)
            },
            "status": 1
        })  # 收藏发型的发型师
    stylist_t = list_change_type(int, stylist_t)

    sheji_st = set(stylist_one) | set(stylist_t)  # 设计沟通场景发型师日活
    sheji_st = list_change_type(int, sheji_st)

    sheji_st_vip = (set(stylist_one) | set(stylist_t)) & set(
        vip_st)  # 设计沟通场景发型师VIP日活

    poster_st_vip = set(vip_st) & set(poster_st)  # 使用海报发型师中VIP的人数

    stylists = seven_day_stylist(star_timeStamp,
                                 star_timeStamp + 86400)  # 美业助手app当日uv

    stylists_yestday = seven_day_stylist(star_timeStamp - 86400,
                                         star_timeStamp)  # 美业助手app昨日uv
    vip_st = list_change_type(str, vip_st)

    stylists_yes = set(stylists) & set(stylists_yestday)  # 次日留存人数

    stylists_vip = set(stylists) & set(vip_st)  # 美业助手app当日VIP日活

    return sheji_st, sheji_st_vip, poster_st, poster_st_vip, stylists, stylists_yes, stylists_vip