#!/bin/bash
project_path=/home/quant_group/msg-center
config_file=/home/config_files/special
cp $config_file/msg_center_white_list.py $project_path/server/white_list.py

sed -i "s/import json/import json\nfrom white_list import white_list\nfrom white_list import phone_white_list/g" $project_path/server/mq/*.py
sed -i "s/msg = json.loads(body, \"utf8\")/msg = json.loads(body, \"utf8\")\n            if msg[\"source\"] not in white_list:\n                logging.info(\"IP：%s不再白名单之列,将检查手机号白名单\", msg[\"source\"])\n                if msg[\"phoneNo\"] not in phone_white_list:\n                        logging.info(\"Phone：%s不再白名单之列，短信中心禁止发送该条短信。\", msg)\n                        self.acknowledge_message(basic_deliver.delivery_tag)\n                        return/g" $project_path/server/mq/*.py
