AyrReleaseLogic.php
2.1 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
<?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(){
$this->param['project_id'] = $this->user['project_id'];
$this->param['operator_id'] = $this->user['id'];
if(isset($this->param['images']) && !empty($this->param['images'])){
$this->param['images'] = implode(',',$this->param['images']);
}
$this->param['platforms'] = json_encode($this->param['platforms']);
$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 = $v;
$imageModel = new Image();
$list = $imageModel->list(['hash'=>['in',$images]],'id');
foreach ($list as $v1){
$arr[] = url('/upload'.$v1['path']);
}
}else{
$fileModel = new File();
$info = $fileModel->read(['hash'=>$v]);
$arr[] = url('/upload'.$info['path']);
}
}
return $this->success($arr);
}
}