| 16339 |
manish.sha |
1 |
import MySQLdb
|
|
|
2 |
from shop2020.clients.HelperClient import HelperClient
|
|
|
3 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
|
|
4 |
|
| 16340 |
manish.sha |
5 |
db = MySQLdb.connect('192.168.158.89',"root","shop2020","dtr" )
|
| 16339 |
manish.sha |
6 |
cursor = db.cursor()
|
|
|
7 |
|
|
|
8 |
SMS_DATA_SQL="select us.user_id, ua.account_key, u.mobile_number, us.comment saholic_user_id from user_activity_status us join users u on us.user_id = u.id join usergroups ug on u.usergroup_id = ug.id join user_accounts ua on us.user_id = ua.user_id where comment in ('Uninstall','Probable uninstall') and last_active < '2015-07-01' and ug.groupbasis ='Not_Defined' and ua.account_type ='saholic' and trim(coalesce(u.mobile_number, '')) <>''"
|
|
|
9 |
|
|
|
10 |
def send_transaction_sms(customerId, mobileNo, smsText, smsType):
|
|
|
11 |
if mobileNo is not None:
|
|
|
12 |
helper_client = HelperClient(host_key = "helper_service_server").get_client()
|
|
|
13 |
helper_client.saveUserSmsForSending(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL)
|
|
|
14 |
|
|
|
15 |
def main():
|
|
|
16 |
cursor.execute(SMS_DATA_SQL)
|
|
|
17 |
result_data = cursor.fetchall()
|
|
|
18 |
|
|
|
19 |
smsText = "Limited offer best deals on micromax, samsung , intex, lenovo mobiles. Check your ProfitMandi app http://bit.ly/1MXGBdd. Save Rs 5000/-"
|
|
|
20 |
helper_client = HelperClient(host_key = "helper_service_server").get_client()
|
|
|
21 |
helper_client.saveUserSmsForSending(112365682, str(9711196613), smsText, SmsType.PROMOTIONAL)
|
|
|
22 |
|
|
|
23 |
if __name__=='__main__':
|
|
|
24 |
main()
|