作者 lyh

gx

@@ -15,6 +15,15 @@ use Illuminate\Support\Facades\DB; @@ -15,6 +15,15 @@ use Illuminate\Support\Facades\DB;
15 class AyrReleaseController extends BaseController 15 class AyrReleaseController extends BaseController
16 { 16 {
17 /** 17 /**
  18 + * @name :(获取当前用户已绑定的社交链接)info
  19 + * @author :lyh
  20 + * @method :post
  21 + * @time :2023/5/9 16:00
  22 + */
  23 + public function info(){
  24 +
  25 + }
  26 + /**
18 * @name :(发布社交)send_post 27 * @name :(发布社交)send_post
19 * @author :lyh 28 * @author :lyh
20 * @method :post 29 * @method :post
@@ -25,6 +34,14 @@ class AyrReleaseController extends BaseController @@ -25,6 +34,14 @@ class AyrReleaseController extends BaseController
25 try { 34 try {
26 //获取发送账号详情 35 //获取发送账号详情
27 $share_info = $ayrShareLogic->ayr_share_info(); 36 $share_info = $ayrShareLogic->ayr_share_info();
  37 + $data = [
  38 + 'image'=>explode(',',$this->param['image']),
  39 + 'file'=>explode(',',$this->param['file'])
  40 + ];
  41 + //参数处理
  42 + $image_file = $this->_extents($data);
  43 + $this->param['mediaUrls'] = $image_file;
  44 + //统一生成链接
28 $param = [ 45 $param = [
29 'post'=>$this->param['content'], 46 'post'=>$this->param['content'],
30 'platforms'=>$this->param['platforms'], 47 'platforms'=>$this->param['platforms'],
@@ -82,7 +82,7 @@ class FileController @@ -82,7 +82,7 @@ class FileController
82 } 82 }
83 } 83 }
84 /** 84 /**
85 - * @name :上传图片 85 + * @name :上传
86 * @return void 86 * @return void
87 * @author :liyuhang 87 * @author :liyuhang
88 * @method 88 * @method
@@ -96,12 +96,13 @@ class FileController @@ -96,12 +96,13 @@ class FileController
96 return $hash; 96 return $hash;
97 } 97 }
98 $url = $this->path; 98 $url = $this->path;
99 - $res = $this->request->file('image')->move($url); 99 + $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
  100 + $res = $files->move($url,$fileName);
100 if ($res === false) { 101 if ($res === false) {
101 return $this->response($files->getError(), Code::USER_ERROR); 102 return $this->response($files->getError(), Code::USER_ERROR);
102 } 103 }
103 $data = [ 104 $data = [
104 - 'path' => $url.'/'.$res->getClientOriginalName(), 105 + 'path' => $url.'/'.$fileName,
105 'created_at' => date('Y-m-d H:i:s',time()), 106 'created_at' => date('Y-m-d H:i:s',time()),
106 'size' => $res->getSize(), 107 'size' => $res->getSize(),
107 'hash' => $hash, 108 'hash' => $hash,
@@ -133,12 +134,13 @@ class FileController @@ -133,12 +134,13 @@ class FileController
133 continue; 134 continue;
134 } 135 }
135 $url = $this->path; 136 $url = $this->path;
136 - $res = $file->move($url); 137 + $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
  138 + $res = $file->move($url,$fileName);
137 if ($res === false) { 139 if ($res === false) {
138 return $this->response($file->getError(), Code::USER_ERROR); 140 return $this->response($file->getError(), Code::USER_ERROR);
139 } 141 }
140 $save_data[] = [ 142 $save_data[] = [
141 - 'path' => $url.'/'.$res->getClientOriginalName(), 143 + 'path' => $url.'/'.$fileName,
142 'created_at' => date('Y-m-d H:i:s',time()), 144 'created_at' => date('Y-m-d H:i:s',time()),
143 'size' => $res->getSize(), 145 'size' => $res->getSize(),
144 'hash' => $hash, 146 'hash' => $hash,
@@ -117,12 +117,13 @@ class ImageController @@ -117,12 +117,13 @@ class ImageController
117 return $hash; 117 return $hash;
118 } 118 }
119 $url = $this->path; 119 $url = $this->path;
120 - $res = $this->request->file('image')->move($url); 120 + $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
  121 + $res = $files->move($url,$fileName);
121 if ($res === false) { 122 if ($res === false) {
122 return $this->response($files->getError(), Code::USER_ERROR); 123 return $this->response($files->getError(), Code::USER_ERROR);
123 } 124 }
124 $data = [ 125 $data = [
125 - 'path' => $url.'/'.$res->getClientOriginalName(), 126 + 'path' => $url.'/'.$fileName,
126 'created_at' => date('Y-m-d H:i:s',time()), 127 'created_at' => date('Y-m-d H:i:s',time()),
127 'size' => $res->getSize(), 128 'size' => $res->getSize(),
128 'hash' => $hash, 129 'hash' => $hash,
@@ -154,6 +155,7 @@ class ImageController @@ -154,6 +155,7 @@ class ImageController
154 * @return type 155 * @return type
155 */ 156 */
156 private function multi($files) { 157 private function multi($files) {
  158 +
157 if (!is_array($files)) { 159 if (!is_array($files)) {
158 $files = [$files]; 160 $files = [$files];
159 } 161 }
@@ -168,12 +170,13 @@ class ImageController @@ -168,12 +170,13 @@ class ImageController
168 continue; 170 continue;
169 } 171 }
170 $url = $this->path; 172 $url = $this->path;
171 - $res = $file->move($url); 173 + $fileName = uniqid().rand(10000,99999).'.'.$file->getClientOriginalExtension();
  174 + $res = $file->move($url,$fileName);
172 if ($res === false) { 175 if ($res === false) {
173 return $this->response($file->getError(), Code::USER_ERROR); 176 return $this->response($file->getError(), Code::USER_ERROR);
174 } 177 }
175 $save_data[] = [ 178 $save_data[] = [
176 - 'path' => $url.'/'.$file->getClientOriginalName(), 179 + 'path' => $url.'/'.$fileName,
177 'created_at' => date('Y-m-d H:i:s',time()), 180 'created_at' => date('Y-m-d H:i:s',time()),
178 'updated_at'=>date('Y-m-d H:i:s',time()), 181 'updated_at'=>date('Y-m-d H:i:s',time()),
179 'size' => $res->getSize(), 182 'size' => $res->getSize(),