TaskService.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Services\Common;
  12. use App\Models\AcceptorModel;
  13. use App\Models\ActionLogModel;
  14. use App\Models\TaskModel;
  15. use App\Models\TradeModel;
  16. use App\Services\BaseService;
  17. use Illuminate\Support\Facades\DB;
  18. /**
  19. * 承兑商管理-服务类
  20. * @author laravel开发员
  21. * @since 2020/11/11
  22. * @package App\Services\Common
  23. */
  24. class TaskService extends BaseService
  25. {
  26. /**
  27. * 构造函数
  28. * @author laravel开发员
  29. * @since 2020/11/11
  30. */
  31. public function __construct()
  32. {
  33. $this->model = new TaskModel();
  34. }
  35. /**
  36. * 获取列表
  37. * @param $params 参数
  38. * @param int $pageSize 分页大小:默认 15
  39. * @return array
  40. */
  41. public function getDataList($params, $pageSize = 10, $field=[])
  42. {
  43. $where = ['a.mark' => 1];
  44. $query = $this->model
  45. ->from('task as a')
  46. ->where($where)
  47. ->select($field ? $field : ['a.*']);
  48. if (isset($params['name']) && $params['name'] != '') {
  49. $query->where('a.name','like',"%{$params['name']}%");
  50. }
  51. if (isset($params['status'])) {
  52. if(is_array($params['status'])){
  53. $query->whereIn('a.status',$params['status']);
  54. }else{
  55. if($params['status'] != ''){
  56. $query->where('a.status',$params['status']);
  57. }
  58. }
  59. }
  60. if (isset($params['type'])) {
  61. if(is_array($params['type'])){
  62. $query->whereIn('a.type',$params['type']);
  63. }else{
  64. if($params['type'] != ''){
  65. $query->where('a.type',$params['type']);
  66. }
  67. }
  68. }
  69. $list = $query->paginate($pageSize > 0 ? $pageSize : 9999999);
  70. $list = $list? $list->toArray() :[];
  71. if($list){
  72. // foreach($list['data'] as &$item){
  73. //// $item['create_time_text'] = $item['create_time']? datetime($item['create_time']):'';
  74. // }
  75. }
  76. return [
  77. 'pageSize'=> $pageSize,
  78. 'total'=>isset($list['total'])? $list['total'] : 0,
  79. 'list'=> isset($list['data'])? $list['data'] : []
  80. ];
  81. }
  82. /**
  83. * 添加会编辑会员
  84. * @return array
  85. * @since 2020/11/11
  86. * @author laravel开发员
  87. */
  88. public function edit()
  89. {
  90. // 请求参数
  91. $data = request()->all();
  92. ActionLogModel::setTitle("新增编辑任务");
  93. ActionLogModel::record();
  94. return parent::edit($data); // TODO: Change the autogenerated stub
  95. }
  96. }