Goods.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\admin\model\shopro\app\mplive;
  3. use app\admin\model\shopro\Common;
  4. class Goods extends Common
  5. {
  6. protected $name = 'shopro_mplive_goods';
  7. protected $append = [
  8. 'audit_status_text',
  9. 'type_text',
  10. 'price_type_text',
  11. ];
  12. /**
  13. * 类型列表
  14. *
  15. * @return array
  16. */
  17. public function typeList()
  18. {
  19. return [0 => '我的小程序', 1 => '其他小程序'];
  20. }
  21. public function auditStatusList()
  22. {
  23. return [0 => '未审核', 1 => '审核中', 2 => '审核通过', 3 => '审核失败'];
  24. }
  25. public function priceTypeList()
  26. {
  27. return [1 => '一口价', 2 => '价格区间', 3 => '折扣价'];
  28. }
  29. public function getPriceTypeTextAttr($value, $data)
  30. {
  31. $value = $value ?: ($data['price_type'] ?? null);
  32. $list = $this->priceTypeList();
  33. return isset($list[$value]) ? $list[$value] : '';
  34. }
  35. public function getAuditStatusTextAttr($value, $data)
  36. {
  37. $value = $value ?: ($data['audit_status'] ?? null);
  38. $list = $this->auditStatusList();
  39. return isset($list[$value]) ? $list[$value] : '';
  40. }
  41. }