Пример #1
0
def test(*,objectid,qrcontent):
    nextId=next_id()
    arr=yield from queryQrObjectId(objectid)
    rows=0
    if len(arr)>0:
       ##update
       logging.info("update objectid() %s" % objectid) 
       q=arr[0]
       q["qrcontent"]=qrcontent
       rows=yield from q.update()
    else:
       ##insert
       q=QrTable(objectid=objectid,qrindex=nextId,qrcontent=qrcontent)
       logging.info("insert qrindex() %s" % nextId)
       rows= yield from q.save()
       
    if rows!=1:
       return dict(errCode=False,content="")
    else:
       arr=yield from queryQrObjectId(objectid)
       qOBJ=arr[0]
       return dict(errCode=True,content=qrindexUrl(qOBJ))
Пример #2
0
def queryQrObjectId(objectid):
    arr=yield from QrTable.findAll("objectid=?",[objectid])
    return arr
Пример #3
0
def queryQrIndex(qrindex):
    arr=yield from QrTable.findAll("qrindex=?",[qrindex])
    return arr