wesmiler 5 dagar sedan
förälder
incheckning
7834a1043d

+ 0 - 36
app/Models/AccountStatisticsModel.php

@@ -1,36 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Models;
-
-/**
- * 用户收益账户-模型
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Models
- */
-class AccountStatisticsModel extends BaseModel
-{
-    // 设置数据表
-    protected $table = 'account_statistics';
-
-    const UPDATED_AT = 'updated_at';
-
-    /**
-     * 用户
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
-     */
-    public function member()
-    {
-        return $this->hasOne(MemberModel::class, 'id','user_id')
-            ->select(['id','mobile','realname','nickname','balance','status']);
-    }
-}

+ 0 - 10
app/Models/GoodsModel.php

@@ -52,16 +52,6 @@ class GoodsModel extends BaseModel
     }
 
     /**
-     * 商家店铺
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
-     */
-    public function store()
-    {
-        return $this->hasOne(StoreModel::class, 'id', 'store_id')
-            ->select(['id','nickname','mobile','bonus_rate','status']);
-    }
-
-    /**
      * 关联商品分类
      */
     public function category()

+ 0 - 166
app/Models/MeetingModel.php

@@ -1,166 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Models;
-
-/**
- * 会议-模型
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Models
- */
-class MeetingModel extends BaseModel
-{
-    // 设置数据表
-    protected $table = 'meetings';
-
-    protected $appends = ['areas','start_time','meeting_time','time_text','time_text1'];
-
-    public function getThumbAttribute($value)
-    {
-        return $value? get_image_url($value) : '';
-    }
-
-    // 时间
-    public function getTimeTextAttribute()
-    {
-        $startTime = $this->start_at? strtotime($this->start_at) : 0;
-        $endTime = $this->end_at? strtotime($this->end_at) : time();
-        $startAt = $this->start_at? datetime($this->start_at,'m月d日 H:i') : '';
-        $formatType = 'm月d日 H:i';
-        if($endTime && $endTime <= $startTime+86400){
-            $formatType = 'H:i';
-        }
-
-        $endAt = date($formatType,$endTime);
-        return $startAt.' - '.$endAt;
-    }
-
-    // 倒计时开始
-    public function getStartTimeAttribute()
-    {
-        $dateTime = time();
-        $time = $this->start_at? strtotime($this->start_at) : 0;
-        return $time>$dateTime?intval($time-$dateTime) : 0;
-    }
-
-    // 会议时长
-    public function getMeetingTimeAttribute()
-    {
-        $dateTime = time();
-        $startTime = $this->start_at? strtotime($this->start_at) : 0;
-        $endTime = $this->end_at? strtotime($this->end_at) : time();
-        $startTime = $dateTime>$startTime?$dateTime:$startTime;
-        return $endTime>$startTime?intval($endTime-$startTime) : 0;
-    }
-
-    // 时间
-    public function getTimeText1Attribute()
-    {
-        $weeks = ['周日','周一','周二','周三','周四','周五','周六'];
-        $startTime = $this->start_at? strtotime($this->start_at) : 0;
-        $endTime = $this->end_at? strtotime($this->end_at) : time();
-        $w = date('w',$startTime);
-        $week = isset($weeks[$w])?' '.$weeks[$w].' ': '';
-        $startAt = $this->start_at? datetime($this->start_at,"Y年m月d日").$week.datetime($this->start_at,"H:i") : '';
-
-        $formatType = 'm月d日  H:i';
-        if($endTime && $endTime <= $startTime+86400){
-            $formatType = 'H:i';
-        }
-
-        $endAt = date($formatType,$endTime);
-        return $startAt.' - '.$endAt;
-    }
-
-    /**
-     * @return array
-     */
-    public function getAreasAttribute()
-    {
-        return [$this->province_id.'',$this->city_id.'',$this->district_id.''];
-    }
-
-    /**
-     * @return array
-     */
-    public function getStoreIdsAttribute($value)
-    {
-        return $value? array_filter(explode(',', $value)):[];
-    }
-
-
-    /**
-     * @return array
-     */
-    public function getSupervisorIdsAttribute($value)
-    {
-        return $value? array_filter(explode(',', $value)):[];
-    }
-
-
-    /**
-     * 主办单位
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
-     */
-    public function company()
-    {
-        return $this->hasOne(StoreModel::class, 'id', 'company_id')
-            ->select(['id','user_id', 'realname','avatar', 'nickname', 'mobile', 'status']);
-    }
-
-    /**
-     * 推荐组织人
-     */
-    public function member()
-    {
-        return $this->hasOne(MemberModel::class, 'id','user_id')
-            ->where(['mark'=>1])
-            ->select(['id', 'nickname','avatar', 'realname','position','company','department','is_auth', 'mobile', 'status']);
-    }
-
-    /**
-     * 省份
-     */
-    public function province()
-    {
-        return $this->hasOne(CityModel::class, 'citycode','province_id')
-            ->where(['mark'=>1]);
-    }
-
-    /**
-     * 城市
-     */
-    public function city()
-    {
-        return $this->hasOne(CityModel::class, 'citycode','city_id')
-            ->where(['mark'=>1]);
-    }
-
-    /**
-     * 区县
-     */
-    public function district()
-    {
-        return $this->hasOne(CityModel::class, 'citycode','district_id')
-            ->where(['mark'=>1]);
-    }
-
-    /**
-     * 签到记录
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany
-     */
-    public function records()
-    {
-        return $this->hasMany(MeetingRecordsModel::class, 'meeting_id','id')
-            ->where(['mark'=>1]);
-    }
-}

+ 0 - 46
app/Models/MeetingRecordsModel.php

@@ -1,46 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Models;
-
-/**
- * 会议签到记录-模型
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Models
- */
-class MeetingRecordsModel extends BaseModel
-{
-    // 设置数据表
-    protected $table = 'meetings_records';
-
-    /**
-     * 推荐组织人
-     */
-    public function member()
-    {
-        return $this->hasOne(MemberModel::class, 'id','user_id')
-            ->where(['mark'=>1])
-            ->select(['id', 'nickname','realname','avatar', 'company','department','position', 'mobile', 'status']);
-    }
-
-    /**
-     * 会议
-     */
-    public function meeting()
-    {
-        return $this->hasOne(MeetingModel::class, 'id','meeting_id')
-            ->with(['company','member'])
-            ->where(['mark'=>1])
-            ->select(['id', 'title','thumb','user_id','bonus_rate','user_bonus_rate', 'company_id', 'status']);
-    }
-    
-}

+ 2 - 11
app/Models/MemberModel.php

@@ -53,15 +53,6 @@ class MemberModel extends BaseModel
     }
 
     /**
-     * 收益账户
-     * @return \Illuminate\Database\Eloquent\Relations\hasOne
-     */
-    public function account()
-    {
-        return $this->hasOne(AccountStatisticsModel::class, 'user_id','id');
-    }
-
-    /**
      * 推荐人
      */
     public function parent()
@@ -69,7 +60,7 @@ class MemberModel extends BaseModel
         return $this->hasOne(MemberModel::class, 'id','parent_id')
             ->with(['account'])
             ->where(['status'=>1,'mark'=>1])
-            ->select(['id', 'nickname','realname','avatar', 'mobile','company','department','position', 'status']);
+            ->select(['id', 'nickname','realname','avatar', 'mobile', 'status']);
     }
 
     /**
@@ -80,7 +71,7 @@ class MemberModel extends BaseModel
         return $this->hasOne(MemberModel::class, 'parent_id','id')
             ->with(['account'])
             ->where(['mark'=>1])
-            ->select(['id', 'nickname','avatar', 'realname','company','parent_id','department','position', 'mobile', 'status']);
+            ->select(['id', 'nickname','avatar', 'realname','parent_id', 'mobile', 'status']);
     }
 
 

+ 0 - 63
app/Models/OrderCommissionModel.php

@@ -1,63 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Models;
-
-/**
- * 佣金订单管理-模型
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Models
- */
-class OrderCommissionModel extends BaseModel
-{
-    // 设置数据表
-    protected $table = 'order_commission';
-
-    protected $appends = ['state_text'];
-
-    // 状态
-    public function getStateTextAttribute()
-    {
-        return $this->state>0?'已到账':'冻结中';
-    }
-
-    /**
-     * 佣金用户
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
-     */
-    public function user()
-    {
-        return $this->hasOne(MemberModel::class, 'id', 'user_id')
-            ->select(['id','openid', 'mobile', 'nickname', 'realname', 'status']);
-    }
-
-    /**
-     * 下单用户
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
-     */
-    public function orderUser()
-    {
-        return $this->hasOne(MemberModel::class, 'id', 'order_user_id')
-            ->select(['id','openid', 'mobile', 'nickname', 'realname', 'status']);
-    }
-
-    /**
-     * 佣金订单
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
-     */
-    public function order()
-    {
-        return $this->hasOne(OrderModel::class, 'id', 'order_id')
-            ->with(['orderGoods'])
-            ->select(['id', 'order_no', 'user_id','total','pay_total','status']);
-    }
-}

