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.
37 lines
1.0 KiB
37 lines
1.0 KiB
import redis, os, sys |
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
|
import config, libs |
|
|
|
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 = config.redis_local |
|
|
|
main(cmd, order_id) |