This commit is contained in:
2020-07-15 20:56:02 +08:00
3 changed files with 9 additions and 4 deletions

View File

@@ -272,7 +272,7 @@ class Form extends Base {
* @author K先森 <77413254@qq.com> * @author K先森 <77413254@qq.com>
*/ */
public function status() { public function status() {
$id = $this->getArrayParam('id'); $id = $this->request->param('form_id', 0);
$status = input('status', '0', 'trim,intval'); $status = input('status', '0', 'trim,intval');
if (!$id) { if (!$id) {
@@ -280,7 +280,7 @@ class Form extends Base {
} }
$map['id'] = array('IN', $id); $map['id'] = array('IN', $id);
$result = db('form')->where($map)->setField('status', $status); $result = FormM::where($map)->update(['status'=>$status]);
if ($result) { if ($result) {
return $this->success("设置成功!"); return $this->success("设置成功!");
} else { } else {

View File

@@ -41,7 +41,7 @@ class Model extends \think\Model {
'title' => ['name' => 'title', 'title' => '标题', 'type' => 'text', 'length' => 200, 'extra' => '', 'remark' => '标题', 'is_show' => 1, 'is_must' => 1, 'value' => ''], 'title' => ['name' => 'title', 'title' => '标题', 'type' => 'text', 'length' => 200, 'extra' => '', 'remark' => '标题', 'is_show' => 1, 'is_must' => 1, 'value' => ''],
'category_id' => ['name' => 'category_id', 'title' => '栏目', 'type' => 'bind', 'length' => 10, 'extra' => 'category:tree', 'remark' => '栏目', 'is_show' => 1, 'is_must' => 1, 'value' => '0'], 'category_id' => ['name' => 'category_id', 'title' => '栏目', 'type' => 'bind', 'length' => 10, 'extra' => 'category:tree', 'remark' => '栏目', 'is_show' => 1, 'is_must' => 1, 'value' => '0'],
'uid' => ['name' => 'uid', 'title' => '用户UID', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '用户UID', 'is_show' => 0, 'is_must' => 1, 'value' => '0'], 'uid' => ['name' => 'uid', 'title' => '用户UID', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '用户UID', 'is_show' => 0, 'is_must' => 1, 'value' => '0'],
'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => ''], 'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => '0'],
'description' => ['name' => 'description', 'title' => '内容描述', 'type' => 'textarea', 'length' => '', 'extra' => '', 'remark' => '内容描述', 'is_show' => 1, 'is_must' => 0, 'value' => ''], 'description' => ['name' => 'description', 'title' => '内容描述', 'type' => 'textarea', 'length' => '', 'extra' => '', 'remark' => '内容描述', 'is_show' => 1, 'is_must' => 0, 'value' => ''],
'content' => ['name' => 'content', 'title' => '内容', 'type' => 'editor', 'length' => '', 'extra' => '', 'remark' => '内容', 'is_show' => 1, 'is_must' => 0, 'value' => ''], 'content' => ['name' => 'content', 'title' => '内容', 'type' => 'editor', 'length' => '', 'extra' => '', 'remark' => '内容', 'is_show' => 1, 'is_must' => 0, 'value' => ''],
'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'select', 'length' => 2, 'extra' => "-1:删除\r\n0:禁用\r\n1:正常\r\n2:待审核\r\n3:草稿", 'remark' => '数据状态', 'is_show' => 1, 'is_must' => 1, 'value' => '1'], 'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'select', 'length' => 2, 'extra' => "-1:删除\r\n0:禁用\r\n1:正常\r\n2:待审核\r\n3:草稿", 'remark' => '数据状态', 'is_show' => 1, 'is_must' => 1, 'value' => '1'],

View File

@@ -51,7 +51,12 @@
<a href="{:url('/admin/model/status', ['id'=>$item['id'], 'status'=>abs(1-$item['status'])])}" class="ajax-get">{$item['status'] ? '禁用' : '启用'}</a> <a href="{:url('/admin/model/status', ['id'=>$item['id'], 'status'=>abs(1-$item['status'])])}" class="ajax-get">{$item['status'] ? '禁用' : '启用'}</a>
<a href="{:url('/admin/model/edit', ['id'=>$item['id']])}">编辑</a> <a href="{:url('/admin/model/edit', ['id'=>$item['id']])}">编辑</a>
<a href="{:url('/admin/model/del', ['id'=>$item['id']])}" class="confirm ajax-get">删除</a> <a href="{:url('/admin/model/del', ['id'=>$item['id']])}" class="confirm ajax-get">删除</a>
<a href="{:url('/admin/content/index?model_id='.$item['id'])}">数据</a> <!--<a href="{:url('/admin/content/index?model_id='.$item['id'])}">数据</a>-->
{if $item['status']}
<a href="{:url('/admin/'.$item['name'].'/index')}">数据</a>
{else}
<a href="javascript:alert('请先启用该模型');">数据</a>
{/if}
</td> </td>
</tr> </tr>
{/volist} {/volist}