+ 0 - 21
app/Models/OrderModel.php

@@ -58,16 +58,6 @@ class OrderModel extends BaseModel
     }
 
     /**
-     * 关联佣金明细
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany
-     */
-    public function commissions()
-    {
-        return $this->hasMany(OrderCommissionModel::class, 'order_id', 'id')
-            ->with(['user','orderUser']);
-    }
-
-    /**
      * 店铺
      * @return \Illuminate\Database\Eloquent\Relations\HasOne
      */
@@ -79,17 +69,6 @@ class OrderModel extends BaseModel
 
 
     /**
-     * 关联会议
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
-     */
-    public function meeting()
-    {
-        return $this->hasOne(MeetingModel::class, 'id', 'meeting_id')
-            ->with(['company','member'])
-            ->select(['id', 'title', 'thumb','user_id','company_id','bonus_rate']);
-    }
-
-    /**
      * 经手人
      * @return \Illuminate\Database\Eloquent\Relations\HasOne
      */

+ 0 - 37
app/Models/SupervisorsConsultRecordsModel.php

@@ -1,37 +0,0 @@
-<?php
-
-namespace App\Models;
-
-/**
- * 领航员/导师-模型
- */
-class SupervisorsConsultRecordsModel extends BaseModel
-{
-    // 设置数据表
-    protected $table = 'supervisors_consult_records';
-
-    /**
-     * 咨询用户
-     */
-    public function member()
-    {
-        return $this->hasOne(MemberModel::class, 'id', 'user_id');
-    }
-
-    /**
-     * 管理
-     */
-    public function admin()
-    {
-        return $this->hasOne(UserModel::class, 'id', 'admin_id');
-    }
-
-    /**
-     * 导师
-     */
-    public function supervisor()
-    {
-        return $this->hasOne(SupervisorsModel::class, 'id', 'source_id');
-    }
-}
-

+ 0 - 53
app/Models/SupervisorsModel.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Models;
-
-/**
- * 领航员/导师-模型
- */
-class SupervisorsModel extends BaseModel
-{
-    // 设置数据表
-    protected $table = 'supervisors';
-
-    protected $appends = ['type_name','mobile_text'];
-
-    // 头像
-    public function getAvatarAttribute($value)
-    {
-        $value = $value ? get_image_url($value) : '';
-        return $value;
-    }
-
-    /**
-     * @return array
-     */
-    public function getmobileTextAttribute()
-    {
-        return $this->mobile? format_mobile($this->mobile):'';
-    }
-
-    // 类型
-    public function getTypeNameAttribute($value)
-    {
-        $types = [1=>'专项导师',2=>'研究导师',3=>'发展导师'];
-        return isset($types[$this->type])?$types[$this->type]:'--';
-    }
-
-    /**
-     * 关联用户
-     */
-    public function member()
-    {
-        return $this->hasOne(MemberModel::class, 'id', 'user_id');
-    }
-
-    /**
-     * 咨询记录
-     */
-    public function consults()
-    {
-        return $this->hasMany(SupervisorsConsultRecordsModel::class, 'source_id', 'id');
-    }
-}
-

+ 0 - 290
app/Services/Api/MeetingService.php

@@ -1,290 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Api;
-
-use App\Models\CityModel;
-use App\Models\MeetingModel;
-use App\Models\MeetingRecordsModel;
-use App\Models\SupervisorsModel;
-use App\Models\UserModel;
-use App\Services\BaseService;
-use App\Services\MpService;
-use App\Services\RedisService;
-
-/**
- * 会议-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Api
- */
-class MeetingService extends BaseService
-{
-    // 静态对象
-    protected static $instance = null;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     */
-    public function __construct()
-    {
-        $this->model = new MeetingModel();
-    }
-
-    /**
-     * 静态入口
-     */
-    public static function make()
-    {
-        if (!self::$instance) {
-            self::$instance = new static();
-        }
-        return self::$instance;
-    }
-
-    /**
-     * 信息
-     * @param int $id
-     * @param int $userId
-     * @return array|mixed
-     */
-    public function getInfo($id,$userId=0,$type=1)
-    {
-        $cacheKey = "caches:meeting:info_{$id}_{$userId}_{$type}";
-        $info = RedisService::get($cacheKey);
-        if($info){
-            return $info;
-        }
-
-        $info =  $this->model->with(['member','company'])
-            ->where(['id'=>$id,'status'=>1,'mark'=>1])
-            ->withCount(['records'])
-            ->first();
-        $info = $info? $info->toArray() : [];
-        if($info){
-            if($type == 2){
-                $info['qrcode'] = MpService::make()->getMiniQrcode('pagesSub/pages/meeting/books',$id);
-                $info['qrcode'] = $info['qrcode']? get_image_url($info['qrcode']):'';
-            }else if($type == 3){
-                $info['is_book'] = MeetingRecordsModel::where(['user_id'=>$userId,'meeting_id'=>$id,'mark'=>1])->value('id');
-            }else{
-                $areaIds = [];
-                if($info['city_id']){
-                    $areaIds[] = $info['city_id'];
-                }
-
-                if($info['district_id']){
-                    $areaIds[] = $info['district_id'];
-                }
-
-                $areas = CityModel::whereIn('citycode', $areaIds)->pluck('name');
-                $areas = $areas?$areas->toArray() :[];
-                $info['area'] = $areas? implode('/',$areas) : '';
-                $stores = '';
-                if($info['store_ids']){
-                    $stores = UserModel::whereIn('id', $info['store_ids'])
-                        ->select(['id','avatar','realname','nickname as company','mobile','department','position','status'])
-                        ->where(['mark'=>1])
-                        ->get();;
-                }
-
-                $info['stores'] = $stores?$stores->toArray() : [];
-                $supervisors = '';
-                if($info['supervisor_ids']){
-                    $supervisors = SupervisorsModel::whereIn('id', $info['supervisor_ids'])
-                        ->select(['id','name','avatar','mobile','company','occupation','department','position','status'])
-                        ->where(['mark'=>1])
-                        ->get();
-                }
-                $info['supervisors'] = $supervisors?$supervisors->toArray() :[];
-                $info['store_count'] = count($info['stores']);
-                $info['supervisor_count'] =count($info['supervisors']);
-            }
-
-            RedisService::set($cacheKey, $info,   rand(5,10));
-        }
-
-        return $info;
-    }
-
-    /**
-     * @param $params
-     * @param int $pageSize
-     * @return array
-     */
-    public function getDataList($params, $pageSize = 15)
-    {
-        $query = $this->getQuery($params);
-        $list = $query->select(['meetings.*'])
-            ->withCount(['records'])
-            ->groupBy('meetings.id')
-            ->orderBy('meetings.sort','desc')
-            ->orderBy('meetings.id','desc')
-            ->paginate($pageSize > 0 ? $pageSize : 9999999);
-        $list = $list? $list->toArray() :[];
-        return [
-            'pageSize'=> $pageSize,
-            'total'=>isset($list['total'])? $list['total'] : 0,
-            'list'=> isset($list['data'])? $list['data'] : []
-        ];
-    }
-
-    /**
-     * 查询
-     * @param $params
-     * @return mixed
-     */
-    public function getQuery($params)
-    {
-        $where = ['meetings.status'=>0,'meetings.mark' => 1];
-        $status = isset($params['status']) && $params['status']? intval($params['status']) : 1;
-        if($status>0){
-            $where['meetings.status'] = $status;
-        }else{
-            unset($where['meetings.status']);
-        }
-
-        return $this->model->with(['member','company'])
-            ->from('meetings')
-            ->leftJoin('meetings_records','meetings_records.meeting_id','meetings.id')
-            ->where($where)
-            ->where(function ($query) use($params){
-                $keyword = isset($params['keyword'])? $params['keyword'] : '';
-                if($keyword){
-                    $query->where('meetings.title','like',"%{$keyword}%");
-                }
-
-                $type = isset($params['type'])? $params['type'] : 0;
-                $userId = isset($params['user_id'])?$params['user_id'] : 0;
-                // 我组织的
-                if($type==1){
-                    $query->where('meetings.user_id', $userId);
-                }else if($type == 2){
-                    $query->where('meetings_records.user_id', $userId)->where('meetings_records.mark',1);
-                }
-
-            });
-    }
-
-    /**
-     * 签到
-     * @param $userId
-     * @param $params
-     * @return array|false
-     */
-    public function books($userId, $params)
-    {
-        $meetingId = isset($params['id']) ? intval($params['id']) : 0;
-        if ($meetingId<=0) {
-            $this->error = '会议参数错误,请返回重试~';
-            return false;
-        }
-
-        $cacheKey = "caches:meetingBooks:{$userId}_{$meetingId}";
-        if (RedisService::get($cacheKey)) {
-            $this->error = '请不要重复签到';
-            return false;
-        }
-
-
-
-        $nowDate = date('Y-m-d H:i:s');
-        $info = $this->model->where(['id'=>$meetingId])->first();
-        $startAt = isset($info['start_at'])?$info['start_at'] : '';
-        $endAt = isset($info['end_at'])?$info['end_at'] : '';
-        $orderDay = isset($info['order_day']) && $info['order_day']>1?intval($info['order_day']) : 1; // 订单关联天数
-        if($startAt && $nowDate < $startAt){
-            RedisService::clear($cacheKey);
-            $this->error = '会议尚未开始,无法签到';
-            return false;
-        }
-
-        if($endAt && $nowDate > $endAt){
-            RedisService::clear($cacheKey);
-            $this->error = '会议已结束,无法签到';
-            return false;
-        }
-
-        $record = MeetingRecordsModel::where(['meeting_id'=> $meetingId,'user_id'=>$userId,'mark'=>1])->first();
-        if($record){
-            RedisService::clear($cacheKey);
-            $this->error = '您已经完成签到';
-            return false;
-        }
-
-        $otherRecord = MeetingRecordsModel::with(['meeting'])->where(['user_id'=>$userId,'mark'=>1])->first();
-        $meeting = isset($otherRecord['meeting'])?$otherRecord['meeting']:[];
-        $meetingStartAt = isset($meeting['start_at'])?$meeting['start_at'] : '';
-        $meetingEndAt = isset($meeting['end_at'])?$meeting['end_at'] : '';
-        if($otherRecord && $meetingStartAt <= $nowDate && $nowDate <= $meetingEndAt){
-            RedisService::clear($cacheKey);
-            $this->error = '您有未完成的会议,请完成后再签到';
-            return false;
-        }
-
-        $data = [
-            'user_id' => $userId,
-            'meeting_id' => $meetingId,
-            'order_count' => 0,
-            'order_total' => 0,
-            'expired_at' => date('Y-m-d H:i:s', time() + $orderDay * 86400),
-            'create_time' => time(),
-            'update_time' => time(),
-            'mark' => 1,
-        ];
-
-        if(!$id = MeetingRecordsModel::insertGetId($data)){
-            RedisService::clear($cacheKey);
-            $this->error = '签到失败';
-            return false;
-        }
-
-        $this->error = '签到成功';
-        RedisService::set($cacheKey, $data, 30);
-        return ['id' => $id];
-    }
-
-    /**
-     * 会议报名记录
-     * @param $params
-     * @param int $pageSize
-     * @return array
-     */
-    public function records($params,$pageSize=20)
-    {
-        $meetingId = isset($params['meeting_id'])?$params['meeting_id']: 0;
-        $list = MeetingRecordsModel::with(['member'])
-            ->from('meetings_records as a')
-            ->leftJoin('member as b','b.id','=','a.user_id')
-            ->where(function($query) use($params){
-                $keyword = isset($params['keyword'])? trim($params['keyword']) : '';
-                if($keyword){
-                    $query->where('b.mobile','like',"%{$keyword}%")
-                        ->orWhere('b.nickname','like',"%{$keyword}%")
-                        ->orWhere('b.realname','like',"%{$keyword}%");
-                }
-            })
-            ->where('b.id','>',0)
-            ->where(['a.meeting_id'=>$meetingId,'a.mark'=>1])
-            ->select(['a.*'])
-            ->orderBy('a.id','desc')
-            ->paginate($pageSize > 0 ? $pageSize : 9999999);
-        $list = $list? $list->toArray() :[];
-
-        return [
-            'pageSize'=> $pageSize,
-            'total'=>isset($list['total'])? $list['total'] : 0,
-            'list'=> isset($list['data'])? $list['data'] : []
-        ];
-    }
-}

