def _get_QRcode_ticket(self):
        url = 'https://qr.m.jd.com/check'
        payload = {
            'appid': '133',
            'callback': 'jQuery{}'.format(random.randint(1000000, 9999999)),
            'token': self.session.cookies.get('wlfstk_smdl'),
            '_': str(int(time.time() * 1000)),
        }
        headers = {
            'User-Agent': self.default_user_agent,
            'Referer': 'https://passport.jd.com/new/login.aspx',
        }
        resp = self.session.get(url=url, headers=headers, params=payload)

        if not resp.ok:
            logger.error('获取二维码扫描结果异常')
            return False

        resp_json = parse_json(resp.text)
        if resp_json['code'] != 200:
            logger.info('Code: %s, Message: %s',
                        resp_json['code'], resp_json['msg'])
            return None
        else:
            logger.info('已完成手机客户端确认')
            return resp_json['ticket']
 def make_reserve(self):
     """商品预约"""
     logger.info('商品名称:{}'.format(get_sku_title()))
     url = 'https://yushou.jd.com/youshouinfo.action?'
     payload = {
         'callback': 'fetchJSON',
         'sku': self.sku_id,
         '_': str(int(time.time() * 1000)),
     }
     headers = {
         'User-Agent': self.default_user_agent,
         'Referer': 'https://item.jd.com/{}.html'.format(self.sku_id),
     }
     print("payload" + json.dumps(payload) + "\n" + "headers" +
           json.dumps(headers))
     resp = self.session.get(url=url, params=payload, headers=headers)
     print(resp)
     resp_json = parse_json(resp.text)
     reserve_url = resp_json.get('url')
     for flag in range(10):
         try:
             self.session.get(url='https:' + reserve_url)
             logger.info('预约成功,已获得抢购资格 / 您已成功预约过了,无需重复预约')
             if global_config.getRaw('messenger', 'enable') == 'true':
                 success_message = "预约成功,已获得抢购资格 / 您已成功预约过了,无需重复预约"
                 send_wechat(success_message)
             break
         except Exception as e:
             logger.error('预约失败正在重试...' + str(flag) + " " + str(e))
             sleep(random.randint(1, 3))
     sys.exit(1)
 def make_reserve(self):
     """商品预约"""
     logger.info('用户:{}'.format(self.get_user_info()))
     logger.info('商品名称:{}'.format(self.get_sku_title()))
     url = 'https://yushou.jd.com/youshouinfo.action?'
     payload = {
         'callback': 'fetchJSON',
         'sku': self.sku_id,
         '_': str(int(time.time() * 1000)),
     }
     headers = {
         'User-Agent': self.default_user_agent,
         'Referer': 'https://item.jd.com/{}.html'.format(self.sku_id),
     }
     resp = self.session.get(url=url, params=payload, headers=headers)
     resp_json = parse_json(resp.text)
     reserve_url = resp_json.get('url')
     self.timers.start()
     while True:
         try:
             self.session.get(url='https:' + reserve_url)
             logger.info('预约成功,已获得抢购资格 / 您已成功预约过了,无需重复预约')
             if global_config.getRaw('messenger', 'enable') == 'true':
                 success_message = "预约成功,已获得抢购资格 / 您已成功预约过了,无需重复预约"
                 send_wechat(success_message)
             break
         except Exception as e:
             logger.error('预约失败正在重试...')
Example #4
0
def getconfig():
    global_config = Config()
    global cookies_String, mail, sc_key, messageType, area, skuidsString, skuids, captchaUrl, eid, fp, payment_pwd
    # cookie 网页获取
    cookies_String = global_config.getRaw('config', 'cookies_String')
    # 有货通知 收件邮箱
    mail = global_config.getRaw('config', 'mail')
    # 方糖微信推送的key  不知道的请看http://sc.ftqq.com/3.version
    sc_key = global_config.getRaw('config', 'sc_key')
    # 推送方式 1(mail)或 2(wechat)
    messageType = global_config.getRaw('config', 'messageType')
    # 地区id
    area = global_config.getRaw('config', 'area')
    # 商品id
    skuidsString = global_config.getRaw('V3', 'skuid')
    skuids = str(skuidsString).split(',')
    # 验证码服务地址
    captchaUrl = global_config.getRaw('Temporary', 'captchaUrl')
    if len(skuids[0]) == 0:
        logger.error('请在configDemo.ini文件中输入你的商品id')
        sys.exit(1)
    '''
    备用
    '''
    # eid
    eid = global_config.getRaw('Temporary', 'eid')
    fp = global_config.getRaw('Temporary', 'fp')
    # 支付密码
    payment_pwd = global_config.getRaw('config', 'payment_pwd')
 def _get_seckill_order_data(self):
     """生成提交抢购订单所需的请求体参数
     :return: 请求体参数组成的dict
     """
     logger.info('生成提交抢购订单所需参数...')
     # 获取用户秒杀初始化信息
     try:
         self.seckill_init_info[self.sku_id] = self._get_seckill_init_info()
         init_info = self.seckill_init_info.get(self.sku_id)
         if init_info == None:
             return None
         default_address = init_info['addressList'][0]  # 默认地址dict
         invoice_info = init_info.get('invoiceInfo', {})  # 默认发票信息dict, 有可能不返回
         token = init_info['token']
         data = {
             'skuId': self.sku_id,
             'num': 1,
             'addressId': default_address['id'],
             'yuShou': 'true',
             'isModifyAddress': 'false',
             'name': default_address['name'],
             'provinceId': default_address['provinceId'],
             'cityId': default_address['cityId'],
             'countyId': default_address['countyId'],
             'townId': default_address['townId'],
             'addressDetail': default_address['addressDetail'],
             'mobile': default_address['mobile'],
             'mobileKey': default_address['mobileKey'],
             'email': default_address.get('email', ''),
             'postCode': '',
             'invoiceTitle': invoice_info.get('invoiceTitle', -1),
             'invoiceCompanyName': '',
             'invoiceContent': invoice_info.get('invoiceContentType', 1),
             'invoiceTaxpayerNO': '',
             'invoiceEmail': '',
             'invoicePhone': invoice_info.get('invoicePhone', ''),
             'invoicePhoneKey': invoice_info.get('invoicePhoneKey', ''),
             'invoice': 'true' if invoice_info else 'false',
             'password': '',
             'codTimeType': 3,
             'paymentType': 4,
             'areaCode': '',
             'overseas': 0,
             'phone': '',
             'eid': global_config.getRaw('config', 'eid'),
             'fp': global_config.getRaw('config', 'fp'),
             'token': token,
             'pru': ''
         }
         return data
     except Exception as e:
         logger.error('获取用户秒杀初始化信息失败{0},正在重试...'.format(e))
         return None
