UserLikeModel.php
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: pl125 <xskjs888@163.com>
// +----------------------------------------------------------------------
namespace api\user\model;
use api\common\model\CommonModel;
class UserLikeModel extends CommonModel
{
/**
* url 自动转化
* @param $value
* @return string
*/
public function getUrlAttr($value)
{
$url = json_decode($value, true);
if (!empty($url)) {
$url = url($url['action'], $url['param'], true, true);
} else {
$url = '';
}
return $url;
}
/**
* thumbnail 自动转化图片地址为绝对地址
* @param $value
* @return string
*/
public function getThumbnailAttr($value)
{
if (!empty($value)) {
$value = cmf_get_image_url($value);
}
return $value;
}
}