// +---------------------------------------------------------------------- namespace app\rob\model; use think\Model; class ProductCodeModel extends Model { /** * 状态名 */ public function getStatusTextAttr($value, $data) { $status = ['', '已使用', '未使用']; return $status[$data['status']]; } }