人人商城

job.ctrl.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('job');
  8. $dos = array('clear', 'execute', 'display');
  9. $do = in_array($do, $dos) ? $do : 'display';
  10. if (!defined('IFRAME')) {
  11. define('IFRAME', 'site');
  12. }
  13. if ($do == 'display') {
  14. $list = job_list($_W['uid'], $_W['isfounder']);
  15. $jobid = intval($_GPC['jobid']);
  16. if (is_array($list) && !empty($array)) {
  17. array_walk($list, function(&$item){
  18. $progress = $item['total'] > 0 ? $item['handled']/$item['total']*100 : 0;
  19. $item['progress'] = $item['status'] ? 100 : intval($progress);
  20. $item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
  21. $item['endtime'] = date('Y-m-d H:i:s', $item['endtime']);
  22. return $item;
  23. });
  24. }
  25. template('system/job');
  26. }
  27. if ($do == 'execute') {
  28. $id = intval($_GPC['id']);
  29. $job = job_single($id);
  30. if ($_W['isfounder'] || $job['uid'] == $_W['uid']) {
  31. $result = job_execute($id);
  32. if (is_error($result)) {
  33. iajax(1, $result['message']);
  34. }
  35. iajax(0, $result['message']);
  36. }
  37. }
  38. if ($do == 'clear') {
  39. $result = job_clear($uid, $_W['isfounder']);
  40. itoast(0, '清除成功', referer());
  41. }