code: def add_record(post_id, catalog_id, order=0):
          '''
          Create the record of post 2 tag, and update the count in g_tag.
          '''
  
          rec = MPost2Catalog.__get_by_info(post_id, catalog_id)
          if rec:
              entry = TabPost2Tag.update(
                  order=order,
                  # For migration. the value should be added when created.
                  par_id=rec.tag_id[:2] + '00',
              ).where(TabPost2Tag.uid == rec.uid)
              entry.execute()
          else:
              TabPost2Tag.create(
                  uid=tools.get_uuid(),
                  par_id=catalog_id[:2] + '00',
                  post_id=post_id,
                  tag_id=catalog_id,
                  order=order,
              )
  
          MCategory.update_count(catalog_idf add_record(post_id, catalog_id, order=0):
          '''
          Create the record of post 2 tag, and update the count in g_tag.
          '''
  
          rec = MPost2Catalog.__get_by_info(post_id, catalog_id)
          if rec:
              entry = TabPost2Tag.update(
                  order=order,
                  # For migration. the value should be added when created.
                  par_id=rec.tag_id[:2] + '00',
              ).where(TabPost2Tag.uid == rec.uid)
              entry.execute()
          else:
              TabPost2Tag.create(
                  uid=tools.get_uuid(),
                  par_id=catalog_id[:2] + '00',
                  post_id=post_id,
                  tag_id=catalog_id,
                  order=order,
              )
  
          MCategory.update_count(catalog_id)
docs: Create the record of post 2 tag, and update the count in g_tag.