| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\AcceptorModel;
- use App\Models\DrawLogModel;
- use App\Models\LiveGiftModel;
- use App\Models\TaskModel;
- use App\Models\TradeModel;
- use App\Models\WalletModel;
- use App\Services\BaseService;
- use Illuminate\Support\Facades\DB;
- /**
- * 承兑商管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
- class DrawLogsService extends BaseService
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- */
- public function __construct()
- {
- $this->model = new DrawLogModel();
- }
- /**
- * 获取列表
- * @param $params 参数
- * @param int $pageSize 分页大小:默认 15
- * @return array
- */
- public function getDataList($params, $pageSize = 10, $field=[])
- {
- $where = ['a.mark' => 1];
- $query = $this->model->with(['member','machine'])
- ->from('draw_logs as a')
- ->leftJoin('machine as b','b.id','a.machine_id')
- ->leftJoin('member as c','c.id','a.user_id')
- ->where($where)
- ->select($field ? $field : ['a.*']);
- if (isset($params['keyword']) && $params['keyword'] != '') {
- $query->where(function($query) use($params){
- $query->where('c.nickname','like',"%{$params['keyword']}%")->orWhere('c.realname','like',"%{$params['keyword']}%")->orWhere('c.username','like',"%{$params['keyword']}%");
- });
- }
- if (isset($params['machine']) && $params['machine'] != '') {
- $query->where(function($query) use($params){
- $kw = isset($params['machine'])? trim($params['machine']) : '';
- if($kw){
- $query->where('b.name','like',"%{$params['machine']}%");
- }
- });
- }
- if (isset($params['order_no']) && $params['order_no'] != '') {
- $query->where('a.order_no','like',"%{$params['order_no']}%");
- }
- if (isset($params['status'])) {
- if(is_array($params['status'])){
- $query->whereIn('a.status',$params['status']);
- }else{
- if($params['status'] != ''){
- $query->where('a.status',$params['status']);
- }
- }
- }
- $list = $query->paginate($pageSize > 0 ? $pageSize : 9999999);
- $list = $list? $list->toArray() :[];
- if($list){
- // foreach($list['data'] as &$item){
- //// $item['create_time_text'] = $item['create_time']? datetime($item['create_time']):'';
- // }
- }
- return [
- 'pageSize'=> $pageSize,
- 'total'=>isset($list['total'])? $list['total'] : 0,
- 'list'=> isset($list['data'])? $list['data'] : []
- ];
- }
- /**
- * 添加会编辑会员
- * @return array
- * @since 2020/11/11
- * @author laravel开发员
- */
- public function edit()
- {
- // 请求参数
- $data = request()->all();
- return parent::edit($data); // TODO: Change the autogenerated stub
- }
- }
|