+ 0 - 230
app/Services/Api/SupervisorsService.php

@@ -1,230 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Api;
-
-use App\Models\SupervisorsConsultRecordsModel;
-use App\Models\SupervisorsModel;
-use App\Services\BaseService;
-use App\Services\ConfigService;
-use App\Services\RedisService;
-
-/**
- * 导师管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Api
- */
-class SupervisorsService extends BaseService
-{
-    protected static $instance = null;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     */
-    public function __construct()
-    {
-        $this->model = new SupervisorsModel();
-    }
-
-    /**
-     * 静态入口
-     * @return static|null
-     */
-    public static function make()
-    {
-        if (!self::$instance) {
-            self::$instance = (new static());
-        }
-        return self::$instance;
-    }
-
-    /**
-     * @param $params
-     * @param int $pageSize
-     * @return array
-     */
-    public function getDataList($params, $pageSize = 15)
-    {
-        $where = ['supervisors.mark' => 1];
-        $status = isset($params['status']) ? $params['status'] : 0;
-        $type = isset($params['type']) ? $params['type'] : 0;
-        $isRecommend = isset($params['is_recommend']) ? $params['is_recommend'] : 0;
-        if ($status > 0) {
-            $where['supervisors.status'] = $status;
-        }
-
-        if ($isRecommend > 0) {
-            $where['supervisors.is_recommend'] = $isRecommend;
-        }
-
-        if ($type > 0) {
-            $where['supervisors.type'] = $type;
-        }
-        $list = $this->model->with(['member'])
-            ->from('supervisors')
-            ->where($where)
-            ->where(function ($query) use ($params) {
-                $keyword = isset($params['keyword']) ? $params['keyword'] : '';
-                if ($keyword) {
-                    $query->where('supervisors.name', 'like', "%{$keyword}%")
-                    ->orWhere('supervisors.mobile','like',"%{$keyword}%")
-                    ->orWhere('supervisors.occupation','like',"%{$keyword}%");
-                }
-            })
-            ->select(['supervisors.*'])
-            ->withCount(['consults'])
-            ->orderBy('supervisors.sort', 'desc')
-            ->orderBy('supervisors.id', 'desc')
-            ->paginate($pageSize > 0 ? $pageSize : 9999999);
-        $list = $list ? $list->toArray() : [];
-        if ($list) {
-            foreach ($list['data'] as &$item) {
-                $item['consults_count']=$item['guidance_count']?$item['guidance_count']:$item['consults_count'];
-                $item['create_time'] = $item['create_time'] ? datetime($item['create_time'], 'Y-m-d H.i.s') : '';
-            }
-        }
-
-        return [
-            'pageSize' => $pageSize,
-            'total' => isset($list['total']) ? $list['total'] : 0,
-            'list' => isset($list['data']) ? $list['data'] : []
-        ];
-    }
-
-    /**
-     * 详情
-     * @param $id
-     * @param $userId
-     * @return array|mixed
-     */
-    public function getInfo($id,$userId=0)
-    {
-        $cacheKey = "caches:supervisors:info_{$id}_{$userId}";
-        $info = RedisService::get($cacheKey);
-        if($info){
-            return $info;
-        }
-        $where = ['id'=> $id,'mark'=>1];
-        $info = $this->model->with(['member'])->where($where)->withCount(['consults'])->first();
-        $info = $info? $info->toArray() : [];
-        if($info){
-            RedisService::set($cacheKey, $info, rand(5, 10));
-        }
-
-        return $info;
-    }
-
-    /**
-     * 获取推荐数据
-     * @return array|mixed
-     */
-    public function getRecommendList($limit=0)
-    {
-        $limit = $limit?$limit:ConfigService::make()->getConfigByCode('supervisors_recommend_num',6);
-        $cacheKey = "caches:supervisors:recommendList";
-        $datas = RedisService::get($cacheKey);
-        if($datas){
-            return $datas;
-        }
-
-        $datas = $this->model->with(['member'])
-            ->where(['is_recommend'=> 1,'status'=>1,'mark'=>1])
-            ->withCount(['consults'])
-            ->limit($limit)
-            ->get();
-        $datas = $datas? $datas->toArray() : [];
-        if($datas){
-            RedisService::set($cacheKey, $datas, rand(300,600));
-        }
-
-        return $datas;
-    }
-
-    /**
-     * 咨询信息提交
-     * @param $userId
-     * @param $params
-     * @return array|false
-     */
-    public function consultSubmit($userId, $params)
-    {
-        $sourceId = isset($params['source_id']) ? intval($params['source_id']) : 0;
-        $realname = isset($params['realname']) ? trim($params['realname']) : '';
-        $mobile = isset($params['mobile']) ? trim($params['mobile']) : '';
-        $industry = isset($params['industry']) ? trim($params['industry']) : '';
-        $position = isset($params['position']) ? trim($params['position']) : '';
-        if (empty($realname)) {
-            $this->error = '请填写姓名';
-            return false;
-        }
-
-        if (empty($mobile)) {
-            $this->error = '请填写联系方式';
-            return false;
-        }
-        if (empty($industry)) {
-            $this->error = '请填写所在行业';
-            return false;
-        }
-
-        if (empty($position)) {
-            $this->error = '请填写当前角色/职务';
-            return false;
-        }
-        $cacheKey = "caches:supervisors:consult:{$userId}_{$sourceId}";
-        if (RedisService::get($cacheKey)) {
-            $this->error = '您近期已经提交过,请30秒后重试';
-            return false;
-        }
-
-        $sourceInfo = $this->model->where(['id'=>$sourceId,'mark'=>1])->first();
-        if(empty($sourceInfo)){
-            RedisService::clear($cacheKey);
-            $this->error = '提交失败,咨询导师不存在';
-            return false;
-        }
-
-        $data = [
-            'user_id' => $userId,
-            'source_id' => $sourceId,
-            'realname' => $realname,
-            'mobile' => $mobile,
-            'industry' => $industry,
-            'position' => $position,
-            'work_year' => isset($params['work_year'])? trim($params['work_year']) : '',
-            'interest' => isset($params['interest'])? trim($params['interest']) : '',
-            'experiences' => isset($params['experiences'])? trim($params['experiences']) : '',
-            'create_time' => time(),
-            'update_time' => time(),
-            'status' => 1,
-            'mark' => 1,
-        ];
-        if (!$id = SupervisorsConsultRecordsModel::where(['source_id'=>$sourceId,'user_id'=>$userId])->value('id')) {
-            if(!$id = SupervisorsConsultRecordsModel::insertGetId($data)){
-                RedisService::clear($cacheKey);
-                $this->error = '提交失败';
-                return false;
-            }
-        }else{
-            SupervisorsConsultRecordsModel::where(['id'=>$id])->update($data);
-        }
-
-        $this->error = '提交成功';
-        RedisService::set($cacheKey, $data, 30);
-        return ['id' => $id];
-    }
-
-
-
-}

