request()->employee->root_id, 'type' => 'haoxiaoyun'])->find(); View::assign('data', $setting); return View::fetch(); } /** * 配置 * * @return String */ public function settingSave() { // 单个企业只能设置一种外呼系统 $setting = OutCallSetting::where(['root_id' => request()->employee->root_id])->findOrEmpty(); if ($setting->isEmpty()) { $setting = new OutCallSetting; } elseif ($setting->type != 'haoxiaoyun') { $setting->delete(); $setting = new OutCallSetting; } $param = request()->only(['open', 'line_type']); // 行业获取 $data = [ 'config' => $param, 'root_id' => request()->employee->root_id, 'type' => 'haoxiaoyun' ]; $rs = $setting->save($data); if (!$rs) return json(['code' => 1, 'msg' => '保存失败']); return json(['code' => 0, 'msg' => '保存成功']); } }