12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\model;
- use think\Model;
- class AgentArticle extends Model
- {
- /**
- * 图片拼接
- */
- public function getFileAttr($value)
- {
- if (empty($value)) return $value;
- $array = explode(',', $value);
- $domain = config('app.ali_oss_bindurl');
- foreach($array as &$item){
- $item = 'https://'.$domain.'/'.$item;
- }
- return $array;
- }
- public function getCoverAttr($value)
- {
- if (empty($value)) return $value;
- $domain = config('app.ali_oss_bindurl');
- $item = 'https://'.$domain.'/'.$value;
- return $item;
- }
-
- public function getAddtimeAttr($value)
- {
- if (empty($value)) return $value;
- $date = date('Y-m-d H:i:s',$value);
- return $date;
- }
- public function clue()
- {
- return $this->hasMany(CustomerClue::class, 'pipe_id', 'id');
- }
- public function setFileAttr($value){
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- public function setCoverAttr($value){
- $domain = config('app.ali_oss_bindurl');
- $search = 'https://'.$domain.'/';
- return str_replace($search, '', $value);
- }
- public function employee()
- {
- return $this->hasOne(Employee::class, 'id', 'employee_id');
- }
- }
|