Ejemplo n.º 1
0
    def ApplyNewFeedSubmit(self):
        max_id = Session.query(func.max(ApplyNewFeed.apply_id)).scalar() or 0

        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        stype_desc = request.params['stype_desc']
        a = ApplyNewFeed(max_id + 1,
                         pm_names=pm_names,
                         pm_emails=pm_emails,
                         dev_names=request.params['dev_names'],
                         dev_emails=request.params['dev_emails'],
                         stype_desc=stype_desc,
                         stype_text=request.params['stype_text'],
                         push_news=int(request.params['push_news']),
                         push_mini=int(request.params['push_mini']),
                         news_merge_desc=request.params['news_merge_desc'],
                         mini_merge_desc=request.params['mini_merge_desc'],
                         lifetime=int(request.params['lifetime']),
                         status=0,
                         apply_time=int(time.time()))
        Session.add(a)
        Session.commit()

        self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型',
                      pm_names + ':' + stype_desc)
        return '申请保存成功'
Ejemplo n.º 2
0
 def AddStypeVersion(self):
   stype = int(request.params['stype'])
   max_ver = Session.query(func.max(DataVersion.version)).filter_by(stype = stype).scalar() or 0
   vc = DataVersion(stype, max_ver + 1, 0, 0)
   Session.add(vc)
   Session.commit()
   return str(max_ver + 1)
Ejemplo n.º 3
0
  def ApplyNewFeedSubmit(self):
    max_id = Session.query(func.max(ApplyNewFeed.apply_id)).scalar() or 0

    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    stype_desc = request.params['stype_desc']
    a = ApplyNewFeed(max_id + 1,
        pm_names = pm_names, 
        pm_emails = pm_emails, 
        dev_names = request.params['dev_names'], 
        dev_emails = request.params['dev_emails'], 
        stype_desc = stype_desc, 
        stype_text = request.params['stype_text'], 
        push_news = int(request.params['push_news']), 
        push_mini = int(request.params['push_mini']), 
        news_merge_desc = request.params['news_merge_desc'], 
        mini_merge_desc = request.params['mini_merge_desc'], 
        lifetime = int(request.params['lifetime']), 
        status = 0,
        apply_time = int(time.time())
        )
    Session.add(a)
    Session.commit()

    self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Ejemplo n.º 4
0
 def AddStypeVersion(self):
     stype = int(request.params['stype'])
     max_ver = Session.query(func.max(
         DataVersion.version)).filter_by(stype=stype).scalar() or 0
     vc = DataVersion(stype, max_ver + 1, 0, 0)
     Session.add(vc)
     Session.commit()
     return str(max_ver + 1)
Ejemplo n.º 5
0
  def AddVersionTpl(self):
    max_id = Session.query(func.max(VersionTplMapping.tpl_id)).scalar() or 1
    tpl_id = max_id + 1
    feed_key = VersionTplMapping(tpl_id = tpl_id,
        stype = request.params['stype'],
        version = request.params['version'])
    Session.add(feed_key)

    Session.commit()
    return str(tpl_id)
Ejemplo n.º 6
0
    def AddVersionTpl(self):
        max_id = Session.query(func.max(
            VersionTplMapping.tpl_id)).scalar() or 1
        tpl_id = max_id + 1
        feed_key = VersionTplMapping(tpl_id=tpl_id,
                                     stype=request.params['stype'],
                                     version=request.params['version'])
        Session.add(feed_key)

        Session.commit()
        return str(tpl_id)
