上传跟进截图

This commit is contained in:
“wanyongkang”
2024-03-20 09:42:07 +08:00
parent 187e7fb31b
commit d1d8d34657

View File

@@ -5,7 +5,7 @@
* @Author: kangkang
* @Date: 2020-10-13 19:52:37
* @LastEditors: “wanyongkang” “937888580@qq.com”
* @LastEditTime: 2024-01-12 16:34:00
* @LastEditTime: 2024-03-19 17:59:11
*/
namespace app\manager\controller;
@@ -21,9 +21,14 @@ use enum\order\ProductOrder as ProductOrderEnum;
use enum\order\UserScore as UserScoreEnum;
use enum\user\User as UserEnum;
use fastphp\base\Controller;
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
class UserFollow extends Controller
{
private $accessKey = 'AfRhvJoAKL24ftGcHMor1WwSpVdular7L7X97JNY';
private $secretKey = 'OyyU-6M45oDZAlVsf8fH0RFALGxTNHAT-yR6cmtU';
private $bucket = 'yewutu';
/**
* @description: 获取消费统计页面列表数据
* @param {*}
@@ -383,13 +388,39 @@ class UserFollow extends Controller
*/
public function changeFolowStatus()
{
$data = json_decode(file_get_contents("php://input"), true)['data'];
$data = $_POST;
$info = [];
$file = $_FILES['file'];
$size_limit = 30 * 1024 * 1024;
if ($file['size']>$size_limit) {
echo json_encode(['code' => -1,'msg'=>'文件过大仅限5M']);
die;
}
$auth = new Auth($this->accessKey, $this->secretKey);
// 初始化 UploadManager 对象并进行文件的上传。
$uploadMgr = new UploadManager();
// 需要填写你的 Access Key 和 Secret Key
// 构建鉴权对象
// 生成上传 Token
$token = $auth->uploadToken($this->bucket);
// 要上传文件的本地路径
$file_filePath = $file['tmp_name'];
// 上传到存储后保存的文件名
$file_key = $data['user_id'].'-'.time().'.png';
// 调用 UploadManager 的 putFile 方法进行文件的上传。
list($ret, $err) = $uploadMgr->putFile($token, $file_key, $file_filePath, null, 'application/octet-stream', true, null, 'v2');
$info['file'] = 'http://ywsc.juip.com/'.$file_key;
$follow_rcord = new FollowRecord;
$user_model = new User;
$user_enum = new UserEnum;
$user_model->updateOne(['Id' => $data['user_id']], ['follow_status' => $data['status']]);
$follow_rcord->updateOne(['user_id' => $data['user_id']], ['active' => 0]);
$info = [];
if (empty($data['id'])) {
$info['user_id'] = $data['user_id'];
$info['op_user'] = $this->userinfo['OperaterID'];