operation notification
This commit is contained in:
parent
55e2aeedf7
commit
9154ada5a3
|
@ -582,4 +582,4 @@ $.get('api/check_session',function(res){
|
|||
})
|
||||
}
|
||||
var t1 = window.setInterval(update, 1000 * 60)
|
||||
var t2 = window.setInterval(checksession,1000*60*31)
|
||||
var t2 = window.setInterval(checksession,1000*60*41)
|
|
@ -35,6 +35,17 @@ def send_wechatmsgs(postdict,tolist):
|
|||
except:
|
||||
pass
|
||||
|
||||
@shared_task
|
||||
def send_wechatmsgsu(postdict,tousers):
|
||||
with open(dirname + 'token.txt','r',encoding= 'utf-8') as f:
|
||||
token=f.read()
|
||||
try:
|
||||
for i in tousers:
|
||||
postdict['touser']= User.object.get(userid=i).openid
|
||||
requests.post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token='+token,data=json.dumps(postdict))
|
||||
except:
|
||||
pass
|
||||
|
||||
@shared_task
|
||||
def send_wechatmsg(postdict):
|
||||
with open(dirname + 'token.txt','r',encoding= 'utf-8') as f:
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
var headimgurl = $('#userindex').attr('headimgurl');
|
||||
var issuper = {{ issuper }};
|
||||
if (issuper == 1) { $('#setupb').show() }
|
||||
if (openid == 0 && issuper != 1) { $('#wxdg').dialog(); } else { $('#bindwx').text('解绑微信'); };
|
||||
if ((openid == 0 ||openid == 'None') && issuper != 1) { $('#wxdg').dialog(); } else { $('#bindwx').text('解绑微信'); };
|
||||
if (headimgurl != 0 && headimgurl != 'None') { $('#headimg').attr('src', headimgurl); }
|
||||
function logout() {
|
||||
$.messager.confirm('系统提示', '您确定要退出本次登录吗?', function (r) {
|
||||
|
@ -184,7 +184,7 @@
|
|||
});
|
||||
}
|
||||
function bindwx() {
|
||||
if (openid == 0) {
|
||||
if (openid == 0 ||openid == 'None') {
|
||||
$('#wxdg').dialog('open');
|
||||
} else {
|
||||
var str = '你已绑定昵称为' + nickname + '的微信号,确定解绑吗?'
|
||||
|
|
|
@ -13,7 +13,7 @@ import time
|
|||
from datetime import datetime,date,timedelta
|
||||
from django.db.models import F,Count,Sum
|
||||
import requests
|
||||
from .tasks import send_wechatmsgs,send_wechatmsg,yjjs,gettime,yjjs_px,yjjs_yl,updateTzzs,updateAqzs,yjjs_gc,yjjs_ws
|
||||
from .tasks import send_wechatmsgs,send_wechatmsg,yjjs,gettime,yjjs_px,yjjs_yl,updateTzzs,updateAqzs,yjjs_gc,yjjs_ws,send_wechatmsgsu
|
||||
from .export import exportdoc,exportxlsx,exportyjdoc,exportsimplexlsx,exportdoc2
|
||||
from .daoru import drusers,drequipments,drrisks,drquestions,cal_riskact_level,cal_area_risk_level,makeqr,makeqr_train,makeqr_riskact,makeqr_examtest,makeqr_area
|
||||
from django.forms.models import model_to_dict
|
||||
|
@ -4499,30 +4499,29 @@ def apioperation(req):
|
|||
sprs = [obj.zyzt['splc'][index]['spr']]
|
||||
obj.todousers = sprs
|
||||
obj.save()
|
||||
for i in sprs:
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':User.objects.get(userid=i).openid,
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
'value':obj.zylx.dickeyname + '作业审批:'
|
||||
},
|
||||
'keyword1':{
|
||||
'value':obj.zynr
|
||||
},
|
||||
'keyword2':{
|
||||
'value':obj.kssj
|
||||
},
|
||||
'keyword3':{
|
||||
'value':obj.zydd
|
||||
},
|
||||
'remark':{
|
||||
'value':'请您及时完成审批!'
|
||||
}
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
'value':obj.zylx.dickeyname + '作业审批:'
|
||||
},
|
||||
'keyword1':{
|
||||
'value':obj.zynr
|
||||
},
|
||||
'keyword2':{
|
||||
'value':obj.kssj
|
||||
},
|
||||
'keyword3':{
|
||||
'value':obj.zydd
|
||||
},
|
||||
'remark':{
|
||||
'value':'请您及时完成审批!'
|
||||
}
|
||||
}
|
||||
send_wechatmsg.delay(postdict)
|
||||
}
|
||||
send_wechatmsgsu.delay(postdict,sprs)
|
||||
return JsonResponse({"code":1})
|
||||
elif a == 'spzy':
|
||||
userid = req.session['userid']
|
||||
|
@ -4541,7 +4540,7 @@ def apioperation(req):
|
|||
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':obj.zyfzr.openid,
|
||||
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
|
@ -4567,30 +4566,29 @@ def apioperation(req):
|
|||
newsprs = data['newsprs']#新审批人
|
||||
obj.todousers = newsprs
|
||||
obj.save()
|
||||
for i in newsprs:
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':User.objects.get(userid=i).openid,
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
'value':obj.zylx.dickeyname + '作业审批:'
|
||||
},
|
||||
'keyword1':{
|
||||
'value':obj.zynr
|
||||
},
|
||||
'keyword2':{
|
||||
'value':obj.kssj
|
||||
},
|
||||
'keyword3':{
|
||||
'value':obj.zydd
|
||||
},
|
||||
'remark':{
|
||||
'value':'请您及时完成审批!'
|
||||
}
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
'value':obj.zylx.dickeyname + '作业审批:'
|
||||
},
|
||||
'keyword1':{
|
||||
'value':obj.zynr
|
||||
},
|
||||
'keyword2':{
|
||||
'value':obj.kssj
|
||||
},
|
||||
'keyword3':{
|
||||
'value':obj.zydd
|
||||
},
|
||||
'remark':{
|
||||
'value':'请您及时完成审批!'
|
||||
}
|
||||
}
|
||||
send_wechatmsg.delay(postdict)
|
||||
}
|
||||
send_wechatmsgsu.delay(postdict,newsprs)
|
||||
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=2,spbm=spruser.ubelongpart)
|
||||
return JsonResponse({"code":1})
|
||||
try:
|
||||
|
@ -4600,30 +4598,29 @@ def apioperation(req):
|
|||
obj.zyzt['jdmc'] = nextsplc['jdmc']
|
||||
obj.todousers = nextsplc['sprs']
|
||||
obj.save()
|
||||
for i in nextsplc['sprs']:
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':User.objects.get(userid=i).openid,
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
'value':obj.zylx.dickeyname + '作业审批:'
|
||||
},
|
||||
'keyword1':{
|
||||
'value':obj.zynr
|
||||
},
|
||||
'keyword2':{
|
||||
'value':obj.kssj
|
||||
},
|
||||
'keyword3':{
|
||||
'value':obj.zydd
|
||||
},
|
||||
'remark':{
|
||||
'value':'请您及时完成审批!'
|
||||
}
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
'value':obj.zylx.dickeyname + '作业审批:'
|
||||
},
|
||||
'keyword1':{
|
||||
'value':obj.zynr
|
||||
},
|
||||
'keyword2':{
|
||||
'value':obj.kssj
|
||||
},
|
||||
'keyword3':{
|
||||
'value':obj.zydd
|
||||
},
|
||||
'remark':{
|
||||
'value':'请您及时完成审批!'
|
||||
}
|
||||
}
|
||||
send_wechatmsg.delay(postdict)
|
||||
}
|
||||
send_wechatmsgsu.delay(postdict,nextsplc['sprs'])
|
||||
|
||||
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
||||
except :
|
||||
|
@ -4634,7 +4631,7 @@ def apioperation(req):
|
|||
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
||||
postdict={
|
||||
'touser':'',
|
||||
'template_id':obj.zyfzr.openid,
|
||||
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
||||
'data':{
|
||||
'first':{
|
||||
|
|
Loading…
Reference in New Issue