1
0

AgentShareLog.php 825 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class AgentShareLog extends Model
  5. {
  6. public function user()
  7. {
  8. return $this->hasOne(User::class, 'id','uid')->bind(['nickname', 'headimgurl']);
  9. }
  10. public function agentUser()
  11. {
  12. return $this->hasOne(AgentUser::class, 'agent_employee_id','employee_id')->bind(['agent_name','type']);
  13. }
  14. public function getAddtimeAttr($value)
  15. {
  16. if (empty($value)) return $value;
  17. $date = date('Y-m-d',$value);
  18. return $date;
  19. }
  20. public function getImgAttr($value)
  21. {
  22. if (empty($value)) return $value;
  23. $array = explode(',', $value);
  24. $domain = config('app.ali_oss_bindurl');
  25. foreach($array as &$item){
  26. $item = 'https://'.$domain.'/'.$item;
  27. }
  28. return $array;
  29. }
  30. }