Ejemplo n.º 7
0
  def UserApplySubmit(self):
    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    feed_desc = request.params['feed_desc']
    apply_id = 0
    if "apply_id" in request.params:
      apply_id = int(request.params['apply_id'])

    print "apply_id", apply_id

    if "apply_id" in request.params:
      a = self.user_applies_.filter_by(apply_id = apply_id).first()
      if a:
        a.pm_names = pm_names
        a.pm_emails = pm_emails
        a.dev_names = request.params['dev_names']
        a.dev_emails = request.params['dev_emails']
        a.feed_stype = int(request.params['feed_stype'])
        a.feed_desc = feed_desc
        a.apply_type = int(request.params['apply_type'])
        a.apply_desc = request.params['apply_desc']
        a.push_news = int(request.params['push_news'])
        a.push_mini = int(request.params['push_mini'])
        a.news_merge_desc = request.params['news_merge_desc']
        a.mini_merge_desc = request.params['mini_merge_desc']
        a.status = 0
        a.apply_time = int(time.time())
      else:
        return '申请id不群在'
    else:
      max_id = Session.query(func.max(UserApply.apply_id)).scalar() or 0
      a = UserApply(max_id + 1,
          pm_names = pm_names, 
          pm_emails = pm_emails, 
          dev_names = request.params['dev_names'], 
          dev_emails = request.params['dev_emails'], 
          feed_stype = int(request.params['feed_stype']), 
          feed_desc = feed_desc, 
          apply_type = int(request.params['apply_type']), 
          apply_desc = request.params['apply_desc'], 
          push_news = int(request.params['push_news']), 
          push_mini = int(request.params['push_mini']), 
          news_merge_desc = request.params['news_merge_desc'], 
          mini_merge_desc = request.params['mini_merge_desc'], 
          status = 0,
          apply_time = int(time.time())
          )
      Session.add(a)
    Session.commit()

    # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Ejemplo n.º 8
0
    def UserApplySubmit(self):
        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        feed_desc = request.params['feed_desc']
        apply_id = 0
        if "apply_id" in request.params:
            apply_id = int(request.params['apply_id'])

        print "apply_id", apply_id

        if "apply_id" in request.params:
            a = self.user_applies_.filter_by(apply_id=apply_id).first()
            if a:
                a.pm_names = pm_names
                a.pm_emails = pm_emails
                a.dev_names = request.params['dev_names']
                a.dev_emails = request.params['dev_emails']
                a.feed_stype = int(request.params['feed_stype'])
                a.feed_desc = feed_desc
                a.apply_type = int(request.params['apply_type'])
                a.apply_desc = request.params['apply_desc']
                a.push_news = int(request.params['push_news'])
                a.push_mini = int(request.params['push_mini'])
                a.news_merge_desc = request.params['news_merge_desc']
                a.mini_merge_desc = request.params['mini_merge_desc']
                a.status = 0
                a.apply_time = int(time.time())
            else:
                return '申请id不群在'
        else:
            max_id = Session.query(func.max(UserApply.apply_id)).scalar() or 0
            a = UserApply(max_id + 1,
                          pm_names=pm_names,
                          pm_emails=pm_emails,
                          dev_names=request.params['dev_names'],
                          dev_emails=request.params['dev_emails'],
                          feed_stype=int(request.params['feed_stype']),
                          feed_desc=feed_desc,
                          apply_type=int(request.params['apply_type']),
                          apply_desc=request.params['apply_desc'],
                          push_news=int(request.params['push_news']),
                          push_mini=int(request.params['push_mini']),
                          news_merge_desc=request.params['news_merge_desc'],
                          mini_merge_desc=request.params['mini_merge_desc'],
                          status=0,
                          apply_time=int(time.time()))
            Session.add(a)
        Session.commit()

        # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
        return '申请保存成功'
Ejemplo n.º 9
0
 def UpdateStypeVersionTestId(self):
   stype = int(request.params['stype'])
   version = int(request.params['version'])
   tpl_id = int(request.params['tpl_id'])
   if stype > 0 and version > 0 and tpl_id >= 0:
     ver = self.data_version_.filter_by(stype = stype, version = version).first()
     if ver:
       ver.test_tpl_id = tpl_id
     else:
       ver = DataVersion(stype, version, tpl_id, 0)
       Session.add(ver)
     Session.commit()
     return '保存成功' + str(ver.test_tpl_id)
   return '参数有错误'
