派生自 development/c++

pans
2019-03-30 b3a8f07c53c479051e427830379779cb56e87736
fix bug
5个文件已修改
57 ■■■■ 已修改文件
QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VideoToImageMulth/main.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
syncDBTool/ErlangDbTool.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/vss/dao/BaseDao.h
@@ -32,6 +32,7 @@
        }
        return simpleResult;
    }
    static bool del(string tableName, std::map<std::string, std::string>& whereColumns) {
        initConnection();
        string sql = "DELETE FROM " + tableName + " where 1=1 " + getWhereColumnNameValuePair(whereColumns);
@@ -42,7 +43,9 @@
        }
        return ret;
    }
    static bool update(std::map<std::string, std::string>& columns, string tableName, std::map<std::string, std::string>& whereColumns) {
    static bool update(std::map<std::string, std::string> &columns, string tableName,
                       std::map<std::string, std::string> &whereColumns) {
        string updateSql = getUpdateSql(columns, tableName, whereColumns);
        initConnection();
        mysqlpp::Query query = conn->query(updateSql);
@@ -80,7 +83,9 @@
    static Json::Value findJsonArray(string sql, std::map<std::string, std::string>& whereColumns) {
        sql = sql + getWhereColumnNameValuePair(whereColumns);
        initConnection();
//        conn->query("SET character_set_server = utf8;");
        mysqlpp::Query query = conn->query(sql);
        std::cout << sql << std::endl;
        Json::Value rowList;
        if (auto res = query.store()) {
            for (auto it = res.begin(); it != res.end(); ++it) {
@@ -93,6 +98,9 @@
                        columnValue = "";
                    }
                    string columnName = fieldNames[0].at(i);
//                    if (columnName == "Nickname") {
//                        columnValue = columnValue;//.substr(0, 20);
//                    }
                    row[columnName] = columnValue;
                }
                rowList.append(row);
@@ -113,6 +121,7 @@
        }
        return ret;
    }
    static string getInsertSql(std::map<std::string, std::string>& columns, string tableName) {
        string insertSql = "INSERT INTO "+tableName+" ("
                           + getColumnNames(columns) +
@@ -122,17 +131,20 @@
        cout << "insertSql " << insertSql << endl;
        return insertSql;
    }
    static string getUpdateSql(std::map<std::string, std::string>& columns, string tableName, std::map<std::string, std::string>& whereColumns) {
    static string getUpdateSql(std::map<std::string, std::string> &columns, string tableName,
                               std::map<std::string, std::string> &whereColumns) {
        string updateSql = "update "+tableName+" set "
                           + getColumnNameValuePair(columns) +
                           " where 1=1 "+
                           getWhereColumnNameValuePair(whereColumns)
        ;
                           getWhereColumnNameValuePair(whereColumns);
        cout << "updateSql " << updateSql << endl;
        return updateSql;
    }
    static void doConnect() {
        cout << "db_host=" << appConfig.getStringProperty("db_host").c_str() << endl;
        conn->set_option(new mysqlpp::SetCharsetNameOption("utf8"));
        if (conn->connect(
            appConfig.getStringProperty("database").c_str(),
            appConfig.getStringProperty("db_host").c_str(),
@@ -148,21 +160,25 @@
//                3306
//        )) {
            cout << "connect success" << endl;
            mysqlpp::Query query = conn->query("SET NAMES UTF8-");
        } else {
            cout << "connect failed" << endl;
        }
    }
    static void initConnection() {
        static bool inited = false;
        if (!inited) {
            inited = true;
            conn = new mysqlpp::Connection(false);
            doConnect();
        }
        if (!conn->connected() || !conn->ping()) {
            doConnect();
        }
    }
    static string getColumnNames(std::map<std::string, std::string>& columns) {
        string columnNames;
        auto size = columns.size();
@@ -176,6 +192,7 @@
        }
        return columnNames;
    }
    static string getColumnValues(std::map<std::string, std::string>& columns) {
        string columnValues;
        auto size = columns.size();
@@ -189,6 +206,7 @@
        }
        return columnValues;
    }
    static string getColumnNameValuePair(std::map<std::string, std::string>& columns) {
        string columnNameValuePair;
        auto size = columns.size();
@@ -205,6 +223,7 @@
        }
        return columnNameValuePair;
    }
    static string getWhereColumnNameValuePair(std::map<std::string, std::string>& columns) {
        string columnNameValuePair;
        auto size = columns.size();
QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
@@ -33,6 +33,7 @@
    sws_freeContext(convert_ctx);
    DBG("m.size is " << m.size());
//    LOG_IF();
    return m;
}
@@ -309,8 +310,9 @@
//        DBG("emitSigal(\"DecoderImageOK\") after");
//#endif
            DBG("emitSigal(\"DecoderImageOK\") after");
            DBG("p_this->m_camIdx is " << p_this->m_camIdx << " queue size is " << p_this->m_rtpQueue.count_queue());
