TaskService.php 3.0 KB

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