Ejemplo n.º 1
0
def getFriends(tornadoSelf):
    openid = tornadoSelf.openid
    user = Ljsmysql.table("user").where("open_id", openid).select()
    if len(user) > 0:
        userid = user[0]['user_id']
        sql = "select * from cont, user where cont.cont_user_id = user.user_id and "
        sql += "cont.user_id = {0} order by cont.cont_id desc".format(userid)
        dbData = Ljsmysql.query(sql)
        sendMsg(tornadoSelf, "friends", dbData)
Ejemplo n.º 2
0
def getMyTask(tornadoSelf):
    openid = tornadoSelf.openid
    user = Ljsmysql.table("user").where("open_id", openid).select()
    if len(user) > 0:
        userid = user[0]['user_id']
        sql = "select * from task, task_status stu, user, file where "
        sql += "task.task_file_id = file.file_id and task.task_status_no = stu.task_status_no and task.from_user_id = user.user_id and "
        sql += "task.task_status_no > 0 and task.user_id = '{0}' ".format(userid)
        sql += "order by task.task_id desc"
        dbData = Ljsmysql.query(sql)
        if not isinstance(dbData, list):
            dbData = list(dbData)
        sql = "select * from task, task_status stu, user where "
        sql += "task.task_file_id = 0 and task.task_status_no = stu.task_status_no and task.from_user_id = user.user_id and "
        sql += "task.task_status_no > 0 and task.user_id = '{0}' ".format(userid)
        sql += "order by task.task_id desc"
        dbData += Ljsmysql.query(sql)
        sendMsg(tornadoSelf, "mytask", dbData)
Ejemplo n.º 3
0
def getMessages(tornadoSelf):
    openid = tornadoSelf.openid
    user = Ljsmysql.table("user").where("open_id", openid).select()
    if len(user) > 0:
        userid = user[0]['user_id']
        sql = "select user.user_name as name, user.user_head as head, msg.from_user_id as userid, count(msg.from_user_id) as num, max(msg.msg_datetime) as dt from msg, user "
        sql += "where msg.to_user_id = {0} and msg.msg_read = 0 and ".format(userid)
        sql += "user.user_id = msg.from_user_id "
        sql += "group by msg.from_user_id order by dt desc"
        dbData = Ljsmysql.query(sql)
        sendMsg(tornadoSelf, "messages", dbData)
Ejemplo n.º 4
0
def getCheckTask(tornadoSelf):
    openid = tornadoSelf.openid
    user = Ljsmysql.table("user").where("open_id", openid).select()
    if len(user) > 0:
        userid = user[0]['user_id']
        sql = "select * from task, task_status stu, user where "
        sql += "task.task_status_no = stu.task_status_no and task.user_id = user.user_id and "
        sql += "task.task_status_no = 2 and task.from_user_id = '{0}' ".format(userid)
        sql += "order by task.task_id desc"
        dbData = Ljsmysql.query(sql)
        sendMsg(tornadoSelf, "checkTask", dbData)
Ejemplo n.º 5
0
def getAllMessage(tornadoSelf, obj):
    openid = tornadoSelf.openid
    user = Ljsmysql.table("user").where("open_id", openid).select()
    if len(user) > 0:
        userid = user[0]['user_id']
        sql = "select * from msg, user where msg.from_user_id = user.user_id and "
        sql += "((msg.from_user_id = {0} and msg.to_user_id = {1}) or (msg.from_user_id = {1} and msg.to_user_id = {0})) ".format(userid, obj['userid'])
        sql += "order by msg.msg_datetime"
        dbData = Ljsmysql.query(sql)
        Ljsmysql.table("msg").where({
            "from_user_id": obj['userid'],
            "to_user_id": userid
        }).update({"msg_read": 1})
        sendMsg(tornadoSelf, "allMessage", dbData)
Ejemplo n.º 6
0
def getTask(tornadoSelf):
    sql = "select * from task, task_status stu, user where "
    sql += "task.task_status_no = stu.task_status_no and task.from_user_id = user.user_id and task.task_status_no = 0 "
    sql += "order by task.task_id desc"
    dbData = Ljsmysql.query(sql)
    sendMsg(tornadoSelf, "task", dbData)
Ejemplo n.º 7
0
def getUserlist(tornadoSelf, obj):
    sql = "select * from user, pos where user.pos_id = pos.pos_id and "
    sql += "user.dep_id = {0} order by user.user_id desc".format(obj['dep_id'])
    dbData = Ljsmysql.query(sql)
    sendMsg(tornadoSelf, "userlist", dbData)