new-admin-api/app/controller/admin/common/Contract.php

91 lines
2.6 KiB
PHP

<?php
namespace app\controller\admin\common;
use app\common\repositories\common\ContractRepository;
use app\common\repositories\system\config\ConfigClassifyRepository;
use app\common\repositories\system\config\ConfigValueRepository;
use crmeb\basic\BaseController;
use think\App;
class Contract extends BaseController{
protected $repository;
public function __construct(App $app, ContractRepository $repository){
parent::__construct($app);
$this->repository = $repository;
}
/**
* Common: 获取授权及签署列表
* Author: wu-hui
* Time: 2024/07/05 11:45
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(){
[$page, $limit] = $this->getPage();
$params = $this->request->params(['title']);
$data = $this->repository->getList((array)$params,(int)$page,(int)$limit);
return app('json')->success($data);
}
/**
* Common: 配置信息 - 修改
* Author: wu-hui
* Time: 2024/07/04 17:35
* @return mixed
*/
public function setConfig(){
$config = $this->request->params([
['appid', ''],
['app_secret', ''],
['open_corp_id', ''],
['template_list', []],
]);
// 保存信息
$cid = app()->make(ConfigClassifyRepository::class)->getConfigClassifyKeyById('contract_config', '法大大合同配置');
if (!$cid) return app('json')->fail('保存失败');
app()->make(ConfigValueRepository::class)->setFormData($config,$this->request->merId());
return app('json')->success('保存成功');
}
/**
* Common: 配置获取
* Author: wu-hui
* Time: 2024/07/04 17:38
* @return mixed
*/
public function getConfig(){
$config = $this->repository->getConfig();
return app('json')->success($config);
}
/**
* Common: 获取合同下载信息
* Author: wu-hui
* Time: 2024/07/05 14:11
* @param $id
* @return mixed
*/
public function downloadInfo($id){
$result = $this->repository->getDownloadInfo($id);
return app('json')->success($result);
}
/**
* Common: 获取企业签署链接
* Author: wu-hui
* Time: 2024/07/05 17:53
* @param $id
* @return mixed
*/
public function signInfo($id){
$result = $this->repository->enterpriseSignInfo($id);
return app('json')->success($result);
}
}