AyrReleaseLogic.php 4.3 KB
<?php

namespace App\Http\Logic\Bside\AyrShare;

use App\Http\Logic\Bside\BaseLogic;
use App\Models\AyrShare\AyrRelease;
use App\Models\File\File;
use App\Models\File\Image;

class AyrReleaseLogic extends BaseLogic
{


    public function __construct()
    {
        parent::__construct();
        $this->model = new AyrRelease();
        $this->param = $this->requestAll;
    }

    /**
     * @name   :(获取详情)release_info
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 16:27
     */
    public function release_info(){
        $info = $this->model->read($this->param);
        if($info === false){
            $this->fail('error');
        }
        return $this->success($info);
    }
    /**
     * @name   :(发布社交写入数据库)release_add
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 9:38
     */
    public function release_add(){
        $rs = $this->model->add($this->param);
        if($rs === false){
            $this->fail('error');
        }
        return $this->success();
    }
    /**
     * @name   :(上传第三方图片参数处理)get_param
     * @author :lyh
     * @method :post
     * @time   :2023/5/10 10:27
     */
    public function image_file_param($data) {
        $arr = [];
        foreach ($data as $k => $v){
            if($k == 'images'){
                $images = explode(',',$v);
                $imageModel = new Image();
                $list = $imageModel->list(['hash'=>['in',$images]],'id');
                foreach ($list as $v1){
                    $arr[] = $v1['ayr_url'];
                }
            }else{
                $files = explode(',',$v);
                $filesModel = new File();
                $list = $filesModel->list(['hash'=>['in',$files]],'id');
                foreach ($list as $v2){
                    $arr[] = $v2['ayr_url'];
                }
            }
        }
        return $this->success($arr);
    }

    /**
     * @name   :(发布到推特)post_twitter
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 13:42
     */
    public function post_twitter($param){
        $param['post'] = '描述';
        $param['platforms'] = ['twitter'];
        $param['twitterOptions'] = [
            'thread'=> true,
            'threadNumber'=> true,
            'mediaUrls'=>[
                //图片地址
            ],
        ];
        return $this->success($param);
    }
    /**
     * @name   :(发布到youtube)post_facebook
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 10:05
     */
    public function post_facebook(){
        $param['post'] = '视频描述';
        $param['platforms'] = ['facebook'];
        $param['faceBookOptions'] = [
            'reels'=> true,
            'title'=>'Super title for the Reel'
        ];
        return $this->success($param);
    }

    /**
     * @name   :(发布到fbg,)post_youtube
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 10:22
     * @TODO::只能发布一张图片和一张视频
     */
    public function post_gmb(){
        $param['post'] = '描述';
        $param['platforms'] = ['gmb'];
        $param['mediaUrls'] = [];//图片链接
        $param['gmbOptions'] = [
            //视屏设置
            'isPhotoVideo' => true,
            'category'=> 'cate',//分类
        ];
        return $this->success($param);
    }

    /**
     * @name   :(发布到instagram)post_google
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 11:54
     */
    public function post_instagram(){
        $param['post'] = '视频描述';
        $param['platforms'] = ['instagram'];
        $param['faceBookOptions'] = [
            'reels'=> true,
            'title'=>'Super title for the Reel'
        ];
        return $this->success();
    }

    /**
     * @name   :(领英)post_linkedin
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 11:56
     */
    public function post_linkedin(){
        return $this->success();
    }

    /**
     * @name   :(红迪网)post_reddit
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 13:40
     */
    public function post_reddit(){
        return $this->success();
    }

    /**
     * @name   :(抖音)post_tiktok
     * @author :lyh
     * @method :post
     * @time   :2023/5/9 13:44
     */
    public function post_tiktok(){

    }
}