Exemplo n.º 1
0
def getOrderDetail(config, orderNo):
    helper.getLog('访问getOrderDetail!!!', 'responseOutCode.HQ2.log')
    url = config['url'] + '?op=OrderFinish'
    headers = hawkAuth(url)
    data = {}
    data['otaCode'] = config['account']
    data['otaOrderNO'] = orderNo
    data['platformSend'] = 0
    parameters = {}
    parameters['type'] = '00'
    parameters['parkCode'] = config['parkCode']
    data['parameters'] = json.dumps(parameters).replace(' ', '')
    sign_str = config['account'] + config['privateKey'] + orderNo + '0' + data[
        'parameters']
    data['sign'] = base64.encodestring(helper.md5(
        sign_str.strip()).upper()).strip()
    postData = '''<?xml version="1.0" encoding="utf-8"?>
            <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                <soap:Body>
                   <OrderFinish xmlns="http://tempuri.org/">
                      <otaCode>%s</otaCode>
                      <otaOrderNO>%s</otaOrderNO>
                      <platformSend>%s</platformSend>
                      <parameters>%s</parameters>
                      <signature>%s</signature>
                    </OrderFinish>
                </soap:Body>
            </soap:Envelope>
       ''' % (config['account'], orderNo, 0, data['parameters'], data['sign'])
    res = helper.httpPost(url, postData, headers)
    resBody = json.loads(
        helper.subStr(res, '<OrderFinishResult>', '</OrderFinishResult>'))
    return resBody
Exemplo n.º 2
0
def reBuyDo(serviceUrl, order, sql):
    re = helper.httpPost(serviceUrl, order)
    helper.getLog(
        're_buy_do_info -- order_id:' + str(order['orderId']) +
        ' -- order_create_time:' + str(order['create_time']) + ' -- ' + sql +
        ' -- ' + re, 'serviceCheckPay.log')
    # print ' ==== ' + str(order['type']) + ':' + helper.now()
    pass
