AyrShareLogic.php
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
namespace App\Http\Logic\Bside\AyrShare;
use App\Helper\AyrShare as AyrShareHelper;
use App\Http\Controllers\file\ImageController;
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($res){
//插入数据库
$param = [
'title'=>$res['title'],
'ref_id'=>$res['refId'],
'profile_key'=>$res['profileKey'],
'user_id'=>$this->user['id'],
'project_id'=>$this->user['project_id'],
'name'=>$this->param['name'],
];
$rs = $this->model->add($param);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @name :(获取当前数据详情)ayr_share_del
* @author :lyh
* @method :post
* @time :2023/5/6 10:16
*/
public function ayr_share_info(){
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
return $this->success($info);
}
/**
* @name :(删除ayr数据并同步删除)
* @author :lyh
* @method :post
* @time :2023/5/6 10:18
*/
public function ayr_share_del(){
$this->param['id'] = ['in',$this->param['id']];
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('删出失败');
}
return $this->success();
}
/**
* @name :(向第三方平台发布帖子)api_public_msg
* @author :lyh
* @method :post
* @time :2023/5/8 9:11
*/
public function send_public_post($param){
//获取图片
$image_c = new ImageController();
$image_info = $image_c->index($param['hash']);
$param = [
'post'=>$param['text'],
'mediaUrls'=>$image_info,
'platforms'=>$this->param['platforms'],
];
//发布帖子
$ayrShareHelper = new AyrShareHelper();
$res = $ayrShareHelper->post_send_msg($param);
$this->success($res);
}
}