• python flask 时间处理 filter多条件组装 当前月1号 当前月内 3个月内 当日内


         filter = []
            filter.append(PayLog.objectid == current_user['id'])
            filter.append(PayLog.type == current_app.config['PAY_USETYPE_APPLY_MONEY'])
    
            if info['unit'] == 1:
                dateC = datetime.date.today().replace(day=1)
                start = int(time.mktime(dateC.timetuple()))
                endC = dateC + relativedelta(months=+1)
                end = int(time.mktime(endC.timetuple()))
                filter.append(PayLog.createtime < end)
                filter.append(PayLog.createtime >= start)
            elif info['unit'] == 2:
                dateC = datetime.date.today()
                start = int(time.mktime(dateC.timetuple()))
                endC = dateC + relativedelta(days=+1)
                end = int(time.mktime(endC.timetuple()))
                filter.append(PayLog.createtime < end)
                filter.append(PayLog.createtime >= start)
            elif info['unit'] == 3:
                dateC = datetime.date.today().replace(day=1)
                sdateC = dateC + relativedelta(months=-3)
                start = int(time.mktime(sdateC.timetuple()))
                endC = dateC + relativedelta(months=+1)
                end = int(time.mktime(endC.timetuple()))
                filter.append(PayLog.createtime < end)
                filter.append(PayLog.createtime >= start)
            count = PayLog.query.filter(*filter).count()
    

      

  • 相关阅读:
    gcc各个版本下载
    加减法运算解决乘除法
    蚂蚁碰撞的概率
    ns2.34移植leach协议
    ubantu16.04安装ns2.34 错误
    ubantu安全卸载火狐浏览器
    post和get的区别
    docker加速配置阿里云镜像
    重装系统后,会因为本机保存的公匙不对报错
    集合 set
  • 原文地址:https://www.cnblogs.com/jackduan/p/13571371.html
Copyright © 2020-2023  润新知