CertificateApply.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\common\model;
  10. use app\common\model\store\User;
  11. /**
  12. * Class CertificateApply
  13. *
  14. * @Author: Yeshihao
  15. * @DateTime: 2024/11/26 13:38
  16. * @package app\common\model
  17. */
  18. class CertificateApply extends BaseModel
  19. {
  20. protected $name = 'certificate_apply';
  21. protected $type = [
  22. 'certificate_ids' => 'array',
  23. 'result_data' => 'array',
  24. 'category_ids' => 'array',
  25. ];
  26. /**
  27. * [getStatusTextAttr]
  28. *
  29. * @Author: Yeshihao
  30. * @DateTime: 2024/11/28 10:06
  31. * @param $value
  32. * @param $data
  33. * @return string
  34. */
  35. public function getStatusTextAttr($value, $data)
  36. {
  37. $arr = [10 => '待审核', 20 => '审核通过', 30 => '审核失败'];
  38. return $arr[$data['status']] ?? '';
  39. }
  40. /**
  41. * [store]
  42. * 提交人
  43. *
  44. * @Author: Yeshihao
  45. * @DateTime: 2024/11/27 18:33
  46. * @return \think\model\relation\BelongsTo
  47. */
  48. public function storeUser()
  49. {
  50. return $this->belongsTo(User::class, 'store_user_id', 'store_user_id');
  51. }
  52. /**
  53. * [apply]
  54. * 申请人
  55. *
  56. * @Author: Yeshihao
  57. * @DateTime: 2024/11/27 18:33
  58. * @return \think\model\relation\BelongsTo
  59. */
  60. public function applyUser()
  61. {
  62. return $this->belongsTo(User::class, 'apply_user_id', 'store_user_id');
  63. }
  64. /**
  65. * 文章详情
  66. *
  67. * @param $id
  68. * @return null|static
  69. * @throws \think\exception\DbException
  70. */
  71. public static function detail($id)
  72. {
  73. return self::get($id);
  74. }
  75. /**
  76. * 软删除
  77. *
  78. * @return false|int
  79. */
  80. public function setDelete()
  81. {
  82. return $this->save(['is_delete' => 1]);
  83. }
  84. }