2023-09-13 17:48:44 +08:00
|
|
|
|
<?php
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
|
|
|
|
// | 开源版本可自由商用,可去除界面版权logo
|
|
|
|
|
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
|
|
|
|
// | github下载:https://github.com/likeshop-github/likeadmin
|
|
|
|
|
// | 访问官网:https://www.likeadmin.cn
|
|
|
|
|
// | likeadmin团队 版权所有 拥有最终解释权
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | author: likeadminTeam
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace app\adminapi\controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
|
|
|
use app\adminapi\lists\ShopContractLists;
|
|
|
|
|
use app\adminapi\logic\ShopContractLogic;
|
|
|
|
|
use app\adminapi\validate\ShopContractValidate;
|
|
|
|
|
use app\api\logic\SmsLogic;
|
2023-09-13 18:45:34 +08:00
|
|
|
|
use app\common\logic\contract\ContractLogic;
|
2023-09-13 17:48:44 +08:00
|
|
|
|
use app\common\model\ShopContract;
|
|
|
|
|
use app\common\model\ShopMerchant;
|
|
|
|
|
use app\Request;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ShopContract控制器
|
|
|
|
|
* Class ShopContractController
|
|
|
|
|
* @package app\adminapi\controller
|
|
|
|
|
*/
|
|
|
|
|
class ShopContractController extends BaseAdminController
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 获取列表
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/09/13 17:01
|
|
|
|
|
*/
|
|
|
|
|
public function lists()
|
|
|
|
|
{
|
|
|
|
|
return $this->dataLists(new ShopContractLists());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 添加
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/09/13 17:01
|
|
|
|
|
*/
|
|
|
|
|
public function add()
|
|
|
|
|
{
|
|
|
|
|
$params = (new ShopContractValidate())->post()->goCheck('add');
|
|
|
|
|
$result = ShopContractLogic::add($params);
|
|
|
|
|
if (true === $result) {
|
|
|
|
|
return $this->success('添加成功', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
return $this->fail(ShopContractLogic::getError());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 编辑
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/09/13 17:01
|
|
|
|
|
*/
|
|
|
|
|
public function edit()
|
|
|
|
|
{
|
|
|
|
|
$params = (new ShopContractValidate())->post()->goCheck('edit');
|
|
|
|
|
$result = ShopContractLogic::edit($params);
|
|
|
|
|
if (true === $result) {
|
|
|
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
return $this->fail(ShopContractLogic::getError());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 删除
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/09/13 17:01
|
|
|
|
|
*/
|
|
|
|
|
public function delete()
|
|
|
|
|
{
|
|
|
|
|
$params = (new ShopContractValidate())->post()->goCheck('delete');
|
|
|
|
|
ShopContractLogic::delete($params);
|
|
|
|
|
return $this->success('删除成功', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 获取详情
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/09/13 17:01
|
|
|
|
|
*/
|
|
|
|
|
public function detail()
|
|
|
|
|
{
|
|
|
|
|
$params = (new ShopContractValidate())->goCheck('detail');
|
|
|
|
|
$result = ShopContractLogic::detail($params);
|
|
|
|
|
return $this->data($result);
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 18:45:34 +08:00
|
|
|
|
// 上传合同
|
2023-09-13 17:48:44 +08:00
|
|
|
|
public function wind_control()
|
|
|
|
|
{
|
2023-09-13 18:45:34 +08:00
|
|
|
|
$params = $this->request->param();
|
2023-09-13 17:48:44 +08:00
|
|
|
|
$file = $params['file'];
|
|
|
|
|
$res = ShopContract::where('id', $params['id'])->update(['file' => $file, 'check_status' => 2]);
|
|
|
|
|
if ($res) {
|
|
|
|
|
$find = ShopContract::where('id', $params['id'])->field('type,party_b,party_a')
|
|
|
|
|
->find()->toArray();
|
|
|
|
|
|
|
|
|
|
$find['party_a_info'] = ShopMerchant::where('id', $find['party_a'])->field('company_name name,master_phone phone')->find()->toArray();
|
|
|
|
|
$find['party_b_info'] = ShopMerchant::where('id', $find['party_b'])->field('company_name name,master_phone phone')->find()->toArray();
|
|
|
|
|
|
|
|
|
|
$a = [
|
2023-09-13 18:52:52 +08:00
|
|
|
|
'mobile' => $find['party_a_info']['phone'],
|
|
|
|
|
'name' => $find['party_a_info']['name'],
|
2023-09-13 17:48:44 +08:00
|
|
|
|
'scene' => 'WQTZ'
|
|
|
|
|
];
|
|
|
|
|
SmsLogic::contractUrl($a);
|
|
|
|
|
$b = [
|
|
|
|
|
'mobile' => $find['party_b_info']['phone'],
|
|
|
|
|
'name' => $find['party_b_info']['name'],
|
|
|
|
|
'scene' => 'WQTZ'
|
|
|
|
|
];
|
|
|
|
|
SmsLogic::contractUrl($b);
|
|
|
|
|
return $this->success('上传成功', [], 1, 1);
|
|
|
|
|
} else {
|
|
|
|
|
if ($res == 0) {
|
|
|
|
|
return $this->success('没有更新', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
return $this->fail('上传失败');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 18:45:34 +08:00
|
|
|
|
// 发送合同
|
|
|
|
|
public function Draftingcontracts()
|
|
|
|
|
{
|
|
|
|
|
$params = $this->request->param();
|
|
|
|
|
$result = ShopContractLogic::Draftingcontracts($params);
|
|
|
|
|
if ($result == true) {
|
|
|
|
|
return $this->success('生成合同成功', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
return $this->fail(ContractLogic::getError());
|
|
|
|
|
}
|
2023-09-13 17:48:44 +08:00
|
|
|
|
}
|