Example #6
0
def parse_json(text):
    try:
        begin = text.find('{')
        end = text.rfind('}') + 1
        return json.loads(text[begin:end])
    except Exception as e:
        logger.error('parse_json error:{0}'.format(e))
        try:
            return json.loads(text)
        except Exception as ex:
            logger.error('parse_json error:{0}'.format(ex))
            logger.info('resp json string:' + text)
            return None
Example #7
0
def analysis_captcha(pic):
    for i in range(1, 10):
        try:
            url = captchaUrl
            resp = session.post(url, pic)
            if not response_status(resp):
                logger.error('解析验证码失败')
                continue
            logger.info('解析验证码[%s]', resp.text)
            return resp.text
        except Exception as e:
            print(traceback.format_exc())
            continue
    return ''
Example #8
0
def cart_detail():
    url = 'https://cart.jd.com/cart.action'
    headers = {
        "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/531.36",
        "Accept":
        "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
        "Referer": "https://order.jd.com/center/list.action",
        "Host": "cart.jd.com",
        "Connection": "keep-alive"
    }
    resp = session.get(url, headers=headers)
    soup = BeautifulSoup(resp.text, "html.parser")

    cart_detail = dict()
    for item in soup.find_all(class_='item-item'):
        try:
            sku_id = item['skuid']  # 商品id
        except Exception as e:
            logger.info('购物车中有套装商品,跳过')
            continue
        try:
            # 例如:['increment', '8888', '100001071956', '1', '13', '0', '50067652554']
            # ['increment', '8888', '100002404322', '2', '1', '0']
            item_attr_list = item.find(class_='increment')['id'].split('_')
            p_type = item_attr_list[4]
            promo_id = target_id = item_attr_list[-1] if len(
                item_attr_list) == 7 else 0

            cart_detail[sku_id] = {
                'name': get_tag_value(item.select('div.p-name a')),  # 商品名称
                'verder_id': item['venderid'],  # 商家id
                'count': int(item['num']),  # 数量
                'unit_price':
                get_tag_value(item.select('div.p-price strong'))[1:],  # 单价
                'total_price':
                get_tag_value(item.select('div.p-sum strong'))[1:],  # 总价
                'is_selected': 'item-selected' in item['class'],  # 商品是否被勾选
                'p_type': p_type,
                'target_id': target_id,
                'promo_id': promo_id
            }
        except Exception as e:
            logger.error("商品%s在购物车中的信息无法解析,报错信息: %s,该商品自动忽略", sku_id, e)

    logger.info('购物车信息:%s', cart_detail)
    return cart_detail
Example #9
0
def add_item_to_cart(sku_id):
    url = 'https://cart.jd.com/gate.action'
    payload = {
        'pid': sku_id,
        'pcount': 1,
        'ptype': 1,
    }
    resp = session.get(url=url, params=payload)
    if 'https://cart.jd.com/cart.action' in resp.url:  # 套装商品加入购物车后直接跳转到购物车页面
        result = True
    else:  # 普通商品成功加入购物车后会跳转到提示 "商品已成功加入购物车!" 页面
        soup = BeautifulSoup(resp.text, "html.parser")
        result = bool(soup.select('h3.ftx-02'))  # [<h3 class="ftx-02">商品已成功加入购物车!</h3>]

    if result:
        logger.info('%s  已成功加入购物车', sku_id)
    else:
        logger.error('%s 添加到购物车失败', sku_id)
    def _validate_cookies(self):
        """
        验证cookies是否有效(是否登陆)
        通过访问用户订单列表页进行判断:若未登录,将会重定向到登陆页面。
        :return: cookies是否有效
        True / False
        """
        url = 'https://order.jd.com/center/list.action'
        payload = {
            'rid': str(int(time.time() * 1000)),
        }
        try:
            resp = self.session.get(
                url=url, params=payload, allow_redirects=False)
            if resp.ok:
                return True
        except Exception as e:
            logger.error(e)

        self.session = requests.session()
        return False
