Upyun.php
1.8 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
<?php
namespace app\index\controller;
use app\common\controller\Frontend;
use think\Config;
/**
* 又拍云异步接口
*/
class Upyun extends Frontend
{
public function notify()
{
$url = $this->request->post("url");
$code = $this->request->post("code");
$message = $this->request->post("message");
$sign = $this->request->post("sign");
$time = $this->request->post("time");
$extparam = $this->request->post("ext-param");
if ($url && $code && $message && $time && $sign)
{
$arr = [$code, $message, $url, $time, Config::get('upload.formkey')];
if ($extparam)
{
$arr[] = $extparam;
}
if ($sign == md5(implode('&', $arr)))
{
$params = array(
'filesize' => $this->request->param("file_size"),
'imagewidth' => $this->request->param("image-width"),
'imageheight' => $this->request->param("image-height"),
'imagetype' => $this->request->param("image-type"),
'imageframes' => $this->request->param("image-frames"),
'mimetype' => $this->request->param("mimetype"),
'extparam' => $extparam,
'url' => $url,
'uploadtime' => $time,
'storage' => 'upyun'
);
model("attachment")->create(array_filter($params));
echo "success";
}
else
{
echo "failure";
}
}
else
{
echo "failure";
}
return;
}
}