李忠征信平台后端管理系统
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.
 
 
 
 
 
 

79 lines
2.6 KiB

<?php
namespace app\admin\controller;
use app\common\controller\Backend;
use app\admin\model\content\Mainjoin;
/**
* 失信人信息主管理
*
* @icon fa fa-circle-o
*/
class Content extends Backend
{
/**
* Content模型对象
* @var \app\admin\model\Content
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\Content;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function shenhe($ids=null){
$row = $this->model->get($ids);
if ($this->request->isPost())
{
$data = $this->request->post();
$row->status = $data['row']['status'];
$row->reason = $data['row']['reason'];
//添加关联事件信息
$where['main_realname'] = $row['main_realname'];
$where['main_phone'] = $row['main_phone'];
$where['main_cardno'] = $row['main_cardno'];
$where['main_company'] = $row['main_company'];
// 获取关联信息id
$content_ids = $this->model->where($where)->whereRaw("id!={$row['id']}")->column('id');
foreach ($content_ids as $key => $value) {
$item['main_id'] = $row['id'];
$item['content_id'] = $value;
$insert[] = $item;
}
if ($row->save()) {
if($data['row']['status']==1){
if(!empty($insert)){
Mainjoin::insertAll($insert);
}
}else if($data['row']['status']==-1){
Mainjoin::where('main_id',$row['id'])->delete();
}
return $this->success("审核成功");
}
return $this->error("审核失败");
}
$this->view->assign("row", $row);
$this->view->assign("statusList", $this->model->getStatusList());
return $this->view->fetch();
}
public function change(){
$id = $this->request->post('ids');
$info = $this->model->get($id);
$info->is_hot = $info['is_hot']?0:1;
if($info->save()); return $this->success("操作成功");
return $this->error("操作失败");
}
}