Example #11
0
def page_detail_captcha(session, isId):
    url = 'https://captcha.jd.com/verify/image'
    acid = '{}_{}'.format(random.random(), random.random())
    payload = {
        'acid': acid,
        'srcid': 'trackWeb',
        'is': isId,
    }
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/531.36",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
        "Referer": "https://trade.jd.com/shopping/order/getOrderInfo.action",
        "Connection": "keep-alive",
        'Host': 'captcha.jd.com',
    }
    try:
        resp = session.get(url=url, params=payload, headers=headers)
        if not response_status(resp):
            logger.error('获取订单验证码失败')
            return ''
        logger.info('解析验证码开始')
        image = Image.open(BytesIO(resp.content))
        image.save('captcha.jpg')
        result = analysis_captcha(resp.content)
        if not result:
            logger.error('解析订单验证码失败')
            return ''
        global submit_captcha_text, submit_captcha_rid
        submit_captcha_text = result
        submit_captcha_rid = acid
        return result
    except Exception as e:
        logger.error('订单验证码获取异常:%s', e)
    return ''
Example #12
0
def get_checkout_page_detail():
    """获取订单结算页面信息

    该方法会返回订单结算页面的详细信息:商品名称、价格、数量、库存状态等。

    :return: 结算信息 dict
    """
    url = 'http://trade.jd.com/shopping/order/getOrderInfo.action'
    # url = 'https://cart.jd.com/gotoOrder.action'
    payload = {
        'rid': str(int(time.time() * 1000)),
    }
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/531.36",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
        "Referer": "https://cart.jd.com/cart.action",
        "Connection": "keep-alive",
        'Host': 'trade.jd.com',
    }
    try:
        resp = session.get(url=url, params=payload, headers=headers)
        if not response_status(resp):
            logger.error('获取订单结算页信息失败')
            return ''
        if '刷新太频繁了' in resp.text:
            return '刷新太频繁了'
        soup = BeautifulSoup(resp.text, "html.parser")
        showCheckCode = get_tag_value(soup.select('input#showCheckCode'), 'value')
        if not showCheckCode:
            pass
        else:
            if showCheckCode == 'true':
                logger.info('提交订单需要验证码')
                global is_Submit_captcha, encryptClientInfo
                encryptClientInfo = get_tag_value(soup.select('input#encryptClientInfo'), 'value')
                is_Submit_captcha = True
        risk_control = get_tag_value(soup.select('input#riskControl'), 'value')

        order_detail = {
            'address': soup.find('span', id='sendAddr').text[5:],  # remove '寄送至: ' from the begin
            'receiver': soup.find('span', id='sendMobile').text[4:],  # remove '收件人:' from the begin
            'total_price': soup.find('span', id='sumPayPriceId').text[1:],  # remove '¥' from the begin
            'items': []
        }

        logger.info("下单信息:%s", order_detail)
        return risk_control
    except requests.exceptions.RequestException as e:
        logger.error('订单结算页面获取异常:%s' % e)
    except Exception as e:
        logger.error('下单页面数据解析异常:%s', e)
    return ''
Example #13
0
def sendWechat(sc_key, text='京东商品监控', desp=''):
    if not text.strip():
        logger.error('Text of message is empty!')
        return

    now_time = str(datetime.datetime.now())
    desp = '[{0}]'.format(now_time) if not desp else '{0} [{1}]'.format(
        desp, now_time)

    try:
        resp = requests.get(
            'https://sc.ftqq.com/{}.send?text={}&desp={}'.format(
                sc_key, text, desp))
        resp_json = json.loads(resp.text)
        if resp_json.get('errno') == 0:
            logger.info('Message sent successfully [text: %s, desp: %s]', text,
                        desp)
        else:
            logger.error('Fail to send message, reason: %s', resp.text)
    except requests.exceptions.RequestException as req_error:
        logger.error('Request error: %s', req_error)
    except Exception as e:
        logger.error('Fail to send message [text: %s, desp: %s]: %s', text,
                     desp, e)
Example #14
0
# 有货通知 收件邮箱
mail = global_config.getRaw('config', 'mail')
# 方糖微信推送的key  不知道的请看http://sc.ftqq.com/3.version
sc_key = global_config.getRaw('config', 'sc_key')
# 推送方式 1(mail)或 2(wechat)
messageType = global_config.getRaw('config', 'messageType')
# 下单模式
modelType = global_config.getRaw('V2', 'model')
# 地区id
area = global_config.getRaw('config', 'area')
# 商品id
skuidsString = global_config.getRaw('V2', 'skuids')
skuids = str(skuidsString).split(',')

if not modelType:
    logger.error('请在configDemo.ini文件填写下单model')

if len(skuids[0]) == 0:
    logger.error('请在configDemo.ini文件中输入你的商品id')
    sys.exit(1)

message = message(messageType=messageType, sc_key=sc_key, mail=mail)
'''
备用
'''
# eid
eid = global_config.getRaw('config', 'eid')
fp = global_config.getRaw('config', 'fp')
# 支付密码
payment_pwd = global_config.getRaw('config', 'payment_pwd')
Example #15
0
    a = """
  ________   __    _               __       __  _
 |___  /\ \ / /   | |              \ \     / / | |
    / /  \ V /    | |               \ \   / /  | |
   / /    > < _   | |                \ \ / /   | |
  / /__  / . \ |__| |1.预约商品       \ V /    | |
 /_____|/_/ \_\____/ 2.秒杀抢购商品    \_/     |_|
    """
    logger.info(a)
    start_tool = JdMaskSpider()
    choice_function = input('选择功能:')
    if choice_function == '1':
        start_tool.login_by_QRcode()
        start_tool.make_reserve()
    elif choice_function == '2':
        start_tool.login_by_QRcode()
        start_tool.request_seckill_url()
        start_tool.request_seckill_checkout_page()
        while True:
            try:
                order = start_tool.submit_seckill_order()
                if order:
                    break
            except Exception as e:
                logger.error('提交失败:{0},正在重试...'.format(e))
            else:
                continue
    else:
        print('没有此功能')
        sys.exit(1)