//            DBG("emitSigal(\"DecoderImageOK\") after");
//            DBG("p_this->m_camIdx is " << p_this->m_camIdx << " queue size is " << p_this->m_rtpQueue.count_queue());
#ifdef TestCode
            {
QiaoJiaSystem/VideoToImageMulth/RtspAnalysManager.cpp
@@ -9,7 +9,7 @@
using std::string;
RtspAnalysManager::RtspAnalysManager(LDBTool *_dbTool) : m_lDBTool(nullptr), m_maxCount(50), m_currentCount(0) {
    INFO("MYH DEBUG HERE");
//    INFO("MYH DEBUG HERE");
    m_lDBTool = new LDBTool;
    init();
@@ -39,7 +39,7 @@
//初始化函数
void RtspAnalysManager::init() {
    INFO("MYH DEBUG HERE")
//    INFO("MYH DEBUG HERE")
    m_GB28181_Enable = appPref.getIntData("GB28181_Enable");
    //#todo GB28181
@@ -153,7 +153,7 @@
        //#todo end
        if (m_controllers_videoCapElem.find(index) == m_controllers_videoCapElem.end()) {
            INFO("MYH DEBUG HERE");
//            INFO("MYH DEBUG HERE");
            if (m_currentCount >= m_maxCount) {
                ERR("addCamera faild, camera's num is full!")
                return -1;
@@ -255,7 +255,7 @@
 * @return
 */
int RtspAnalysManager::removeAll() {
    INFO("MYH DEBUG HERE");
//    INFO("MYH DEBUG HERE");
    if (m_GB28181_Enable) {
        for (auto controller: m_controllers_videoCapElem) {
@@ -276,7 +276,7 @@
        }
        m_controllers.clear();
    }
    INFO("MYH DEBUG HERE");
//    INFO("MYH DEBUG HERE");
    m_imgRedisCRwLock.wrlock();
    for (auto controller: m_imgRedisControllers) {
@@ -291,7 +291,7 @@
    m_currentCount = 0;
    INFO("MYH DEBUG HERE");
//    INFO("MYH DEBUG HERE");
    return 0;
}
@@ -345,7 +345,7 @@
        ERR("Save Failed Cam: " << camId << " ImageKey: " << imageName);
    }
//    m_imgRedisCRwLock.unlock();
    INFO("MYH DEBUG HERE");
//    INFO("MYH DEBUG HERE");
    return true;
}
QiaoJiaSystem/VideoToImageMulth/main.cpp
@@ -66,8 +66,10 @@
//            std::string rtmpAddr = appConfig.getStringProperty("srsAddr");
//            std::string publish_basepath = rtmpAddr + "" ;
//            appPref.setStringData("publish.basepath", publish_basepath);
        appPref.setIntData("pulish.width", 640);
        appPref.setIntData("pulish.height", 360);
//        appPref.setIntData("pulish.width", 640);
//        appPref.setIntData("pulish.height", 360);
        appPref.setIntData("pulish.width", 1920);
        appPref.setIntData("pulish.height", 1080);
    }
//    int arg1 = atoi(argv[1]);
//
syncDBTool/ErlangDbTool.cpp
@@ -11,6 +11,8 @@
#include <QtCore/QString>
#include <QtCore/QDebug>
#include <QtCore/QVariantList>
#include <basic/util/app/AppPreference.hpp>
using ErlangTool::map_DevDataCache;
using ErlangTool::map_TabDataCache;
@@ -1760,7 +1762,7 @@
            ETERM *fromp, *tuplep, *fnp, *argp, *resp;
            int port;                                /* Listen port number */
            port = PORT;
            port = appPref.getIntData("ErlNodePort");
            /* Make a listen socket */
            if ((listen = my_listen(port)) <= 0) {
                ERR("my_listen is error");