| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\controller\admin;
- use app\extra\basic\Base;
- use app\extra\tools\XcJob;
- use app\middleware\AuthMiddleware;
- use LinFly\Annotation\Route\Controller;
- use LinFly\Annotation\Route\Middleware;
- use LinFly\Annotation\Route\Route;
- use support\Request;
- use support\Response;
- #[Controller(prefix: "/api/task"),Middleware(AuthMiddleware::class)]
- class Task extends Base
- {
- /**
- * 获取星川任务详情
- * @param Request $request
- * @return Response
- */
- #[Route(path: "job",methods: "get")]
- public function getJobDetail(Request $request): Response
- {
- try {
- $param = $this->_valid([
- "job_id.require" => trans("empty.require")
- ]);
- if (!is_array($param)) return error($param);
- $data = (new XcJob)->token()->getJobDetail($param['job_id']);
- if ($data['base_resp']['status_code'] <> 0) return error("获取任务失败");
- $task = [
- "expiration_time_end" => date("Y-m-d H:i:s",$data['object_field_info']['object_basic_info']['expiration_time_end']),
- "title" => $data['object_field_info']['object_basic_info']['object_name']??'',
- "product_cover_url" => $data['object_field_info']['object_product_info']['product_cover_url']??'',
- "product_name" => $data['object_field_info']['object_product_info']['product_name']??'',
- "product_id" => $data['object_field_info']['object_product_info']['external_product_id']??'',
- "auto" => 2,
- "job_id" => $param['job_id'],
- "category" => "douyin",
- "category_detail" => $data['object_field_info']['object_product_info']['category_detail']['second_cname']??'',
- "product_selling_point" => $data['object_field_info']['object_product_info']['product_selling_point_detail']??'',
- "target_audience" => $data['object_field_info']['object_product_info']['target_audience_desc']??'',
- "content" => $data['object_field_info']['object_requirement_info']['author_preference']?nl2br($data['object_field_info']['object_requirement_info']['author_preference']):'',
- "total_budget" => $data['object_field_info']['object_project_info']['total_budget_fen']?format_money_bit($data['object_field_info']['object_project_info']['total_budget_fen']/100):'',
- ];
- return success("ok",$task);
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- }
|