Example #16
0
def submit_order(session, risk_control, sku_id, skuids, submit_Time,
                 encryptClientInfo, is_Submit_captcha, payment_pwd,
                 submit_captcha_text, submit_captcha_rid):
    """

    重要:
    1.该方法只适用于普通商品的提交订单(即可以加入购物车,然后结算提交订单的商品)
    2.提交订单时,会对购物车中勾选✓的商品进行结算(如果勾选了多个商品,将会提交成一个订单)

    :return: True/False 订单提交结果
    """
    url = 'https://trade.jd.com/shopping/order/submitOrder.action'
    # js function of submit order is included in https://trade.jd.com/shopping/misc/js/order.js?r=2018070403091

    data = {
        'overseaPurchaseCookies': '',
        'vendorRemarks': '[]',
        'submitOrderParam.sopNotPutInvoice': 'false',
        'submitOrderParam.trackID': 'TestTrackId',
        'submitOrderParam.ignorePriceChange': '0',
        'submitOrderParam.btSupport': '0',
        'riskControl': risk_control,
        'submitOrderParam.isBestCoupon': 1,
        'submitOrderParam.jxj': 1,
        'submitOrderParam.trackId':
        '9643cbd55bbbe103eef18a213e069eb0',  # Todo: need to get trackId
        # 'submitOrderParam.eid': eid,
        # 'submitOrderParam.fp': fp,
        'submitOrderParam.needCheck': 1,
    }

    def encrypt_payment_pwd(payment_pwd):
        return ''.join(['u3' + x for x in payment_pwd])

    if len(payment_pwd) > 0:
        data['submitOrderParam.payPassword'] = encrypt_payment_pwd(payment_pwd)

    headers = {
        "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/531.36",
        "Accept":
        "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
        "Referer": "http://trade.jd.com/shopping/order/getOrderInfo.action",
        "Connection": "keep-alive",
        'Host': 'trade.jd.com',
    }
    for count in range(1, 11):
        logger.info('第[%s/%s]次尝试提交订单', count, 10)
        try:
            if is_Submit_captcha:
                captcha_result = page_detail_captcha(session,
                                                     encryptClientInfo)
                # 验证码服务错误
                if not captcha_result:
                    logger.error('验证码服务异常')
                    continue
                data['submitOrderParam.checkcodeTxt'] = submit_captcha_text
                data['submitOrderParam.checkCodeRid'] = submit_captcha_rid
            resp = session.post(url=url, data=data, headers=headers)
            resp_json = json.loads(resp.text)
            logger.info('本次提交订单耗时[%s]毫秒',
                        str(int(time.time() * 1000) - submit_Time))
            # 返回信息示例:
            # 下单失败
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 60123, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '请输入支付密码!'}
            # {'overSea': False, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'orderXml': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 60017, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '您多次提交过快,请稍后再试'}
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 60077, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '获取用户订单信息失败'}
            # {"cartXml":null,"noStockSkuIds":"xxx","reqInfo":null,"hasJxj":false,"addedServiceList":null,"overSea":false,"orderXml":null,"sign":null,"pin":"xxx","needCheckCode":false,"success":false,"resultCode":600157,"orderId":0,"submitSkuNum":0,"deductMoneyFlag":0,"goJumpOrderCenter":false,"payInfo":null,"scaleSkuInfoListVO":null,"purchaseSkuInfoListVO":null,"noSupportHomeServiceSkuList":null,"msgMobile":null,"addressVO":{"pin":"xxx","areaName":"","provinceId":xx,"cityId":xx,"countyId":xx,"townId":xx,"paymentId":0,"selected":false,"addressDetail":"xx","mobile":"xx","idCard":"","phone":null,"email":null,"selfPickMobile":null,"selfPickPhone":null,"provinceName":null,"cityName":null,"countyName":null,"townName":null,"giftSenderConsigneeName":null,"giftSenderConsigneeMobile":null,"gcLat":0.0,"gcLng":0.0,"coord_type":0,"longitude":0.0,"latitude":0.0,"selfPickOptimize":0,"consigneeId":0,"selectedAddressType":0,"siteType":0,"helpMessage":null,"tipInfo":null,"cabinetAvailable":true,"limitKeyword":0,"specialRemark":null,"siteProvinceId":0,"siteCityId":0,"siteCountyId":0,"siteTownId":0,"skuSupported":false,"addressSupported":0,"isCod":0,"consigneeName":null,"pickVOname":null,"shipmentType":0,"retTag":0,"tagSource":0,"userDefinedTag":null,"newProvinceId":0,"newCityId":0,"newCountyId":0,"newTownId":0,"newProvinceName":null,"newCityName":null,"newCountyName":null,"newTownName":null,"checkLevel":0,"optimizePickID":0,"pickType":0,"dataSign":0,"overseas":0,"areaCode":null,"nameCode":null,"appSelfPickAddress":0,"associatePickId":0,"associateAddressId":0,"appId":null,"encryptText":null,"certNum":null,"used":false,"oldAddress":false,"mapping":false,"addressType":0,"fullAddress":"xxxx","postCode":null,"addressDefault":false,"addressName":null,"selfPickAddressShuntFlag":0,"pickId":0,"pickName":null,"pickVOselected":false,"mapUrl":null,"branchId":0,"canSelected":false,"address":null,"name":"xxx","message":null,"id":0},"msgUuid":null,"message":"xxxxxx商品无货"}
            # {'orderXml': None, 'overSea': False, 'noStockSkuIds': 'xxx', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'cartXml': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 600158, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': {'oldAddress': False, 'mapping': False, 'pin': 'xxx', 'areaName': '', 'provinceId': xx, 'cityId': xx, 'countyId': xx, 'townId': xx, 'paymentId': 0, 'selected': False, 'addressDetail': 'xxxx', 'mobile': 'xxxx', 'idCard': '', 'phone': None, 'email': None, 'selfPickMobile': None, 'selfPickPhone': None, 'provinceName': None, 'cityName': None, 'countyName': None, 'townName': None, 'giftSenderConsigneeName': None, 'giftSenderConsigneeMobile': None, 'gcLat': 0.0, 'gcLng': 0.0, 'coord_type': 0, 'longitude': 0.0, 'latitude': 0.0, 'selfPickOptimize': 0, 'consigneeId': 0, 'selectedAddressType': 0, 'newCityName': None, 'newCountyName': None, 'newTownName': None, 'checkLevel': 0, 'optimizePickID': 0, 'pickType': 0, 'dataSign': 0, 'overseas': 0, 'areaCode': None, 'nameCode': None, 'appSelfPickAddress': 0, 'associatePickId': 0, 'associateAddressId': 0, 'appId': None, 'encryptText': None, 'certNum': None, 'addressType': 0, 'fullAddress': 'xxxx', 'postCode': None, 'addressDefault': False, 'addressName': None, 'selfPickAddressShuntFlag': 0, 'pickId': 0, 'pickName': None, 'pickVOselected': False, 'mapUrl': None, 'branchId': 0, 'canSelected': False, 'siteType': 0, 'helpMessage': None, 'tipInfo': None, 'cabinetAvailable': True, 'limitKeyword': 0, 'specialRemark': None, 'siteProvinceId': 0, 'siteCityId': 0, 'siteCountyId': 0, 'siteTownId': 0, 'skuSupported': False, 'addressSupported': 0, 'isCod': 0, 'consigneeName': None, 'pickVOname': None, 'shipmentType': 0, 'retTag': 0, 'tagSource': 0, 'userDefinedTag': None, 'newProvinceId': 0, 'newCityId': 0, 'newCountyId': 0, 'newTownId': 0, 'newProvinceName': None, 'used': False, 'address': None, 'name': 'xx', 'message': None, 'id': 0}, 'msgUuid': None, 'message': 'xxxxxx商品无货'}
            # {"orderXml":null,"cartXml":null,"noStockSkuIds":"","reqInfo":null,"hasJxj":false,"overSea":false,"addedServiceList":null,"sign":null,"pin":null,"needCheckCode":true,"success":false,"resultCode":0,"orderId":0,"submitSkuNum":0,"deductMoneyFlag":0,"goJumpOrderCenter":false,"payInfo":null,"scaleSkuInfoListVO":null,"purchaseSkuInfoListVO":null,"noSupportHomeServiceSkuList":null,"msgMobile":null,"addressVO":null,"msgUuid":null,"message":"验证码不正确,请重新填写"}
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'jd_7c3992aa27d1a', 'needCheckCode': False, 'success': False, 'resultCode': 60070, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '抱歉,您当前选择的省份无法购买商品星工 KN95口罩防雾霾防尘防花粉PM2.5 硅胶鼻垫带阀耳戴透气 工业粉尘防护口罩 白色25只独立包装'}
            # 下单成功
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': True, 'resultCode': 0, 'orderId': 8740xxxxx, 'submitSkuNum': 1, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': None}
            if resp_json.get('success'):
                logger.info('订单提交成功! 订单号:%s', resp_json.get('orderId'))
                return True
            else:
                resultMessage, result_code = resp_json.get(
                    'message'), resp_json.get('resultCode')
                if result_code == 0:
                    # self._save_invoice()
                    if '验证码不正确' in resultMessage:
                        resultMessage = resultMessage + '(验证码错误)'
                        logger.info('提交订单验证码[错误]')
                        continue
                    else:
                        resultMessage = resultMessage + '(下单商品可能为第三方商品,将切换为普通发票进行尝试)'
                elif result_code == 60077:
                    resultMessage = resultMessage + '(可能是购物车为空 或 未勾选购物车中商品)'
                elif result_code == 60123:
                    resultMessage = resultMessage + '(需要在payment_pwd参数配置支付密码)'
                elif result_code == 60070:
                    resultMessage = resultMessage + '(省份不支持销售)'
                    skuids.remove(sku_id)
                    logger.info('[%s]类型口罩不支持销售踢出', sku_id)
                logger.info('订单提交失败, 错误码:%s, 返回信息:%s', result_code,
                            resultMessage)
                if result_code == 60017:
                    data['riskControl'] = get_checkout_page_detail()
                    continue
                logger.info(resp_json)
                return False
        except Exception as e:
            print(traceback.format_exc())
            continue
 def submit_seckill_order(self):
     """提交抢购(秒杀)订单
     :return: 抢购结果 True/False
     """
     url = 'https://marathon.jd.com/seckillnew/orderService/pc/submitOrder.action'
     payload = {
         'skuId': self.sku_id,
     }
     order_data=self._get_seckill_order_data()
     if order_data == None:
         return False
     self.seckill_order_data[self.sku_id] = order_data
     for skiltimes in range(3):
         try:
             logger.info('提交抢购订单:{}次...'.format(skiltimes))
             headers = {
                 'User-Agent': self.default_user_agent,
                 'Host': 'marathon.jd.com',
                 'Referer': 'https://marathon.jd.com/seckill/seckill.action?skuId={0}&num={1}&rid={2}'.format(
                     self.sku_id, 1, int(time.time())),
             }
             resp = self.session.post(
                 url=url,
                 params=payload,
                 data=self.seckill_order_data.get(self.sku_id),
                 headers=headers)
             if not resp.ok:
                 continue
             if resp.text=="null":
                 continue
             if resp.text.find("{") == -1:
                 logger.info('提交抢购订单respText:' + resp.text)
                 continue
             
             resp_json = parse_json(resp.text)
             # 返回信息
             # 抢购失败:
             # {'errorMessage': '很遗憾没有抢到,再接再厉哦。', 'orderId': 0, 'resultCode': 60074, 'skuId': 0, 'success': False}
             # {'errorMessage': '抱歉,您提交过快,请稍后再提交订单!', 'orderId': 0, 'resultCode': 60017, 'skuId': 0, 'success': False}
             # {'errorMessage': '系统正在开小差,请重试~~', 'orderId': 0, 'resultCode': 90013, 'skuId': 0, 'success': False}
             # 抢购成功:
             # {"appUrl":"xxxxx","orderId":820227xxxxx,"pcUrl":"xxxxx","resultCode":0,"skuId":0,"success":true,"totalMoney":"xxxxx"}
             if resp_json.get('success'):
                 order_id = resp_json.get('orderId')
                 total_money = resp_json.get('totalMoney')
                 pay_url = 'https:' + resp_json.get('pcUrl')
                 logger.info('抢购成功,订单号:{}, 总价:{}, 电脑端付款链接:{}'.format(
                     order_id, total_money, pay_url))
                 if global_config.getRaw('messenger', 'enable') == 'true':
                     success_message = "抢购成功,订单号:{}, 总价:{}, 电脑端付款链接:{}".format(
                         order_id, total_money, pay_url)
                     send_wechat(success_message)
                 return True
             else:
                 logger.info('抢购失败,返回信息:{}'.format(resp_json))
                 if global_config.getRaw('messenger', 'enable') == 'true':
                     error_message = '抢购失败,返回信息:{}'.format(resp_json)
                     send_wechat(error_message)
                 continue
         except Exception as e:
             logger.error('提交抢购订单失败:{},正在重试...'.format(e))
