|
@@ -171,44 +171,13 @@ class Study extends Backend |
|
@@ -171,44 +171,13 @@ class Study extends Backend |
171
|
}
|
171
|
}
|
172
|
}
|
172
|
}
|
173
|
|
173
|
|
174
|
- public function qiniu($filePath = '', $fileName = '')
|
174
|
+ public function chang_down()
|
175
|
{
|
175
|
{
|
176
|
-// $filePath=ROOT_PATH.'public'.DS.'uploads'.DS.'20200224'.DS.'img1.jpg';//文件路径
|
|
|
177
|
-// $fileName='public'.DS.'uploads'.DS.'20200224'.DS.'img1.jpg'; //七牛云上的名字
|
|
|
178
|
-// $filePath = ROOT_PATH . 'public' . DS . 'uploads' . DS . '20200224' . DS . 'img2.jpg';//文件路径
|
|
|
179
|
-// $fileName = 'public' . DS . 'uploads' . DS . '20200224' . DS . 'img2.jpg'; //七牛云上的名字,头部不带杠
|
|
|
180
|
-
|
|
|
181
|
- $config = get_addon_config('qiniu');
|
|
|
182
|
- $policy = array(
|
|
|
183
|
- 'saveKey' => $fileName,
|
|
|
184
|
- );
|
|
|
185
|
- $auth = new \Qiniu\Auth($config['accessKey'], $config['secretKey']);
|
|
|
186
|
- $token = $auth->uploadToken($config['bucket'], null, $config['expire'], $policy);
|
|
|
187
|
- $multipart = [
|
|
|
188
|
- ['name' => 'token', 'contents' => $token],
|
|
|
189
|
- [
|
|
|
190
|
- 'name' => 'file',
|
|
|
191
|
- 'contents' => fopen($filePath, 'r'),
|
|
|
192
|
- 'filename' => $fileName,
|
|
|
193
|
- ]
|
|
|
194
|
- ];
|
|
|
195
|
-
|
|
|
196
|
- try {
|
|
|
197
|
- $client = new Client();
|
|
|
198
|
- $res = $client->request('POST', $config['uploadurl'], [
|
|
|
199
|
- 'multipart' => $multipart
|
|
|
200
|
- ]);
|
|
|
201
|
- $code = $res->getStatusCode();
|
|
|
202
|
- //成功不做任何操作
|
|
|
203
|
- } catch (\GuzzleHttp\Exception\ClientException $e) {
|
|
|
204
|
- // unlink($filePath);
|
|
|
205
|
- $this->error("上传失败");
|
176
|
+ $id = input('id');
|
|
|
177
|
+ $res = \app\admin\model\Study::where('id', $id)->update(['grade_id' => 1]);
|
|
|
178
|
+ if ($res !== false) {
|
|
|
179
|
+ $this->success('');
|
206
|
}
|
180
|
}
|
207
|
-// dump($code);
|
|
|
208
|
-// $url = '/';
|
|
|
209
|
-
|
|
|
210
|
- //上传成功后将存储变更为qiniu
|
|
|
211
|
-// $this->success("上传成功", ['url' => cdnurl($url), 'save_path' => $url]);
|
|
|
212
|
}
|
181
|
}
|
213
|
|
182
|
|
214
|
/**
|
183
|
/**
|