123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- <?php
- namespace App\Http\Controllers;
- use App\Exceptions\ValidateException;
- use App\Http\Bean\Util\Jutuike\GetOrderListParamBean;
- use App\Http\Bean\Util\Pdd\Ddk\GoodsDetailParamBean;
- use App\Http\Bean\Util\Pdd\Ddk\GoodsPromotionUrlGenerateParamBean;
- use App\Http\Bean\Util\Pdd\Ddk\GoodsSearchParamBean;
- use App\Http\Bean\Util\Wechat\Miniprograme\GetOrderSearchParamBean;
- use App\Http\Bean\Util\Wechat\Miniprograme\GetProductGenerateParamBean;
- use App\Http\Bean\Util\Wechat\Miniprograme\GetProductListParamBean;
- use App\Http\Enum\MeiTuanLinkTypeEnum;
- use App\Http\Logic\Cron\CronLogic;
- use App\Http\Utils\BaseUtil;
- use App\Http\Utils\DianYing\DianYingUtil;
- use App\Http\Utils\HeiMaUtil;
- use App\Http\Utils\Jutuike\JutuikeUtil;
- use App\Http\Utils\KenDeJi\KenDeJiUtil;
- use App\Http\Utils\McDonalds\McDonaldsUtil;
- use App\Http\Utils\Meituan\MeituanLianmengUtil;
- use App\Http\Utils\Pdd\DuoDuoKeUtil;
- use App\Http\Utils\TaoBao\TaobaoLianMengUtil;
- use App\Http\Utils\Wechat\Miniprograme\MiniprogrameLianMengUtil;
- use App\Http\Utils\WechatAccountUtil;
- use App\Models\TaobaoPidModel;
- use App\Models\UserOrderCommissionModel;
- use App\Models\WechatAccountModel;
- use EasyWeChat\Kernel\Messages\Image;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\DB;
- use Tool\ShanTaoTool\Bean\Pdd\Ddk\ResourceUrlGenParamBean;
- use Tool\ShanTaoTool\Pdd\Ddk\DdkDaogouService;
- /**
- * @SWG\Swagger(
- * schemes={"http"},
- * host="test-daogou.codedreamit.com/api",
- * basePath="/",
- * @SWG\Info(
- * title="导购API文档",
- * version="1.0.0",
- * )
- * )
- */
- class BaseController extends Controller
- {
- /**
- * Controller constructor.
- */
- public function __construct(Request $request)
- {
- //进行统一的参数验证
- //判断对应目录下的验证类是否存在
- $controllerName = $request->route()->getActionName();
- $flag = preg_match("/Controllers\\\(.*)@(.*)/",$controllerName,$match);
- if($flag){
- $controllerName = $match[1];
- $actionName = $match[2];
- $class = "\\App\\Http\\Validate\\$controllerName"."Validate";
- //判断验证是否存在
- if(class_exists($class) && method_exists($class,$actionName)){
- $instance = new $class();
- $validateFlag = $instance->$actionName($request->all());
- if(!$validateFlag){
- throw new ValidateException($instance->getError(),501);
- }
- }
- }
- }
- /**
- * 成功返回
- * @param array $data
- * @param int $code
- * @param string $msg
- * @param string $url
- * @return \Illuminate\Http\JsonResponse
- */
- public function success($data = [], $code = 200, $msg = "", $url = "")
- {
- return response()->json(
- [
- "status"=>true,
- "data"=>$data,
- "code"=>$code,
- "msg"=>$msg,
- "url"=>$url
- ]
- );
- }
- /**
- * 错误返回
- * @param $msg
- * @param string $code
- * @param string $url
- */
- public function error($msg,$code="500",$url="")
- {
- return response()->json(
- [
- "status"=>false,
- "data"=>"",
- "code"=>$code,
- "msg"=>$msg,
- "url"=>$url
- ]
- );
- }
- /**
- * 生成swagger.json文件
- */
- public function swagger()
- {
- $swagger=\Swagger\scan(__DIR__."/../");
- $swagger->saveAs('./swagger.json');
- return $this->success();
- }
- /**
- * 读取swagger内容
- */
- public function loadSwagger()
- {
- $data = json_decode(file_get_contents("./swagger.json"),true);
- return $data;
- }
- public function test()
- {
- dd(TaobaoLianMengUtil::getActivityInfo(70362850341,"20150318020002597"));
- CronLogic::taobaoOrdersLogic();
- dd(1);
- $data = TaobaoPidModel::query()
- ->select([DB::raw("any_value(heima_app_key) as heima_app_key"),DB::raw("any_value(heima_app_secret) as heima_app_secret"),"heima_sid"])
- ->groupBy("heima_sid")
- ->get()->toArray();
- $res = HeiMaUtil::getOrderList($data[0]);
- dd($res);
- // dd(TaobaoLianMengUtil::getGoodsInfo(621062906541));
- // $completeOrders = UserOrderCommissionModel::query()
- // ->where("commission_status",1)
- // ->where("order_commission",">",0)
- // ->where("user_id","<>",0)
- // ->where("order_complete_notify_status",0)
- // ->groupBy("user_id")
- // ->select(["user_id",DB::Raw("sum(order_commission) as total_order_commission"),DB::Raw("GROUP_CONCAT(id) as ids")])
- // ->get();
- // return $this->success($completeOrders);
- // return $this->success(JutuikeUtil::getActList());
- // TaobaoLianMengUtil::taokoulingConvert("淘宝,信这于好之他而着我而天到微喜【sheii苏茵茵】大小姐~韩国真皮粗跟中筒靴女秋弹力长靴瘦腿靴");
- $kouling = "38信有看么子他然是那年有去信 https://m.tb.cn/h.f8tCpoK?sm=67141d 骆驼男装 2021年新款羽绒服男短款加厚情侣款衣服冬季外套面包服";
- // $info = TaobaoLianMengUtil::taokoulingConvert($kouling,70362850341);
- // $goodsInfo = TaobaoLianMengUtil::getGoodsInfo(654351631402,70362850341);
- // $res = TaobaoLianMengUtil::taokoulingCreate($info["click_url"],70362850341);
- // $heimaData = HeiMaUtil::gaoYongZhuanLian(654351631402,70362850341);
- $taobaoSid = 70362850341;
- $info = TaobaoLianMengUtil::taokoulingConvert($kouling,$taobaoSid);
- $goodsInfo = TaobaoLianMengUtil::getGoodsInfo($info["num_iid"],$taobaoSid);
- $res = TaobaoLianMengUtil::taokoulingCreate($info["click_url"],$taobaoSid);
- $heimaData = HeiMaUtil::gaoYongZhuanLian($info["num_iid"],$taobaoSid);
- $goodsTitle = $goodsInfo["title"];
- $goodsPrice = $goodsInfo["zk_final_price"];
- $couponInfo = $heimaData["coupon_info"]??"";
- $couponPrice = 0;
- if (preg_match("/满\d*元减(\d*)元/",$couponInfo,$match)){
- $couponPrice = $match[1];
- }
- $afterCouponPrice = $goodsPrice-$couponPrice;
- $rebeatPrice = round($goodsInfo["zk_final_price"]*$heimaData["max_commission_rate"]/100*0.7,2);
- $url = $res["model"];
- //获取淘口令
- $msg = <<<S
- 【 $goodsTitle 】
- 【原价】:$goodsPrice 元
- 【优惠券】:$couponPrice 元
- 【券后价】:$afterCouponPrice 元
- 【返现金额】:$rebeatPrice 元
- -------------------------
- 复制这条信息:$url
- 打开【手机淘宝】即可查看
- 具体返现金额,以实际支付金额为准
- -------------------------
- 进入公众号=>我的=>钱包,可以1:1提现哦
- S;
- dd($msg);
- dump($heimaData);
- dump($res);
- dump($goodsInfo);
- dd($info);
- $res = HeiMaUtil::gaoYongZhuanLian(621062906541);
- // $res = TaobaoLianMengUtil::taokoulingConvert("49嘻学上时说他然上在家去了! https://m.tb.cn/h.fjEHoGt?sm=d75195 超大浴巾成人男女学生宿舍比纯棉全棉吸水速干洗澡可穿毛巾裹巾夏");
- dd($res);
- // $data = JutuikeUtil::goodsCategory("jd");
- // return $this->success($data);
- // $url = "https://mobile.yangkeduo.com/goods.html?_wvx=10&refer_share_uin=RKJBZMVHVOZWU3HQPZYUD5MAEQ_GEXDA&refer_share_uid=5985443220&share_uin=RKJBZMVHVOZWU3HQPZYUD5MAEQ_GEXDA&page_from=23&_wv=41729&refer_share_id=vJXEDkANGEc4uvPW9QgRCHPj3P6GELOc&refer_share_channel=copy_link&share_uid=5985443220&pxq_secret_key=EUEHP3OMNH3X4GQUAL37HDD7UJBLLM3OD42X55VHLGG6GT3EBPLQ&goods_id=276748200008";
- // $url = "https://mobile.yangkeduo.com/goods.html?_wvx=10&refer_share_uin=QKZTKYYF4LYNCB7SVBSL42IYWY_GEXDA&refer_share_uid=3669222324&share_uin=QKZTKYYF4LYNCB7SVBSL42IYWY_GEXDA&page_from=101&_wv=41729&refer_share_id=l6x0HEi8EMpQ2F9CJiCmsW1IqO5fnT3K&refer_share_channel=copy_link&share_uid=3669222324&pxq_secret_key=6T5MOY4WIDK2ALUXMKACS7QZ3CEYWBUQRZATVA5T5PDULJS3CV6A&goods_id=169921843493";
- // $tmp = BaseUtil::getParamsByUrl($url);
- // $url = $tmp["url"]."?goods_id=".$tmp["goods_id"];
- //获取商品详情
- // $bean = new GoodsSearchParamBean(
- // [
- // "keyword"=>$url,
- // "pid"=>"23985775_220421267"
- // ]
- // );
- // dump($url);
- // $goodsData = DuoDuoKeUtil::goodsSearch($bean);
- // dd($goodsData);
- //
- // $url = "https://mobile.yangkeduo.com/goods.html?goods_id=276748200008";
- // $data = DuoDuoKeUtil::goodsZsUnitUrlGen("23985775_220421267",$url);
- // dd($data);
- // $app = WechatAccountUtil::getApp("fanbuting");
- // $msg = new Image(env("WECHAT_IMAGE_MEDIA_ID"));
- // $res = $app->customer_service->message($msg)->to("odg3c6jmqrrstlPH93KFC40dMtXs")->send();
- // dd($res);
- // $app = WechatAccountUtil::getApp("fanbuting");
- // $result = $app->material->uploadImage("1.png");
- // dd($result);
- // $data = JutuikeUtil::getActList();
- // return $this->success($data);
- // $url = "0.0₤R9nsXr6r5tH₴ https://m.tb.cn/h.fWKqJYQ?sm=9652d6 2-5条 收小肚子中高腰内裤女裆收腹提臀束腰塑身三角裤";
- //
- // $res = preg_match("/https\:\/\/m\.tb\.cn/",$url,$match);
- // dump($res);
- // dd($match);
- // $url = "https://m.vip.com/product-1710619050-6919460940636579082.html?nmsns=shop_iphone-7.54.6-link&nst=product&nsbc=&nct=link&ncid=e65103bd61351bb17486b16b4492127425d68046&nabtid=13&nuid=&nchl_param=share:e65103bd61351bb17486b16b4492127425d68046:1632980761329&mars_cid_a=e65103bd61351bb17486b16b4492127425d68046&chl_type=share";
- // $res = preg_match("/https\:\/\/m\.vip\.com/",$url,$match);
- // $url = "https://item.m.jd.com/product/13441798.html?&utm_source=iosapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=CopyURL&ad_od=share";
- // $url = "2👈啊brXxXrh98ep哈 https://m.tb.cn/h.fWqjHlK?sm=4fbca7 心相印纸巾茶语丝享抽纸家用实惠装餐巾纸面巾纸心心相印纸巾6包";
- // $url = "https://m-goods.kaola.com/product/1383664.html?shareOs=iOS&datid=__da_230bb323_5691a97408c33c80&klasspm=a215sy.page_kla_productpage.growthshare.copylink";
- // dump($url);
- // $url = "https://m.tb.cn/h.f6WeDYQ?sm=978306 ";
- // $goods = JutuikeUtil::transferGoodsLink($url);
- // dump($goods);
- // dump($goods["goodsId"]);
- // $data = JutuikeUtil::convert($goods["goodsId"],"jtkupstream21");
- $data = JutuikeUtil::convert("551557489590","jtkupstream21");
- dd($data);
- // return $this->success($data);
- // $oauthRes = DuoDuoKeUtil::memberAuthorityQuery("23985775_220421267");
- // if(!$oauthRes["authority_query_response"]["bind"]){
- // //未备案
- // $beanData = [
- // "p_id"=>"23985775_220421267",
- // "goods_sign_list"=>json_encode(["Y9f2liecoxFRU4gRwfDZm_tBr6P0jzj2_JKXkSmwdy"]),
- // ];
- //
- // $beanData["generate_authority_url"] = "true";
- // $generateBean = new GoodsPromotionUrlGenerateParamBean($beanData);
- // $res = DuoDuoKeUtil::goodsPromotionUrlGenerate($generateBean);
- // dd($res);
- // }else{
- //
- // }
- // $bean = new GoodsSearchParamBean(
- // []
- // );
- // $data = DuoDuoKeUtil::goodsSearch($bean);
- //
- // //获取到goods_sign
- // $goods_sign = $data["goods_search_response"]["goods_list"][0]["goods_sign"];
- // $beanData = [
- // "p_id"=>"23985775_220860321",
- // "goods_sign_list"=>json_encode([$goods_sign]),
- // ];
- //
- // $generateBean = new GoodsPromotionUrlGenerateParamBean($beanData);
- // $res = DuoDuoKeUtil::goodsPromotionUrlGenerate($generateBean);
- // return $this->success($data);
- // $params = [
- // "goodsSign"=>"134221771214"
- // ];
- // $bean = new GoodsDetailParamBean($params);
- // $data = DuoDuoKeUtil::goodsDetail($bean);
- // dd($data);
- // $url="https://mobile.yangkeduo.com/goods.html?_wvx=10&refer_share_uid=3669222324&share_uin=QKZTKYYF4LYNCB7SVBSL42IYWY_GEXDA&page_from=35&_wv=41729&refer_share_channel=copy_link&refer_share_id=JH6kVhnKqN5NIuAIRfb9tmkmfyyWR8yF&share_uid=3669222324&pxq_secret_key=MQRO6DTQJ7RNUNBUJLWQXGXIUHVHKISZRWVIGNWUVQXV7P74HXDA&goods_id=134221771214";
- // $res = preg_match("/goods_id=(.*)/",$url,$match);
- // if($res){
- // dd($match);
- // }
- // JutuikeUtil::transferGoodsLink($url);
- // $app = WechatAccountUtil::getApp("fanbuting");
- // return $this->success($app->qrcode->forever(12));
- // $data = JutuikeUtil::getActList();
- // $data = JutuikeUtil::transferAct(123,3);
- // $data = JutuikeUtil::getOrderList(new GetOrderListParamBean());
- // return $this->success($data);
- // $url = "https://mobile.yangkeduo.com/goods2.html?_wvx=10&refer_share_uid=3669222324&share_uin=QKZTKYYF4LYNCB7SVBSL42IYWY_GEXDA&page_from=35&_wv=41729&refer_share_channel=copy_link&refer_share_id=ukvmmxZsICNVPodwgxOlWhD7cckCuUr4&share_uid=3669222324&pxq_secret_key=ZFW7YES6N7KIXS7XW4JZD6YGTK3VLAAPTC3RDW2BI45OMMQGCZPA&goods_id=266346895187";
- // $res = preg_match("/https\:\/\/mobile\.yangkeduo\.com/",$url,$match);
- // $data = DuoDuoKeUtil::goodsZsUnitUrlGen("23985775_219021997",$url);
- // dd($data);
- // $bean = new GetOrderSearchParamBean(
- // [
- // "startTimestamp"=>time()-20*60,
- // "endTimestamp"=>time()
- // ]
- // );
- // $data = MiniprogrameLianMengUtil::getOrderSearch($bean);
- // $bean = new GetProductListParamBean(
- // [
- // "from"=>0,
- // "limit"=>10,
- // "sortType"=>1
- // ]
- // );
- // $data = MiniprogrameLianMengUtil::getProductList($bean);
- // $bean = new GetProductGenerateParamBean(
- // [
- // "pid"=>"olIhv5Owrbf3EbOPjddpY8B5XR7Q_871679398",
- // "productList"=>[
- // [
- // "productId"=>"38133489",
- // "appId"=>"wxf565e2dfa175c3fa"
- // ]
- // ]
- // ]
- // );
- // $data = MiniprogrameLianMengUtil::getProductGenerate($bean);
- // $data = MiniprogrameLianMengUtil::addPromotion("测试推广位");
- // $data = MiniprogrameLianMengUtil::getPromotionList(0,10);
- // $data = DdkDaogouService::goodsPidGenerate(1);
- // $pdd_sid = "23985775_216467151";
- // $bean = new ResourceUrlGenParamBean(
- // [
- // "pid"=>$pdd_sid,
- // "resourceType"=>39997
- // ]
- // );
- // $data = DdkDaogouService::resourceUrlGen($bean);
- // $data = DianYingUtil::getDianYingActUrl(123);
- // $data =date("m月d日");
- // $data = TaobaoLianMengUtil::getActivityInfo("111538400047","20150318020002597");
- // $data = MeituanLianmengUtil::generateLink(22,"ceshi",MeiTuanLinkTypeEnum::MINIPROGRAME,env("MEITUAN_LIANMENG_KEY"));
- // $data = WechatAccountModel::findByWechatAppCode("fanbuting");
- return $data;
- }
- }
|