Exemple #1
0
    def create_task(self, device_id, time, action):
        #  这里有坑,action 如果就是False的话,将没有任何警告的直接返回,应该加LOG
        if not device_id\
                or not time\
                or not action:
            return {'result': error_code.ERROR_PARAMS_ERROR}

        value = {"device_id": device_id,
                 "time": time,
                 "action": action}
        DBDeviceTaskInst.insert_ls([value])

        logger.info("RpcHandler::create_task, device_id:%s, time:%s, action:%s" % (device_id, time, action))
        return {'result': error_code.ERROR_SUCCESS}