Пример #1
0
    def select_configuration(self):
        logger.info(self.params)
        configuration_id = self.params.get("configuration_id", "")
        shop_ids = self.params.get("shop_ids", "").split(";")
        m_type = self.params.get("type", "")
        result, tmp = [], []

        with sessionCM() as session:
            if not configuration_id:
                for shop_id in shop_ids:
                    shop = Shop.find_by_id(session, shop_id)

                    if shop_id:
                        result = Configuration.find_by_shop_id(
                            session, shop_id)
                        result = [
                            item for item in result if item.type == m_type
                        ] if m_type else result

                    if not isinstance(result, list):
                        result = [result]
                    for item in result:
                        tmp.append({
                            "id": item.id,
                            "shop_id": item.shop_id,
                            "status": item.status,
                            "content": item.content,
                            "count": item.count,
                            "type": item.type,
                            "condition": item.condition,
                            "platform": shop.platform
                        })
            else:
                result = Configuration.find_by_id(session, configuration_id)
                shop = Shop.find_by_id(session, result.shop_id)
                for item in result:
                    tmp.append({
                        "id": item.id,
                        "shop_id": item.shop_id,
                        "status": item.status,
                        "content": item.content,
                        "count": item.count,
                        "type": item.type,
                        "condition": item.condition,
                        "platform": shop.platform
                    })

        return {"status": 1, "data": tmp}
Пример #2
0
def search_account():
    # with sessionCM() as session:
    count = 1
    f = open("accounts.text", 'rb')
    shop = Shop()
    while True:
        line = f.readline()
        if not line:
            break
        shop.account = line.strip()
        print "第 %d 个..." % count
        handler = WishTicket(shop)
        result = handler.list_all_tickets()

        if len(result.get("data", [])):
            print line, len(result.get("data", []))
            raw_input("continue ... ")
        count += 1
Пример #3
0
def sync_smt_customer_list(task_id, shop_id, timestamp):
    with sessionCM() as session:
        task = Task.find_by_id(session, task_id)
        shop = Shop.find_by_id(session, shop_id)
        handler = SyncSmtCustomer(shop, timestamp)
        try:
            handler.execute()
            task.status = 1
            task.remark = timestamp
        except Exception, e:
            logger.warning(traceback.format_exc(e))
            task.status = -1
        finally:
Пример #4
0
def sync_evaluation_list(task_id, shop_id, timestamp):
    method_route = {
        "eBay": SyncEbayEvaluation,
        "AliExpress": SyncSmtEvaluation
    }
    with sessionCM() as session:
        task = Task.find_by_id(session, task_id)
        shop = Shop.find_by_id(session, shop_id)
        handler = method_route[shop.platform](shop)
        try:
            logger.info(timestamp)
            handler.execute()
            task.status = 1
            task.remark = timestamp
        except Exception, e:
            logger.warning(traceback.format_exc(e))
            task.status = -1
        finally:
Пример #5
0
def sync_customer_list(task_id, shop_id, timestamp):
    method_route = {
        "eBay": SyncEbayCustomer,
        "Wish": SyncWishCustomer,
    }
    with sessionCM() as session:
        task = Task.find_by_id(session, task_id)
        shop = Shop.find_by_id(session, shop_id)

        handler = method_route[shop.platform](shop, timestamp)
        try:
            logger.info(timestamp)
            handler.execute()
            task.status = 1
            task.remark = timestamp
        except Exception, e:
            logger.warning(traceback.format_exc(e))
            task.status = -1
        finally:
Пример #6
0
 def get_shop(self):
     shop_id = self.params.get("shop_id", "1")
     with sessionCM() as session:
         shop = Shop.find_by_id(session, "7612")
         shop.token = "AgAAAA**AQAAAA**aAAAAA**7HTjVw**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6ABkoGoD5aHpAqdj6x9nY+seQ**94UCAA**AAMAAA**UGJaMLGzkw/V30Q7yrFVpkDxh9+F1v7X7taOlLW6WeEQCY/F6PhqPrjJfFLfw5rg93LNBvSQV4hO/cLtHS1K059mXzg61q4xHToNFk2uK+DdoFlCGbc1BD0TRyZ9zOSw4peeHJy/XUG2GwzkyPSrkBlU8X8e2IcZiyqCEILF0yl0ffDJy4Yz62JZVYCCX7HzvI/39N3ROGcUpCVbmxPE+QJI4a2Xst9ApBikHreVDntERITCRj8FhnnmAoDHGWziGN5GlNOQ40ETGX9GUX9yjK31haSpTpIsJRQBYhYeOYwo+F+LV5mFR55XDtuKD837jmKGZvpwll2pN4XhJfVbU7VFWbqyi2p4ccjxNEKXqmbJSSESvXmhiNK5J5EmAZVxh0BmXnNAHYCMJ1gZ7+sa4shnnzH12wcjMjK679iwXyYiK1YTrNmLNei4UeDFBfb2fzqm+eSDQIBK9g+HX/fZkTssU0O1m59wTeS+9GG6Bu7wTZyjU5cbCbjlQl6J4xhy4rs+efJLLAx/PfXmAODHgPF1Ai4rF/YYogFy+V9G0SiQJLQz31yxD3uJuDNyVoEB7/voPAvVutUvZcJzw2LAHIETfHG7GNMoHFA1fyLOF76YIZzsxBylxRY/x12gLlHFaKrtNAJRWpbKHO6usD0GMehDd9a/ALlSqHMPolKyaN6RMWEdov/Drq5PYTW+2OmO8GYyzrmCSk8s+OEv4LhLwkL4YBdYZyKoGo7Qf2FTqbfuYOKMblMi2MDACFSYKuvZ"
         shop.site_id = "0"
         # shop = Shop.find_by_id(session, shop_id)
         # if not shop:
         #     self.write({"status": 0, "data": "店铺不存在!"})
         #     return ""
         # managements = Management.find_management(session, self.current_user.id, shop.id)
         #
         # if not managements:
         #     self.write({"status": 0, "data": "您没有管理此店铺权限,请让主账号在“账户管理”中添加店铺授权!"})
         #     return ""
         # shop = Shop.find_by_id(session, '7982')
         # shop.platform = 'AliExpress'
         # shop.account = '1be0afca-412a-42a1-b1f3-bc4b34e9bf0b'
         # shop.site_id = 2
         # shop.session = '0bdf6f64-372d-4b6a-b68b-5efe64bc18bd'
         # shop.owner = 'cn1518284505qzvx'
     return shop
