Commit 53a8dafe authored by zfc's avatar zfc Committed by hujun

添加编辑客户写入记录

parent ac6563e1
......@@ -45,15 +45,21 @@ class Client extends Basic
if ($this->params['user_nick'] || $this->params['user_nick'] || $this->params['id']) {
if ($this->request->isPost()) {
if ($this->params['id']) {
//编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']);
$this->operating_records($this->params['agents_id'], $type=3, $remark='用户编辑',0,$this->params['id']);
} else {
//添加
$data['start'] = $this->user->edit($this->params);
if ($data['start'] == -1) {
$this->code = 101;
$this->msg = '该用户已存在';
}
if($data['start']==1){
$data['id']= $this->user->id;
$this->operating_records($this->params['agents_id'], $type=3, $remark='用户添加',0,$data['id']);
}else{
$this->code = 101;
$this->msg = '提交重复!';
......
......@@ -11,6 +11,7 @@ namespace app\api_broker\extend;
*/
use app\model\AAgents;
use app\model\Users;
use app\model\GOperatingRecords;
use think\Controller;
use think\Request;
use think\Response;
......@@ -96,6 +97,12 @@ class Basic extends Controller
}
}
/**
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function verifyAgentInfo()
{
$agentModel = new AAgents();
......@@ -212,7 +219,7 @@ class Basic extends Controller
}
/**
* Cors Request Header信息
* Cors Request Header信息
* @return array
*/
public static function corsRequestHander()
......@@ -227,6 +234,24 @@ class Basic extends Controller
}
/**
* 记录操作
* @param int $agents_id
* @param int $house_id
* @param string $type
* @param string $remark
* @param int $user_id
* @return bool|false|int
*/
public function operating_records($agents_id = 0, $type = '' ,$remark = '',$house_id=0,$user_id=0) {
$records = new GOperatingRecords();
$result = $records->record($agents_id, $type, $remark,$house_id,$user_id);
return $result;
}
}
......@@ -15,16 +15,15 @@ use think\Session;
class GOperatingRecords extends BaseModel
{
/**
* 行为日志记录
*
/**日志
* @param int $agents_id
* @param string $type
* @param string $remark
* @param $houses_id
* @param string $houses_id
* @param int $user_id
* @return bool|false|int
*/
public function record($agents_id = 0, $type = '' ,$remark = '', $houses_id = '')
public function record($agents_id = 0, $type = '' ,$remark = '', $houses_id = '',$user_id=0)
{
$result = false;
$agents_id = $agents_id ? $agents_id : Session::get('userId');
......@@ -41,6 +40,7 @@ class GOperatingRecords extends BaseModel
'ip' => $request->ip(),
'remark' => $remark,
'houses_id' => $houses_id,
'user_id' => $user_id,
'type' => $type,
'create_time' => date('Y-m-d H:i:s'),
];
......
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