Example #18
0
        start_tool = Jd_Mask_Spider()
        choice_function = input('选择功能:')
        if choice_function == '1':
            start_tool.login()
            start_tool.make_reserve()
        elif choice_function == '2':
            tryTimes = 0
            skill_count = global_config.getRaw('config', 'kill_count')
            kill_per_time = global_config.getRaw('config', 'kill_per_time')
            while True:
                tryTimes = tryTimes + 1
                logger.info("---------------------------->开始第{}次抢购<-----------------------------".format(tryTimes))
                try:
                    start_tool.request_seckill_url()
                except Exception as e:
                    logger.error("request_seckill_url fail error {}".format(e))
                try:
                    start_tool.request_seckill_checkout_page()
                except Exception as e:
                    logger.error("request_seckill_checkout_page fail error {}".format(e))

                # 可能需要的链接 https://tak.jd.com/t/98DD1?_t=1611281236817
                try:
                    start_tool.submit_seckill_order()
                except Exception as e:
                    logger.error("submit_seckill_order fail error {}".format(e))

                time.sleep(float(kill_per_time))
            logger.info("------------------------>完成了{}次抢购,你运气不好没办法<----------------------".format(tryTimes))
        else:
            logger.error("没有此功能")
Example #19
0
cookies_String = global_config.getRaw('config', 'cookies_String')