Пример #7
0
def search_account():
    # with sessionCM() as session:
    count = 1
    f = open("smt_ccounts.text", 'rb')
    shop = Shop()
    shop.session = "0bdf6f64-372d-4b6 a-b68b-5efe64bc18bd"
    shop.site_id = 2
    shop.platform = "AliExpress"
    shop.name = 'Limerence'
    while True:
        line = f.readline()
        if not line:
            break
        shop.account = line.strip()
        print "第 %d 个..." % count
        handler = AliMessage(shop)
        result = handler.get_msg_relation_list(msg_source="order_msg")
        lens = len(result.get("result", []))
        if len(result.get("result", [])):
            print line, len(result.get("result", []))
            raw_input("continue ... ")
        count += 1
Пример #8
0
        params = {
            "access_token": self.account,
            "msgSources": msg_sources,
            "buyerId": buyer_id,
            "content": content
        }
        if channel_id:
            params.update({"channelId": channel_id})
        if image:
            params["imgPath"] = image
        response = self.execute('api.addMsg', params)
        return response


if __name__ == "__main__":
    shop = Shop()
    shop.account = "6bf331f0-8e5b-4edb-96a4-5fabf975834c"
    shop.session = "0bdf6f64-372d-4b6 a-b68b-5efe64bc18bd"
    shop.site_id = 2
    shop.platform = "AliExpress"
    shop.name = 'Limerence'
    handler = AliMessage(shop)
    # result = handler.get_msg_detail_list(
    #     channel_id="66947353601", msg_source="message_center"
    # )

    # result = handler.get_msg_relation_list(
    #     msg_source="order_msg",
    #     current_page=1,
    #     page_size=10
    # )
Пример #9
0
# -*- coding: utf-8 -*-

# @author: xuhe
# @date: 16/5/26
# @description:

from morph.lib.model.shop import Shop
shop = Shop(account="da6ed36c890e467f983fbc40b99870e2",
            session="6a4d3537a8134ba4b433c00169ab1a22")

from wishsdk.product import WishProduct
from wishsdk.variant import WishVariant
wp = WishProduct(shop)

product = {
    "name":
    "The new black and white slim Korean men's shirts long sleeved shirt mens fashion tide French front jacket",
    "description":
    "Application scenarios: Daily\nApplicable object: Youth\nSubdivision style: business casual\nPattern: solid color\nClothing craft: iron processing\nListing Year season: Spring 2016\nBasic style: Fashion City\nSleeve length\nType: Slim version\nCollar type: square collar",
    "tags":
    "men's shirts,long sleeved shirt,men's fashion,french jacket",
    "sku":
    "ELY-SHIRT-1",
    "color":
    "Purple",
    "size":
    "L",
    "inventory":
    "1000",
    "price":
    "47.98",
Пример #10
0
                    u'translated_message': u"Where is my product?",
                    u'translated_message_zh': u'\u54EA\u91CC\u662F\u6211\u7684\u4EA7\u54C1\uFF1F'
                }
            }],
            u'state': u'Awaiting your response',
            u'state_id': u'1',
            u'subject': u'Return or Exchange',
            u'sublabel': u'',
            u'transaction_id': u'123456789012345678901234'
        }
    },
    u'message': u''
}

if __name__ == "__main__":
    shop = Shop()
    shop.account = "373756ae5115474c8f0bcba44159194a"
    shop.session = "f5d42d3b104c4043859e09785e573e05"
    shop.owner = "596d75982eac1176e8290607"
    shop.platform = "Wish"
    shop.id = 15183
    shop.site_id = 1

    hanler = WishTicket(shop)

    # result = hanler.list_all_tickets()
    #
    # import json
    # print json.dumps(result, indent=2)

