// +---------------------------------------------------------------------- namespace app\model\wechat; /** * 微信模型 */ class Wechat extends \think\Model { public static $fieldlist = [ ['name' => 'title', 'title' => '名称', 'type' => 'text', 'is_must' => 1, 'help' => '微信名称'], ['name' => 'type', 'title' => '微信类型', 'type' => 'select', 'is_must' => 1, 'option' => [['key' => 1, 'label' => '公众号'],['key' => 2, 'label' => '小程序'],['key' => 3, 'label' => '企业号']], 'help' => 'AppID'], ['name' => 'app_id', 'title' => '微信APPID', 'type' => 'text', 'is_must' => 1, 'help' => 'AppID'], ['name' => 'secret', 'title' => '微信秘钥', 'type' => 'text', 'help' => 'AppSecret'], ['name' => 'token', 'title' => '微信Token', 'type' => 'text', 'help' => 'Token'], ['name' => 'aes_key', 'title' => 'EncodingAESKey', 'type' => 'text', 'help' => 'EncodingAESKey,兼容与安全模式下请一定要填写!!!'], ]; protected function getTypeTextAttr($value, $data){ $type = self::$fieldlist[1]['option']; $type_text = ""; foreach($type as $val){ if($data['type'] && $data['type'] == $val['key']){ $type_text = $val['label']; } } return $type_text; } }