Rev 16339 | Blame | Compare with Previous | Last modification | View Log | RSS feed
import MySQLdbfrom shop2020.clients.HelperClient import HelperClientfrom shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsTypedb = MySQLdb.connect('192.168.158.89',"root","shop2020","dtr" )cursor = db.cursor()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, '')) <>''"def send_transaction_sms(customerId, mobileNo, smsText, smsType):if mobileNo is not None:helper_client = HelperClient(host_key = "helper_service_server").get_client()helper_client.saveUserSmsForSending(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL)def main():cursor.execute(SMS_DATA_SQL)result_data = cursor.fetchall()smsText = "Limited offer best deals on micromax, samsung , intex, lenovo mobiles. Check your ProfitMandi app http://bit.ly/1MXGBdd. Save Rs 5000/-"helper_client = HelperClient(host_key = "helper_service_server").get_client()helper_client.saveUserSmsForSending(112365682, str(9711196613), smsText, SmsType.PROMOTIONAL)if __name__=='__main__':main()