Пример #11
0
            "street_address1": address1,
            "street_address2": address2,
            "city": city,
            "state": state,
            "zipcode": zipcode,
            "country": country,
            "phone_number": phone_number
        }
        response = self.execute("order/change-shipping", params)
        return response

    def modify_order_tracking(self, order_id, tracking_provider, tracking_number, ship_note=""):
        params = {
            "access_token": self.account,
            "id": order_id,
            "tracking_provider": tracking_provider,
            "tracking_number": tracking_number,
            "ship_note": ship_note
        }
        response = self.execute("order/modify-tracking", params)
        return response
# #
from morph.lib.model.shop import Shop
shop = Shop()
shop.account = "acc850109f764b41bcf7fa2fe4747628"
shop.session = "9151a8f84fca4714a67c09637bd19b09"
wo = WishOrder(shop)
# z = wo.retrieve_recently_changed_orders("20", "2016-07-04T20:10:20")
z = wo.retrieve_unfulfilled_orders(0,0)
print z
print len(z["data"])
Пример #12
0
        :param score:    评分,1-5分
        :param content:  评价内容
        :return:
        """
        params = {
            "access_token": self.account,
            "orderId": order_id,
            "score": score,
            "feedbackContent": content
        }
        response = self.execute('api.evaluation.saveSellerFeedback', params)
        return response


if __name__ == "__main__":
    shop = Shop()
    shop.account = "a36c6039-cca4-4638-a84a-dc1ec9c4200f"
    shop.session = "0bdf6f64-372d-4b6a-b68b-5efe64bc18bd"
    shop.site_id = 2
    shop.platform = "AliExpress"
    shop.name = 'Limerence'
    handler = AliEvaluation(shop)
    # result = handler.get_msg_detail_list(
    #     channel_id="66947353601", msg_source="message_center"
    # )
    #
    # result = handler.get_msg_relation_list(
    #     msg_source="message_center"
    # )

    # result = handler.get_evaluation_list(current_page=1, page_size=3)
Пример #13
0
            "serviceName": service_name,
            "logisticsNo": logistics_no,
            "sendType": "all",
            "outRef": order_no,
        }
        self.need_signature = True
        response = self.execute("api.sellerShipment", params)
        return response

    def get_seller_address(self):
        params = {
            "access_token": self.account,
            "request": json.dumps(["sender", "pickup", "refund"])
        }
        self.need_signature = True
        response = self.execute("alibaba.ae.api.getLogisticsSellerAddresses",
                                params)
        return response


if __name__ == "__main__":
    shop = Shop()
    shop.session = "0aaf0faf-590a-4d49-bcef-21171766745e"
    shop.account = "48d74966-d355-4296-87bb-ad5117c0512c"
    AT = AliLogistics(shop)
    print AT.get_by_id("500997895186903")
    # res1 = AT.get_print_info(3374557145, "RF449915291CN")
    # print res1
    # nums = ["04245701278", "04245844360", "04245701264"]
    # print AT.get_print_infos(nums)
    # print AT.list_supported_service()
Пример #14
0
                msg_timestamp = time.strptime("%Y-%m-%dT%H:%M:%s", msg_date)
                if not is_first_sync and msg_timestamp <= latest_date:
                    continue
                print "创建 Message ... "
                Message.create(
                    session,
                    channel_id=channel.id,
                    origin_id="",
                    external_message_id="",
                    content=reply["message"],
                    image_urls=";".join(reply["image_urls"]),
                    receive_time=reply["date"],
                    source="buyer" if reply["sender"] == "user" else "seller",
                )
                latest_date = time.strptime("%Y-%m-%dT%H:%M:%s", reply["date"])
                print "创建完成 ! "

    def execute(self, ticket_id=None):
        self.sync_ticket_list(ticket_id=ticket_id)


if __name__ == '__main__':
    shop = Shop()
    shop.account = '373756ae5115474c8f0bcba44159194a'
    shop.platform = "Wish"
    shop.id = 7104
    handler = SyncWishCustomer(shop)
    print "开始同步 ... "
    handler.execute()
    print "同步完成 ! "
Пример #15
0
            "pageSize": 50,
        }
        self.need_signature = True

        response = self.execute('api.findOrderListQuery', params)
        return response

    def get_orders_simple_list(self, page=1):
        params = {
            "access_token": self.account,
            "page": page,
            "pageSize": 50,
            "orderStatus": "FINISH"
        }
        self.need_signature = True
        response = self.execute('api.findOrderListQuery', params)
        return response


#
if __name__ == "__main__":
    shop = Shop()
    shop.account = "0e6d6295-33ef-4dba-acbe-f81ad2c08fb2"
    shop.session = "997bb82d-22e7-4947-a235-d1ea53c242f2"
    AT = AliTrade(shop)
    res1 = AT.get_orders_list_all(page=1)
    print res1

    # print res1
    # res2 = AT.get_order_detail_by_id(72225047485505)
    # print res2