Exemplo n.º 3
0
def sendDataToOuterJYZY(url, data):
    # print data
    # print url;
    # url = 'http://www.juyingzhiye.com/service/open'
    # data = 'method=createOrderForBeforePaySync&requestParam={"data":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4gICAgPHJlcXVlc3QgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vcGlhby5xdW5hci5jb20vMjAxMy9RTWVucGlhb1JlcXVlc3RTY2hlbWEgUU1SZXF1ZXN0RGF0YVNjaGVtYS0yLjAuMS54c2QiIHhtbG5zPSJodHRwOi8vcGlhby5xdW5hci5jb20vMjAxMy9RTWVucGlhb1JlcXVlc3RTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiPiAgICAgICAgPGhlYWRlcj4gICAgICAgICAgICA8YXBwbGljYXRpb24+UXVuYXIuTWVucGlhby5BZ2VudDwvYXBwbGljYXRpb24+ICAgICAgICAgICAgPHByb2Nlc3Nvcj5TdXBwbGllckRhdGFFeGNoYW5nZVByb2Nlc3NvcjwvcHJvY2Vzc29yPiAgICAgICAgICAgIDx2ZXJzaW9uPnYyLjAuMTwvdmVyc2lvbj4gICAgICAgICAgICA8Ym9keVR5cGU+Q3JlYXRlT3JkZXJGb3JCZWZvcmVQYXlTeW5jUmVxdWVzdEJvZHk8L2JvZHlUeXBlPiAgICAgICAgICAgIDxjcmVhdGVVc2VyPlN1cHBsaWVyU3lzdGVtTmFtZTwvY3JlYXRlVXNlcj4gICAgICAgICAgICA8Y3JlYXRlVGltZT4yMDE3LTEyLTIwIDE4OjE0OjM4PC9jcmVhdGVUaW1lPiAgICAgICAgICAgIDxzdXBwbGllcklkZW50aXR5PjY1MTY8L3N1cHBsaWVySWRlbnRpdHk+ICAgICAgICA8L2hlYWRlcj4gICAgICAgIDxib2R5IHhzaTp0eXBlPSJDcmVhdGVPcmRlckZvckJlZm9yZVBheVN5bmNSZXF1ZXN0Qm9keSI+ICAgICAgICAgICAgPG9yZGVySW5mbz4gICAgICAgICAgICAgICAgPG9yZGVySWQ+NjAzNDAxPC9vcmRlcklkPiAgICAgICAgICAgICAgICA8cHJvZHVjdD4gICAgICAgICAgICAgICAgICAgIDxyZXNvdXJjZUlkPjEwMjQ1PC9yZXNvdXJjZUlkPiAgICAgICAgICAgICAgICAgICAgPHByb2R1Y3ROYW1lPua1i+ivleelqDwvcHJvZHVjdE5hbWU+ICAgICAgICAgICAgICAgICAgICA8dmlzaXREYXRlPjIwMTctMTItMjA8L3Zpc2l0RGF0ZT4gICAgICAgICAgICAgICAgICAgIDxzZWxsUHJpY2U+MTA8L3NlbGxQcmljZT4gICAgICAgICAgICAgICAgICAgIDxjYXNoQmFja01vbmV5PjA8L2Nhc2hCYWNrTW9uZXk+ICAgICAgICAgICAgICAgIDwvcHJvZHVjdD4gICAgICAgICAgICAgICAgPGNvbnRhY3RQZXJzb24+ICAgICAgICAgICAgICAgICAgICA8bmFtZT7mtYvor5U8L25hbWU+ICAgICAgICAgICAgIA==ICAgICAgIDxuYW1lUGlueWluPjwvbmFtZVBpbnlpbj4gICAgICAgICAgICAgICAgICAgIDxtb2JpbGU+MTUyMTMyNDk3NzU8L21vYmlsZT4gICAgICAgICAgICAgICAgICAgIDxlbWFpbD48L2VtYWlsPiAgICAgICAgICAgICAgICAgICAgPGFkZHJlc3M+PC9hZGRyZXNzPiAgICAgICAgICAgICAgICAgICAgPHppcENvZGU+PC96aXBDb2RlPiAgICAgICAgICAgICAgICA8L2NvbnRhY3RQZXJzb24+ICAgICAgICAgICAgICAgIDx2aXNpdFBlcnNvbj4gICAgICAgICAgICAgICAgICAgIDxwZXJzb24+ICAgICAgICAgICAgICAgICAgICAgICAgPG5hbWU+PC9uYW1lPiAgICAgICAgICAgICAgICAgICAgICAgIDxuYW1lUGlueWluPjwvbmFtZVBpbnlpbj4gICAgICAgICAgICAgICAgICAgICAgICA8Y3JlZGVudGlhbHM+PC9jcmVkZW50aWFscz4gICAgICAgICAgICAgICAgICAgICAgICA8Y3JlZGVudGlhbHNUeXBlPjwvY3JlZGVudGlhbHNUeXBlPiAgICAgICAgICAgICAgICAgICAgICAgIDxkZWZpbmVkMVZhbHVlPjwvZGVmaW5lZDFWYWx1ZT4gICAgICAgICAgICAgICAgICAgICAgICA8ZGVmaW5lZDJWYWx1ZT48L2RlZmluZWQyVmFsdWU+ICAgICAgICAgICAgICAgICAgICA8L3BlcnNvbj4gICAgICAgICAgICAgICAgPC92aXNpdFBlcnNvbj4gICAgICAgICAgICAgICAgPG9yZGVyUXVhbnRpdHk+MTwvb3JkZXJRdWFudGl0eT4gICAgICAgICAgICAgICAgPG9yZGVyUHJpY2U+MTA8L29yZGVyUHJpY2U+ICAgICAgICAgICAgICAgIDxvcmRlckNhc2hCYWNrTW9uZXk+PC9vcmRlckNhc2hCYWNrTW9uZXk+ICAgICAgICAgICAgICAgIDxvcmRlclN0YXR1cz5DQVNIUEFZX09SREVSX0lOSVQ8L29yZGVyU3RhdHVzPiAgICAgICAgICAgICAgICA8b3JkZXJSZW1hcms+PC9vcmRlclJlbWFyaz4gICAgICAgICAgICAgICAgPG9yZGVyU291cmNlPjwvb3JkZXJTb3VyY2U+ICAgICAgICAgICAgICAgIDxldGlja2V0Tm8+PC9ldGlja2V0Tm8+ICAgICAgICAgICAgPC9vcmRlckluZm8+ICAgICAgICA8L2JvZHk+ICAgIDwvcmVxdWVzdD4gICAg","securityType":"MD5","signed":"002867F0B33D0B82A04A5FDCF0E48D84"}'
    re = helper.httpPost(url, data, {'Content-Type': 'application/x-www-form-urlencoded'})
    # re = helper.httpPost(url, data)

    res = json.loads(re)
    redata = base64.decodestring(res['data'])
    # print redata
    # exit()

    return redata
