mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
ComposerUpdate
This commit is contained in:
parent
747b3f1228
commit
73fde3ff2d
@ -249,8 +249,9 @@ class WechatService extends Service
|
||||
}
|
||||
if ($redirect && !empty($result['url'])) {
|
||||
throw new HttpResponseException(redirect($result['url'], 301));
|
||||
} else {
|
||||
throw new HttpResponseException(response("window.location.href='{$result['url']}'"));
|
||||
}
|
||||
exit("window.location.href='{$result['url']}'");
|
||||
}
|
||||
}
|
||||
|
||||
|
8
composer.lock
generated
8
composer.lock
generated
@ -909,12 +909,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "9952e50062d5d8f447680cea4a557155b7353158"
|
||||
"reference": "d9b6c53ed98ef92d9d9560c38e7d9442350042f5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/9952e50062d5d8f447680cea4a557155b7353158",
|
||||
"reference": "9952e50062d5d8f447680cea4a557155b7353158",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/d9b6c53ed98ef92d9d9560c38e7d9442350042f5",
|
||||
"reference": "d9b6c53ed98ef92d9d9560c38e7d9442350042f5",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -958,7 +958,7 @@
|
||||
],
|
||||
"description": "ThinkPHP v6.0 Development Library",
|
||||
"homepage": "http://framework.thinkadmin.top",
|
||||
"time": "2019-12-24T02:28:27+00:00"
|
||||
"time": "2019-12-25T02:08:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zoujingli/wechat-developer",
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -935,12 +935,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "9952e50062d5d8f447680cea4a557155b7353158"
|
||||
"reference": "d9b6c53ed98ef92d9d9560c38e7d9442350042f5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/9952e50062d5d8f447680cea4a557155b7353158",
|
||||
"reference": "9952e50062d5d8f447680cea4a557155b7353158",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/d9b6c53ed98ef92d9d9560c38e7d9442350042f5",
|
||||
"reference": "d9b6c53ed98ef92d9d9560c38e7d9442350042f5",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -956,7 +956,7 @@
|
||||
"ext-json": "*",
|
||||
"topthink/framework": "^6.0"
|
||||
},
|
||||
"time": "2019-12-24T02:28:27+00:00",
|
||||
"time": "2019-12-25T02:08:57+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"think": {
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2019-12-24 18:19:07
|
||||
// This file is automatically generated at:2019-12-25 11:04:15
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\app\\Service',
|
||||
|
@ -62,39 +62,30 @@ class PageHelper extends Helper
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function init($dbQuery, $page = true, $display = true, $total = false, $limit = 0)
|
||||
|
||||
{
|
||||
$this->page = $page;
|
||||
$this->total = $total;
|
||||
$this->limit = $limit;
|
||||
$this->display = $display;
|
||||
$this->query = $this->buildQuery($dbQuery);
|
||||
// 数据列表排序处理
|
||||
// 数据列表排序自动处理
|
||||
if ($this->app->request->isPost()) {
|
||||
$post = $this->app->request->post();
|
||||
$sort = intval(isset($post['sort']) ? $post['sort'] : 0);
|
||||
unset($post['action'], $post['sort']);
|
||||
if ($this->app->db->table($this->query->getTable())->where($post)->update(['sort' => $sort]) !== false) {
|
||||
return $this->controller->success('列表排序修改成功!', '');
|
||||
} else {
|
||||
return $this->controller->error('列表排序修改失败,请稍候再试!');
|
||||
}
|
||||
$this->sortAction();
|
||||
}
|
||||
// 未配置 order 规则时自动按 sort 字段排序
|
||||
if (!$this->query->getOptions('order') && method_exists($this->query, 'getTableFields')) {
|
||||
if (in_array('sort', $this->query->getTableFields())) $this->query->order('sort desc');
|
||||
// 列表设置默认排序处理
|
||||
if (!$this->query->getOptions('order')) {
|
||||
$this->orderAction();
|
||||
}
|
||||
// 列表分页及结果集处理
|
||||
if ($this->page) {
|
||||
// 分页每页显示记录数
|
||||
if ($this->limit > 0) {
|
||||
$limit = intval($this->limit);
|
||||
} else {
|
||||
$limit = $this->app->request->get('limit', $this->app->cookie->get('limit'));
|
||||
$this->app->cookie->set('limit', $limit = intval($limit >= 10 ? $limit : 20));
|
||||
}
|
||||
list($select, $query) = ['', $this->app->request->get()];
|
||||
$paginate = $this->query->paginate(['list_rows' => $limit, 'query' => $query], $this->total);
|
||||
list($options, $query) = ['', $this->app->request->get()];
|
||||
$pager = $this->query->paginate(['list_rows' => $limit, 'query' => $query], $this->total);
|
||||
foreach ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200] as $num) {
|
||||
list($query['limit'], $query['page'], $selected) = [$num, 1, $limit === $num ? 'selected' : ''];
|
||||
if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) {
|
||||
@ -102,15 +93,15 @@ class PageHelper extends Helper
|
||||
} else {
|
||||
$url = $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query));
|
||||
}
|
||||
$select .= "<option data-num='{$num}' value='{$url}' {$selected}>{$num}</option>";
|
||||
$options .= "<option data-num='{$num}' value='{$url}' {$selected}>{$num}</option>";
|
||||
}
|
||||
$pagehtml = "<div class='pagination-container nowrap'><span>共 {$paginate->total()} 条记录,每页显示 <select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>{$select}</select> 条,共 {$paginate->lastPage()} 页当前显示第 {$paginate->currentPage()} 页。</span>{$paginate->render()}</div>";
|
||||
$html = "<div class='pagination-container nowrap'><span>共 {$pager->total()} 条记录,每页显示 <select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>{$options}</select> 条,共 {$pager->lastPage()} 页当前显示第 {$pager->currentPage()} 页。</span>{$pager->render()}</div>";
|
||||
if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) {
|
||||
$this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $pagehtml));
|
||||
$this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $html));
|
||||
} else {
|
||||
$this->controller->assign('pagehtml', $pagehtml);
|
||||
$this->controller->assign('pagehtml', $html);
|
||||
}
|
||||
$result = ['page' => ['limit' => intval($limit), 'total' => intval($paginate->total()), 'pages' => intval($paginate->lastPage()), 'current' => intval($paginate->currentPage())], 'list' => $paginate->items()];
|
||||
$result = ['page' => ['limit' => intval($limit), 'total' => intval($pager->total()), 'pages' => intval($pager->lastPage()), 'current' => intval($pager->currentPage())], 'list' => $pager->items()];
|
||||
} else {
|
||||
$result = ['list' => $this->query->select()->toArray()];
|
||||
}
|
||||
@ -121,4 +112,39 @@ class PageHelper extends Helper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行列表排序操作
|
||||
* POST 提交 {action:sort,PK:$PK,SORT:$SORT}
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
private function sortAction()
|
||||
{
|
||||
if ($this->app->request->post('action') === 'sort') {
|
||||
if (method_exists($this->query, 'getTableFields') && in_array('sort', $this->query->getTableFields())) {
|
||||
$pk = $this->query->getPk() ?? 'id';
|
||||
if ($this->app->request->has($pk, 'post')) {
|
||||
$map = [$pk => $this->app->request->post($pk, 0)];
|
||||
$data = ['sort' => intval(isset($map['sort']) ?? 0)];
|
||||
if ($this->app->db->table($this->query->getTable())->where($map)->update($data) !== false) {
|
||||
$this->controller->success('列表排序修改成功!', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->controller->error('列表排序修改失败,请稍候再试!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表默认排序处理
|
||||
* 未配置排序规则时自动按SORT排序
|
||||
*/
|
||||
private function orderAction()
|
||||
{
|
||||
if (method_exists($this->query, 'getTableFields')) {
|
||||
if (in_array('sort', $this->query->getTableFields())) {
|
||||
$this->query->order('sort desc');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,16 +35,16 @@ class JsonRpcClientService extends Service
|
||||
* 请求ID
|
||||
* @var integer
|
||||
*/
|
||||
private $requestid;
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* 创建连接对象
|
||||
* @param string $proxy
|
||||
* @return $this
|
||||
* @return mixed
|
||||
*/
|
||||
public function create($proxy)
|
||||
{
|
||||
$this->requestid = CodeExtend::uniqidNumber();
|
||||
$this->id = CodeExtend::uniqidNumber();
|
||||
$this->proxy = $proxy;
|
||||
return $this;
|
||||
}
|
||||
@ -64,7 +64,7 @@ class JsonRpcClientService extends Service
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-type: application/json',
|
||||
'content' => json_encode([
|
||||
'jsonrpc' => '2.0', 'method' => $method, 'params' => $params, 'id' => $this->requestid,
|
||||
'jsonrpc' => '2.0', 'method' => $method, 'params' => $params, 'id' => $this->id,
|
||||
], JSON_UNESCAPED_UNICODE),
|
||||
],
|
||||
];
|
||||
@ -77,8 +77,8 @@ class JsonRpcClientService extends Service
|
||||
throw new \think\Exception("无法连接到 {$this->proxy}");
|
||||
}
|
||||
// Final checks and return
|
||||
if ($response['id'] != $this->requestid) {
|
||||
throw new \think\Exception("错误的响应标记 (请求标记: {$this->requestid}, 响应标记: {$response['id']})");
|
||||
if ($response['id'] != $this->id) {
|
||||
throw new \think\Exception("错误的响应标记 (请求标记: {$this->id}, 响应标记: {$response['id']})");
|
||||
}
|
||||
if (is_null($response['error'])) {
|
||||
return $response['result'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user