PurchaseItemEnclosure.php 534 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace app\data\model\helpers;
  3. use think\db\Query;
  4. /**
  5. * @method Query|static show()
  6. */
  7. trait PurchaseItemEnclosure{
  8. public function getEnclosureAttr($file){
  9. $files=json_decode($file,true)?:[];
  10. foreach ($files as &$file){
  11. if(isset($file['icon'])){
  12. $file['icon']=sprintf('%s/static/images/ext/pdf.png',request()->domain());
  13. }
  14. }
  15. return $files;
  16. }
  17. public function setEnclosureAttr($file){
  18. return json_encode($file?:[],256);
  19. }
  20. }