Exemplo n.º 4
0
def sendDataToOuterHQ2(config, data):
    helper.getLog('访问sendDataToOuterHQ2!!!', 'responseOutCode.HQ2.log')
    url = config['url'] + '?op=OrderOccupies'

    headers = hawkAuth(url)
    data = '''<?xml version="1.0" encoding="utf-8"?>
            <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            <soap:Body>
               <OrderOccupies xmlns="http://tempuri.org/">
                   <merchantCode>%s</merchantCode>
                   <postOrder>%s</postOrder>
                   <signature>%s</signature>
                </OrderOccupies>
            </soap:Body>
        </soap:Envelope>
       ''' % (data['merchantCode'], data['postOrder'], data['signature'])
    res = helper.httpPost(url, data, headers)
    resBody = json.loads(
        helper.subStr(res, '<OrderOccupiesResult>', '</OrderOccupiesResult>'))
    return resBody
Exemplo n.º 5
0
def runService(clientConfig, mallProductConfig, mallBoughts, code, configType):
    # for mallBought in mallBoughts:
    # if mallBought['client_id'] == 1257:
    # print clientConfig , code, mallBoughts,'==============================='

    #python
    if configType == 2:
        eval('Service' + code + '.MallService' + code)(clientConfig,
                                                       mallProductConfig,
                                                       mallBoughts)
    #java
    elif configType == 1:
        for mallBought in mallBoughts:
            requestData = {
                'type': 'mall',
                'key': '3e3bcd9d71d52132a9b413a57be173ca',
                'orderId': str(mallBought['order_id'])
            }
            # print urllib.urlencode(requestData);
            url = helper.confGet('host', 'nwxService') + 'api/order'
            reChar = helper.httpPost(url, requestData)
            res = json.loads(reChar)
            if res['isok']:
                #返回的验证码,如果下单失败,则为空
                if not res['codes']:
                    # print requestData
                    helper.getLog('重新下单失败 -- ' + url + ' -- ' + reChar +
                                  ' -- ' + urllib.urlencode(requestData))
                else:
                    helper.getLog('重新下单成功 -- ' + url + ' -- ' + reChar +
                                  ' -- ' + urllib.urlencode(requestData))
            else:
                helper.getLog('重新下单失败 -- ' + url + ' -- ' + reChar + ' -- ' +
                              urllib.urlencode(requestData))
    elif configType == 3:
        eval('Service' + code + '.MallService' + code)(clientConfig,
                                                       mallProductConfig,
                                                       mallBoughts)

    pass
Exemplo n.º 6
0
def addTicketToOuterJKB(config, ticketBought):
    # global dbObj
    # dbObj = globalVar.getDbObj()
    dbObj = db.db()

    #查询游客信息
    # userInfo = ''
    userInfo = dbObj.select(
        "select user_id, name, mobile, id_number from t_user_identity_info where id = %d"
        % ticketBought['identity_info_id'])
    # userInfo = []
    # userInfo.append({
    # 'name': '微景通',
    # 'mobile' : '18523876001'
    # })
    if userInfo == False or len(userInfo) < 1:
        visitorName = 'weijingtongVisitor'
        visitorMobile = '18523876001'
    else:
        userInfo = userInfo[0]
        visitorMobile = userInfo['mobile']
        ##        visitorName = userInfo['user_id']
        visitorName = userInfo['name']
        visitorName = urllib.quote(visitorName.encode('utf-8'))
        # visitorName = repr(visitorName.decode('UTF-8'))[2:-1]
