You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.7 KiB

<?php
namespace app\base\model\wechat;
use app\base\model\Base;
use think\model\concern\SoftDelete;
class WechatClassify extends Base
{
use SoftDelete;
// 设置当前模型对应的完整数据表名称
protected $table = 'base_wechat_classify';
protected $type = [
'content' => 'serialize'
];
/**
* 自定义菜单格式化
* @date 2020-10-21
*/
public function buttonFormat($name, $type, $content)
{
if ($type == 'click') {
return ['type' => $type, 'name' => $name, 'key' => $content];
} else if ($type == 'view') {
return ['type' => $type, 'name' => $name, 'url' => $content];
} else if ($type == 'scancode_push') {
return ['type' => $type, 'name' => $name, 'key' => 'rselfmenu_0_1'];
} else if ($type == 'scancode_waitmsg') {
return ['type' => $type, 'name' => $name, 'key' => 'rselfmenu_0_0'];
} else if ($type == 'pic_sysphoto') {
return ['type' => $type, 'name' => $name, 'key' => 'rselfmenu_1_0'];
} else if ($type == 'pic_photo_or_album') {
return ['type' => $type, 'name' => $name, 'key' => 'rselfmenu_1_1'];
} else if ($type == 'pic_weixin') {
return ['type' => $type, 'name' => $name, 'key' => 'rselfmenu_1_2'];
} else if ($type == 'location_select') {
return ['type' => $type, 'name' => $name, 'key' => 'rselfmenu_2_0'];
} else if ($type == 'miniprogram') {
$content = explode(' ', $content);
return ['type' => $type, 'name' => $name, 'appid' => $content[0], 'pagepath' => $content[1], 'url' => $content[2]];
}
}
}