Company.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class Company extends Model
  5. {
  6. // 表名
  7. protected $name = 'company';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = false;
  10. // 定义时间戳字段名
  11. protected $createTime = false;
  12. protected $updateTime = false;
  13. protected $deleteTime = false;
  14. // 追加属性
  15. protected $append = [
  16. 'wechat_encode_text',
  17. 'pay_weixin_open_text',
  18. 'pay_routine_open_text',
  19. 'wx_open_platform_text'
  20. ];
  21. public function getWechatEncodeList()
  22. {
  23. return ['0' => __('Wechat_encode 0'), '1' => __('Wechat_encode 1'), '2' => __('Wechat_encode 2')];
  24. }
  25. public function getPayWeixinOpenList()
  26. {
  27. return ['0' => __('Pay_weixin_open 0'), '1' => __('Pay_weixin_open 1')];
  28. }
  29. public function getPayRoutineOpenList()
  30. {
  31. return ['0' => __('Pay_routine_open 0'), '1' => __('Pay_routine_open 1')];
  32. }
  33. public function getWxOpenPlatformList()
  34. {
  35. return ['0' => __('Wx_open_platform 0'), '1' => __('Wx_open_platform 1')];
  36. }
  37. public function getWechatEncodeTextAttr($value, $data)
  38. {
  39. $value = $value ? $value : (isset($data['wechat_encode']) ? $data['wechat_encode'] : '');
  40. $list = $this->getWechatEncodeList();
  41. return isset($list[$value]) ? $list[$value] : '';
  42. }
  43. public function getPayWeixinOpenTextAttr($value, $data)
  44. {
  45. $value = $value ? $value : (isset($data['pay_weixin_open']) ? $data['pay_weixin_open'] : '');
  46. $list = $this->getPayWeixinOpenList();
  47. return isset($list[$value]) ? $list[$value] : '';
  48. }
  49. public function getPayRoutineOpenTextAttr($value, $data)
  50. {
  51. $value = $value ? $value : (isset($data['pay_routine_open']) ? $data['pay_routine_open'] : '');
  52. $list = $this->getPayRoutineOpenList();
  53. return isset($list[$value]) ? $list[$value] : '';
  54. }
  55. public function getWxOpenPlatformTextAttr($value, $data)
  56. {
  57. $value = $value ? $value : (isset($data['wx_open_platform']) ? $data['wx_open_platform'] : '');
  58. $list = $this->getWxOpenPlatformList();
  59. return isset($list[$value]) ? $list[$value] : '';
  60. }
  61. }