first push
This commit is contained in:
31
LiveStock/sms_management.py
Normal file
31
LiveStock/sms_management.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import requests
|
||||
from django.http import HttpResponse
|
||||
|
||||
from LiveStock.models import Cooperative
|
||||
from authentication.sahandsms.sms import USERNAME_SMS, PASSWORD_SMS, USERNAME_SMS_FINANCIAL, PASSWORD_SMS_FINANCIAL
|
||||
from panel.helper import check_mobile_number
|
||||
|
||||
|
||||
def send_sms_for_cooperative(request):
|
||||
cooperative=Cooperative.objects.filter(trash=False)
|
||||
for c in cooperative:
|
||||
mobile=c.user.mobile
|
||||
password=c.user.password
|
||||
message = 'کاربر گرامی' \
|
||||
f'\n' \
|
||||
f'اطلاعات کاربری شما در سامانه به شرح زیر میباشد:' \
|
||||
f'\n' \
|
||||
f'\n' \
|
||||
f'نام کاربری: {mobile}' \
|
||||
f'\n' \
|
||||
f'رمز عبور: {password}' \
|
||||
f'\n' \
|
||||
f'(سامانه رصدیار)' \
|
||||
|
||||
check_mobile = check_mobile_number(mobile)
|
||||
if check_mobile:
|
||||
u = "http://webservice.sahandsms.com/newsmswebservice.asmx/SendPostUrl?username={}&password={}&from=30002501&to={}&message={}".format(
|
||||
USERNAME_SMS, PASSWORD_SMS,
|
||||
mobile, message)
|
||||
|
||||
return HttpResponse('pk')
|
||||
Reference in New Issue
Block a user