人人商城

cron.html 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. {template 'common/header-gw'}
  2. <ol class="breadcrumb">
  3. <li><a href="./?refresh"><i class="fa fa-home"></i></a></li>
  4. <li><a href="{url 'system/welcome'}">系统</a></li>
  5. <li class="active">计划任务</li>
  6. </ol>
  7. <ul class="nav nav-tabs">
  8. <li {if $do == 'list'} class="active"{/if}><a href="{php echo url('system/cron/list');}">任务列表</a></li>
  9. <li {if $do == 'post' && empty($id)} class="active"{/if}><a href="{php echo url('system/cron/post');}">添加任务</a></li>
  10. {if $do == 'post' && !empty($id)}<li class="active"><a href="{php echo url('system/cron/post');}">编辑任务</a></li>{/if}
  11. </ul>
  12. <div class="clearfix">
  13. {if $do == 'post'}
  14. <form class="form-horizontal form" id="form1" action="" method="post">
  15. <input type="hidden" name="id" value="{$cron['cronid']}">
  16. <div class="form-group">
  17. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"><span class="text-danger">* </span>任务名称</label>
  18. <div class="col-sm-10 col-xs-12">
  19. <input type="text" class="form-control" placeholder="设置本任务的任务名称" name="name" value="{$cron['name']}"/>
  20. <span class="help-block">设置本任务的任务名称</span>
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"><span class="text-danger">* </span> 任务脚本:</label>
  25. <div class="col-sm-10 col-xs-12">
  26. <input type="text" class="form-control" placeholder="设置本任务的执行程序文件名" name="filename" value="{$cron['filename']}"/>
  27. <span class="help-block">设置本任务的执行程序文件名,请勿包含路径,系统计划任务位于 source/include/cron/ 目录中,插件计划任务位于 source/plugin/插件目录/cron/ 目录中</span>
  28. </div>
  29. </div>
  30. <div class="form-group">
  31. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"><span class="text-danger"> </span> 是否可用:</label>
  32. <div class="col-sm-10 col-xs-12">
  33. <label class="radio-inline">
  34. <input type="radio" name="available" value="1" {if $cron['available'] == 1}checked{/if}/> 可用
  35. </label>
  36. <label class="radio-inline">
  37. <input type="radio" name="available" value="0" {if $cron['available'] == 0}checked{/if}/> 不可用
  38. </label>
  39. </div>
  40. </div>
  41. <div class="form-group">
  42. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">每周:</label>
  43. <div class="col-sm-10 col-xs-12">
  44. <select name="weekday" class="form-control">
  45. <option value="-1" {if $cron['weekday'] == '-1'}selected{/if}>*</option>
  46. <option value="0" {if $cron['weekday'] == '0'}selected{/if}>周日</option>
  47. <option value="1" {if $cron['weekday'] == '1'}selected{/if}>周一</option>
  48. <option value="2" {if $cron['weekday'] == '2'}selected{/if}>周二</option>
  49. <option value="3" {if $cron['weekday'] == '3'}selected{/if}>周三</option>
  50. <option value="4" {if $cron['weekday'] == '4'}selected{/if}>周四</option>
  51. <option value="5" {if $cron['weekday'] == '5'}selected{/if}>周五</option>
  52. <option value="6" {if $cron['weekday'] == '6'}selected{/if}>周六</option>
  53. </select>
  54. <span class="help-block">设置星期几执行本任务,“*”为不限制,本设置会覆盖下面的“日”设定</span>
  55. </div>
  56. </div>
  57. <div class="form-group">
  58. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">每月:</label>
  59. <div class="col-sm-10 col-xs-12">
  60. <select name="day" class="form-control">
  61. <option value="-1" {if $cron['day'] == '-1'}selected{/if}>*</option>
  62. <?php
  63. for($i = 1; $i < 32; $i ++) {
  64. if($cron['day'] == $i) {
  65. echo '<option selected value="'.$i.'">'.$i.'日</option>';
  66. } else {
  67. echo '<option value="'.$i.'">'.$i.'日</option>';
  68. }
  69. }
  70. ?>
  71. </select>
  72. <span class="help-block">设置哪一日执行本任务,“*”为不限制</span>
  73. </div>
  74. </div>
  75. <div class="form-group">
  76. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">小时:</label>
  77. <div class="col-sm-10 col-xs-12">
  78. <select name="hour" class="form-control">
  79. <option value="-1" {if $cron['hour'] == '-1'}selected{/if}>*</option>
  80. <?php
  81. for($i = 0; $i < 24; $i ++) {
  82. if($cron['hour'] == $i) {
  83. echo '<option selected value="'.$i.'">'.$i.'时</option>';
  84. } else {
  85. echo '<option value="'.$i.'">'.$i.'时</option>';
  86. }
  87. }
  88. ?>
  89. </select>
  90. <span class="help-block">设置哪一小时执行本任务,“*”为不限制</span>
  91. </div>
  92. </div>
  93. <div class="form-group">
  94. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">分钟:</label>
  95. <div class="col-sm-10 col-xs-12">
  96. <input type="text" name="minute" value="{$cron['minute']}" placeholder="设置哪些分钟执行本任务" class="form-control"/>
  97. <span class="help-block">设置哪些分钟执行本任务,至多可以设置 12 个分钟值,多个值之间用半角逗号 "," 隔开,留空为不限制</span>
  98. </div>
  99. </div>
  100. <div class="form-group">
  101. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  102. <div class="col-sm-10 col-xs-12">
  103. <input type="hidden" value="{$_W['token']}" name="token"/>
  104. <input type="submit" value="提交" name="submit" class="btn btn-primary col-lg-1"/>
  105. </div>
  106. </div>
  107. </form>
  108. {elseif $do == 'list'}
  109. <div class="panel panel-default">
  110. <div class="table-responsive panel-body">
  111. <table class="table table-hover">
  112. <thead class="navbar-inner">
  113. <tr>
  114. <th style="width:50px;"></th>
  115. <th style="width:150px;">名称</th>
  116. <th style="width:200px;">可用</th>
  117. <th style="width:100px;">所属模块</th>
  118. <th style="min-width:180px;">时间</th>
  119. <th style="min-width:300px;">上次执行时间</th>
  120. <th style="min-width:300px;">下次执行时间</th>
  121. <th style="min-width:300px;">操作</th>
  122. </tr>
  123. </thead>
  124. <tbody>
  125. <form action="{php echo url('system/cron/del')}" id="form1" method="post">
  126. {loop $crons $cron}
  127. <tr>
  128. <td><input type="checkbox" name="cronid[]" value="{$cron['cronid']}"/> </td>
  129. <td>{$cron['name']}</td>
  130. <td>
  131. {if $cron['available'] == 1}
  132. <span class="label label-success">可用</span>
  133. {else}
  134. <span class="label label-danger">不可用</span>
  135. {/if}
  136. </td>
  137. <td>{$cron['module']}</td>
  138. <td>{$cron['cn']}</td>
  139. <td>{$cron['lastrun']}</td>
  140. <td>{$cron['nextrun']}</td>
  141. <td>
  142. <a title="编辑" href="{php echo url('system/cron/post', array('id' => $cron['cronid']))}">编辑</a>&nbsp;-&nbsp;
  143. <a title="执行" href="{php echo url('system/cron/run', array('id' => $cron['cronid']))}">执行</a>
  144. </td>
  145. </tr>
  146. {/loop}
  147. <tr>
  148. <td colspan="8">
  149. <input type="hidden" value="{$_W['token']}" name="token"/>
  150. <input type="submit" value="删除" name="submit" class="btn btn-primary" onclick="if(confirm('删除后将不可恢复,确定删除吗?')){return true;}return false;"/>
  151. </td>
  152. </tr>
  153. </tbody>
  154. </form>
  155. </table>
  156. </div>
  157. </div>
  158. {/if}
  159. </div>
  160. {template 'common/footer-gw'}