# 有货通知 收件邮箱
mail = global_config.getRaw('config', 'mail')
# 方糖微信推送的key  不知道的请看http://sc.ftqq.com/3.version
sc_key = global_config.getRaw('config', 'sc_key')
# 推送方式 1(mail)或 2(wechat)
messageTtpe = global_config.getRaw('config', 'messageTtpe')
# 地区id
area = global_config.getRaw('config', 'area')
# 商品id
skuidsString = global_config.getRaw('config', 'skuids')
skuids = str(skuidsString).split(',')

if len(skuids[0]) == 0:
    logger.error('请在config.ini文件中输入你的商品id')
    sys.exit(1)

message = message(messageTtpe=messageTtpe, sc_key=sc_key, mail=mail)
'''
备用
'''
# eid
eid = global_config.getRaw('config', 'eid')
fp = global_config.getRaw('config', 'fp')
# 支付密码
payment_pwd = global_config.getRaw('config', 'payment_pwd')

session = requests.session()
session.headers = {
    "User-Agent":
Example #20
0
def submit_marathon(session, risk_control, sku_id, skuids, submit_Time, encryptClientInfo, is_Submit_captcha, payment_pwd,
                 submit_captcha_text, submit_captcha_rid, eid, fp, token):
    """

    重要:
    1.该方法只适用于普通商品的提交订单(即可以加入购物车,然后结算提交订单的商品)
    2.提交订单时,会对购物车中勾选✓的商品进行结算(如果勾选了多个商品,将会提交成一个订单)

    :return: True/False 订单提交结果
    """
    url = 'https://marathon.jd.com/seckillnew/orderService/pc/submitOrder.action?skuId=%s' % sku_id
    # js function of submit order is included in https://trade.jd.com/shopping/misc/js/order.js?r=2018070403091

    data = {
        'overseaPurchaseCookies': '',
        'vendorRemarks': '[]',
        'submitOrderParam.sopNotPutInvoice': 'false',
        # 'submitOrderParam.TrackID': TrackID,
        'submitOrderParam.ignorePriceChange': '0',
        'submitOrderParam.btSupport': '0',
        'riskControl': risk_control,
        'submitOrderParam.isBestCoupon': 1,
        'submitOrderParam.jxj': 1,
        # 'submitOrderParam.eid': eid,
        # 'submitOrderParam.fp': fp,
        # 'submitOrderParam.token': token,
        'submitOrderParam.needCheck': 1,
    }

    # data = {
    #     'skuId': sku_id,
    #     'num': '1',
    #     'addressId': '1037145130',
    #     'yuShou': 'true',
    #     'isModifyAddress': 'false',
    #     'name': '%E8%83%A1%E6%96%8C',
    #     'provinceId': '22',
    #     'cityId': '1930',
    #     'countyId': '49324',
    #     'townId': '49398',
    #     'addressDetail': '%E6%B0%B4%E6%B4%A5%E8%A1%9761%E5%8F%B7%E4%B8%96%E5%8F%91%E5%AE%B6%E5%9B%AD5%E6%A0%8B1%E5%8D%95%E5%85%83',
    #     'mobile': '138%2A%2A%2A%2A6776',
    #     'mobileKey': '152f93b94f4fe35d388398f965264ce7',
    #     'email': '',
    #     'postCode': '',
    #     'invoiceTitle': '4',
    #     'invoiceCompanyName': '',
    #     'invoiceContent': '1',
    #     'invoiceTaxpayerNO': '',
    #     'invoiceEmail': '',
    #     'invoicePhone': '138%2A%2A%2A%2A6776',
    #     'invoicePhoneKey': '152f93b94f4fe35d388398f965264ce7',
    #     'invoice': 'true',
    #     'password': '',
    #     'codTimeType': '3',
    #     'paymentType': '4',
    #     'areaCode': '',
    #     'overseas': '0',
    #     'phone': '',
    #     'eid': eid,
    #     'fp': fp,
    #     'token': token,
    #     'pru': '',
    #     'provinceName': '%E5%9B%9B%E5%B7%9D',
    #     'cityName': '%E6%88%90%E9%83%BD%E5%B8%82',
    #     'countyName': '%E5%8F%8C%E6%B5%81%E5%8C%BA',
    #     'townName': '%E5%8D%8E%E9%98%B3%E8%A1%97%E9%81%93'
    # }

    def encrypt_payment_pwd(payment_pwd):
        return ''.join(['u3' + x for x in payment_pwd])

    if len(payment_pwd) > 0:
        data['submitOrderParam.payPassword'] = encrypt_payment_pwd(payment_pwd)

    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/531.36",
        "Accept": "application/json, text/plain, */*",
        "Referer": "https://marathon.jd.com/seckill/seckill.action",
        "Connection": "keep-alive",
        'Host': 'marathon.jd.com',
    }
    for count in range(1, 3):
        logger.info('第[%s/%s]次尝试提交订单', count, 3)
        try:
            if is_Submit_captcha:
                captcha_result = page_detail_captcha(session, encryptClientInfo)
                # 验证码服务错误
                if not captcha_result:
                    logger.error('验证码服务异常')
                    continue
                data['submitOrderParam.checkcodeTxt'] = submit_captcha_text
                data['submitOrderParam.checkCodeRid'] = submit_captcha_rid
            resp = session.post(url=url, data=data, headers=headers)
            resp_json = json.loads(resp.text)
            logger.info('本次提交订单耗时[%s]毫秒', str(int(time.time() * 1000) - submit_Time))
            # 返回信息示例:
            # 下单失败
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 60123, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '请输入支付密码!'}
            # {'overSea': False, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'orderXml': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 60017, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '您多次提交过快,请稍后再试'}
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 60077, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '获取用户订单信息失败'}
            # {"cartXml":null,"noStockSkuIds":"xxx","reqInfo":null,"hasJxj":false,"addedServiceList":null,"overSea":false,"orderXml":null,"sign":null,"pin":"xxx","needCheckCode":false,"success":false,"resultCode":600157,"orderId":0,"submitSkuNum":0,"deductMoneyFlag":0,"goJumpOrderCenter":false,"payInfo":null,"scaleSkuInfoListVO":null,"purchaseSkuInfoListVO":null,"noSupportHomeServiceSkuList":null,"msgMobile":null,"addressVO":{"pin":"xxx","areaName":"","provinceId":xx,"cityId":xx,"countyId":xx,"townId":xx,"paymentId":0,"selected":false,"addressDetail":"xx","mobile":"xx","idCard":"","phone":null,"email":null,"selfPickMobile":null,"selfPickPhone":null,"provinceName":null,"cityName":null,"countyName":null,"townName":null,"giftSenderConsigneeName":null,"giftSenderConsigneeMobile":null,"gcLat":0.0,"gcLng":0.0,"coord_type":0,"longitude":0.0,"latitude":0.0,"selfPickOptimize":0,"consigneeId":0,"selectedAddressType":0,"siteType":0,"helpMessage":null,"tipInfo":null,"cabinetAvailable":true,"limitKeyword":0,"specialRemark":null,"siteProvinceId":0,"siteCityId":0,"siteCountyId":0,"siteTownId":0,"skuSupported":false,"addressSupported":0,"isCod":0,"consigneeName":null,"pickVOname":null,"shipmentType":0,"retTag":0,"tagSource":0,"userDefinedTag":null,"newProvinceId":0,"newCityId":0,"newCountyId":0,"newTownId":0,"newProvinceName":null,"newCityName":null,"newCountyName":null,"newTownName":null,"checkLevel":0,"optimizePickID":0,"pickType":0,"dataSign":0,"overseas":0,"areaCode":null,"nameCode":null,"appSelfPickAddress":0,"associatePickId":0,"associateAddressId":0,"appId":null,"encryptText":null,"certNum":null,"used":false,"oldAddress":false,"mapping":false,"addressType":0,"fullAddress":"xxxx","postCode":null,"addressDefault":false,"addressName":null,"selfPickAddressShuntFlag":0,"pickId":0,"pickName":null,"pickVOselected":false,"mapUrl":null,"branchId":0,"canSelected":false,"address":null,"name":"xxx","message":null,"id":0},"msgUuid":null,"message":"xxxxxx商品无货"}
            # {'orderXml': None, 'overSea': False, 'noStockSkuIds': 'xxx', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'cartXml': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': False, 'resultCode': 600158, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': {'oldAddress': False, 'mapping': False, 'pin': 'xxx', 'areaName': '', 'provinceId': xx, 'cityId': xx, 'countyId': xx, 'townId': xx, 'paymentId': 0, 'selected': False, 'addressDetail': 'xxxx', 'mobile': 'xxxx', 'idCard': '', 'phone': None, 'email': None, 'selfPickMobile': None, 'selfPickPhone': None, 'provinceName': None, 'cityName': None, 'countyName': None, 'townName': None, 'giftSenderConsigneeName': None, 'giftSenderConsigneeMobile': None, 'gcLat': 0.0, 'gcLng': 0.0, 'coord_type': 0, 'longitude': 0.0, 'latitude': 0.0, 'selfPickOptimize': 0, 'consigneeId': 0, 'selectedAddressType': 0, 'newCityName': None, 'newCountyName': None, 'newTownName': None, 'checkLevel': 0, 'optimizePickID': 0, 'pickType': 0, 'dataSign': 0, 'overseas': 0, 'areaCode': None, 'nameCode': None, 'appSelfPickAddress': 0, 'associatePickId': 0, 'associateAddressId': 0, 'appId': None, 'encryptText': None, 'certNum': None, 'addressType': 0, 'fullAddress': 'xxxx', 'postCode': None, 'addressDefault': False, 'addressName': None, 'selfPickAddressShuntFlag': 0, 'pickId': 0, 'pickName': None, 'pickVOselected': False, 'mapUrl': None, 'branchId': 0, 'canSelected': False, 'siteType': 0, 'helpMessage': None, 'tipInfo': None, 'cabinetAvailable': True, 'limitKeyword': 0, 'specialRemark': None, 'siteProvinceId': 0, 'siteCityId': 0, 'siteCountyId': 0, 'siteTownId': 0, 'skuSupported': False, 'addressSupported': 0, 'isCod': 0, 'consigneeName': None, 'pickVOname': None, 'shipmentType': 0, 'retTag': 0, 'tagSource': 0, 'userDefinedTag': None, 'newProvinceId': 0, 'newCityId': 0, 'newCountyId': 0, 'newTownId': 0, 'newProvinceName': None, 'used': False, 'address': None, 'name': 'xx', 'message': None, 'id': 0}, 'msgUuid': None, 'message': 'xxxxxx商品无货'}
            # {"orderXml":null,"cartXml":null,"noStockSkuIds":"","reqInfo":null,"hasJxj":false,"overSea":false,"addedServiceList":null,"sign":null,"pin":null,"needCheckCode":true,"success":false,"resultCode":0,"orderId":0,"submitSkuNum":0,"deductMoneyFlag":0,"goJumpOrderCenter":false,"payInfo":null,"scaleSkuInfoListVO":null,"purchaseSkuInfoListVO":null,"noSupportHomeServiceSkuList":null,"msgMobile":null,"addressVO":null,"msgUuid":null,"message":"验证码不正确,请重新填写"}
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'jd_7c3992aa27d1a', 'needCheckCode': False, 'success': False, 'resultCode': 60070, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '抱歉,您当前选择的省份无法购买商品星工 KN95商品防雾霾防尘防花粉PM2.5 硅胶鼻垫带阀耳戴透气 工业粉尘防护商品 白色25只独立包装'}
            # 下单成功
            # {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': 'xxx', 'needCheckCode': False, 'success': True, 'resultCode': 0, 'orderId': 8740xxxxx, 'submitSkuNum': 1, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': None}
            if resp_json.get('success'):
                logger.info('订单提交成功! 订单号:%s', resp_json.get('orderId'))
                return True
            else:
                resultMessage, result_code = resp_json.get('message'), resp_json.get('resultCode')
                if result_code == 0:
                    # self._save_invoice()
                    if '验证码不正确' in resultMessage:
                        resultMessage = resultMessage + '(验证码错误)'
                        logger.info('提交订单验证码[错误]')
                        continue
                    else:
                        resultMessage = resultMessage + '(下单商品可能为第三方商品,将切换为普通发票进行尝试)'
                elif result_code == 60077:
                    resultMessage = resultMessage + '(可能是购物车为空 或 未勾选购物车中商品)'
                elif result_code == 60123:
                    resultMessage = resultMessage + '(需要在payment_pwd参数配置支付密码)'
                elif result_code == 60070:
                    resultMessage = resultMessage + '(省份不支持销售)'
                    skuids.remove(sku_id)
                    logger.info('[%s]类型商品不支持销售踢出', sku_id)
                logger.info('订单提交失败, 错误码:%s, 返回信息:%s', result_code, resultMessage)
                logger.info(resp_json)
                return False
        except Exception as e:
            print(traceback.format_exc())
            continue