Ejemplo n.º 10
0
    def SaveStypeConfig(self):
        if self.UserRight(request, response) < 2:
            return '{"status":1, "desc":"没有操作权限, 请确保管理员帐号登录"}'

        cfg = self.stype_config_.filter_by(
            stype=int(request.params['stype'])).first()
        if not cfg:
            cfg = StypeConfig(
                stype=int(request.params['stype']),
                weight=int(request.params['weight']),
                type=int(request.params['type']),
                ptype=int(request.params['ptype']),
                description=request.params['title'],
                push_feed_flags=int(request.params['push_flags']),
                news_merge_type=int(request.params['news_merge_type']),
                mini_merge_type=int(request.params['mini_merge_type']),
                is_update_time_on_merge=int(
                    request.params['update_time_on_merge']),
                is_custom_expr=int(request.params['custom_expr']),
                persist_body=int(request.params['save_content']),
                persist_feeddb=int(request.params['save_feed_db']),
                lifetime=int(request.params['lifetime']),
                daily_quota=int(request.params['daily_quota']))

            Session.add(cfg)
            if 'apply_id' in request.params:
                apply_id = int(request.params['apply_id'])
                self.FeedApplyHandled(apply_id)
        else:
            if int(request.params['is_new']) > 0:
                return '{"status":1, "desc":"新建子类型保存失败(已经存在)"}'

            print cfg.is_update_time, cfg.is_custom_expr
            cfg.is_persist_content = int(request.params['save_content'])
            cfg.ptype = int(request.params['ptype'])
            cfg.description = request.params['title']
            cfg.push_flag = int(request.params['push_flags'])
            cfg.news_merge_type = int(request.params['news_merge_type'])
            cfg.mini_merge_type = int(request.params['mini_merge_type'])
            cfg.is_update_time = int(request.params['update_time_on_merge'])
            cfg.is_custom_expr = int(request.params['custom_expr'])
            cfg.is_persist_content = int(request.params['save_content'])
            cfg.is_persist_feeddb = int(request.params['save_feed_db'])
            cfg.lifetime = int(request.params['lifetime'])
            cfg.daily_quota = int(request.params['daily_quota'])
            cfg.weight = request.params['weight']

        Session.commit()
        return '{"status":0, "desc":"保存成功"}'
Ejemplo n.º 11
0
 def UpdateStypeVersionTestId(self):
     stype = int(request.params['stype'])
     version = int(request.params['version'])
     tpl_id = int(request.params['tpl_id'])
     if stype > 0 and version > 0 and tpl_id >= 0:
         ver = self.data_version_.filter_by(stype=stype,
                                            version=version).first()
         if ver:
             ver.test_tpl_id = tpl_id
         else:
             ver = DataVersion(stype, version, tpl_id, 0)
             Session.add(ver)
         Session.commit()
         return '保存成功' + str(ver.test_tpl_id)
     return '参数有错误'
Ejemplo n.º 12
0
  def SaveStypeConfig(self):
    if self.UserRight(request, response) < 2:
      return '{"status":1, "desc":"没有操作权限, 请确保管理员帐号登录"}'

    cfg = self.stype_config_.filter_by(stype=int(request.params['stype'])).first()
    if not cfg:
      cfg = StypeConfig(stype = int(request.params['stype']), 
          weight = int(request.params['weight']), 
          type = int(request.params['type']), 
          ptype = int(request.params['ptype']), 
          description = request.params['title'], 
          push_feed_flags = int(request.params['push_flags']), 
          news_merge_type = int(request.params['news_merge_type']),
          mini_merge_type = int(request.params['mini_merge_type']),
          is_update_time_on_merge = int(request.params['update_time_on_merge']),
          is_custom_expr = int(request.params['custom_expr']),
          persist_body = int(request.params['save_content']),
          persist_feeddb = int(request.params['save_feed_db']),
          lifetime = int(request.params['lifetime']),
          daily_quota = int(request.params['daily_quota']))

      Session.add(cfg)
      if 'apply_id' in request.params:
        apply_id = int(request.params['apply_id'])
        self.FeedApplyHandled(apply_id)
    else:
      if int(request.params['is_new']) > 0:
        return '{"status":1, "desc":"新建子类型保存失败(已经存在)"}'

      print cfg.is_update_time, cfg.is_custom_expr
      cfg.is_persist_content = int(request.params['save_content'])
      cfg.ptype = int(request.params['ptype'])
      cfg.description = request.params['title']
      cfg.push_flag = int(request.params['push_flags'])
      cfg.news_merge_type  = int(request.params['news_merge_type'])
      cfg.mini_merge_type = int(request.params['mini_merge_type'])
      cfg.is_update_time = int(request.params['update_time_on_merge'])
      cfg.is_custom_expr = int(request.params['custom_expr'])
      cfg.is_persist_content = int(request.params['save_content'])
      cfg.is_persist_feeddb = int(request.params['save_feed_db'])
      cfg.lifetime = int(request.params['lifetime'])
      cfg.daily_quota = int(request.params['daily_quota'])
      cfg.weight = request.params['weight'] 

    Session.commit()
    return '{"status":0, "desc":"保存成功"}'