+ 0 - 344
app/Services/Common/BalanceLogService.php

@@ -1,344 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Common;
-
-use App\Models\AccountLogModel;
-use App\Models\ActionLogModel;
-use App\Models\BalanceLogModel;
-use App\Models\MemberModel;
-use App\Models\MessageModel;
-use App\Services\BaseService;
-use App\Services\RedisService;
-use Illuminate\Support\Facades\DB;
-
-/**
- * 余额管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
-class BalanceLogService extends BaseService
-{
-    public static $instance = null;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     * AccountService constructor.
-     */
-    public function __construct()
-    {
-        $this->model = new BalanceLogModel();
-    }
-
-    /**
-     * 静态入口
-     * @return static|null
-     */
-    public static function make()
-    {
-        if (!self::$instance) {
-            self::$instance = (new static());
-        }
-        return self::$instance;
-    }
-
-    /**
-     * @param $params
-     * @param int $pageSize
-     * @return array
-     */
-    public function getDataList($params, $pageSize = 15)
-    {
-        $query = $this->getQuery($params);
-
-        $model = clone $query;
-        $counts = [
-            'count'=> $model->count('a.id'),
-            'total'=> $model->sum('a.money'),
-        ];
-
-        $list = $query->select(['a.*'])
-            ->orderBy('a.create_time','desc')
-            ->orderBy('a.id','desc')
-            ->paginate($pageSize > 0 ? $pageSize : 9999999);
-        $list = $list? $list->toArray() :[];
-        if($list){
-            foreach($list['data'] as &$item){
-                $item['create_time'] = $item['create_time']? datetime($item['create_time'],'Y-m-d H.i.s') : '';
-                $item['pay_img'] = $item['pay_img']? get_image_url($item['pay_img']) : '';
-                $item['member'] = isset($item['member'])? $item['member'] : [];
-            }
-        }
-
-        return [
-            'pageSize'=> $pageSize,
-            'total'=>isset($list['total'])? $list['total'] : 0,
-            'counts'=>$counts,
-            'list'=> isset($list['data'])? $list['data'] : []
-        ];
-    }
-
-    /**
-     * 查询
-     * @param $params
-     * @return \Illuminate\Database\Eloquent\Builder
-     */
-    public function getQuery($params)
-    {
-        $where = ['a.mark' => 1];
-        $type = isset($params['type'])? $params['type'] : 0;
-        if($type>0){
-            $where['a.type'] = $type;
-        }
-
-       return $this->model->with(['member'])->from("balance_logs as a")
-            ->leftJoin('member as b','b.id','=','a.user_id')
-            ->where($where)
-            ->where(function ($query) use($params) {
-                $keyword = isset($params['keyword']) ? $params['keyword'] : '';
-                $userId = isset($params['user_id'])? $params['user_id'] : 0;
-                if($userId){
-                    $query->where('a.user_id',$userId);
-                }
-
-                if ($keyword) {
-                    $query->where(function($query) use($keyword){
-                        $query->where('b.nickname','like',"%{$keyword}%")
-                            ->orWhere('b.mobile','like',"%{$keyword}%");
-                    });
-                }
-
-                $orderNo = isset($params['order_no'])? trim($params['order_no']) : '';
-                if($orderNo){
-                    $query->where(function($query) use($orderNo){
-                        $query->where('a.order_no','like',"%{$orderNo}%");
-                    });
-                }
-
-                $status = isset($params['status'])? $params['status'] : 0;
-                if($status==0){
-                    $query->whereIn('a.status',[2,4]);
-                }else if($status<0){
-                    $query->whereIn('a.status', [1,3]);
-                }else if($status>0){
-                    $query->where('a.status', $status);
-                }
-            })
-            ->where(function ($query) use($params){
-
-                // 日期
-                $date = isset($params['date']) ? $params['date'] : [];
-                $start = isset($date[0])? $date[0] : '';
-                $end = isset($date[1])? $date[1] : '';
-                $end = $start>=$end? '' : $end;
-                if ($start) {
-                    $query->where('a.create_time','>=', strtotime($start));
-                }
-                if($end){
-                    $query->where('a.create_time','<=', strtotime($end));
-                }
-            });
-    }
-
-
-    /**
-     * 添加或编辑
-     * @return array
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function edit()
-    {
-        $data = request()->all();
-        return parent::edit($data); // TODO: Change the autogenerated stub
-    }
-
-    /**
-     * 审核
-     * @param $adminId
-     * @param $params
-     * @return array|false
-     */
-    public function confirm($adminId, $params)
-    {
-        $id = isset($params['id'])? intval($params['id']) : 0;
-        $status = isset($params['status'])? intval($params['status']) : 0;
-        $payStatus = isset($params['pay_status'])? intval($params['pay_status']) : 0;
-        $confirmRemark = isset($params['confirm_remark'])? trim($params['confirm_remark']) : '';
-        $payImg = isset($params['pay_img'])? trim($params['pay_img']) : '';
-        $payImg = $payImg? get_image_path($payImg) : '';
-
-        $info = $this->model->with(['member'])->where(['id'=> $id,'mark'=>1])->first();
-        $userInfo = isset($info['member'])? $info['member'] : [];
-        $orderStatus = isset($info['status'])? $info['status'] : 0;
-        $orderUserId = isset($info['user_id'])? $info['user_id'] : 0;
-        $balance = isset($userInfo['balance'])? $userInfo['balance'] : 0;
-        $money = isset($info['money'])? $info['money'] : 0;
-        if(empty($info) || empty($userInfo) || $orderUserId<=0 || $money<=0){
-            $this->error = '提现信息不存在或参数错误';
-            return false;
-        }
-
-        if($orderStatus != 1){
-            $this->error = '提现订单状态不可操作';
-            return false;
-        }
-
-        if(!in_array($status,[2,3])){
-            $this->error = '审核状态错误';
-            return false;
-        }
-
-        if($status == 3 && empty($confirmRemark)){
-            $this->error = '请填写审核驳回备注';
-            return false;
-        }
-
-        DB::beginTransaction();
-        $status = $payStatus==20 && $status==2?4:$status;
-        $updateData = ['status'=>$status,'pay_status'=> $payStatus,'pay_img'=> $payImg,'confirm_admin_id'=>$adminId,'update_time'=>time(),'confirm_remark'=>$confirmRemark];
-        if(!$this->model->where(['id'=> $id])->update($updateData)){
-            DB::rollBack();
-            $this->error = '提现审核失败';
-            return false;
-        }
-
-        // 如果驳回
-        if($status == 3){
-            $updateData = ['balance'=>DB::raw("balance + {$money}"),'update_time'=>time()];
-            if(!MemberModel::where(['id'=> $orderUserId])->update($updateData)){
-                DB::rollBack();
-                $this->error = '提现审核处理失败';
-                return false;
-            }
-
-            $log = [
-                'user_id' => $orderUserId,
-                'source_order_no' => isset($info['order_no']) ? $info['order_no'] : '',
-                'type' => 5,
-                'money' => $money,
-                'after_money' => moneyFormat($balance+$money,2),
-                'date'=> date('Y-m-d'),
-                'create_time' => time(),
-                'remark' => '提现驳回',
-                'status' => 1,
-                'mark' => 1,
-            ];
-            if(!AccountLogModel::insertGetId($log)){
-                DB::rollBack();
-                $this->error = '提现审核处理失败';
-                return false;
-            }
-        }else if($status == 2){
-            // 线上直接打款逻辑
-        }
-
-
-
-        DB::commit();
-        $this->error = '提现审核成功';
-        return ['id'=>$id,'money'=>$money,'status'=>$status];
-    }
-
-    /**
-     * 打款
-     * @param $adminId
-     * @param $params
-     * @return array|false
-     */
-    public function payment($adminId, $params)
-    {
-        $id = isset($params['id'])? intval($params['id']) : 0;
-        $payStatus = isset($params['pay_status'])? intval($params['pay_status']) : 0;
-        $payImg = isset($params['pay_img'])? trim($params['pay_img']) : '';
-        $payImg = $payImg? get_image_path($payImg) : '';
-
-        $info = $this->model->with(['member'])->where(['id'=> $id,'mark'=>1])->first();
-        $userInfo = isset($info['member'])? $info['member'] : [];
-        $orderStatus = isset($info['status'])? $info['status'] : 0;
-        $orderUserId = isset($info['user_id'])? $info['user_id'] : 0;
-        $balance = isset($userInfo['balance'])? $userInfo['balance'] : 0;
-        $money = isset($info['money'])? $info['money'] : 0;
-        if(empty($info) || empty($userInfo) || $orderUserId<=0 || $money<=0){
-            $this->error = '提现信息不存在或参数错误';
-            return false;
-        }
-
-        if($orderStatus != 2){
-            $this->error = '提现订单状态不可操作';
-            return false;
-        }
-
-        if($payStatus != 20){
-            $this->error = '请选择已打款';
-            return false;
-        }
-
-
-        DB::beginTransaction();
-        $updateData = ['pay_status'=> $payStatus,'pay_img'=> $payImg,'update_time'=>time()];
-        if($payStatus == 20){
-            $updateData['status'] = 4;
-        }
-        if(!$this->model->where(['id'=> $id])->update($updateData)){
-            DB::rollBack();
-            $this->error = '提现打款处理失败';
-            return false;
-        }
-
-        DB::commit();
-        $this->error = '提现打款状态更新成功';
-        return ['id'=>$id,'money'=>$money,'status'=>$payStatus];
-    }
-
-    /**
-     * 删除
-     * @return array
-     */
-    public function delete()
-    {
-        // 设置日志标题
-        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除余额明细", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
-        ActionLogModel::record();
-        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
-        return parent::delete(); // TODO: Change the autogenerated stub
-    }
-
-    /*\提现统计
-     * @param int $type
-     * @return array|mixed
-     */
-    public function getTotal($type=1)
-    {
-        $cacheKey = "caches:balances:total_{$type}";
-        $data = RedisService::get($cacheKey);
-        if($data){
-            return $data;
-        }
-
-        $data = $this->model->where(['mark'=>1])
-            ->where(function($query) use($type){
-                if($type== 1){
-                    $query->where(['type'=>2])->whereIn('status',[2,4]);
-                }else {
-                    $query->where(['type'=>2]);
-                }
-            })->sum('money');
-        if($data){
-            RedisService::set($cacheKey, $data, rand(300, 600));
-        }
-
-        return $data;
-    }
-}

