Commit db00b150 authored by hujun's avatar hujun

记录客方修改记录

parent bb8c274f
......@@ -2,6 +2,7 @@
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\Users;
use app\model\UPhoneFollowPp;
use think\Request;
......@@ -212,17 +213,31 @@ class Member extends Basic{
public function pcEditClient() {
$data = [];
if ($this->params['user_nick'] || $this->params['id']) {
if ($this->request->isPost()) {
//编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']);
$this->operating_records($this->userId, $type=3, $remark='用户编辑',0,$this->params['id']);
if (empty($this->params['user_nick']) || empty($this->params['id'])) {
return $this->response(101, 'user_nick or user_phone or id is null');
}
if ($this->request->isPost()) {
$user_data = $this->user->getUserById('id,agent_id', $this->params['id']);
if (empty($user_data)) {
return $this->response(101, '没有用户信息');
} else {
$data['list'] = $this->user->getClient($this->params['id']);
//是否修改客方
if ($this->params['agents_id'] != $user_data['agent_id']) {
$agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '修改客方为'.$agent_data['name'].'-'.$agent_data['phone'];
} else {
$remark = '用户编辑';
}
}
$data['start'] = $this->user->edit($this->params, $this->params['id']); //新增或编辑
$this->operating_records($this->userId, $type=3, $remark, $this->params['id']);
} else {
$this->code = 101;
$this->msg = 'user_nick or user_phone or id is null';
$data['list'] = $this->user->getClient($this->params['id']);
}
return $this->response($this->code, $this->msg,$data);
......
......@@ -130,7 +130,7 @@ class Basic extends Controller
$is_auth = $agents->agentsAuth($auth_id, $this->userId);
$is_auth = empty($is_auth['id']) ? 0:1;
}
if (empty($is_auth) && $this->userId != 1) {
if($this->request->isAjax()){
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));exit;
......@@ -215,11 +215,12 @@ class Basic extends Controller
* @param int $agents_id
* @param string $type
* @param string $remark
* @return bool|int|string
* @param string $user_id
* @return bool|false|int
*/
public function operating_records($agents_id = 0, $type = '' ,$remark = '') {
public function operating_records($agents_id = 0, $type = '' ,$remark = '', $user_id = '') {
$records = new GOperatingRecords();
$result = $records->record($agents_id, $type, $remark);
$result = $records->record($agents_id, $type, $remark, '',$user_id);
return $result;
}
}
\ No newline at end of file
......@@ -203,7 +203,6 @@ class Users extends Model
$insert_data['status'] = -1;
$insert_data['create_time'] = date('Y-m-d H:i:s');
$return_id = $this->save($insert_data);
$return_id = 1;
} else {
$return_id = -1;
}
......@@ -401,4 +400,22 @@ class Users extends Model
}
}
/**
* 通过id获取用户信息
*
* @param string $field
* @param $id
* @param string $where
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getUserById($field = '*', $id, $where = '') {
return $this->field($field)
->where('id',$id)
->where($where)
->find();
}
}
......@@ -4,6 +4,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
pageSize: 15, /*每页显示多少条*/
user_id : 0,
urls: '',
agent_id2 : 0,
init: function () {
//初始化dot
$ ("body").append (template);
......@@ -96,7 +97,6 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
$("#cus_fang").val(user_ht);
$(".user-ul2").html('');
user.agent_id2 = $ (obj).attr ("data-id");
},
search_phone:function(){//手机号
$.ajax ({
......
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