header = [ "cookie" => $this->getCookies() ]; return $this; } /** * 获取达人信息 * @param string $name * @return array */ public function getStarData(string $name = ""): array { $param = [ "request_source" => 2, "keyword" => $name, "page" => 1, "page_size" => 10 ]; $resp = Http::asJson()->withHeaders($this->header)->post($this->getaway."/life/alliance/v1/merchant/talent_square/talent/search/?root_life_account_id=7595228109947947043&life_biz_view_id=22&life_account_biz_ids=",$param)->array(); if ($resp['status_code'] <> 0) return [0,'登录过期,请联系管理员']; if (!isset($resp['talent_list'][0])) return [0,'未获取到达人信息,请确认是否已开通达人权限']; return [1,$resp['talent_list'][0]]; } /** * 获取订单信息 * @param string $orderId * @return array */ public function getOrderData(string $orderId = ""): array { $param = [ "order_id" => $orderId, "current_time_ms" => round(microtime(true) * 1000), "show_reason" => "catering_comprehensive_coupon", "search_type" => 1, "source" => 1, "dito_biz_common_param" => [ "page_id" => "502", "scene_version" => "management", "source" => "dlk_pc" ], "industry" => "industry_common" ]; $resp = Http::asJson()->withHeaders($this->header)->post($this->getaway."/life/trade_view/v1/management/coupon/sale/get_detail?industry=industry_common&root_life_account_id=7595228109947947043&life_biz_view_id=22&life_account_biz_ids=",$param)->array(); if (!isset($resp['data']['dito_data']['meta_data'])) return [0,'获取失败']; $metaData = $resp['data']['dito_data']['meta_data']; $dataRe = json_decode(json_decode($metaData, true), true); $orderFee = $dataRe['order_fee']['bill_commissions']; $starFee = $lifeFee = 0; foreach ($orderFee as $value) { if ($value['title'] == "软件服务费") { $lifeFee = substr($value['amount'],1); } if ($value['title'] == "达人服务费") { $starFee = substr($value['amount'],1); } } return [1,[ "douyin_uid" => $dataRe['order_source']['sale_user_unique_id']??'', "star_fee" => $starFee, "life_fee" => $lifeFee, ]]; } protected function getCookies() { return (new SystemConfig)->where(['type' => "life","name" => "cookies"])->value("value"); } }