|
@@ -5,6 +5,7 @@ namespace app\admin\controller;
|
|
|
|
|
|
use app\BaseController;
|
|
|
use think\facade\Db;
|
|
|
+use think\facade\Validate;
|
|
|
use think\Request;
|
|
|
use think\facade\Cache;
|
|
|
|
|
@@ -33,23 +34,52 @@ class Exec extends Base
|
|
|
|
|
|
public function nowlist()
|
|
|
{
|
|
|
- $post = $this->post;
|
|
|
- $token = isset($post['token']) ? trim($post['token']) : "";
|
|
|
- if ($token == "") {
|
|
|
- return error_show(101, 'token不能为空');
|
|
|
- }
|
|
|
+
|
|
|
+ $param = $this->request->only(['token', 'page' => 1, 'size' => 15, 'type' => 1], 'post', 'trim');
|
|
|
+
|
|
|
+ $val = Validate::rule([
|
|
|
+ 'token' => 'require',
|
|
|
+ 'page' => 'require|number',
|
|
|
+ 'size' => 'require|number',
|
|
|
+ 'type' => 'require|number|in:1,2',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if (!$val->check($param)) return error_show(1005, $val->getError());
|
|
|
+
|
|
|
+ $count = Db::name("exec")
|
|
|
+ ->where('type', $param['type'])
|
|
|
+ ->count('id');
|
|
|
+
|
|
|
+ $list = Db::name("exec")
|
|
|
+ ->where('type', $param['type'])
|
|
|
+ ->page($param['page'], $param['size'])
|
|
|
+ ->order('id')
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ return app_show(0, "获取成功", ["list" => $list, "count" => $count]);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// $post = $this->post;
|
|
|
+// $token = isset($post['token']) ? trim($post['token']) : "";
|
|
|
+// if ($token == "") {
|
|
|
+// return error_show(101, 'token不能为空');
|
|
|
+// }
|
|
|
// $effetc = VerifyTokens($token);
|
|
|
// if(!empty($effetc) && $effetc['code']!=0){
|
|
|
// return error_show($effetc['code'],$effetc['message']);
|
|
|
// }
|
|
|
- $where = ['type' => 1];
|
|
|
- $page = isset($post['page']) ? intval($post['page']) : 1;
|
|
|
- $size = isset($post['size']) ? intval($post['size']) : 10;
|
|
|
- $count = Db::name("exec")->where($where)->count();
|
|
|
- $total = ceil($count / $size) > 1 ? ceil($count / $size) : 1;
|
|
|
- $page = $page >= $total ? intval($total) : $page;
|
|
|
- $list = Db::name("exec")->where($where)->page($page, $size)->select();
|
|
|
- return app_show(0, "获取成功", ["list" => $list, "count" => $count]);
|
|
|
+// $where = ['type' => 1];
|
|
|
+// $page = isset($post['page']) ? intval($post['page']) : 1;
|
|
|
+// $size = isset($post['size']) ? intval($post['size']) : 10;
|
|
|
+// $count = Db::name("exec")->where($where)->count();
|
|
|
+// $total = ceil($count / $size) > 1 ? ceil($count / $size) : 1;
|
|
|
+// $page = $page >= $total ? intval($total) : $page;
|
|
|
+// $list = Db::name("exec")->where($where)->page($page, $size)->select();
|
|
|
+// return app_show(0, "获取成功", ["list" => $list, "count" => $count]);
|
|
|
}
|
|
|
|
|
|
public function save()
|