You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1005 B
35 lines
1005 B
import redis, os, sys |
|
|
|
def main(cmd, order_id): |
|
if cmd == 'print': |
|
key = 'model:printOrder' |
|
elif cmd == 'repair': |
|
key = 'model:IndependentRepairTeamcheckGLBQueue' |
|
elif cmd == 'make3d': |
|
key = 'model:make' |
|
elif cmd == 'make3d10': |
|
key = 'model:make10' |
|
elif cmd == 'foot': |
|
key = 'model:foot' |
|
|
|
if order_id == 'view': |
|
for i in r.lrange(key, 0, -1): |
|
print(i) |
|
print(f'当前{key}队列长度:{r.llen(key)}') |
|
else: |
|
order_ids = order_id.split(',') |
|
for order_id in order_ids: |
|
r.lpush(key, order_id) |
|
print(f'已推送{order_id}到{key}, 当前队列长度:{r.llen(key)}') |
|
|
|
if __name__ == '__main__': |
|
if len(sys.argv) == 3: |
|
cmd = sys.argv[1] |
|
order_id = sys.argv[2] |
|
else: |
|
print('用法:python push_cmd.py <cmd> <order_id>') |
|
exit(1) |
|
|
|
r = redis.Redis(host='106.14.158.208', password='kcV2000', port=6379, db=6) |
|
|
|
main(cmd, order_id) |