Commit 17b39dd7 authored by hujun's avatar hujun

Merge remote-tracking branch 'origin/0702-v.2.2.0' into 0702-v.2.2.0

parents 8536b8fc 8fc109b8
......@@ -27,6 +27,7 @@ use app\model\ABindingDevice;
use app\model\Agents;
use app\model\AStore;
use app\model\Regions;
use think\Exception;
use think\Session;
use think\Db;
......@@ -135,6 +136,38 @@ class Agent extends Basic
}
}
/**
* 绑定或者解绑
* @return \think\Response
*/
public function updateDevice()
{
$params = $this->request->param();
/* $params = array(
"agent_id" => 1,//解绑或者绑定的经纪人id
"id" => 1, //关系id
"operator_id" => 12,//操作人id 登陆后台的经纪人id
"is_forbidden" => 0,//0正常 1禁止
);*/
$checkResult = $this->validate($params, "VerifyValidate.verifyIsForbidden");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$aBD = new ABindingDevice();
try {
$id = $aBD->updateDevice($params);
if ($id > 0) {
return $this->response("200", "update success", [ "id" => $id ]);
} else {
return $this->response("101", "请求异常");
}
} catch (Exception $exception) {
return $this->response("101", "请求错误:" . $exception);
}
}
/**
* 新增or修改or查看
* $group_id !=0为查看
......
......@@ -13,18 +13,26 @@ class VerifyValidate extends Validate
{
protected $rule = [
'id' => 'require|number',
// 'wx_open_id' => 'require|length:10,50',
// 'source' => 'require|number',
// 'user_id' => 'require|number|gt:0',
'phone' => 'require|number',
'device_id' => 'require',
'is_forbidden' => 'require|in:0,1',
'operator_id' => 'require|number',
];
protected $message = [
'id.require' => 'id不能为空',
'phone.require' => '手机号不能为空',
'phone.number' => '手机号输入错误',
'device_id.require' => '设备号获取失败,请联系管理员',
'is_forbidden.require' => '是否绑定字段必填',
'is_forbidden.in' => '是否绑定字段值只能为0或1',
'operator_id.require' => '操作人为必填字段',
'operator_id.number' => '操作人编号只能为数字',
];
protected $scene = [
'select' => [ 'id' ],
'verifyIsForbidden' => [ 'phone', 'device_id', 'is_forbidden', 'operator_id' ],
];
}
\ No newline at end of file
......@@ -140,6 +140,7 @@ Route::group('index', [
'updateStatus' => [ 'index/agent/updateStatus', [ 'method' => 'post' ] ], //状态修改【接口】
'updateRole' => [ 'index/agent/updateRole', [ 'method' => 'post' ] ], //经纪人角色修改【接口】
'deviceList' => [ 'index/agent/deviceList', [ 'method' => 'post|get' ] ], //经纪人设备id绑定列表
'updateDevice' => [ 'index/agent/updateDevice', [ 'method' => 'post|get' ] ],//解绑或绑定经纪人设备id
//客户标签
'getULabelsList' => [ 'index/label/getULabelsList', [ '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