diff --git a/src/Wechat/MenuItem.php b/src/Wechat/MenuItem.php index 6d3df6dd8..dbbfbd44e 100644 --- a/src/Wechat/MenuItem.php +++ b/src/Wechat/MenuItem.php @@ -40,7 +40,18 @@ public function __construct($name, $type = null, $property = null) $type !== null && $this->with('type', $type); if ($property !== null) { - $key = ($type === 'view') ? 'url' : 'key'; + switch($type){ + case 'view': + $key = 'url'; + break; + case 'media_id': + // no break + case 'view_limited': + $key = 'media_id'; + break; + default: + $key = 'key'; + } $this->with($key, $property); } }