Skip to content

Commit

Permalink
chore(*): 清理 TS+ 中很多无用垃圾代码
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Nov 27, 2018
1 parent 3855c66 commit f91ac6e
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 41 deletions.
1 change: 0 additions & 1 deletion app/Admin/Controllers/FileStorage/FileSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class FileSize
*/
public function show(): JsonResponse
{
$sysAllowUploadSize = '';
// Get configure.
$configure = (array) setting('file-storage', 'task-create-validate', []);
$result = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use Zhiyi\Plus\Models\WalletCharge as WalletChargeModel;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use SlimKit\PlusCheckIn\Models\CheckinLog as CheckinLogModel;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Zhiyi\Plus\Packages\Currency\Processes\Common as CommonProcess;
use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract;

Expand All @@ -43,7 +42,7 @@ class CheckInController extends Controller
*
* @author Seven Du <[email protected]>
*/
public function __construct(ConfigRepository $config)
public function __construct()
{
$this->attach_balance = setting('checkin', 'attach-balance', 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

use Illuminate\Http\Request;
use function Zhiyi\Plus\setting;
use Zhiyi\Plus\Support\Configuration;
use Zhiyi\Plus\Http\Controllers\Controller;

class PayControlController extends Controller
Expand All @@ -41,7 +40,7 @@ public function getCurrentStatus()
/**
* 更新动态付费状态
*/
public function updateStatus(Request $request, Configuration $config)
public function updateStatus(Request $request)
{
$paySwitcg = $request->input('open');
$payWordLimit = intval($request->input('textLength'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ class ConfigController extends Controller
/**
* 导航配置列表.
* @author 28youth
* @param Request $request
* @param int|int $pos 0-顶部 1-底部
* @return mixed
*/
public function index(Request $request, int $pos = 0)
public function index(int $pos = 0)
{
$data = [];
$parents = [];
Expand Down Expand Up @@ -117,11 +116,10 @@ public function manage(Request $request)
/**
* 获取一条导航记录.
* @author 28youth
* @param Request $request
* @param int $nid 记录id
* @return mixed
*/
public function getnav(Request $request, int $nid)
public function getnav(int $nid)
{
$nav = Navigation::find($nid);
if ($nav) {
Expand All @@ -132,11 +130,10 @@ public function getnav(Request $request, int $nid)
/**
* 删除导航记录.
* @author 28youth
* @param Request $request
* @param int $nid 记录id
* @return mixed
*/
public function delete(Request $request, int $nid)
public function delete(int $nid)
{
$nav = Navigation::find($nid);
if ($nav) {
Expand Down
12 changes: 3 additions & 9 deletions packages/zhiyicx-plus-pc/src/Controllers/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@ class AccountController extends BaseController
/**
* 基本设置.
* @author Foreach
* @param Request $request
* @return mixed
*/
public function index(Request $request)
public function index()
{
$this->PlusData['account_cur'] = 'index';

$user_id = $this->PlusData['TS']->id ?? 0;

$user = $this->PlusData['TS'];
$user['city'] = explode(' ', $user['location']);
$data['user'] = $user;
Expand Down Expand Up @@ -109,11 +105,10 @@ public function security()
/**
* 我的钱包.
* @author Foreach
* @param Request $request
* @param int|int $type [类型]
* @return mixed
*/
public function wallet(Request $request, int $type = 1)
public function wallet(int $type = 1)
{
$this->PlusData['account_cur'] = 'wallet';

Expand Down Expand Up @@ -239,11 +234,10 @@ public function getMyBinds()
/**
* 我的积分.
* @author szlvincent
* @param Request $request
* @param int|int $type [类型]
* @return mixed
*/
public function currency(Request $request, int $type = 1)
public function currency(int $type = 1)
{
$this->PlusData['account_cur'] = 'currency';

Expand Down
3 changes: 1 addition & 2 deletions packages/zhiyicx-plus-pc/src/Controllers/FeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@ public function feeds(Request $request)
/**
* 动态详情.
* @author Foreach
* @param Request $request
* @param int $feed_id [动态id]
* @return mixed
*/
public function read(Request $request, Feed $feed)
public function read(Feed $feed)
{
$feedinfo = api('GET', '/api/v2/feeds/'.$feed->id);
$feedinfo['collect_count'] = $feed->collection->count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function notifications(Request $request)
$data['notifications'] = api('GET', '/api/v2/user/notifications', ['offset' => $offset, 'limit' => $limit]);

// 设置已读
$read = api('PUT', '/api/v2/user/notifications/all');
api('PUT', '/api/v2/user/notifications/all');

$return = '';
if (! empty($data['notifications'])) {
Expand Down
3 changes: 1 addition & 2 deletions packages/zhiyicx-plus-pc/src/Controllers/NewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@ public function read(News $news)
/**
* 资讯投稿
* @author ZsyD
* @param Request $request
* @param int $news_id [资讯id]
* @return mixed
*/
public function release(Request $request, int $news_id = 0)
public function release(int $news_id = 0)
{
if ($this->PlusData['config']['bootstrappers']['news:contribute']['verified'] && ! $this->PlusData['TS']['verified']) {
abort(403, '未认证用户不能投稿');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function captcha()
// 设置字体大小
$builder->setBackgroundColor(237, 237, 237);
// 可以设置图片宽高及字体
$builder->build($width = 100, $height = 40, $font = null);
$builder->build(/* width */ 100, /* height */ 40, /* font */ null);
// 获取验证码的内容
$phrase = $builder->getPhrase();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function question(Request $request, ?string $user)
'user_id' => $request->query('user_id'),
];
$topics = api('GET', '/api/v2/user/question-topics', $params);
foreach ($topics as $key => &$value) {
foreach ($topics as &$value) {
$value['has_follow'] = true;
}
$after = last($topics)['id'] ?? 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function rewards(Request $request)

return response()->json([
'data' => $html,
'after' => $after ?? 0,
'after' => 0,
'count' => count($data['rewards']) ?? 0,
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function question(Request $request)
$question['data'] = api('GET', '/api/v2/questions', $params);
if ($params['type'] == 'excellent') {
// TODO
foreach ($question['data'] as $key => &$value) {
foreach ($question['data'] as &$value) {
$value['excellent_show'] = false;
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/zhiyicx-plus-pc/src/Controllers/RankController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ class RankController extends BaseController
/**
* 排行榜.
* @author ZysD
* @param Request $request
* @param int|int $mold [排行榜类型]
* @return mixed
*/
public function index(Request $request, int $mold = 1)
public function index(int $mold = 1)
{
$data['mold'] = $mold;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SearchController extends BaseController
* @param string $keywords [关键字]
* @return mixed
*/
public function index(Request $request, int $type = 1, string $keywords = '')
public function index(int $type = 1, string $keywords = '')
{
$data['type'] = $type;
$data['keywords'] = $keywords;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,10 @@ public function bind(Request $request)
/**
* 获取登录信息.
* @author ZsyD<[email protected]>
* @param Request $request
* @param $token
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void
*/
public function getToken(Request $request, $token)
public function getToken($token)
{
$jwt = app(\Tymon\JWTAuth\JWTAuth::class);
$jwt->setToken($token);
Expand Down
8 changes: 3 additions & 5 deletions packages/zhiyicx-plus-pc/src/Controllers/TopicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ public function index(Request $request)
* 话题详情.
*
* @author mutoe <[email protected]>
* @param Request $request
* @param int $topic_id
*/
public function detail(Request $request, int $topic_id)
public function detail(int $topic_id)
{
// 获取话题详情
$data['topic'] = api('GET', '/api/v2/feed/topics/'.$topic_id);
Expand All @@ -97,9 +96,8 @@ public function detail(Request $request, int $topic_id)
* 创建话题.
*
* @author mutoe <[email protected]>
* @param Request $request
*/
public function create(Request $request)
public function create()
{
return view('pcview::topic.create', [], $this->PlusData);
}
Expand All @@ -111,7 +109,7 @@ public function create(Request $request)
* @param Request $request
* @param int $topic_id
*/
public function edit(Request $request, int $topic_id)
public function edit(int $topic_id)
{
$data['topic'] = api('GET', '/api/v2/feed/topics/'.$topic_id);

Expand Down
3 changes: 1 addition & 2 deletions packages/zhiyicx-plus-pc/src/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ public function users(Request $request, int $type = 1)
/**
* 地区搜索.
* @author 28youth
* @param Request $request
* @return mixed
*/
public function area(Request $request)
public function area()
{
$data['area'] = api('GET', '/api/v2/locations/hots');
$this->PlusData['current'] = 'users';
Expand Down

0 comments on commit f91ac6e

Please sign in to comment.