Ejemplo n.º 13
0
  def UpdateStypeVersionUsingId(self):
    if self.UserRight(request, response) < 2:
      return '"没有操作权限, 请确保管理员帐号登录"'

    stype = int(request.params['stype'])
    version = int(request.params['version'])
    tpl_id = int(request.params['tpl_id'])
    if stype > 0 and version > 0 and tpl_id >= 0:
      ver = self.data_version_.filter_by(stype = stype, version = version).first()
      if ver:
        ver.using_tpl_id = tpl_id
      else:
        ver = DataVersion(stype, version, 0, tpl_id, 0)
        Session.add(ver)
      Session.commit()
      return '保存成功' + str(ver.using_tpl_id)
    return '参数有错误'
Ejemplo n.º 14
0
    def UpdateStypeVersionUsingId(self):
        if self.UserRight(request, response) < 2:
            return '"没有操作权限, 请确保管理员帐号登录"'

        stype = int(request.params['stype'])
        version = int(request.params['version'])
        tpl_id = int(request.params['tpl_id'])
        if stype > 0 and version > 0 and tpl_id >= 0:
            ver = self.data_version_.filter_by(stype=stype,
                                               version=version).first()
            if ver:
                ver.using_tpl_id = tpl_id
            else:
                ver = DataVersion(stype, version, 0, tpl_id, 0)
                Session.add(ver)
            Session.commit()
            return '保存成功' + str(ver.using_tpl_id)
        return '参数有错误'
Ejemplo n.º 15
0
    def ApplyPublishSubmit(self):
        max_id = Session.query(func.max(ApplyPublish.apply_id)).scalar() or 0

        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        publish_desc = request.params['publish_desc']
        a = ApplyPublish(max_id + 1,
                         stype_id=int(request.params['stype_id']),
                         version=int(request.params['version']),
                         tpl_id=int(request.params['tpl_id']),
                         pm_names=pm_names,
                         pm_emails=pm_emails,
                         dev_names=request.params['dev_names'],
                         dev_emails=request.params['dev_emails'],
                         publish_desc=publish_desc,
                         status=0,
                         apply_time=int(time.time()))
        Session.add(a)
        Session.commit()

        # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
        return '申请保存成功'
Ejemplo n.º 16
0
  def ApplyNewVersionSubmit(self):
    max_id = Session.query(func.max(ApplyNewVersion.apply_id)).scalar() or 0

    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    version_desc = request.params['version_desc']
    a = ApplyNewVersion(max_id + 1,
        stype_id = int(request.params['stype_id']),
        from_version_id = int(request.params['from_version_id']),
        pm_names = pm_names, 
        pm_emails = pm_emails, 
        dev_names = request.params['dev_names'], 
        dev_emails = request.params['dev_emails'], 
        version_desc = version_desc, 
        version_text = request.params['version_text'], 
        status = 0,
        apply_time = int(time.time())
        )
    Session.add(a)
    Session.commit()

    # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Ejemplo n.º 17
0
  def ApplyPublishSubmit(self):
    max_id = Session.query(func.max(ApplyPublish.apply_id)).scalar() or 0

    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    publish_desc = request.params['publish_desc']
    a = ApplyPublish(max_id + 1,
        stype_id = int(request.params['stype_id']),
        version = int(request.params['version']),
        tpl_id = int(request.params['tpl_id']),
        pm_names = pm_names, 
        pm_emails = pm_emails, 
        dev_names = request.params['dev_names'], 
        dev_emails = request.params['dev_emails'], 
        publish_desc = publish_desc, 
        status = 0,
        apply_time = int(time.time())
        )
    Session.add(a)
    Session.commit()

    # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Ejemplo n.º 18
0
    def ApplyNewVersionSubmit(self):
        max_id = Session.query(func.max(
            ApplyNewVersion.apply_id)).scalar() or 0

        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        version_desc = request.params['version_desc']
        a = ApplyNewVersion(max_id + 1,
                            stype_id=int(request.params['stype_id']),
                            from_version_id=int(
                                request.params['from_version_id']),
                            pm_names=pm_names,
                            pm_emails=pm_emails,
                            dev_names=request.params['dev_names'],
                            dev_emails=request.params['dev_emails'],
                            version_desc=version_desc,
                            version_text=request.params['version_text'],
                            status=0,
                            apply_time=int(time.time()))
        Session.add(a)
        Session.commit()

        # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
        return '申请保存成功'