##        visitorName = '\u5f20\u8001\u5927'
##        visitorName = urllib.urlencode({1:visitorName})[2:]

# visitorName = 'wjtVisitor'
    ticketName = dbObj.getValue(
        "select name from t_ticket where id = %d" % ticketBought['ticket_id'],
        'name')
    ticketName = urllib.quote(ticketName.encode('utf-8'))
    # ticketName = '成人票'
    # ticketName = repr(ticketName.decode('UTF-8'))[2:-1][0:48]
    # ticketName = 'test'

    visitPerson = {}
    visitPerson['visitName'] = visitorName
    visitPerson['visitMobile'] = visitorMobile
    visitPerson['credentials'] = userInfo['id_number']
    visitPerson['credentialsType'] = 'Idcard'

    body = {}
    body['productName'] = ticketName
    body['contactMobile'] = visitorMobile
    body['contactName'] = visitorName
    body['orderPrice'] = str(round(ticketBought['price'], 2))
    body['orderQuantity'] = ticketBought['count']
    body['orderRemark'] = 'weijingtong'
    body['outOrderId'] = ticketBought['order_detail_id']
    body['resourceId'] = config['resourceId_' + str(ticketBought['ticket_id'])]
    body['sellPrice'] = str(round(ticketBought['list_price'], 2))
    body['useDate'] = str(ticketBought['plan_time'])[0:10]
    body['visitPerson'] = [visitPerson]

    data = {}
    data['body'] = body
    data['appKey'] = config['AppKey']

    data = json.dumps(data, ensure_ascii=False)
    # data = json.dumps(data)
    # print data
    # exit()
    # time = str(helper.thisTime())[0:10] + str(int(str(helper.thisTime())[12:])*100)
    time = str(int(round(helper.thisTime() * 1000)))
    # time = '1'
    print config['AppKey'] + data + time + config['SecretKey']
    sign = helper.md5(config['AppKey'] + data + time +
                      config['SecretKey']).upper().strip()
    # sign = '1'

    httpHeader = {
        'Content-Type': 'application/json;charset=utf-8',
        'APPKEY': config['AppKey'],
        'TIMESTAMP': time,
        'SIGN': sign,
    }
    # print httpHeader;
    print sign
    # exit()
    try:
        # 发起同步
        re = helper.httpPost(config['url'] + '?method=createOrder', data,
                             httpHeader)
        reBody = json.loads(re)
        # print reBody ;exit()
        #成功同步
        if 200 == reBody['rspCode']:
            #支付定单
            body = {}
            body['orderId'] = outOrderId = reBody['body']['orderId']
            body['paymentSerialno'] = ticketBought['id']

            data2 = {}
            data2['body'] = body
            data2['appKey'] = config['AppKey']
            data2 = json.dumps(data2)

            # print data2;exit()
            sign = helper.md5(config['AppKey'] + data2 + time +
                              config['SecretKey']).upper().strip()
            httpHeader = {
                'Content-Type': 'application/json;charset=utf-8',
                'APPKEY': config['AppKey'],
                'TIMESTAMP': time,
                'SIGN': sign,
            }

            re2 = helper.httpPost(config['url'] + '?method=payOrder', data2,
                                  httpHeader)
            reBody = json.loads(re2)
            print reBody
            if 200 == reBody['rspCode']:
                re = re + "\n\n" + re2
                print re
                #生成二维码
                qrcodeImg = reBody['body']['qrcodeUrl']
                sql = "update t_ticket_bought set out_app_code = 'JKB', temp_receiving_code = '%s', receiving_code='%s', dimen_code_path = '%s', remark2 = '%s' where id = %d" % (
                    ticketBought['receiving_code'], reBody['body']['eticket'],
                    qrcodeImg, '{"outOrderId":"' + outOrderId + '"}',
                    ticketBought['id'])
                print sql
                if not True == dbObj.update(sql):
                    helper.getLog(
                        sql,
                        'addTicketToOuterJKB.UpdateTicketboughtlistErr.log')
            else:
                re = "%s\nPostData1:%s\n\n%s\nPostData2:%s" % (re, data, re2,
                                                               data2)
                print re
                pass

        else:
            re = "%s \nPostData:%s\nPostHead:%s" % (re, data,
                                                    json.dumps(httpHeader))
            pass
    except Exception, e:
        re = str(Exception) + ":" + str(e)
        re = "%s \nPostData:%s" % (re, data)
