|
@@ -131,4 +131,48 @@ class Exec extends BaseController
|
|
|
$isPushed = $redis->handler()->lPush($info['type']==1? "nowreport":"execreport", json_encode($info));
|
|
|
return $up? app_show(0,"编辑成功"):error_show(1004,"编辑失败");
|
|
|
}
|
|
|
+ public function execlist(){
|
|
|
+ $post = request()->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")->field("name,apply_name,apply_id,status,down_url,remark,addtime,updatetime,expiretime")
|
|
|
+ ->where($where)->page($page,$size)->select();
|
|
|
+ return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
|
|
|
+ }
|
|
|
+ public function execdown(){
|
|
|
+ $post = request()->post();
|
|
|
+ $token = isset($post['token']) ? trim($post['token']) : "";
|
|
|
+ if($token==""){
|
|
|
+ return error_show(101,'token不能为空');
|
|
|
+ }
|
|
|
+ $id = isset($post['id'])&&$post['id']!=='' ? intval($post['id']) :"";
|
|
|
+ if($id==""){
|
|
|
+ return error_show(1004,"参数id不能为空");
|
|
|
+ }
|
|
|
+ $info=Db::name("exec")->where(["id"=>$id])->find();
|
|
|
+ if(empty($info)){
|
|
|
+ return error_show(1004,"未找到下载数据");
|
|
|
+ }
|
|
|
+ $info['status']=1;
|
|
|
+ $info['updatetime'] = date("Y-m-d H:i:s");
|
|
|
+ $info['addtime'] = date("Y-m-d H:i:s");
|
|
|
+ $up = Db::name("exec")->save($info);
|
|
|
+ $redis = Cache::store("redis");
|
|
|
+ $isPushed = $redis->handler()->lPush("nowexecreport", json_encode($info));
|
|
|
+ return $up? app_show(0,"已加入下载队列"):error_show(1004,"下载失败");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|