+ 3 - 49
app/Services/Common/BalanceLogsService.php

@@ -269,11 +269,6 @@ class BalanceLogsService extends BaseService
                 if (!empty($payImg)) {
                     $record->pay_img = $payImg;
                 }
-
-                // 如果是代理提现审核通过,更新代理表的累计提现金额
-                if ($record->account_type == 2 && $record->type == 2) {
-                    $this->updateAgentWithdrawTotal($record);
-                }
             }
 
             $record->save();
@@ -303,7 +298,6 @@ class BalanceLogsService extends BaseService
         $where = ['a.mark' => 1];
         $list = $this->model->from('balance_logs as a')
             ->leftJoin('member as b','b.id','=','a.user_id')
-            ->leftJoin('driver as c','c.id','=','a.user_id')
             ->where($where)
             ->where(function ($query) use($params){
                 $userType = isset($params['user_type'])? $params['user_type'] : 0;
@@ -316,15 +310,6 @@ class BalanceLogsService extends BaseService
                             $query->where('a.order_no','like',"%{$keyword}%")->orWhere('b.nickname','like',"%{$keyword}%")->orWhere('b.mobile','like',"%{$keyword}%");
                         });
                     }
-                }else if ($userType == 2){
-                    $query->where('a.user_type', $userType);
-
-                    $keyword = isset($params['keyword'])? $params['keyword'] : '';
-                    if($keyword){
-                        $query->where(function($query) use($keyword){
-                            $query->where('a.order_no','like',"%{$keyword}%")->orWhere('c.realname','like',"%{$keyword}%")->orWhere('c.mobile','like',"%{$keyword}%");
-                        });
-                    }
                 }
             })
             ->where(function ($query) use($params){
@@ -340,7 +325,7 @@ class BalanceLogsService extends BaseService
                     $query->where('a.type', $type);
                 }
             })
-            ->select(['a.*','b.nickname as user_nickname','b.realname as user_realname','b.mobile as user_mobile','c.realname as driver_name','c.mobile as driver_mobile','c.realname as driver_realname'])
+            ->select(['a.*','b.nickname as user_nickname','b.realname as user_realname','b.mobile as user_mobile'])
             ->orderBy('a.create_time','desc')
             ->orderBy('a.id','desc')
             ->paginate($pageSize > 0 ? $pageSize : 9999999);
@@ -351,12 +336,7 @@ class BalanceLogsService extends BaseService
                 $item['qrcode'] = $item['qrcode']? get_image_url($item['qrcode']) : '';
                 $item['account'] = $item['account']? json_decode($item['account'], true) : [];
                 $item['username'] = $item['user_nickname']? $item['user_nickname'].($item['user_mobile']?'-'.$item['user_mobile']:'') : '';
-                $item['driver'] = $item['driver_name']? $item['driver_name'].($item['driver_mobile']?'-'.$item['driver_mobile']:'') : '';
-                if($item['user_type'] == 2){
-                    $item['realname'] = $item['realname']? $item['realname'] : $item['driver_realname'];
-                }else{
-                    $item['realname'] = $item['realname']? $item['realname'] : $item['user_realname'];
-                }
+                $item['realname'] = $item['realname']? $item['realname'] : $item['user_realname'];
 
             }
         }
@@ -412,22 +392,6 @@ class BalanceLogsService extends BaseService
         return $counts;
     }
 
-    /**
-     * 更新代理表的累计提现金额
-     */
-    private function updateAgentWithdrawTotal($record)
-    {
-        // 查找代理记录
-        $agent = AgentModel::where('user_id', $record->user_id)
-            ->where('mark', 1)
-            ->first();
-
-        if ($agent) {
-            // 累加提现金额到 withdraw_total
-            $agent->withdraw_total = bcadd($agent->withdraw_total ?? 0, $record->actual_money, 2);
-            $agent->save();
-        }
-    }
 
     /**
      * 退回余额(根据账户类型退回到对应的表)
@@ -442,17 +406,7 @@ class BalanceLogsService extends BaseService
                     $user->save();
                 }
                 break;
-                
-            case 2: // 代理账户
-                $agent = AgentModel::where('user_id', $record->user_id)
-                    ->where('mark', 1)
-                    ->first();
-                if ($agent) {
-                    $agent->balance = bcadd($agent->balance, $record->money, 2);
-                    $agent->save();
-                }
-                break;
-                
+
             case 3: // 商户账户
                 $store = StoreModel::where('user_id', $record->user_id)
                     ->where('mark', 1)

+ 0 - 106
app/Services/Common/MeetingRecordService.php

@@ -1,106 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Common;
-
-use App\Models\MeetingRecordsModel;
-use App\Services\BaseService;
-
-/**
- * 会议签到记录管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
-class MeetingRecordService extends BaseService
-{
-    public static $instance = null;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     */
-    public function __construct()
-    {
-        $this->model = new MeetingRecordsModel();
-    }
-
-    /**
-     * 静态入口
-     */
-    public static function make()
-    {
-        if (!self::$instance) {
-            self::$instance = new static();
-        }
-        return self::$instance;
-    }
-
-    /**
-     * 列表(兼容旧方法)
-     * @param $params
-     * @param int $pageSize
-     * @return array
-     */
-    public function getDataList($params, $pageSize = 15)
-    {
-        $where = ['a.mark' => 1];
-        $status = isset($params['status']) ? $params['status'] : 0;
-        if ($status > 0) {
-            $where['a.status'] = $status;
-        }
-
-        $userId = isset($params['user_id']) ? $params['user_id'] : 0;
-        if ($userId > 0) {
-            $where['a.user_id'] = $userId;
-        }
-
-        $meetingId = isset($params['meeting_id']) ? $params['meeting_id'] : 0;
-        if ($meetingId > 0) {
-            $where['a.meeting_id'] = $meetingId;
-        }
-
-        $query = $this->model->with(['member','meeting'])->from('meetings_records as a')
-            ->leftJoin('member as b','b.id','=','a.user_id')
-            ->where($where)
-            ->where(function ($query) use ($params) {
-                $keyword = isset($params['keyword']) ? $params['keyword'] : '';
-                if ($keyword) {
-                    $query->where('b.nickname', 'like', "%{$keyword}%")
-                        ->orWhere('b.mobile', 'like', "%{$keyword}%")
-                        ->orWhere('b.realname', 'like', "%{$keyword}%");
-                }
-            })
-            ->select(['a.*']);
-
-        $query->orderBy('a.id', 'desc');
-        $list = $query->paginate($pageSize > 0 ? $pageSize : 9999999);
-        $list = $list ? $list->toArray() : [];
-        if ($list) {
-            foreach ($list['data'] as &$item) {
-                $item['create_time'] = $item['create_time'] ? datetime($item['create_time'], 'Y-m-d H.i.s') : '';
-            }
-        }
-
-        return [
-            'msg' => '操作成功',
-            'code' => 0,
-            'data' => isset($list['data']) ? $list['data'] : [],
-            'count' => isset($list['total']) ? $list['total'] : 0,
-        ];
-    }
-    public function delete()
-    {
-        $this->model->where(['mark'=>0])->where('update_time','<', time() - 600)->delete();
-        return parent::delete(); // TODO: Change the autogenerated stub
-    }
-}

