12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\sys\controller;
- use app\model\OutCallSetting;
- use think\facade\View;
- class Haoxiaoyun
- {
- /**
- * 设置页面
- *
- * @return String
- */
- public function setting()
- {
- $setting = OutCallSetting::where(['root_id' => 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' => '保存成功']);
- }
- }
|