| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\workerapi\service;
- use app\common\model\bank_account\BankAccount;
- use app\common\model\master_worker\MasterWorker;
- use app\common\model\master_worker\MasterWorkerAgree;
- use app\common\model\tenant\TenantAgree;
- use app\common\model\tenant\TenantRegister;
- use app\common\model\training\TrainingWorkerTask;
- class MasterWokerTaskRequiredService
- {
- public static function learningStatus($userId) : bool
- {
- if(TrainingWorkerTask::where('master_worker_id', $userId)->value('shop_goods_id'))
- return (bool)TrainingWorkerTask::where('master_worker_id', $userId)->value('shop_orders_id');
- return true;
- }
- public static function trainingTask($userId): bool
- {
- if(TrainingWorkerTask::where('master_worker_id', $userId)->value('training_task_id'))
- return TrainingWorkerTask::where('master_worker_id', $userId)->value('training_status')==2;
- return true;
- }
- public static function operateStatus($userId): bool
- {
- return TrainingWorkerTask::where('master_worker_id', $userId)->value('operate_status')==1;
- }
- public static function bankStatus($userId): bool
- {
- return (bool)BankAccount::where('worker_id',$userId)->where('audit_state',1)->value('id');
- }
- public static function categoryStatus($userId): bool
- {
- return (bool)MasterWorker::where('id',$userId)->value('category_ids');
- }
- public static function serviceStatus($userId): bool
- {
- $masterWorker = MasterWorker::where('id',$userId)->find();
- return !((empty($masterWorker['lon']) || empty($masterWorker['lat'])));
- }
- public static function tenantRegisterStatus($userId): bool
- {
- $masterWorker = MasterWorker::where('id',$userId)->find();
- return (bool)TenantRegister::where('mobile', $masterWorker['mobile'])->value('status');
- }
- public static function tenantAgreeStatus($userId): bool
- {
- return (bool)TenantAgree::where('worker_id',$userId)->where('audit_state',1)->value('id');
- }
- public static function harmlessAgreeStatus($userId): bool
- {
- return (bool)MasterWorkerAgree::where(['agree_type'=>'harmless_content','worker_id'=>$userId,'audit_state'=>1])->value('id');
- }
- public static function crimeAgreeStatus($userId): bool
- {
- return (bool)MasterWorkerAgree::where(['agree_type'=>'crime_content','worker_id'=>$userId,'audit_state'=>1])->value('id');
- }
- }
|