AyrShareLogic.php 1.4 KB
<?php

namespace App\Http\Logic\Bside\AyrShare;

use App\Helper\AyrShare as AyrShareHelper;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\AyrShare\AyrShare;

class AyrShareLogic extends BaseLogic
{
    public function __construct()
    {
        parent::__construct();

        $this->model = new AyrShare();
        $this->param = $this->requestAll;
    }

    /**
     * @name   :(创建账号并绑定)ayr_add
     * @author :lyh
     * @method :post
     * @time   :2023/5/6 9:19
     */
    public function ayr_share_add(){
        $param = [
            'title'=>md5(uniqid().time())
        ];
        //发送请求注册社交用户
        $ayrShareHelper = new AyrShareHelper();
        $res = $ayrShareHelper->post_create_profiles($param);
        if($res['status'] == 'fail'){
            $this->response('绑定失败');
        }
        //插入数据库
        $data = [
            'title'=>$res['title'],
            'ref_id'=>$res['refId'],
            'profile_key'=>$res['profileKey'],
            'user_id'=>$this->user['id'],
            'project_id'=>$this->user['project_id'],

        ];
        $rs = $this->model->add($data);
        if($rs === false){
            $this->fail('error');
        }
        return $this->success();
    }

    /**
     * @name   :(zhuzhuang)sql_add
     * @author :lyh
     * @method :post
     * @time   :2023/5/6 10:04
     */
    public function sql_add(){

    }
}