api/Wms gzt_bind 增加 error 日志

This commit is contained in:
liufumingren 2026-08-28 19:55:57 +08:00
parent 42dd50e1ef
commit dd39b4d287

View File

@ -317,15 +317,18 @@ class Wms extends Api
}
public function gzt_bind(){
$params=$this->request->post();
\think\Log::error("[gzt_bind] 入参: " . json_encode($params, JSON_UNESCAPED_UNICODE));
$GztModel = new \app\common\model\wms\Gzt;
$WAREHOUSEID = $this->auth->warehouseid;
$gzt = $GztModel->where(['id'=>$params["id"],"wareHouseId"=>$WAREHOUSEID,"type"=>2])->find();
if(!$gzt){
\think\Log::error("[gzt_bind] 工作台不存在或类型错误: id={$params['id']} wareHouseId={$WAREHOUSEID}");
$this->error("工作台不存在,或工作台是团购类型");
}
$sid = $this->redis->get("bindcode_".$params["code"]);
$sid2 = $this->redis->get("gzt_".$gzt["id"]);
if(!$sid){
\think\Log::error("[gzt_bind] 无记录或二维码已失效: code={$params['code']} gzt_id={$gzt['id']}");
$this->error('无记录或二维码已失效');
}else{
$uuid = Random::uuid();
@ -341,6 +344,10 @@ class Wms extends Api
$options = [];
$urlEncodedString = http_build_query($requsetData);
$req = Http::sendRequest($url, $urlEncodedString, 'POST', $options);
\think\Log::error("[gzt_bind] binded 请求结果: " . json_encode($req, JSON_UNESCAPED_UNICODE));
if(!$req['ret']){
\think\Log::error("[gzt_bind] binded 发送失败: " . json_encode($req, JSON_UNESCAPED_UNICODE));
}
if($sid2){
$requsetData = [
'sid'=>$sid2,
@ -349,6 +356,10 @@ class Wms extends Api
];
$urlEncodedString = http_build_query($requsetData);
$req = Http::sendRequest($url, $urlEncodedString, 'POST', $options);
\think\Log::error("[gzt_bind] cheakBind 请求结果: " . json_encode($req, JSON_UNESCAPED_UNICODE));
if(!$req['ret']){
\think\Log::error("[gzt_bind] cheakBind 发送失败: " . json_encode($req, JSON_UNESCAPED_UNICODE));
}
}
$this->success('绑定成功');
}