...
|
...
|
@@ -14,6 +14,11 @@ class UserSize extends Model |
|
|
protected $updateTime = 'updatetime';
|
|
|
protected $deleteTime = false;
|
|
|
|
|
|
// 追加属性
|
|
|
protected $append = [
|
|
|
'size_text'
|
|
|
];
|
|
|
|
|
|
/**
|
|
|
* 隐藏字段
|
|
|
* @var array
|
...
|
...
|
@@ -105,4 +110,36 @@ class UserSize extends Model |
|
|
{
|
|
|
return self::get(compact('user_id', 'id'));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 尺寸详情
|
|
|
*/
|
|
|
public function getSizeTextAttr($value,$data){
|
|
|
$size_text = [];
|
|
|
if(!empty($data['body_info'])){
|
|
|
$size = json_decode(str_replace('\'','"',$data['body_info']),true);
|
|
|
foreach($size as $k => $v){
|
|
|
$style = Style::where('id',$k)->field('style_name,style_type')->find()->toArray();
|
|
|
$style['style_value'] = '';
|
|
|
switch ($style['style_type']) {
|
|
|
case '1':
|
|
|
$style['style_value'] = StyleValue::where('id',$v)->value('style_value_name');
|
|
|
break;
|
|
|
case '2':
|
|
|
$style['style_value'] = $v;
|
|
|
break;
|
|
|
case '3':
|
|
|
$style['style_value'] = cdnurl($v,true);
|
|
|
break;
|
|
|
}
|
|
|
$size_text[] = $style;
|
|
|
}
|
|
|
}
|
|
|
$size_text = array_merge([
|
|
|
['style_name'=>'身高','style_type'=>'1','style_value_name'=>$data['height'].'CM'],
|
|
|
['style_name'=>'体重','style_type'=>'1','style_value_name'=>$data['weight'].'KG'],
|
|
|
['style_name'=>'腰围','style_type'=>'1','style_value_name'=>$data['waistline']],
|
|
|
],$size_text);
|
|
|
return $size_text;
|
|
|
}
|
|
|
} |
...
|
...
|
|