| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- // +----------------------------------------------------------------------
- // | likeadmin快速开发前后端分离管理后台(PHP版)
- // +----------------------------------------------------------------------
- // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
- // | 开源版本可自由商用,可去除界面版权logo
- // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
- // | github下载:https://github.com/likeshop-github/likeadmin
- // | 访问官网:https://www.likeadmin.cn
- // | likeadmin团队 版权所有 拥有最终解释权
- // +----------------------------------------------------------------------
- // | author: likeadminTeam
- // +----------------------------------------------------------------------
- namespace app\common\model;
- use app\common\model\BaseModel;
- use app\common\model\dict\DictData;
- use think\facade\Cache;
- /**
- * MasterWorkerRegister模型
- * Class MasterWorkerRegister
- * @package app\common\model
- */
- class MasterWorkerRegister extends BaseModel
- {
-
- protected $name = 'master_worker_register';
- public function getMaintainExpTypeTextAttr($value,$data):string{
- $default = Cache::get('WORKER_EXP_TYPE');
- if (!$default) {
- $status = DictData::whereIn('type_value', 'worker_exp_type')->column('name','value');
- Cache::set('WORKER_EXP_TYPE', json_encode($status,true),5);
- } else {
- $status = json_decode($default,true);
- }
- return $status[$data['maintain_exp_type']] ?? '';
- }
- public function getOtherExpTypeTextAttr($value,$data):string{
- $default = Cache::get('WORKER_OTHER_EXP_TYPE');
- if (!$default) {
- $status = DictData::whereIn('type_value', 'worker_other_exp_type')->column('name','value');
- Cache::set('WORKER_OTHER_EXP_TYPE', json_encode($status,true),5);
- } else {
- $status = json_decode($default,true);
- }
- return $status[$data['other_exp_type']] ?? '';
- }
- public function getCityTextAttr($value,$data):string{
- $default = Cache::get('CITY');
- if (!$default) {
- $status = DictData::whereIn('type_value', 'city')->column('name','value');
- Cache::set('CITY', json_encode($status,true),5);
- } else {
- $status = json_decode($default,true);
- }
- return $status[$data['city']] ?? '';
- }
- public function getVehicleTypeTextAttr($value,$data):string{
- $default = Cache::get('WORKER_VEHICLE_TYPE');
- if (!$default) {
- $status = DictData::whereIn('type_value', 'worker_vehicle_type')->column('name','value');
- Cache::set( 'WORKER_VEHICLE_TYPE', json_encode($status,true),5);
- } else {
- $status = json_decode($default,true);
- }
- return $status[$data['vehicle_type']] ?? '';
- }
- }
|