Commit 085bf7a8 authored by zhuwei's avatar zhuwei

客户来电记录

parent 06a246ca
<?php
namespace app\api_broker\controller;
/**
* Created by PhpStorm.
* User: zhuwei
* Date:
* Time:
*/
use app\api_broker\extend\Basic;
use app\model\AUserCallAgent;
use think\Request;
class CallAgent extends Basic
{
protected $aUserCallAgent;
public function __construct($request = null)
{
parent::__construct($request);
$this->aUserCallAgent = new AUserCallAgent();
}
public function addUserCallAgent(){
$params = $this->params;
/*$params = array(
"user_id" => 1,
"agent_id" => 4,
);*/
if (!isset($params["user_id"]) or !isset($params["agent_id"]) ) {
return $this->response("101", "请求参数错误");
}
//先判断是否已经存在数据
$insert["user_id"] = $params['user_id'];
$insert["agent_id"] = $params['agent_id'];
$insert["status"] = 0;
$res = $this->aUserCallAgent->saveUserCallAgent($insert);//int(1)
if ($res) {
return $this->response("200", "成功");
} else {
return $this->response("101", "失败");
}
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Db;
use think\Model;
class AUserCallAgent extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'a_user_call_agent';
public function saveUserCallAgent($data) {
$time = date("Y-m-d h:i:sa", time());
$data['create_time'] = $time;
$data['update_time'] = $time;
return $this->insert($data);
}
/**
* 查询数据
* 朱伟
*/
public function getUserCallAgent($field,$params)
{
$result = Db::table($this->table)
->field($field)
//->alias('a')
->where($params)
->select();
//dump($this->getLastSql());
return $result;
}
}
......@@ -632,6 +632,8 @@ Route::group('broker', [
'bargainMain' => [ 'api_broker/Bargain/bargainList', [ 'method' => 'POST|GET' ] ],
'addUserCallAgent' => [ 'api_broker/CallAgent/addUserCallAgent', [ 'method' => 'POST|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