|
|
@@ -6,6 +6,7 @@ use app\common\logic\BaseLogic;
|
|
|
use app\common\model\master_worker\MasterWorker;
|
|
|
use app\common\model\master_worker\MasterWorkerAccountLog;
|
|
|
use app\common\model\works\ServiceWork;
|
|
|
+use think\Exception;
|
|
|
use think\facade\Config;
|
|
|
|
|
|
/**
|
|
|
@@ -75,6 +76,12 @@ class MasterWorkerLogic extends BaseLogic
|
|
|
if ($user->isEmpty()) {
|
|
|
throw new \Exception('用户不存在');
|
|
|
}
|
|
|
+ if($user->work_status == 0 ){
|
|
|
+ throw new Exception('请先申请长期停单');
|
|
|
+ }
|
|
|
+ if($user->work_status == 1 ){
|
|
|
+ throw new Exception('请等待长期停单审核');
|
|
|
+ }
|
|
|
$user->is_disable = YesNoEnum::YES;
|
|
|
$user->save();
|
|
|
return true;
|
|
|
@@ -84,6 +91,28 @@ class MasterWorkerLogic extends BaseLogic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static function stopWork(int $userId)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $user = MasterWorker::findOrEmpty($userId);
|
|
|
+ if ($user->isEmpty()) {
|
|
|
+ throw new \Exception('用户不存在');
|
|
|
+ }
|
|
|
+ if($user->work_status == 1 ){
|
|
|
+ throw new Exception('请等待长期停单审核');
|
|
|
+ }
|
|
|
+ if($user->work_status == 2 ){
|
|
|
+ throw new Exception('长期停单审核通过');
|
|
|
+ }
|
|
|
+ $user->work_status = 1;
|
|
|
+ $user->save();
|
|
|
+ return true;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ self::setError($e->getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static function detail($userId): array
|
|
|
{
|
|
|
$worker = MasterWorker::field('id,sn,avatar,real_avatar,real_name,nickname,account,mobile,sex,estimate_money,user_money,earnest_money,exp,worker_number,work_status')
|