Exemplo n.º 7
0
def addTicketToOuterZXK(config, ticketBought):
    # global dbObj
    # dbObj = globalVar.getDbObj()
    dbObj = db.db()

    #查询游客信息
    # userInfo = ''
    userInfo = dbObj.select(
        "select user_id, name, mobile, id_number from t_user_identity_info where id = %d"
        % ticketBought['identity_info_id'])
    # userInfo = []
    # userInfo.append({
    # 'name': '微景通',
    # 'mobile' : '18523876001'
    # })
    if userInfo == False or len(userInfo) < 1:
        visitorName = 'weijingtongVisitor'
        visitorMobile = '18523876001'
        visitorIdNumber = '110102198601018573'
    else:
        userInfo = userInfo[0]
        visitorMobile = userInfo['mobile']
        visitorIdNumber = userInfo['id_number']
        ##        visitorName = userInfo['user_id']
        visitorName = userInfo['name']
        visitorName = repr(visitorName.decode('UTF-8'))[2:-1]
##        visitorName = '\u5f20\u8001\u5927'
##        visitorName = urllib.urlencode({1:visitorName})[2:]

# visitorName = 'wjtVisitor'
    ticketName = dbObj.getValue(
        "select name from t_ticket where id = %d" % ticketBought['ticket_id'],
        'name')
    # ticketName = '成人票'
    # ticketName = repr(ticketName.decode('UTF-8'))[2:-1][0:48]
    # ticketName = 'test'
    visitPerson = '''[
        {    "name": "%s",
            "mobile": "%s",
            "idCard": "%s"
        }
    ]''' % (visitorName[0:24], visitorMobile, visitorIdNumber)
    requestBody = '''{
        "orderSerialId": "%s",
        "productNo": "%s",
        "payType": 1,
        "tickets": %s,
        "price": %s,
        "contractPrice": %s,
        "bookName": "%s",
        "bookMobile": "%s",
        "idCard": "%s",
        "travelDate": "%s",
        "visitPerson": %s
    }''' % (ticketBought["order_detail_id"],
            config["productNo_" + str(ticketBought["ticket_id"])],
            ticketBought["count"], int(ticketBought["price"] * 100),
            int(ticketBought["price"] * 100), visitorName[0:24], visitorMobile,
            visitorIdNumber, str(ticketBought["plan_time"])[0:10], visitPerson)

    # print requestBody;exit();
    # data = '{"pageIndex":1,"pageSize":100}' # 1/F4jrg9alyN0uDgJNlEaCLroiTtH9LhlljImdztF8Y=
    KEY = str(config['user_key'])  #密钥
    IV = str(config['user_key'])  #偏转向量
    desObj = des(KEY, ECB, IV, pad=None,
                 padmode=PAD_PKCS5)  # 使用DES对称加密算法的CBC模式加密
    # requestBody = 'adfasfaf'
    requestBody = str(requestBody)
    requestBodyFormat = requestBody
    # print helper.httpPost('http://123.56.105.30:5677/Tongcheng/Encrypt/', requestBody);exit(); #获取des密文
    # print (requestBody);
    # print (str(config['user_key']) );
    requestBody = desObj.encrypt(requestBody)
    # print base64.encodestring(b2a_hex(requestBody))
    requestBody = base64.encodestring(requestBody)
    # print requestBody;
    # print "Decrypted: %r" % desObj.decrypt(base64.decodestring(requestBody));exit()

    timestamp = str(time.time())[0:10]

    sign = config['user_id'] + 'CreateOrder' + str(
        timestamp) + 'v1.0' + requestBody + config['user_key']
    # print (sign);
    md5Obj = md5.new()
    md5Obj.update(sign)
    sign = md5Obj.hexdigest()

    requestHead = '''{
        "user_id": "%s",
        "method": "CreateOrder",
        "timestamp": %s,
        "version": "v1.0",
        "sign": "%s"
    }''' % (config["user_id"], timestamp, sign)
    data = '''{
        "requestHead": %s,
        "requestBody": "%s"
    }''' % (requestHead, requestBody)

    # print (data);
    # exit();

    try:
        re = helper.httpPost(config['url'], data)

        #成功同步
        res = json.loads(re)
        # print res;
        # print res['responseHead']['res_code'];
        # print json.loads(desObj.decrypt(base64.decodestring(res['responseBody'])))
        responseBody = desObj.decrypt(base64.decodestring(res['responseBody']))
        re = re + "\nResponseBodyFormat:" + responseBody
        responseBody = json.loads(responseBody)
        # exit();
        #成功同步
        if '1000' == res['responseHead']['res_code'] or '2001' == res[
                'responseHead']['res_code']:
            sql = "update t_ticket_bought set out_app_code='ZXK', temp_receiving_code='%s', dimen_code_path='%s', remark2='%s' where id = %d" % (
                responseBody['partnerCode'],
                responseBody['partnerQRCodeAddress'],
                responseBody['partnerOrderId'], ticketBought['id'])
            # print sql
            if not True == dbObj.update(sql):
                helper.getLog(
                    sql, 'addTicketToOuterZXK.UpdateTicketboughtlistErr.log')
        else:
            re = "%s \nPostData:%s\nRequestBodyFormat:%s" % (re, data,
                                                             requestBodyFormat)
            pass
    except Exception, e:
        re = str(Exception) + ":" + str(e)
        re = "%s \nPostData:%s\nRequestBodyFormat:%s" % (re, data,
                                                         requestBodyFormat)
