Пример #1
0
def saveStrategyConfItem(strategy_id, index_label, formular, price, direction):
    strategyConfList = []

    # SQL 查询语句  添加数据
    sql = " INSERT INTO strategy_conf_item(strategy_id,index_label,formular,price, direction)VALUES(%s,%s,%s,%s, %s);"
    param = (strategy_id, index_label, formular, price, direction)
    db.update_db_with_params(sql, param)
Пример #2
0
def update_user_info(user_id, nick_name, open_id, age, gender, avator, style, experience):
    # SQL update 语句
    sql = "update user_info set nick_name=%s,open_id=%s,age=%s,gender=%s," \
          "avator=%s,style=%s,experience=%s" \
          " where user_id = %s"
    param = (nick_name, open_id, age, gender, avator, style, experience, user_id)
    db.update_db_with_params(sql, param)
Пример #3
0
def updateStrategyConf(strategy_id):
    strategyConfList = []
    #  首先删除 之前配置的conf
    sql = "delete from strategy_conf_item where strategy_id= %s "
    db.update_db_with_params(sql, strategy_id)
    # strategy_id = cursor.fetchone()
    return strategy_id
Пример #4
0
def saveUserItem(phone, password, nick_name, open_id, age, gender, avator, levels,
                 strategy_amount, history_amount, style, experience):
    strategyConfList = []
    # SQL  添加数据
    sql = "INSERT INTO user_info(phone,password,nick_name,open_id,age,gender,avator,levels," \
          "strategy_amount,history_amount,style,experience)VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);"
    param = (phone, password, nick_name, open_id, age, gender, avator, levels,
             strategy_amount, history_amount, style, experience)
    db.update_db_with_params(sql, param)
Пример #5
0
def updateStrategy(strategy_id, strategy_name, creator, coin_category, init_balance, start_time, end_time):
    # param = (strategy_name, creator)
    # cursor.execute(sql, param)
    # results = cursor.fetchall()
    strategyConfList = []
    # SQL update 语句
    sql = "update strategy set strategy_name=%s, coin_category = %s, init_balance = %s, start_time= %s, end_time = %s " \
          " where strategy_id = %s and creator = %s "
    param = (strategy_name, coin_category, init_balance, start_time, end_time, strategy_id, creator)
    db.update_db_with_params(sql, param)
    # cursor.execute('SELECT LAST_INSERT_ID();')
    # strategy_id = cursor.fetchone()

    return strategy_id
Пример #6
0
def insertStrategyLog(strategy_id, userId, coin_category, init_balance, start_time, end_time):
    sql = "insert into strategy_log(strategy_id, start_date, end_date, init_balance, coin_category,creator, create_time ) " \
          " values(%s, %s, %s, %s, %s, %s, now()); "

    params = (strategy_id, start_time, end_time, init_balance, coin_category, userId)
    strategy_log_id = db.update_db_with_params(sql, params)
    return strategy_log_id
Пример #7
0
def saveStrategy(strategy_name, creator, coin_category, init_balance, start_time, end_time):
    strategyConfList = []
    # SQL 查询语句
    sql = " INSERT INTO strategy(strategy_name,creator, coin_category,init_balance,start_time,end_time)VALUES(%s,%s,%s,%s,%s, %s);"
    param = (strategy_name, creator, coin_category, init_balance, start_time, end_time)
    strategy_id = db.update_db_with_params(sql, param)
    return strategy_id
Пример #8
0
def update_user_phone_num(phone, user_id):
    # SQL update 语句
    sql = "update user_info set phone=%s" \
          " where user_id = %s"
    param = (phone, user_id)
    db.update_db_with_params(sql, param)
Пример #9
0
def update_user_pwd(user_id, new_pwd):
    # SQL update 语句
    sql = "update user_info set password=%s" \
          " where user_id = %s"
    param = (new_pwd, user_id)
    db.update_db_with_params(sql, param)
Пример #10
0
def mob_updateStrategy(strategy_id, userId, coin_category, init_balance, start_time, end_time):
    sql = "update strategy set  coin_category = %s, init_balance = %s, start_time= %s, end_time = %s" \
          " where strategy_id = %s and creator = %s "

    params = (coin_category, init_balance, start_time, end_time, strategy_id, userId)
    db.update_db_with_params(sql, params)
Пример #11
0
def deleteStrategyLogById(strategy_log_id):
    # SQL 查询语句
    # sql = " delete from strategy_log where strategy_log_id = %s;"
    sql = "update strategy_log set del_flag = 1 where strategy_log_id = %s; "
    param = (strategy_log_id)
    db.update_db_with_params(sql, param)
Пример #12
0
def deleteStrategyById(strategy_id, userId):
    # sql 查询语句
    sql = " update strategy set del_flag = 1 where strategy_id=%s and creator = %s"
    param = (strategy_id, userId)
    db.update_db_with_params(sql, param)
Пример #13
0
def saveStrategyName(strategy_id, strategy_name, creator):
    strategyConfList = []
    # SQL 查询语句
    sql = " update strategy set strategy_name=%s where strategy_id=%s and creator=%s"
    param = (strategy_name, strategy_id, creator)
    db.update_db_with_params(param)