'外呼设置'])->find(); if (!$had) { $parent = Permission::where(['auth_name' => '企业管理'])->find(); $data = [ 'pid' => $parent->id, 'auth_name' => '外呼设置', 'uri' => 'yhuatong/setting', 'is_menu' => 1, 'sort' => 53, 'relation' => 'yhuatong/setting,yhuatong/balence,yhuatong/settingSave,yhuatong/comIndustryList' ]; // 添加权限 Permission::create($data); } // 创建配置表 $this->table('out_call_setting', ['comment' => '外呼系统设置']) ->addColumn('root_id', 'integer', ['comment' => '所属企业id']) ->addColumn('type', 'string', ['comment' => '外呼系统类型']) ->addColumn('config', 'json', ['comment' => '外呼系统配置']) ->create(); // 创建通话记录表 $this->table('out_call_log', ['comment' => '外呼记录']) ->addColumn('session_id', 'string', ['comment' => '唯一标识ID']) ->addColumn('bind_num', 'string', ['comment' => '中间号']) ->addColumn('caller_num', 'string', ['comment' => '主叫']) ->addColumn('callee_num', 'string', ['comment' => '被叫']) ->addColumn('fwd_start_time', 'string', ['comment' => '外呼开始时间', 'null' => true]) ->addColumn('call_end_time', 'string', ['comment' => '通话结束时间', 'null' => true]) ->addColumn('billsec', 'integer', ['comment' => '通话时长(秒)', 'null' => true]) ->addColumn('status', 'integer', ['comment' => '通话状态 1-接通 -1-未接通 -2未拨打', 'default' => -2]) ->addColumn('call_status', 'integer', ['comment' => '释放原因', 'null' => true]) ->addColumn('employee_id', 'integer', ['comment' => '员工id']) ->addColumn('root_id', 'integer', ['comment' => '企业ID']) ->addColumn('customer_id', 'integer', ['comment' => '客户id']) ->addColumn('key', 'string', ['comment' => '录音key', 'null' => true]) ->addColumn('hash', 'string', ['comment' => '文件hash', 'null' => true]) ->addColumn('fsize', 'string', ['comment' => '文件大小', 'null' => true]) ->addColumn('url', 'string', ['comment' => '录音地址', 'null' => true]) ->addColumn('call_id', 'string', ['comment' => '呼叫id', 'null' => true]) ->addColumn('addtime', 'timestamp', ['comment' => '添加时间', 'default' => 'CURRENT_TIMESTAMP']) ->create(); // 跟踪记录添加跟踪类型 $this->table('customer_visit_log') ->addColumn('data_type', 'string', ['comment' => '多态关联类型', 'null' => true]) ->addColumn('data_id', 'integer', ['comment' => '多态关联类型id', 'null' => true]) ->update(); } }