+ 0 - 253
app/Services/Common/MeetingService.php

@@ -1,253 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Common;
-
-use App\Models\ActionLogModel;
-use App\Models\MeetingModel;
-use App\Models\StoreModel;
-use App\Models\SupervisorsModel;
-use App\Services\BaseService;
-use App\Services\MpService;
-use App\Services\RedisService;
-
-/**
- * 会议管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
-class MeetingService extends BaseService
-{
-    public static $instance = null;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     */
-    public function __construct()
-    {
-        $this->model = new MeetingModel();
-    }
-
-    /**
-     * 静态入口
-     */
-    public static function make()
-    {
-        if (!self::$instance) {
-            self::$instance = new static();
-        }
-        return self::$instance;
-    }
-
-
-    /**
-     * 获取数据列表
-     * @param array $params 请求参数
-     * @param int $pageSize 分页大小
-     */
-    public function getDataList($params, $pageSize = 15)
-    {
-        try {
-            $query = $this->model->where('mark', 1);
-
-            // 状态筛选
-            if (isset($params['status']) && $params['status']) {
-                $query->where('status', $params['status']);
-            }
-
-            // 关键词搜索
-            if (isset($params['keyword']) && $params['keyword']) {
-                $keyword = $params['keyword'];
-                $query->where(function ($q) use ($keyword) {
-                    $q->where('title', 'like', '%' . $keyword . '%');
-                });
-            }
-
-            $list = $query->with(['member','city','district','company'])
-                ->withCount(['records'])
-                ->orderBy('sort', 'desc')
-                ->orderBy('id', 'desc')
-                ->paginate($pageSize);
-
-            $list = $list ? $list->toArray() : [];
-
-            if ($list && isset($list['data'])) {
-                foreach ($list['data'] as &$item) {
-                    $item['create_time'] = $item['create_time'] ? datetime($item['create_time'],'Y-m-d H:i:s') : '';
-
-                    $city = isset($item['city'])?$item['city']:[];
-                    $district = isset($item['district'])?$item['district']:[];
-                    $cityName = isset($city['name'])?$city['name']:'';
-                    $districtName = isset($district['name'])?$district['name']:'';
-                    $item['area'] = $cityName.'/'.$districtName;
-                    if($item['store_ids']){
-                        $item['stores'] = StoreModel::whereIn('id', $item['store_ids'])
-                            ->select(['id','nickname','mobile'])
-                            ->get();
-                    }
-
-                    $item['supervisors'] = [];
-                    if($item['supervisor_ids']){
-                        $item['supervisors'] = SupervisorsModel::whereIn('id', $item['supervisor_ids'])
-                            ->select(['id','name','mobile'])
-                            ->get();
-                    }
-                }
-            }
-
-            return [
-                'msg' => '操作成功',
-                'code' => 0,
-                'data' => $list['data'] ?? [],
-                'count' => $list['total'] ?? 0,
-            ];
-        } catch (\Exception $e) {
-            return [
-                'msg' => '查询失败: ' . $e->getMessage(),
-                'code' => 1,
-                'data' => [],
-                'count' => 0,
-            ];
-        }
-    }
-
-    /**
-     * 添加会编辑会员
-     * @return array
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function edit()
-    {
-        // 请求参数
-        $data = request()->all();
-        $id = isset($data['id']) ? $data['id'] : 0;
-
-        // 封面
-        if (isset($data['thumb']) && $data['thumb']) {
-            $data['thumb'] = get_image_path(trim($data['thumb']));
-        }
-
-        $areas = isset($data['areas'])?$data['areas']:[];
-        // 省份
-        $data['province_id'] = isset($areas[0])?$areas[0]:0;
-        // 城市
-        $data['city_id'] = isset($areas[1])?$areas[1]:0;
-        // 县区
-        $data['district_id'] = isset($areas[2])?$areas[2]:0;
-
-        // 签到关联订单有效天数
-        $data['order_day'] = isset($data['order_day']) && $data['order_day']>1? intval($data['order_day']) : 1;
-
-        $data['store_ids'] = $data['store_ids']? implode(',',$data['store_ids']).',' : '';
-        $data['supervisor_ids'] = $data['supervisor_ids']? implode(',',$data['supervisor_ids']).',' : '';
-
-        // 设置日志
-        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => '编辑会议信息', 'content' => json_encode($data, 256), 'module' => 'admin']);
-        ActionLogModel::record();
-
-        RedisService::keyDel("caches:meetings:count*");
-        RedisService::keyDel("caches:meetings:info_{$id}*");
-        unset($data['company']);
-        return parent::edit($data);
-    }
-
-
-    /**
-     * 获取详情
-     */
-    public function getInfo($id = null)
-    {
-        if ($id === null) {
-            $id = request()->input('id');
-        }
-
-        $info = MeetingModel::with(['company'])->where('id', $id)
-            ->where('mark', 1)
-            ->first();
-
-        if (!$info) {
-            return ['code' => 1, 'msg' => '会议不存在'];
-        }
-
-        $info = $info->toArray();
-        $info['thumb'] = $info['thumb'] ? get_image_url($info['thumb']) : '';
-        $info['qrcode'] = MpService::make()->getMiniQrcode('pagesSub/pages/meeting/books',$info['id']);
-        $info['qrcode'] = $info['qrcode']? get_image_url($info['qrcode']):'';
-        return [
-            'code' => 0,
-            'msg' => '获取成功',
-            'data' => $info
-        ];
-    }
-
-    /**
-     * 设置状态
-     */
-    public function status()
-    {
-        $params = request()->all();
-        $id = $params['id'] ?? 0;
-        $status = $params['status'] ?? 1;
-
-        $info = MeetingModel::where('id', $id)
-            ->where('mark', 1)
-            ->first();
-
-        if (!$info) {
-            return ['code' => 1, 'msg' => '会议不存在'];
-        }
-
-        $info->status = $status;
-        $info->update_time = time();
-        $info->save();
-
-        RedisService::clear("caches:meeting:info_{$id}");
-        return ['code' => 0, 'msg' => '设置成功'];
-    }
-
-    /**
-     * 删除
-     * @return array
-     */
-    public function delete()
-    {
-        $id = request()->input('id');
-        $this->model->where(['mark'=>0])->where('update_time','<', time() - 600)->delete();
-        if (is_array($id)) {
-            // 批量删除
-            $count = MeetingModel::whereIn('id', $id)
-                ->where('mark', 1)
-                ->update(['mark' => 0, 'update_time' => time()]);
-
-            return ['code' => 0, 'msg' => "成功删除{$count}条记录"];
-        } else {
-            // 单个删除
-            $info = MeetingModel::where('id', $id)
-                ->where('mark', 1)
-                ->first();
-
-            if (!$info) {
-                return ['code' => 1, 'msg' => '会议不存在'];
-            }
-
-            $info->mark = 0;
-            $info->update_time = time();
-            $info->save();
-
-            RedisService::clear("caches:meeting:info_{$id}*");
-            return ['code' => 0, 'msg' => '删除成功'];
-        }
-    }
-}

+ 0 - 244
app/Services/Common/StoreCategoryService.php

