Commit db00b150 authored by hujun's avatar hujun

记录客方修改记录

parent bb8c274f
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace app\index\controller; namespace app\index\controller;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\AAgents;
use app\model\Users; use app\model\Users;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowPp;
use think\Request; use think\Request;
...@@ -212,17 +213,31 @@ class Member extends Basic{ ...@@ -212,17 +213,31 @@ class Member extends Basic{
public function pcEditClient() { public function pcEditClient() {
$data = []; $data = [];
if ($this->params['user_nick'] || $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()) { if ($this->request->isPost()) {
//编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']); $user_data = $this->user->getUserById('id,agent_id', $this->params['id']);
$this->operating_records($this->userId, $type=3, $remark='用户编辑',0,$this->params['id']);
if (empty($user_data)) {
return $this->response(101, '没有用户信息');
} else { } 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 { } else {
$this->code = 101; $data['list'] = $this->user->getClient($this->params['id']);
$this->msg = 'user_nick or user_phone or id is null';
} }
return $this->response($this->code, $this->msg,$data); return $this->response($this->code, $this->msg,$data);
......
...@@ -215,11 +215,12 @@ class Basic extends Controller ...@@ -215,11 +215,12 @@ class Basic extends Controller
* @param int $agents_id * @param int $agents_id
* @param string $type * @param string $type
* @param string $remark * @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(); $records = new GOperatingRecords();
$result = $records->record($agents_id, $type, $remark); $result = $records->record($agents_id, $type, $remark, '',$user_id);
return $result; return $result;
} }
} }
\ No newline at end of file
...@@ -203,7 +203,6 @@ class Users extends Model ...@@ -203,7 +203,6 @@ class Users extends Model
$insert_data['status'] = -1; $insert_data['status'] = -1;
$insert_data['create_time'] = date('Y-m-d H:i:s'); $insert_data['create_time'] = date('Y-m-d H:i:s');
$return_id = $this->save($insert_data); $return_id = $this->save($insert_data);
$return_id = 1;
} else { } else {
$return_id = -1; $return_id = -1;
} }
...@@ -401,4 +400,22 @@ class Users extends Model ...@@ -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', ' ...@@ -4,6 +4,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
pageSize: 15, /*每页显示多少条*/ pageSize: 15, /*每页显示多少条*/
user_id : 0, user_id : 0,
urls: '', urls: '',
agent_id2 : 0,
init: function () { init: function () {
//初始化dot //初始化dot
$ ("body").append (template); $ ("body").append (template);
...@@ -96,7 +97,6 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -96,7 +97,6 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
$("#cus_fang").val(user_ht); $("#cus_fang").val(user_ht);
$(".user-ul2").html(''); $(".user-ul2").html('');
user.agent_id2 = $ (obj).attr ("data-id"); user.agent_id2 = $ (obj).attr ("data-id");
}, },
search_phone:function(){//手机号 search_phone:function(){//手机号
$.ajax ({ $.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