大众点评接口优惠卷,订单对接

参考

openshoppingdianping.readthedocs.io/zh/latest/index.html
openshoppingdianping.readthedocs.io/zh/latest/open_guide.html#client-id
openshoppingdianping.readthedocs.io/zh/latest/

demo

public function dianping($push_info=array()){

if(empty($push_info)){

return false;

require_once VENPATH.’third/dianping/DefaultDPClient.php’;

require_once VENPATH.’third/dianping/request/GroupCouponRequest.php’;

$info=array();

$client_id = ”;

$client_secret = ”;

// $preUrl = “https://openshopping.51ping.com/”;//测试

$preUrl = “https://openshopping.dianping.com/”;//正式

$client = new DefaultDPClient($client_id,$client_secret, $preUrl);

$request = new GroupCouponRequest();

$request->couponCode =Arr::get($push_info, ‘coupon_number’, ”);//优惠券券号,使用多张的话,使用List转JSON

$request->comments = “测试”; //备注信息

$request->shopName = Arr::get($push_info, ‘brand_name’, ”); //品牌名称

$request->orderId = Arr::get($push_info, ‘order_sn’, ”);

$request->orderAmount = Arr::get($push_info, ‘goods_amount’, ”);// 订单原始金额

$request->payAmount =Arr::get($push_info, ‘order_amount’, ”); //订单支付金额

$request->consumeTime = time()*1000; //优惠券消费时间

$request->freightFee = 0; //订单运费

$request->attributes[‘couponShop’] = Arr::get($push_info, ‘store_name’, ”);//消费分店名

$request->attributes[‘couponCity’] = Arr::get($push_info, ‘store_city’, ”);//消费城市

$request->attributes[‘couponContext’] = ‘代金券满减 满500-60,满1000-120,满2000-260,满5000-600’;//优惠券内容

$request->attributes[‘couponType’] = ‘1’;//优惠券类型;1:代金券;2:折扣券;3:团购券

$request->attributes[‘orderType’] = ‘1’;//订单类型:1:线下;2:线上

$obj = $client->execute($request, “GroupCouponResponse”);

$info = get_object_vars($obj);

// var_dump($obj);

// var_dump($info[‘status’]);

Log::instance()->add(1,’dianping_order’. json_encode($info));

链接:http://pan.baidu.com/s/1jIrasEa 密码:k6q4

原文链接:https://blog.csdn.net/fighting_tl/article/details/78228564?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165277499316781683997394%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165277499316781683997394&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-13-78228564-null-null.nonecase&utm_term=%E4%BC%98%E6%83%A0

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
文明发言,共建和谐米科社区
提交
头像

昵称

取消
昵称表情图片