@@ -1,244 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Common;
-
-use App\Models\StoreCategoryModel;
-use App\Services\BaseService;
-
-/**
- * 商家分类管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
-class StoreCategoryService extends BaseService
-{
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     */
-    public function __construct()
-    {
-        $this->model = new StoreCategoryModel();
-    }
-
-
-    /**
-     * 获取数据列表
-     * @param array $params
-     * @param int $pageSize
-     * @return array
-     */
-    public function getDataList($params, $pageSize = 15)
-    {
-        // 分页查询
-        $list = $this->model->orderBy('sort', 'desc')
-            ->where('pid', 0)
-            ->where(function ($query) use ($params) {
-                if (isset($params['store_id']) && $params['store_id'] > 0) {
-                    $query->where('store_id', $params['store_id']);
-                }
-                if (isset($params['name']) && $params['name']) {
-                    $query->where('name', 'like', "%{$params['name']}%");
-                }
-                if (isset($params['status']) && $params['status'] !== null && $params['status'] !== '') {
-                    $query->where('status', intval($params['status']));
-                }
-            })
-            ->orderBy('id', 'asc')
-            ->paginate($pageSize > 0 ? $pageSize : 9999999);
-
-        $list = $list->toArray();
-
-        // 格式化数据
-        if (isset($list['data']) && !empty($list['data'])) {
-            foreach ($list['data'] as &$val) {
-                $val['create_time'] = $val['create_time'] ? datetime($val['create_time'], 'Y-m-d H:i:s') : '';
-            }
-        }
-
-        //返回结果
-        return [
-            'msg' => '操作成功',
-            'code' => 0,
-            'data' => $list['data'],
-            'count' => $list['total']
-        ];
-    }
-
-    /**
-     * 获取分类详情
-     * @return array
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function info()
-    {
-        // 记录ID
-        $id = request()->input("id", 0);
-        $info = [];
-        if ($id) {
-            $info = $this->model->getInfo($id);
-            if ($info && isset($info['create_time'])) {
-                $info['create_time'] = $info['create_time'] ? datetime($info['create_time'], 'Y-m-d H:i:s') : '';
-            }
-        }
-        return message(MESSAGE_OK, true, $info);
-    }
-
-    /**
-     * 添加或编辑
-     * @return array
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function edit()
-    {
-        // 参数
-        $param = request()->all();
-
-        // 验证分类名称
-        if (empty($param['name'])) {
-            $this->error = '分类名称不能为空';
-            return false;
-        }
-
-        // 强制设置 pid=0,忽略层级关系,只保留一级分类
-        $param['pid'] = 0;
-
-        // 设置默认值
-        if (!isset($param['status'])) {
-            $param['status'] = 1; // 默认有效
-        }
-        if (!isset($param['sort'])) {
-            $param['sort'] = 0; // 默认排序为0
-        }
-        if (!isset($param['remark'])) {
-            $param['remark'] = ''; // 默认备注为空
-        }
-
-        // 保存数据
-        $result = $this->model->edit($param);
-        if (!$result) {
-            $this->error = '操作失败';
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * 设置状态
-     * @param array $params
-     * @return bool
-     */
-    public function setStatus($params)
-    {
-        $id = isset($params['id']) ? intval($params['id']) : 0;
-        $status = isset($params['status']) ? intval($params['status']) : 1;
-
-        if (!$id) {
-            $this->error = '分类ID不能为空';
-            return false;
-        }
-
-        $info = $this->model->where(['id' => $id, 'mark' => 1])->first();
-        if (!$info) {
-            $this->error = '分类信息不存在';
-            return false;
-        }
-
-        // 更新状态
-        $this->model->where('id', $id)->update([
-            'status' => $status,
-            'update_time' => time()
-        ]);
-
-        $this->error = $status == 1 ? '启用成功' : '禁用成功';
-        return true;
-    }
-
-    /**
-     * 删除(重写父类方法)
-     * @return array
-     */
-    public function delete()
-    {
-        // 参数
-        $param = request()->all();
-        // 记录ID
-        $id = getter($param, "id");
-        if (empty($id)) {
-            return message("分类ID不能为空", false);
-        }
-
-        $info = $this->model->where(['id' => $id, 'mark' => 1])->first();
-        if (!$info) {
-            return message("分类信息不存在", false);
-        }
-
-        // 忽略 pid,不需要检查子分类(因为只有一级分类)
-
-        // 删除(软删除)
-        $this->model->where('id', $id)->update([
-            'mark' => 0,
-            'update_time' => time()
-        ]);
-
-        return message("删除成功", true);
-    }
-
-    /**
-     * 批量删除
-     * @param array $params
-     * @return bool
-     */
-    public function deleteAll($params)
-    {
-        $ids = isset($params['ids']) ? $params['ids'] : [];
-
-        if (empty($ids) || !is_array($ids)) {
-            $this->error = '请选择要删除的分类';
-            return false;
-        }
-
-        // 忽略 pid,不需要检查子分类(因为只有一级分类)
-
-        // 批量删除(软删除)
-        $this->model->whereIn('id', $ids)->update([
-            'mark' => 0,
-            'update_time' => time()
-        ]);
-
-        $this->error = '删除成功';
-        return true;
-    }
-
-    /**
-     * 获取分类选项(用于下拉选择)
-     * 只返回一级分类(pid=0),忽略层级关系
-     * @return array
-     */
-    public function options()
-    {
-        // 只查询一级分类(pid=0)
-        $list = $this->model->where(['mark' => 1, 'status' => 1, 'pid' => 0])
-            ->orderBy('sort', 'desc')
-            ->orderBy('id', 'asc')
-            ->select(['id', 'name'])
-            ->get()
-            ->toArray();
-
-        return message("操作成功", true, $list);
-    }
-}

+ 0 - 152
app/Services/Common/SupervisorConsultRecordService.php

@@ -1,152 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Common;
-
-use App\Models\SupervisorsConsultRecordsModel;
-use App\Services\BaseService;
-
-/**
- * 导师咨询记录管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
-class SupervisorConsultRecordService extends BaseService
-{
-    public static $instance = null;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     */
-    public function __construct()
-    {
-        $this->model = new SupervisorsConsultRecordsModel();
-    }
-
-    /**
-     * 静态入口
-     */
-    public static function make()
-    {
-        if (!self::$instance) {
-            self::$instance = new static();
-        }
-        return self::$instance;
-    }
-
-    /**
-     * 列表(兼容旧方法)
-     * @param $params
-     * @param int $pageSize
-     * @return array
-     */
-    public function getDataList($params, $pageSize = 15)
-    {
-        $where = ['a.mark' => 1];
-        $status = isset($params['status']) ? $params['status'] : 0;
-        if ($status > 0) {
-            $where['a.status'] = $status;
-        }
-
-        $userId = isset($params['user_id']) ? $params['user_id'] : 0;
-        if ($userId > 0) {
-            $where['a.user_id'] = $userId;
-        }
-
-        $sourceId = isset($params['source_id']) ? $params['source_id'] : 0;
-        if ($sourceId > 0) {
-            $where['a.source_id'] = $sourceId;
-        }
-
-        $query = $this->model->with(['member','supervisor'])->from('supervisors_consult_records as a')
-            ->leftJoin('member as b','b.id','=','a.user_id')
-            ->where($where)
-            ->where(function ($query) use ($params) {
-                $keyword = isset($params['keyword']) ? $params['keyword'] : '';
-                if ($keyword) {
-                    $query->where('a.realname', 'like', "%{$keyword}%")
-                        ->orWhere('a.mobile', 'like', "%{$keyword}%");
-                }
-            })
-            ->where(function ($query) use ($params) {
-                $date = isset($params['date'])?$params['date']:[];
-                $start = isset($date[0])?$date[0]: '';
-                $end = isset($date[1])?$date[1]: '';
-                if ($start) {
-                    $query->where('a.create_time', '>=', strtotime($start));
-                }
-                if ($end && $start < $end) {
-                    $query->where('a.create_time', '<=', strtotime($end));
-                }else if ($end && $start == $end) {
-                    $query->where('a.create_time', '<', strtotime($end)+86400);
-                }
-            })
-            ->select(['a.*']);
-
-        $query->orderBy('a.id', 'desc');
-        $list = $query->paginate($pageSize > 0 ? $pageSize : 9999999);
-        $list = $list ? $list->toArray() : [];
-        if ($list) {
-            foreach ($list['data'] as &$item) {
-                $item['create_time'] = $item['create_time'] ? datetime($item['create_time'], 'Y-m-d H.i.s') : '';
-            }
-        }
-
-        return [
-            'msg' => '操作成功',
-            'code' => 0,
-            'data' => isset($list['data']) ? $list['data'] : [],
-            'count' => isset($list['total']) ? $list['total'] : 0,
-        ];
-    }
-
-    /**
-     * 删除
-     * @return array
-     */
-    public function delete()
-    {
-        $this->model->where(['mark'=>0])->where('update_time','<', time() - 600)->delete();
-        return parent::delete(); // TODO: Change the autogenerated stub
-    }
-
-    /**
-     * 处理状态
-     * @param int $adminId
-     * @return array
-     */
-    public function status($adminId=0)
-    {
-        $data = request()->all();
-        if (!$data['id']) {
-            return message('记录ID不能为空', false);
-        }
-        if (!$data['status']) {
-            return message('记录状态不能为空', false);
-        }
-        $error = '';
-        $item = [
-            'id' => $data['id'],
-            'status' => $data['status']
-        ];
-        if($adminId){
-            $item['admin_id'] =  $data['admin_id'];
-        }
-        $rowId = $this->model->edit($item, $error);
-        if (!$rowId) {
-            return message($error, false);
-        }
-        return message();
-    }
-}

+ 0 - 330
app/Services/Common/SupervisorsService.php

