本帖最后由 柠檬 于 2022-1-23 10:42 编辑 #使用方法:
配合玩法为为充值玩家提供周卡,月卡等服务
也可以作为充值满一定玩家提供福利 ,定时返还银元宝
打开宝塔-左侧-计划任务
任务名称自定义
选择执行周期即每天要充值的时间
修改上面的数据库密码 充值金额 和要充值的帐号
复制上面的内容 填入脚本内容里
添加任务即可 - <div>
- </div><div>#!/bin/bash
- DBNAME="dl_adb_all"
- USERNAME="root"
- PASSWORD="BHD2WjrBnT8sKAKj"
- COIN_NUM="100"
- user_account=("test0816" "1008611" "1105389211qq")
- length=`expr ${#user_account[@]} - 1`
- for i in $(seq 0 $length)
- do
- BEFORE_COIN=`mysql -u${USERNAME} -p${PASSWORD} --skip-column-names -e "use ${DBNAME} ;
- SELECT silver_coin FROM account WHERE account = '${user_account[i]}';"`
- AFTER_COIN=`expr $BEFORE_COIN + $COIN_NUM`
- if [ $AFTER_COIN -ge 0 ] && [ $AFTER_COIN -le 2000000000 ]
- then mysql -u${USERNAME} -p${PASSWORD} -e "use ${DBNAME};
- UPDATE account SET silver_coin = silver_coin + $COIN_NUM, CHECKSUM = upper(CAST(md5(concat(CAST(account AS char CHARACTER SET utf8),CAST(PASSWORD AS char CHARACTER SET utf8),CAST(LPAD(CONV(privilege, 10, 16), 8, 0) AS char CHARACTER SET utf8),CAST(blocked_time AS char CHARACTER SET utf8),CAST(LPAD(CONV(gold_coin, 10, 16), 8, 0) AS char CHARACTER SET utf8),CAST(LPAD(CONV(silver_coin, 10, 16), 8, 0) AS char CHARACTER SET utf8),CAST(coin_password AS char CHARACTER SET utf8),CAST(unlock_coin_password_time AS char CHARACTER SET utf8),CAST(trade_lock_time AS char CHARACTER SET utf8),CAST(permit_ip AS char CHARACTER SET utf8),'ABCDEF')) AS CHAR))WHERE account = '${user_account[i]}';"
- sleep 1
- echo "$(date +"%Y-%m-%d %H:%M:%S") 成功为帐号 ${user_account[i]} 充值$COIN_NUM银元宝,当前银元宝数量为$AFTER_COIN" >> /root/charge_accs.log
- else echo "$(date +"%Y-%m-%d %H:%M:%S") 帐号 ${user_account[i]} 充值失败, 当前银元宝数量为$BEFORE_COIN" >> /root/charge_accs.log
- fi
- done
- </div>
复制代码
|