MasterWokerTaskRequiredService.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace app\workerapi\service;
  3. use app\common\model\bank_account\BankAccount;
  4. use app\common\model\master_worker\MasterWorker;
  5. use app\common\model\master_worker\MasterWorkerAgree;
  6. use app\common\model\tenant\TenantAgree;
  7. use app\common\model\tenant\TenantRegister;
  8. use app\common\model\training\TrainingWorkerTask;
  9. class MasterWokerTaskRequiredService
  10. {
  11. public static function learningStatus($userId) : bool
  12. {
  13. if(TrainingWorkerTask::where('master_worker_id', $userId)->value('shop_goods_id'))
  14. return (bool)TrainingWorkerTask::where('master_worker_id', $userId)->value('shop_orders_id');
  15. return true;
  16. }
  17. public static function trainingTask($userId): bool
  18. {
  19. if(TrainingWorkerTask::where('master_worker_id', $userId)->value('training_task_id'))
  20. return TrainingWorkerTask::where('master_worker_id', $userId)->value('training_status')==2;
  21. return true;
  22. }
  23. public static function operateStatus($userId): bool
  24. {
  25. return TrainingWorkerTask::where('master_worker_id', $userId)->value('operate_status')==1;
  26. }
  27. public static function bankStatus($userId): bool
  28. {
  29. return (bool)BankAccount::where('worker_id',$userId)->where('audit_state',1)->value('id');
  30. }
  31. public static function categoryStatus($userId): bool
  32. {
  33. return (bool)MasterWorker::where('id',$userId)->value('category_ids');
  34. }
  35. public static function serviceStatus($userId): bool
  36. {
  37. $masterWorker = MasterWorker::where('id',$userId)->find();
  38. return !((empty($masterWorker['lon']) || empty($masterWorker['lat'])));
  39. }
  40. public static function tenantRegisterStatus($userId): bool
  41. {
  42. $masterWorker = MasterWorker::where('id',$userId)->find();
  43. return (bool)TenantRegister::where('mobile', $masterWorker['mobile'])->value('status');
  44. }
  45. public static function tenantAgreeStatus($userId): bool
  46. {
  47. return (bool)TenantAgree::where('worker_id',$userId)->where('audit_state',1)->value('id');
  48. }
  49. public static function harmlessAgreeStatus($userId): bool
  50. {
  51. return (bool)MasterWorkerAgree::where(['agree_type'=>'harmless_content','worker_id'=>$userId,'audit_state'=>1])->value('id');
  52. }
  53. public static function crimeAgreeStatus($userId): bool
  54. {
  55. return (bool)MasterWorkerAgree::where(['agree_type'=>'crime_content','worker_id'=>$userId,'audit_state'=>1])->value('id');
  56. }
  57. }