Exemplo n.º 8
0
def addMallToOuterXiRuan(config, productConfig, mallBought):
    # print config;print productConfig;print mallBought;exit()

    # conf = ConfigParser.ConfigParser()
    # conf.read("%s/config/config.ini" % sys.path[0])
    # print "%s/config/config.ini" % sys.path[0]
    url = helper.confGet(
        'host', 'commonService') + 'OuterApp/XiRuan/login/?clientId=' + str(
            mallBought['client_id'])
    print url
    helper.getLog(url)
    session = json.loads(helper.httpGet(url))

    if not session['status']:
        helper.getLog(session['data'])
        return
    # print session;exit()

    #查询游客信息
    # userInfo = ''
    # dbObj = globalVar.getDbObj()
    dbObj = db.db()

    userInfo = dbObj.select(
        "select user_id, name, mobile, id_number from t_user_identity_info where id = %d"
        % mallBought['identity_info_id'])
    if userInfo == False or len(userInfo) < 1:
        visitorName = 'weijingtongVisitor'
        visitorMobile = '18523876001'
    else:
        userInfo = userInfo[0]
        visitorMobile = userInfo['mobile']
        visitorName = userInfo['user_id']
        visitorName = userInfo['name']
        # visitorName = 'visitor'
        visitorName = repr(visitorName.decode('UTF-8'))[2:-1]
        # visitorName = '\u5f20\u8001\u5927'
##        visitorName = urllib.urlencode({1:visitorName})[2:]