@@ -1,330 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services\Common;
-
-use App\Models\ActionLogModel;
-use App\Models\MemberModel;
-use App\Models\SupervisorsModel;
-use App\Services\BaseService;
-use App\Services\RedisService;
-
-/**
- * 导师管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Services\Common
- */
-class SupervisorsService extends BaseService
-{
-    public static $instance = null;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     */
-    public function __construct()
-    {
-        $this->model = new SupervisorsModel();
-    }
-
-    /**
-     * 静态入口
-     */
-    public static function make()
-    {
-        if (!self::$instance) {
-            self::$instance = new static();
-        }
-        return self::$instance;
-    }
-
-    /**
-     * 获取列表
-     */
-    public function getList()
-    {
-        $params = request()->all();
-        $pageSize = $params['limit'] ?? 20;
-        $where = ['supervisors.mark' => 1];
-        $query = $this->model->with(['member'])
-            ->from('supervisors')
-            ->where($where)
-            ->where(function ($query) use ($params) {
-                $keyword = isset($params['keyword']) ? $params['keyword'] : '';
-                if ($keyword) {
-                    $query->where('supervisors.name', 'like', "%{$keyword}%")->orWhere('supervisors.mobile', 'like', "%{$keyword}%");
-                }
-            })
-            ->where(function ($query) use ($params) {
-                $status = isset($params['status']) ? $params['status'] : 0;
-                if ($status > 0) {
-                    $query->where('supervisors.status',$status);
-                }
-
-                // 认证
-                $isAuth = isset($params['is_auth']) ? intval($params['is_auth']) : 0;
-                if ($isAuth) {
-                    $query->where('supervisors.is_auth', $isAuth);
-                }
-
-                // 推荐
-                $isRecommend = isset($params['is_recommend']) ? intval($params['is_recommend']) : 0;
-                if ($isRecommend) {
-                    $query->where('supervisors.is_recommend', $isRecommend);
-                }
-
-                // 类型
-                $type = isset($params['type']) ? intval($params['type']) : 0;
-                if ($type) {
-                    $query->where('supervisors.type', $type);
-                }
-            })
-            ->select(['supervisors.*'])
-            ->withCount(['consults'])
-            ->orderBy('supervisors.sort', 'desc')
-            ->orderBy('supervisors.id', 'desc');
-        $list = $query->paginate($pageSize > 0 ? $pageSize : 9999999);
-        $list = $list ? $list->toArray() : [];
-
-        if ($list) {
-            foreach ($list['data'] as &$item) {
-                $item['avatar'] = $item['avatar'] ? get_image_url($item['avatar']) : '';
-                $item['create_time_text'] = datetime($item['create_time'], 'Y-m-d H:i');
-                $item['consults_count'] = $item['consults_count']?$item['consults_count']:0;
-                $item['intro'] = $item['intro']? get_format_content($item['intro']):'';
-            }
-        }
-
-        return [
-            'code' => 0,
-            'msg' => '获取成功',
-            'data' => isset($list['data'])?$list['data']:[],
-            'count' => isset($list['total'])?$list['total']:0
-        ];
-    }
-
-    /**
-     * 搜索用户(用于下拉选择)
-     * @param string $keyword 搜索关键词
-     * @param int $accountType 账户类型
-     * @param int $limit 返回数量
-     * @return array
-     */
-    public function searchUsers($keyword = '',$limit = 20)
-    {
-        try {
-            $query = MemberModel::where('mark', 1);
-
-            // 关键词搜索:昵称、手机号、ID
-            if (!empty($keyword)) {
-                $query->where(function ($q) use ($keyword) {
-                    $q->where('id', $keyword)
-                        ->orWhere('name', 'like', "%{$keyword}%")
-                        ->orWhere('mobile', 'like', "%{$keyword}%");
-                });
-            }
-
-            $list = $query->select(['id', 'name', 'mobile', 'type'])
-                ->limit($limit)
-                ->get()
-                ->toArray();
-
-            // 转换为数组(如果是对象)
-            $list = json_decode(json_encode($list), true);
-
-            return [
-                'code' => 0,
-                'msg' => '获取成功',
-                'data' => $list
-            ];
-        } catch (\Exception $e) {
-            return [
-                'code' => 1,
-                'msg' => '搜索失败:' . $e->getMessage(),
-                'data' => []
-            ];
-        }
-    }
-
-    /**
-     * 用户选项
-     * @return array
-     */
-    public function options()
-    {
-        // 获取参数
-        $param = request()->all();
-        // 用户ID
-        $keyword = getter($param, "keyword");
-        $id = getter($param, "id");
-        $datas = $this->model->where(['status' => 1, 'mark' => 1])
-            ->where(function ($query) use ($id) {
-                if ($id) {
-                    $query->whereNotIn('id', [$id]);
-                }
-            })
-            ->where(function ($query) use ($keyword) {
-                if ($keyword) {
-                    $query->where('name', 'like', "%{$keyword}%")->orWhere('mobile', 'like', "%{$keyword}%");
-                }
-            })
-            ->select(['id', 'name', 'mobile', 'type', 'status'])
-            ->get();
-
-        return $datas ? $datas->toArray() : [];
-    }
-
-    /**
-     * 编辑
-     * @return array
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function edit()
-    {
-        // 请求参数
-        $data = request()->all();
-        $id = isset($data['id']) ? $data['id'] : 0;
-
-        // 头像处理
-        if (isset($data['avatar']) && $data['avatar']) {
-            $data['avatar'] = get_image_path(trim($data['avatar']));
-        }
-
-        // 手机号唯一性验证
-        $name = isset($data['name']) ? trim($data['name']) : '';
-        if ($name) {
-            $checkId = $this->model->where(['name' => $name, 'mark' => 1])->value('id');
-            if ($checkId && ($id != $checkId)) {
-                return message('导师已存在', false);
-            }
-        }
-
-        $data['user_id'] = isset($data['user_id']) ? intval($data['user_id']) : 0;
-        if ($data['user_id']) {
-            $checkId = $this->model->where(['user_id' => $data['user_id'], 'mark' => 1])->value('id');
-            if ($checkId && ($id != $checkId)) {
-                return message('该会员账号已绑定其他导师', false);
-            }
-        }
-
-
-        // 处理数值类型字段
-        if (isset($data['status'])) {
-            $data['status'] = (int)$data['status'];
-        }
-
-        // 设置日志
-        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => '编辑导师信息', 'content' => json_encode($data, 256), 'module' => 'admin']);
-        ActionLogModel::record();
-        return parent::edit($data);
-    }
-
-    /**
-     * 设置状态
-     */
-    public function status()
-    {
-        $params = request()->all();
-        $id = $params['id'] ?? 0;
-        $status = $params['status'] ?? 1;
-        $member = $this->model->where('id', $id)
-            ->where('mark', 1)
-            ->first();
-
-        if (!$member) {
-            return ['code' => 1, 'msg' => '记录不存在'];
-        }
-
-        $member->status = $status;
-        $member->update_time = time();
-        $member->save();
-        return ['code' => 0, 'msg' => '设置成功'];
-    }
-
-    /**
-     * 设置推荐
-     */
-    public function recommend()
-    {
-        $params = request()->all();
-        $id = $params['id'] ?? 0;
-        $status = $params['is_recommend'] ?? 1;
-        $member = $this->model->where('id', $id)
-            ->where('mark', 1)
-            ->first();
-
-        if (!$member) {
-            return ['code' => 1, 'msg' => '记录不存在'];
-        }
-
-        $member->is_recommend = $status;
-        $member->update_time = time();
-        $member->save();
-        return ['code' => 0, 'msg' => '设置成功'];
-    }
-
-    /**
-     * 设置认证
-     */
-    public function auth()
-    {
-        $params = request()->all();
-        $id = $params['id'] ?? 0;
-        $status = $params['is_auth'] ?? 1;
-        $member = $this->model->where('id', $id)
-            ->where('mark', 1)
-            ->first();
-
-        if (!$member) {
-            return ['code' => 1, 'msg' => '记录不存在'];
-        }
-
-        $member->is_auth = $status;
-        $member->update_time = time();
-        $member->save();
-        return ['code' => 0, 'msg' => '设置成功'];
-    }
-
-    /**
-     * 删除
-     * @return array
-     */
-    public function delete()
-    {
-        $id = request()->input('id');
-        // 删除数据
-        $this->model->where('mark', 1)->where('update_time','<=', 600)->delete();
-        if (is_array($id)) {
-            // 批量删除
-            $count = $this->model->whereIn('id', $id)
-                ->where('mark', 1)
-                ->update(['mark' => 0, 'update_time' => time()]);
-            return ['code' => 0, 'msg' => "成功删除{$count}条记录"];
-        } else {
-            // 单个删除
-            $info =  $this->model->where('id', $id)
-                ->where('mark', 1)
-                ->first();
-
-            if (!$info) {
-                return ['code' => 1, 'msg' => '记录不存在'];
-            }
-
-            $info->mark = 0;
-            $info->update_time = time();
-            $info->save();
-            return ['code' => 0, 'msg' => '删除成功'];
-        }
-    }
-}