Esempio n. 1
0
# -*- coding: utf-8 -*-

import sys
reload(sys)
sys.setdefaultencoding('utf8')
import os, time
import json
import httplib
from HW_DT_TOOL import getToday
from HW_DB import DataBaseParent_local, DataBaseParent_byerp
sys.path.append("/home/webroot/oWorld/complaint")
from share import template_id_msg_tj, AppId_tj, AppSecret_tj, host_url, read_access_token_common, write_access_token_common, my_urlencode
#本地mysql数据库
local = DataBaseParent_local()
sys.setdefaultencoding('utf-8')


def mWxPushMsg_tracking_fw(pk, prj_name, usr_id_tj, usr_name, status):
    now = getToday()
    toUser = get_toUser(usr_id_tj)
    conn = httplib.HTTPSConnection('api.weixin.qq.com')
    sToken = read_access_token_common('access_token_tj')
    if sToken == '':
        url = "/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s" % (
            AppId_tj, AppSecret_tj)
        conn.request('GET', '%s' % url)
        res = conn.getresponse()
        body = res.read()
        ddata = json.loads(body)
        sToken = ddata['access_token']
        conn.close()
Esempio n. 2
0
# -*- coding: utf-8 -*-

import sys
reload(sys)
sys.setdefaultencoding('utf8')
import os,time
import json
import urllib
from HW_DB   import DataBaseParent_local
#本地mysql数据库
db=DataBaseParent_local()  
# uc=unicode(str('s'), 'eucgb2312_cn')
sys.path.append("/home/webroot/oWorld")
from common.HW_FILE_TOOL           import make_sub_path,writeTXT,openTXT,writeLOG
# from complaint.share           import write_access_token,read_access_token
#微信服务号变量
AppId = 'wxe703baaad2a1c9dc'   #APPID
Token = 'Fgfdg1F_W45Ed155w7wrfw'
EncodingAESKey = 'MOTN3tKdlg8rTbcYtK32MW6IK9QG4oQbZH5ZzQUQSk6'
AppSecret = '780065948cba96c5831c6b047a0ff7f8'
host_url = 'http://lw.szby.cn'

def getWxUsers():
    conn = httplib.HTTPSConnection('api.weixin.qq.com') 
    sToken = read_access_token()
    if sToken == '':            
        url = "/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"%(AppId,AppSecret)
        conn.request('GET', '%s'%url)  
        res = conn.getresponse()       
        body = res.read()  
        ddata=json.loads(body)
# -*- coding: utf-8 -*-

import sys
import os,time
import httplib
import urllib
import json
# import pymssql
# sys.path.append("/home/webroot/oWorld/complaint")
# exec ('from share        import ToGBK')
# import MySQLdb
from HW_DB   import DataBaseParent_local,DataBaseParent_byerp,DataBaseParent_bkerp
#本地mysql数据库
local=DataBaseParent_local()  
#主系统MSSQL数据库
byerp = DataBaseParent_byerp()
bkerp = DataBaseParent_bkerp()
uc=unicode(str('s'), 'eucgb2312_cn')

def ToGBK(s):
    try:
        s=str(s.decode("utf-8").encode("GBK"))
    except:
        s=s
    s = s.replace("\n","\r\n")
    return s

if __name__ == "__main__":

    sql="select isnull(max(seq_from_wx),0) from out_proj_tracking where datasource = 2 "
    rows,iN=byerp.select(sql)