|
|
|
@ -256,7 +256,15 @@ class SupplyDemandController extends CommonController
|
|
|
|
'supply_demand_id' => $all['supply_demand_id'] ?? 0
|
|
|
|
'supply_demand_id' => $all['supply_demand_id'] ?? 0
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
// 增加联系次数
|
|
|
|
// 增加联系次数
|
|
|
|
SupplyDemand::where('id', $all['supply_demand_id'])->increment('contact_count');
|
|
|
|
if (isset($all['supply_demand_id'])) {
|
|
|
|
|
|
|
|
SupplyDemand::where('id', $all['supply_demand_id'])->increment('contact_count');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 存在对话,如果也存在供需信息id,则更新供需id到最新
|
|
|
|
|
|
|
|
if (isset($all['supply_demand_id'])) {
|
|
|
|
|
|
|
|
$dialogue->supply_demand_id = $all['supply_demand_id'];
|
|
|
|
|
|
|
|
$dialogue->save();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isset($all['supply_demand_id'])) {
|
|
|
|
if (isset($all['supply_demand_id'])) {
|
|
|
|
$now = date('Y-m-d');
|
|
|
|
$now = date('Y-m-d');
|
|
|
|
@ -335,9 +343,11 @@ class SupplyDemandController extends CommonController
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 获取会话id
|
|
|
|
// 获取会话id
|
|
|
|
$dialogue = Dialogue::where('user_id', $this->getUserId())
|
|
|
|
$dialogue = Dialogue::where(function ($query) use ($all) {
|
|
|
|
->where('to_user_id', $all['to_user_id'])
|
|
|
|
$query->where('user_id', $this->getUserId())->where('to_user_id', $all['to_user_id']);
|
|
|
|
->first();
|
|
|
|
})->orWhere(function ($query) use ($all) {
|
|
|
|
|
|
|
|
$query->where('user_id', $all['to_user_id'])->where('to_user_id', $this->getUserId());
|
|
|
|
|
|
|
|
})->first();
|
|
|
|
if (empty($dialogue)) {
|
|
|
|
if (empty($dialogue)) {
|
|
|
|
return $this->fail([ResponseCode::ERROR_BUSINESS, '会话不存在']);
|
|
|
|
return $this->fail([ResponseCode::ERROR_BUSINESS, '会话不存在']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|