作者 邓超

Merge remote-tracking branch 'origin/master'

@@ -5,6 +5,7 @@ namespace Controller; @@ -5,6 +5,7 @@ namespace Controller;
5 use Lib\Mail\Mail; 5 use Lib\Mail\Mail;
6 use Model\emailSql; 6 use Model\emailSql;
7 use Model\sendJobsSql; 7 use Model\sendJobsSql;
  8 +use Model\sendJobStatusSql;
8 9
9 10
10 /** 11 /**
@@ -101,6 +102,31 @@ class Job extends Base { @@ -101,6 +102,31 @@ class Job extends Base {
101 102
102 } 103 }
103 104
  105 + /**
  106 + * 黑格发件任务详情
  107 + * @author:dc
  108 + * @time 2023/4/17 15:57
  109 + */
  110 + public function jobDetail()
  111 + {
  112 + $page = app()->request('page', 1, 'intval');
  113 + $limit = app()->request('limit', 20, 'intval');
  114 + $jobId = app()->request('id', 0, 'intval');
  115 +
  116 + if (!$jobId) {
  117 + app()->e('send_job_id_null_error');
  118 + }
  119 +
  120 + $where = dbWhere([
  121 + 'job_id' => $jobId
  122 + ]);
  123 +
  124 + $lists = db()->all(sendJobStatusSql::detail($where, $page, $limit));
  125 +
  126 + return listsPage($lists,
  127 + db()->count(sendJobStatusSql::count($jobId))
  128 + , 1, 20);
  129 + }
104 130
105 131
106 132
@@ -97,7 +97,8 @@ return [ @@ -97,7 +97,8 @@ return [
97 97
98 98
99 'send_job_start_error' => '开始执行任务失败', 99 'send_job_start_error' => '开始执行任务失败',
100 - 'send_job_stop_error' => '暂停任务失败' 100 + 'send_job_stop_error' => '暂停任务失败',
  101 + 'send_job_id_null_error' => '任务id不能为空',
101 102
102 103
103 104
@@ -43,5 +43,17 @@ class sendJobStatusSql { @@ -43,5 +43,17 @@ class sendJobStatusSql {
43 return "select count(*) as t,{$sucees},{$error} from `".self::$table."` where `job_id` = {$job_id} "; 43 return "select count(*) as t,{$sucees},{$error} from `".self::$table."` where `job_id` = {$job_id} ";
44 } 44 }
45 45
  46 + /**
  47 + * job任务详情页
  48 + * @param $where
  49 + * @param int $page
  50 + * @param int $limit
  51 + * @return string
  52 + */
  53 + public static function detail($where, int $page = 1, int $limit = 20)
  54 + {
  55 + return "select * from `" . static::$table . "` where " . $where . " order by id desc limit {$limit} offset " . (($page - 1) * $limit);
  56 + }
  57 +
46 58
47 } 59 }
@@ -51,6 +51,8 @@ return [ @@ -51,6 +51,8 @@ return [
51 'job/stop' => [\Controller\Job::class, 'stop'], 51 'job/stop' => [\Controller\Job::class, 'stop'],
52 // 开始任务 52 // 开始任务
53 'job/start' => [\Controller\Job::class, 'start'], 53 'job/start' => [\Controller\Job::class, 'start'],
  54 + // 任务详情
  55 + 'job/detail' => [\Controller\Job::class, 'jobDetail'],
54 56
55 // 上传图片 57 // 上传图片
56 'upload/image' => [\Controller\Upload::class, 'image'] 58 'upload/image' => [\Controller\Upload::class, 'image']