#使用日期
    useDate = mallBought['remark2'].split(',')
    data = '''{
        "sign":"3E365195E5A5CFA2ABC5F5B302182F73",
        "ts":%s,
        "session":"%s",
        "hotelid":"%s",
        "appkey":"%s",
        "loc":"zh_CN",
        "method":"xmsopen.reservation.xopsavereservation",
        "ver":"1.0.0",
        "params":[
            {
                "rmtype":"%s",
                "holdname":"%s",
                "rmnum":"%s",
                "hotelid":"%s",
                "contact_name":"%s",
                "arr":"%s",
                "mobile":"%s",
                "ratecode":"%s",
                "sex":"",
                "rate":"%s",
                "contact_mobile":"%s",
                "name":"%s",
                "dep":"%s",
                "gstno":"%s",
                "ref":"weixin",
                "channel":"weixin",
                "restype":"%s"
            }
        ],
        "cmmcode":"%s"
    }''' % (str(helper.thisTime()).replace(
        '.', ''), session['data'], config['hotelid'], config['appkey'],
            productConfig['rmtype'], visitorName, mallBought['buy_count'],
            productConfig['hotelid'], visitorName, useDate[0], visitorMobile,
            productConfig['ratecode'], mallBought['price'], visitorMobile,
            visitorName, useDate[1], mallBought['buy_count'],
            productConfig['restype'], config['cmmcode'])

    # print data
    re = re2 = ''
    try:
        if mallBought['remark']:
            outappCodes = mallBought['remark'].split(',')
            rsvno = outappCodes[0]
            accnt = outappCodes[1]
            res = {}
            res['success'] = True
        else:
            re = helper.httpPost(config['host'], data)
            # print re
            #成功同步
            res = json.loads(re)
            if res['success'] == True:
                rsvno = res['results'][0]['rsvno']
                accnt = res['results'][0]['accnt']
                sql = "update t_mall_bought set remark = '%s,%s' where id = '%d'" % (
                    rsvno, accnt, mallBought['id'])
                if not True == dbObj.update(sql):
                    helper.getLog(
                        sql,
                        'addMallToOuterXiRuan.UpdateMallboughtlistErr.log')

            # print res
        if res['success'] == True:
            data2 = '''{
                "sign":"3E365195E5A5CFA2ABC5F5B302182F73",
                "ts":%s,
                "session":"%s",
                "hotelid":"%s",
                "appkey":"%s",
                "loc":"zh_CN",
                "method":"xmsopen.accounts.xopdopaymentaccount",
                "ver":"1.0.0",
                "params":[
                    {
                        "pay_money":"%s",
                        "pay_code":"%s",
                        "payno":"%s",
                        "remark":"%s",
                        "hotelid":"%s",
                        "rsvno":"%s",
                        "accnt":"%s"
                    }
                ],
                "cmmcode":"%s"
            }''' % (str(helper.thisTime()).replace(
                '.', ''), session['data'], config['hotelid'], config['appkey'],
                    mallBought['total_pay_price'], '9034',
                    mallBought['order_detail_id'], 'weixin order',
                    productConfig['hotelid'], rsvno, accnt, config['cmmcode'])

            # print data2
            try:
                re2 = helper.httpPost(config['host'], data2)
                # print re2
                #成功同步
                res = json.loads(re2)
                if res['success'] == True:
                    sql = "update t_mall_bought set out_app_code = 'XiRuan', out_app_no = '%s' where id = '%d'" % (
                        rsvno, mallBought['id'])
                    if not True == dbObj.update(sql):
                        helper.getLog(
                            sql,
                            'addMallToOuterXiRuan.UpdateMallboughtlistErr.log')
                #失败后,也更新一下bought,不再重复
                else:
                    sql = "update t_mall_bought set out_app_code = 'XiRuan' where id = '%d'" % mallBought[
                        'id']
                    if not True == dbObj.update(sql):
                        helper.getLog(
                            sql,
                            'addMallToOuterXiRuan.UpdateMallboughtlistErr.log')

                    re2 = "resmsg2:%s \npostdata2:%s" % (re2, data2)
            except Exception, e:
                re2 = str(Exception) + ":" + str(e)
                re2 = "errmsg2:%s \npostdata2:%s" % (re2, data2)
                pass
        #失败后,也更新一下bought,不再重复
        else: