|
@@ -298,73 +298,14 @@ S;
|
|
|
// }
|
|
|
|
|
|
$instance->info("匹配到拼多多链接");
|
|
|
- $goodsInfo = JutuikeUtil::transferGoodsLink($message["Content"]);
|
|
|
- $tuiguangRes = JutuikeUtil::convert($goodsInfo["goodsId"],$jutuikeSid,"pdd");
|
|
|
- $goodsTitle = $tuiguangRes["goodsName"];
|
|
|
- $goodsPrice = $tuiguangRes["marketPrice"];
|
|
|
- $couponPrice = $tuiguangRes["couponInfo"]["fav"];
|
|
|
- $afterCouponPrice = $tuiguangRes["price"];
|
|
|
- $rebeatPrice = round($tuiguangRes["commission"]*0.7,2);
|
|
|
- $url = $tuiguangRes["url"];
|
|
|
- $msg = <<<S
|
|
|
-【 $goodsTitle 】
|
|
|
-【原价】:$goodsPrice 元
|
|
|
-【优惠券】:$couponPrice 元
|
|
|
-【券后价】:$afterCouponPrice 元
|
|
|
-【返现金额】:$rebeatPrice 元
|
|
|
- -------------------------
|
|
|
-点击链接购买:$url
|
|
|
-具体返现金额,以实际支付金额为准
|
|
|
--------------------------
|
|
|
-进入公众号=>我的=>钱包,可以1:1提现哦
|
|
|
-S;
|
|
|
- $wenti = new Text($msg);
|
|
|
- $app->customer_service->message($wenti)->to($officialOpenId)->send();
|
|
|
- return;
|
|
|
-// $instance->info("拼多多处理过的链接:".$message["Content"]);
|
|
|
-// //获取商品详情
|
|
|
-// $bean = new GoodsSearchParamBean(
|
|
|
-// [
|
|
|
-// "keyword"=>$message["Content"],
|
|
|
-// "pid"=>"23985775_220421267"
|
|
|
-// ]
|
|
|
-// );
|
|
|
-// $goodsData = DuoDuoKeUtil::goodsSearch($bean);
|
|
|
-// $instance->info("拼多多返回商品详情数据:".json_encode($goodsData));
|
|
|
-//
|
|
|
-// //1.判断推广位是否备案
|
|
|
-// $oauthRes = DuoDuoKeUtil::memberAuthorityQuery($platformSid);
|
|
|
-// $instance->info("备案信息:".json_encode($oauthRes));
|
|
|
-// //2.未备案这授权,已备案则直接获取推广链接
|
|
|
-// if($oauthRes["authority_query_response"]["bind"]){
|
|
|
-// //已备案
|
|
|
-// $instance->info("拼多多转链用的url:".$message["Content"]);
|
|
|
-// $data = DuoDuoKeUtil::goodsZsUnitUrlGen($platformSid,$message["Content"]);
|
|
|
-// $instance->info("拼多多返回数据:".json_encode($data));
|
|
|
-// $url = $data["goods_zs_unit_generate_response"]["short_url"];
|
|
|
-//// $link = "<a href='".$url."'>点我购买,即刻拿优惠</a>";
|
|
|
-// }else{
|
|
|
-// //未备案,使用自己已备案的pid调用商品搜索接口获取goods_sign
|
|
|
-// //获取到goods_sign
|
|
|
-// $goods_sign = $goodsData["goods_search_response"]["goods_list"][0]["goods_sign"];
|
|
|
-// $beanData = [
|
|
|
-// "p_id"=>$platformSid,
|
|
|
-// "goods_sign_list"=>json_encode([$goods_sign]),
|
|
|
-// "generate_authority_url"=>"true",
|
|
|
-// ];
|
|
|
-//
|
|
|
-// $generateBean = new GoodsPromotionUrlGenerateParamBean($beanData);
|
|
|
-// $res = DuoDuoKeUtil::goodsPromotionUrlGenerate($generateBean);
|
|
|
-// $instance->info("生成备案信息:".json_encode($res));
|
|
|
-// $url = $res["goods_promotion_url_generate_response"]["goods_promotion_url_list"][0]["short_url"];
|
|
|
-//// $link = "<a href='".$url."'>点击备案之后,直接购买</a>";
|
|
|
-// }
|
|
|
-//
|
|
|
-// $goodsPrice = round($goodsData["goods_search_response"]["goods_list"][0]["min_group_price"]/100,2);
|
|
|
-// $couponPrice = round($goodsData["goods_search_response"]["goods_list"][0]["coupon_discount"]/100,2);
|
|
|
-// $afterCouponPrice = $goodsPrice-$couponPrice;
|
|
|
-// $rebeatPrice = round($goodsData["goods_search_response"]["goods_list"][0]["promotion_rate"]*$afterCouponPrice*0.7/1000,2);
|
|
|
-// $goodsTitle = $goodsData["goods_search_response"]["goods_list"][0]["goods_name"];
|
|
|
+// $goodsInfo = JutuikeUtil::transferGoodsLink($message["Content"]);
|
|
|
+// $tuiguangRes = JutuikeUtil::convert($goodsInfo["goodsId"],$jutuikeSid,"pdd");
|
|
|
+// $goodsTitle = $tuiguangRes["goodsName"];
|
|
|
+// $goodsPrice = $tuiguangRes["marketPrice"];
|
|
|
+// $couponPrice = $tuiguangRes["couponInfo"]["fav"];
|
|
|
+// $afterCouponPrice = $tuiguangRes["price"];
|
|
|
+// $rebeatPrice = round($tuiguangRes["commission"]*0.7,2);
|
|
|
+// $url = $tuiguangRes["url"];
|
|
|
// $msg = <<<S
|
|
|
//【 $goodsTitle 】
|
|
|
//【原价】:$goodsPrice 元
|
|
@@ -374,14 +315,73 @@ S;
|
|
|
// -------------------------
|
|
|
//点击链接购买:$url
|
|
|
//具体返现金额,以实际支付金额为准
|
|
|
-//拼多多存在比价订单(无佣金):自己登录后的查看详情页复制链接,进行转链
|
|
|
-//解决方法:退出app,浏览需要购买的商品页,然后复制链接转链,即可避免
|
|
|
//-------------------------
|
|
|
//进入公众号=>我的=>钱包,可以1:1提现哦
|
|
|
//S;
|
|
|
// $wenti = new Text($msg);
|
|
|
// $app->customer_service->message($wenti)->to($officialOpenId)->send();
|
|
|
// return;
|
|
|
+// $instance->info("拼多多处理过的链接:".$message["Content"]);
|
|
|
+ //获取商品详情
|
|
|
+ $bean = new GoodsSearchParamBean(
|
|
|
+ [
|
|
|
+ "keyword"=>$message["Content"],
|
|
|
+ "pid"=>"23985775_220421267"
|
|
|
+ ]
|
|
|
+ );
|
|
|
+ $goodsData = DuoDuoKeUtil::goodsSearch($bean);
|
|
|
+ $instance->info("拼多多返回商品详情数据:".json_encode($goodsData));
|
|
|
+
|
|
|
+ //1.判断推广位是否备案
|
|
|
+ $oauthRes = DuoDuoKeUtil::memberAuthorityQuery($platformSid);
|
|
|
+ $instance->info("备案信息:".json_encode($oauthRes));
|
|
|
+ //2.未备案这授权,已备案则直接获取推广链接
|
|
|
+ if($oauthRes["authority_query_response"]["bind"]){
|
|
|
+ //已备案
|
|
|
+ $instance->info("拼多多转链用的url:".$message["Content"]);
|
|
|
+ $data = DuoDuoKeUtil::goodsZsUnitUrlGen($platformSid,$message["Content"]);
|
|
|
+ $instance->info("拼多多返回数据:".json_encode($data));
|
|
|
+ $url = $data["goods_zs_unit_generate_response"]["short_url"];
|
|
|
+// $link = "<a href='".$url."'>点我购买,即刻拿优惠</a>";
|
|
|
+ }else{
|
|
|
+ //未备案,使用自己已备案的pid调用商品搜索接口获取goods_sign
|
|
|
+ //获取到goods_sign
|
|
|
+ $goods_sign = $goodsData["goods_search_response"]["goods_list"][0]["goods_sign"];
|
|
|
+ $beanData = [
|
|
|
+ "p_id"=>$platformSid,
|
|
|
+ "goods_sign_list"=>json_encode([$goods_sign]),
|
|
|
+ "generate_authority_url"=>"true",
|
|
|
+ ];
|
|
|
+
|
|
|
+ $generateBean = new GoodsPromotionUrlGenerateParamBean($beanData);
|
|
|
+ $res = DuoDuoKeUtil::goodsPromotionUrlGenerate($generateBean);
|
|
|
+ $instance->info("生成备案信息:".json_encode($res));
|
|
|
+ $url = $res["goods_promotion_url_generate_response"]["goods_promotion_url_list"][0]["short_url"];
|
|
|
+// $link = "<a href='".$url."'>点击备案之后,直接购买</a>";
|
|
|
+ }
|
|
|
+
|
|
|
+ $goodsPrice = round($goodsData["goods_search_response"]["goods_list"][0]["min_group_price"]/100,2);
|
|
|
+ $couponPrice = round($goodsData["goods_search_response"]["goods_list"][0]["coupon_discount"]/100,2);
|
|
|
+ $afterCouponPrice = $goodsPrice-$couponPrice;
|
|
|
+ $rebeatPrice = round($goodsData["goods_search_response"]["goods_list"][0]["promotion_rate"]*$afterCouponPrice*0.7/1000,2);
|
|
|
+ $goodsTitle = $goodsData["goods_search_response"]["goods_list"][0]["goods_name"];
|
|
|
+ $msg = <<<S
|
|
|
+【 $goodsTitle 】
|
|
|
+【原价】:$goodsPrice 元
|
|
|
+【优惠券】:$couponPrice 元
|
|
|
+【券后价】:$afterCouponPrice 元
|
|
|
+【返现金额】:$rebeatPrice 元
|
|
|
+ -------------------------
|
|
|
+点击链接购买:$url
|
|
|
+具体返现金额,以实际支付金额为准
|
|
|
+拼多多存在比价订单(无佣金):自己登录后的查看详情页复制链接,进行转链
|
|
|
+解决方法:退出app,浏览需要购买的商品页,然后复制链接转链,即可避免
|
|
|
+-------------------------
|
|
|
+进入公众号=>我的=>钱包,可以1:1提现哦
|
|
|
+S;
|
|
|
+ $wenti = new Text($msg);
|
|
|
+ $app->customer_service->message($wenti)->to($officialOpenId)->send();
|
|
|
+ return;
|
|
|
}
|
|
|
//2.判断是否匹配上淘宝链接
|
|
|
$res = preg_match("/https\:\/\/m\.tb\.cn/",$message["Content"],$match);
|