MasterWorkerRegister.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\common\model;
  15. use app\common\model\BaseModel;
  16. use app\common\model\dict\DictData;
  17. use think\facade\Cache;
  18. /**
  19. * MasterWorkerRegister模型
  20. * Class MasterWorkerRegister
  21. * @package app\common\model
  22. */
  23. class MasterWorkerRegister extends BaseModel
  24. {
  25. protected $name = 'master_worker_register';
  26. public function getMaintainExpTypeTextAttr($value,$data):string{
  27. $default = Cache::get('WORKER_EXP_TYPE');
  28. if (!$default) {
  29. $status = DictData::whereIn('type_value', 'worker_exp_type')->column('name','value');
  30. Cache::set('WORKER_EXP_TYPE', json_encode($status,true),5);
  31. } else {
  32. $status = json_decode($default,true);
  33. }
  34. return $status[$data['maintain_exp_type']] ?? '';
  35. }
  36. public function getOtherExpTypeTextAttr($value,$data):string{
  37. $default = Cache::get('WORKER_OTHER_EXP_TYPE');
  38. if (!$default) {
  39. $status = DictData::whereIn('type_value', 'worker_other_exp_type')->column('name','value');
  40. Cache::set('WORKER_OTHER_EXP_TYPE', json_encode($status,true),5);
  41. } else {
  42. $status = json_decode($default,true);
  43. }
  44. return $status[$data['other_exp_type']] ?? '';
  45. }
  46. public function getCityTextAttr($value,$data):string{
  47. $default = Cache::get('CITY');
  48. if (!$default) {
  49. $status = DictData::whereIn('type_value', 'city')->column('name','value');
  50. Cache::set('CITY', json_encode($status,true),5);
  51. } else {
  52. $status = json_decode($default,true);
  53. }
  54. return $status[$data['city']] ?? '';
  55. }
  56. public function getVehicleTypeTextAttr($value,$data):string{
  57. $default = Cache::get('WORKER_VEHICLE_TYPE');
  58. if (!$default) {
  59. $status = DictData::whereIn('type_value', 'worker_vehicle_type')->column('name','value');
  60. Cache::set( 'WORKER_VEHICLE_TYPE', json_encode($status,true),5);
  61. } else {
  62. $status = json_decode($default,true);
  63. }
  64. return $status[$data['vehicle_type']] ?? '';
  65. }
  66. }