Commit fecf8e47 authored by hujun's avatar hujun

操作记录

parent e2037690
......@@ -10,7 +10,9 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\GHouses;
use think\Db;
use think\Request;
......@@ -261,7 +263,33 @@ class Houses extends Basic
*/
public function getExclusive() {
if ($this->params['houses_id']) {
$this->data = $this->house->getExclusive($this->params,$this->params['houses_id']);
$this->data = $this->house->getExclusive($this->params['houses_id']);
} else {
$this->code = 101;
$this->msg = 'houses_id is null';
}
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 操作记录
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRecords()
{
if ($this->params['houses_id']) {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$field = 'id,name,remark,create_time';
$params['houses_id'] = $this->params['houses_id'];
$params['type'] = 2;
$agents = new AAgents();
$this->data = $agents->getRecords($pageNo, $pageSize,'id DESC', $field, $params);
} else {
$this->code = 101;
$this->msg = 'houses_id is null';
......
......@@ -7,7 +7,7 @@
*/
namespace app\model;
use think\Db;
class AAgents extends BaseModel
{
......@@ -82,4 +82,29 @@ public function saveList(){
return $this->alias('a')->where($params)->count();
}
/**
* 操作盘方记录
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRecords($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '')
{
$data = Db::table('g_operating_records')
->field($field)
->where($params)
->limit($pageSize)
->order($order_)
->page($pageNo)
->select();
return $data;
}
}
\ No newline at end of file
......@@ -296,14 +296,13 @@ class GHouses extends BaseModel
/**
* 获取独家方信息
*
* @param $data
* @param $houses_id
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getExclusive($data, $houses_id) {
public function getExclusive($houses_id) {
$result = $this->field('id,is_exclusive_type')->where('id',$houses_id)->where('status','<>',3)->find();
if ($result->id) {
$house_ext = $this->table('g_houses_ext')->where('house_id',$houses_id)->field('agent_start_time,agent_end_time')->find();
......
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/1/20
* Time: 17:52
*/
namespace app\model;
use think\Request;
class GOperatingRecords extends BaseModel
{
/**
* 行为日志记录
*
* @param int $agents_id
* @param array $data
* @param string $type
* @param string $remark
* @return bool|false|int
*/
public function record($agents_id = 0, $data = [],$type = '' ,$remark = '')
{
$result = false;
if ($agents_id>0) {
$request = Request::instance();
$name = db('a_agents')->where('id',$agents_id)->value('username');
$data = [
'agents_id' => $agents_id,
'name' => $name,
'request_method' => $request->method(),
'url' => $request->url(),
'data' => $data,
'ip' => $request->ip(),
'remark' => $remark,
'type' => $type,
];
$result = $this->isUpdate(false)->data($data)->save();
}
return $result;
}
}
\ No newline at end of file
......@@ -117,6 +117,7 @@ Route::group('index', [
'carefullyChosen' => ['index/houses/carefullyChosen', ['method' => 'post']], //设置精选楼盘
'editExclusive' => ['index/houses/editExclusive', ['method' => 'post']], //添加和编辑楼盘独家
'getExclusive' => ['index/houses/getExclusive', ['method' => 'get']], //获取楼盘独家
'getRecords' => ['index/houses/getRecords',['method'=>'get']], //操作记录
]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment