调整快捷上传视频

This commit is contained in:
luofei 2023-06-09 13:54:46 +08:00
parent b111bf2f62
commit 656108fcc9

View File

@ -12,6 +12,9 @@ use think\App;
class Upload extends BaseController
{
/**
* @var CommunityRepository
*/
public $repository;
public function __construct(App $app)
@ -60,7 +63,7 @@ class Upload extends BaseController
$topicIds = [40 => 69, 42 => 70, 43 => 73];
$userIndex = array_rand($users);
$userPhone = $users[$userIndex]['phone'];
$userId = User::getInstance()->where('phone', $userPhone)->value('uid');
$userId = User::getInstance()->where('account', $userPhone)->value('uid');
$topicId = array_rand($topicIds);
$categoryId = $topicIds[$topicId];
$filename = rtrim($file->getOriginalName(), '.mp4');
@ -76,9 +79,8 @@ class Upload extends BaseController
'uid' => $userId,
];
$data = $this->checkParams($community);
$res = $this->repository->create($data);
halt($res);
return app('json')->success('上传成功');
$id = $this->repository->create($data);
return app('json')->success('上传成功', ['id' => $id, 'user_id' => $userId, 'phone' => $userPhone]);
}
public function checkParams($data)