mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]微信菜单修改
This commit is contained in:
parent
7212d77f59
commit
b052fbab51
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Think.Admin
|
||||
// +----------------------------------------------------------------------
|
||||
@ -82,6 +83,11 @@ class Menu extends BasicAdmin {
|
||||
load_wechat('Menu')->deleteMenu();
|
||||
$this->success('删除并取消微信菜单成功!', '');
|
||||
}
|
||||
foreach ($data as &$vo) {
|
||||
if (isset($vo['content'])) {
|
||||
$vo['content'] = str_replace('"', "'", $vo['content']);
|
||||
}
|
||||
}
|
||||
if (Db::name($this->table)->where('1=1')->delete() !== false && Db::name($this->table)->insertAll($data) !== false) {
|
||||
$result = $this->_push();
|
||||
if ($result['status']) {
|
||||
@ -110,10 +116,10 @@ class Menu extends BasicAdmin {
|
||||
*/
|
||||
protected function _push() {
|
||||
$result = Db::name($this->table)
|
||||
->field('id,index,pindex,name,type,content')
|
||||
->where('status', '1')
|
||||
->order('sort ASC,id ASC')
|
||||
->select();
|
||||
->field('id,index,pindex,name,type,content')
|
||||
->where('status', '1')
|
||||
->order('sort ASC,id ASC')
|
||||
->select();
|
||||
foreach ($result as &$row) {
|
||||
empty($row['content']) && $row['content'] = uniqid();
|
||||
switch ($row['type']) {
|
||||
@ -153,4 +159,5 @@ class Menu extends BasicAdmin {
|
||||
}
|
||||
return array('status' => false, 'errmsg' => $wechat->errMsg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -231,7 +231,7 @@
|
||||
var type = $span.attr('data-type') || 'text';
|
||||
$html.find('input[name="menu-type"]').on('click', function () {
|
||||
$span.attr('data-type', this.value || 'text');
|
||||
var content = $span.attr('data-content') || '';
|
||||
var content = $span.data('content') || '';
|
||||
var html = function () {
|
||||
switch (this.value) {
|
||||
case 'customservice':
|
||||
@ -253,7 +253,7 @@
|
||||
var select = [], tpl = '<div><label class="font-noraml"><input class="cuci-radio" name="content" type="radio" {checked} value="{value}"> {title}</label></div>';
|
||||
if (!(options[content] || false)) {
|
||||
content = 'scancode_push';
|
||||
$span.attr('data-content', content);
|
||||
$span.data('content', content);
|
||||
}
|
||||
for (var i in options) {
|
||||
select.push(tpl.replace('{value}', i).replace('{title}', options[i]).replace('{checked}', (i === content) ? 'checked' : ''));
|
||||
@ -263,7 +263,7 @@
|
||||
}.call(this);
|
||||
var $html = $(html), $input = $html.find('input,textarea');
|
||||
$input.on('change keyup click', function () {
|
||||
$span.attr('data-content', $(this).val() || $(this).html());
|
||||
$span.data('content', $(this).val() || $(this).html());
|
||||
});
|
||||
$('.editor-content-input').html($html);
|
||||
}).filter('input[value="{type}"]'.replace('{type}', type)).trigger('click');
|
||||
@ -280,7 +280,7 @@
|
||||
var menudata = {};
|
||||
menudata.name = $span.text();
|
||||
menudata.type = $span.attr('data-type');
|
||||
menudata.content = $span.attr('data-content') || '';
|
||||
menudata.content = $span.data('content') || '';
|
||||
return menudata;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user