With Ali in the hungry, we have a distribution of word-of-mouth orders of customers, is on track, people neat, well-trained ... However, suddenly lost all the orders from the source, no orders, there is no income, online 7, 8 customer service, offline nearly 100 distribution staff, can only start looking for new jobs ... Accidentally remembered, the early days of the company to the word-of-mouth 1.0 to do the printer, just the basic completion, the word-of-mouth outside of the sale, did not expect a few years later, the word-of-mouth sell 2.0 and deeply hurt us once ... Old old, sigh two, return to the text.
background
Before real-time access to the word-of-mouth business orders, and point-of-delivery orders, and then use our scheduling system to unify the dispatch of various sources of orders, combined with the distribution of self-grab single, coupled with the captain of the distribution line scheduling, the maximum distribution staff to add "on the way", improve efficiency ... This team should not because of the word of mouth, it becomes a copper scrap. Twilight Look back, originally hungry there is also a merchant interface, although there is no Taobao outside the open platform so powerful, provide several language sample code, not how to do. Hands-on, clothed.
Hands before, or lazy Baidu, thought can find some basic code, or the like, do not know is no one to use it, or no one to share ... No, there is, there is no estimate of this article.
Although, we want to be able to have the interface of the front bird distribution, the reality is always so realized, really no, that right vote with the merchant's interface to understand this process, in the future, if they can open the distribution provider interface, the estimated code can also be used. preparatory work
API Document http://merchant.openapi.eleme.io/
Estimated that most programmers, know the above address can be ha, finally have code OH.
There is a note in the document is consumer key, this is currently sent by mail to get, the mail is written on the business's access address can be, the following figure (figure I), in addition, the Mail also refers to the modification of the order, operation as shown in Figure II
(Figure I)
Although, they provide a test of the business, but I have several browsers have been tested, the order will prompt me to add the address, as shown in Figure 3, my heart is almost a crash, finally let a customer gave me an account to reluctantly soothe the wounded heart. If you want to test, or use a formal business, I can assure you that you are going to collapse.
The code you're familiar with
In terms of code, there are currently two main interfaces implemented: Get new orders, order details two interfaces. The other interfaces are pretty much the same. The code is not well written, and it is appreciated if treatise.
The code structure is as follows
BaseEleAPI.cs implements the signature, generating the requested URL and other features.
NewOrdersInfo.cs get the entity that corresponds to the new order
EleOrder.cs get the entity that corresponds to the order details
EleUtil.cs Configure Consumer_key,consumer_secret and some tools.
HttpHelper.cs look at the name to know, this is the use of other people's class, which has the original author information.
Just one place in the code. Note that each data is converted to lowercase when the signature is generated.
At the end of this section there is demo download.
Successful Data acquisition
When looking at the log output below the information, I know already victory in sight, integrated so many interfaces, the process is almost the same, a few hours to get it, of course, to achieve all the interface, so that orders run up, there is a lot of work to do, and so on the back of the empty, and then perfect. Of course, more hope someone can use this.
2016-05-14 17:43:28 returnmsg={"message": "OK", "code": $, "data": {"Original_price": 58.0, "restaurant_name": "Shen Vegetable Shop", "Status_code": 2, "restaurant_id": 860035, "Service_fee": 7.5, "consignee": "Zhang Ping", "Invoice": "", "description": "", "user _id ": 24086157," Delivery_geo ":" 24.46839,118.09094 "," detail ": {" Abandoned_extra ": []," group ": [[{" category_id ": 1," Name ":" Fresh cut red dragon fruit to the pound "," price ": 24.0," Sale_mode ": 0," specs ": []," garnish ": []," id ": 82727401," Quantity ": 1},{" Category_ ID ": 1," "Name": "Three Bowls", "price": 12.0, "Sale_mode": 0, "specs": [], "garnish": [], "id": 82727363, "Quantity": 1},{"Category_ ID ": 1," "Name": "The Township of the Sky Loquat", "Price": 18.0, "Sale_mode": 0, "specs": [], "garnish": [], "id": 82727558, "Quantity": 1}], "Extra" : [{"description": "", "Quantity": 1, "price": -10.0, "stats_quantity": 1, "category_id": "Type": 102, "id": 10087364, " Name ":" Online payment reduction offer "},{" description ":", "Price": 4.0, "name": "Delivery fee", "category_id": 2, "id": -10, "Quantity": 1},{" Description ":", "Price": -7.0, "name": "Use red envelope", "category_id": 0, "id": 194098285927, "Quantity": 1}]}, "active _at ":" 2016-05-1322:54:30 "," Invoiced ": 0," user_name ":" 32b93b42c "," Deliver_fee ": 0," Is_book ": 0," Restaurant_part ": 4.0," Deliver_time ": null," order_id ":" 100646048067066976 "," Eleme_part ": 6.0," income ": 42.5," Restaurant_number ": 3," Address ":" Bainaohui Science and Technology Building 1906 "," Hongbao ": -7.0," Is_online_paid ": 1," delivery_poi_address ":" Bainaohui Science Building 1906 (Xiamen, Fujian province Simin) "," Total_price " : 41.0, "Created_at": "2016-05-13 22:53:48", "service_rate": 0.15, "Package_fee": 0, "activity_total": 10.0, "Phone_list" : ["1361092"]}, "request_id": "B32835ae1f8040409624274d924860f0"}
2016-05-14 17:43:28 Order Data: Bainaohui Science and Technology building 1906 Delivertime=Conclusion
Business interface here on the end, for the platform distribution, estimates are not very big, but for a single business, or chain business is very useful, if they are open in several platforms, orders can be combined, whether it is distribution, or statistics are very meaningful, and do not have to open a few platform merchant side. Listen to the annoying, you have a new hungry order, you have Baidu order, you have a new US group takeout orders ...
Next, I will pay attention to the other platform of the merchant interface, there are new progress will, and then share to everyone, I firmly believe that: give a person rose hand fragrance.
Demo is here, sweep code plus friends, haha, mainly to make friends ha.
Become a good programmer.