isAjax()) { // 参数获取 $model = new DividemoneyAccount(); $page = input('page', 1); $page_size = input('page_size', 10); $condition = []; $condition[] = ['site_id', '=', $this->site_id]; $condition[] = ['is_system', '=', 1]; $list = $model->getDividemoneyAccountPageList($condition, $page, $page_size); return $list; } $this->forthMenu(); return $this->fetch("account/lists"); } public function add() { if (request()->isAjax()) { $channel_type = input('channel_type', ''); $account = input('account', ''); $model = new DividemoneyAccount(); $data = request()->post(); if (empty($account)) return error('请填写正确的账户'); $data['is_platform'] = 1; $data['is_system'] = 1; $data['site_id'] = $this->site_id; $data['ag_site_id'] = $this->site_id; $data['create_time'] = time(); $data['update_time'] = time(); $info = model('dividemoney_account')->getInfo(['site_id' => $this->site_id, 'channel_type' => $channel_type]); if ($info) { return error(-1, '已绑定相同类型'); } if (model('dividemoney_account')->add($data)) { return success(0, '添加成功'); } else { return error(-1, '添加失败'); } } $upload_config_model = new ConfigModel(); $upload_config_result = $upload_config_model->getDefaultImg($this->site_id, $this->app_module)['data']['value']; $this->assign("default_headimg", $upload_config_result['head']); return $this->fetch('account/add'); } public function edit() { $id = input('id', 0); if (request()->isAjax()) { $channel_type = input('channel_type', ''); $account = input('account', ''); $model = new DividemoneyAccount(); $data = request()->post(); if (empty($account)) return error('请填写正确的账户'); $data['is_platform'] = 1; $data['is_system'] = 1; $data['site_id'] = $this->site_id; $data['ag_site_id'] = $this->site_id; if ($model->where([['id', '=', $id]])->save($data)) { return success(0, '添加成功'); } else { return error(-1, '添加失败'); } } $model = new DividemoneyAccount(); $info = $model->where([['id', '=', $id]])->find(); $this->assign('info', $info['data']); return $this->fetch('account/edit'); } public function delete() { if (request()->isAjax()) { $id = input('id', 0); $info= model('dividemoney_account') ->delete([ ['id', '=', $id], ['site_id', '=', $this->site_id] ]); if ($info) { return success(0, '删除成功'); } else { return error(-1, '删除失败'); } } } }