内容模型功能完成

This commit is contained in:
2020-04-01 22:20:11 +08:00
parent 85d33da0d4
commit 9dafceb2eb
32 changed files with 415 additions and 339 deletions

View File

@@ -12,83 +12,73 @@ namespace app\controller\admin;
use app\model\Wechat as WechatM;
/**
* @title 微信公众号
* @description 微信公众号管理
* @title 微信模块
* @description 微信公众号、小程序管理
*/
class Wechat extends Base {
/**
* @title 公众号列表
* @title 微信列表
* @author huajie <banhuajie@163.com>
*/
public function index() {
// $map = array('status' => array('gt', -1));
$map = [];
// $order = "id desc";
// //获取列表数据
// $list = WechatM::where($map)->order($order)->paginate(10, false, array(
// 'query' => $this->request->param(),
// ));
$order = "id desc";
//获取列表数据
$list = WechatM::where($map)->order($order)->paginate($this->request->pageConfig);
$this->data = array(
'list' => [],
'list' => $list,
'page' => '',
);
return $this->fetch();
}
/**
* @title 新建用户行为
* @title 添加微信
* @author colin <colin@tensent.cn>
*/
public function add() {
$model = model('Action');
if ($this->request->isPost()) {
$data = input('post.');
$result = $model->save($data);
$data = $this->request->post();
$result = WechatM::create($data);
if (false != $result) {
action_log('add_action', 'Action', $result, session('user_auth.uid'));
return $this->success('添加成功!', url('index'));
return $this->success('添加成功!', url('/admin/wechat/index'));
} else {
return $this->error($model->getError());
return $this->error('添加失败!');
}
} else {
$data = array(
'keyList' => $model->fieldlist,
$this->data = array(
'keyList' => WechatM::$fieldlist
);
$this->assign($data);
$this->setMeta("添加行为");
return $this->fetch('public/edit');
return $this->fetch('admin/public/edit');
}
}
/**
* @title 编辑用户行为
* @title 修改微信
* @author colin <colin@tensent.cn>
*/
public function edit($id = null) {
$model = model('Action');
if ($this->request->isPost()) {
$data = input('post.');
$result = $model->save($data, array('id' => $data['id']));
$data = $this->request->post();
$result = WechatM::update($data, ['id' => $data['id']]);
if ($result !== false) {
action_log('edit_action', 'Action', $id, session('user_auth.uid'));
return $this->success('编辑成功!', url('index'));
return $this->success('编辑成功!', url('/admin/wechat/index'));
} else {
return $this->error($model->getError());
return $this->error('修改失败!');
}
} else {
$info = $model::where(array('id' => $id))->find();
$info = WechatM::find($id);
if (!$info) {
return $this->error("非法操作!");
}
$data = array(
$this->data = array(
'info' => $info,
'keyList' => $model->fieldlist,
'keyList' => WechatM::$fieldlist
);
$this->assign($data);
$this->setMeta("编辑行为");
return $this->fetch('public/edit');
return $this->fetch('admin/public/edit');
}
}
@@ -136,7 +126,7 @@ class Wechat extends Base {
* @title 小程序列表
* @author huajie <banhuajie@163.com>
*/
public function miniapp() {
public function pay() {
return $this->fetch();
}
/**