当前位置: 首页 > news >正文

com是什么网站网络培训平台有哪些

com是什么网站,网络培训平台有哪些,怎么样自己建立一个网站,公众号平台官网登录入口手机版1、根据appid,secret获取token 2、查找粉丝 3、指定模板及粉丝id发送模板消息 4、链接SqlServer数据库获取消息任务 5、创建定时任务监听消息 from logging import exception import time import pymysql import datetime; from utils.http_utils import *; from model.msg_wx_… 1、根据appid,secret获取token 2、查找粉丝 3、指定模板及粉丝id发送模板消息 4、链接SqlServer数据库获取消息任务 5、创建定时任务监听消息 from logging import exception import time import pymysql import datetime; from utils.http_utils import *; from model.msg_wx_model import *; from threading import Timerappid wx*****; appsecret ****; template_id 9uWUl0evW9o5Q5KPbZaa4WxpXOsHN9V28vWPG2T** #模板id token ;#查找公众号所有的粉丝 def findUser():url fhttps://api.weixin.qq.com/cgi-bin/user/get?access_token{token}next_openid;result httpGet(url,);print(result);for row in result[data][openid]:print(row);url https://api.weixin.qq.com/cgi-bin/user/info?access_token token openid row;jsonText httpGet(url,);print(jsonText);pass;#指定粉丝发送模板消息 def send(userId, content):list content.split(|);first list[0]k1list[1];k2list[2];k3list[3];k4list[4];k5list[5];remark list[6];jsonstr {first:{ \f value:{first},\ color:#173177\},\keyword1: {\f value:{k1},\ color:#173177\},\keyword2: {\f value:{k2},\ color:#173177\},\keyword3: {\f value:{k3},\ color:#173177\},\keyword4: {\f value:{k4},\ color:#173177\},\keyword5: {\f value:{k5},\ color:#173177\},\remark:{\f value:{remark},\ color:#173177\}};jsonstr jsonstr.replace(, \)body { ftouser:{userId}, template_id: {template_id}, url:#, data:{jsonstr} };data json.loads(body);url https://api.weixin.qq.com/cgi-bin/message/template/send?access_token token;result httpPost(url, data , );print(result);def getToken(): print(获取token...)url https://api.weixin.qq.com/cgi-bin/token?grant_typeclient_credentialappid appid secret appsecret;result httpGet(url,);print(result);global token;token result[access_token];#Timer(60*60, getToken).start()def sendMsg():now datetime.datetime.now()ts now.strftime(%Y-%m-%d %H:%M:%S)conn1 pymysql.connect(hostxx.xx.xx.xx,port3306,userroot,passwdxxx,dbsxty_data )cursor1 conn1.cursor()print(ts 获取消息任务)sql select to_user,content,id from msg_wx where state 0 #print(sql)cursor1.execute(sql)data1 cursor1.fetchall()#print(data1);for row in data1:userId row[0];content row[1];msgId row[2];send(userId,content);msg MsgWxModel();msg.cursor cursor1;msg.conn conn1;msg.id msgId;msg.state 1;msg.send_date ts;msg.update();cursor1.close();conn1.close();#获取token def job0():try:getToken(); except Exception as reason:print(reason)pass;Timer(60*60, job0).start(); #发送消息 def job1():try:sendMsg(); except Exception as reason:getToken();print(reason)Timer(5, job1).start();print(消息服务已启动...) job0(); job1(); #findUser();
http://www.hkea.cn/news/14523984/

相关文章:

  • 乐清 做网站 多少钱怎样做网络推广
  • 网站做标签页北京商城网站设计报价
  • jq动画效果网站网站备案 查询
  • 重庆模板建站哪家好怎么建立一个网站能够与讯飞云对话
  • 法律行业网站建设军事新闻2023
  • 福州建设部官方网站高端网站有哪些优势
  • 大庆网站建设优化网站发布方式有哪些
  • 创意策划网站成都谁做捕鱼网站
  • 手机网站上线左右滑动兼职网页设计怎么报价
  • wordpress友情链接函数seo网站推广方式
  • h5网站开发中心飞鱼crm系统
  • 百度站长平台注册qq是用什么软件开发的
  • 导航网站制作 zhihuwordpress登入后台
  • 网站备案怎么做超链接新网站一般建设空间大小
  • 绍兴免费做网站网站前台维护
  • 湖南建设监理协会网站什么是ip地址和域名
  • 中高端网站设计wordpress 后台子菜单
  • 163网站视频动做网站域名 评估作价
  • 初中生做网站挣钱自己可以做网站生意好做吗
  • 厦门模板网站可以在哪些网站 APP做推广
  • 完成一个个人主页网站的制作网络推广培训教程
  • 老网站改版做别的做网站每年都要费用的吗
  • 公司建设网站需求用rp怎样做网站
  • 比较冷门的视频网站做搬运静安做网站的公司
  • 聊天网站建设wordpress淘宝客主题免费下载
  • 国外网站做推广百度网站推广找谁做
  • 0元购怎么在网站做深汕特别合作区包括哪些地方
  • 邯郸网站开发动物网站建设
  • wordpress图片预加载seo 网站标题长度
  • 网站建设策划稿wordpress 评论模块