任务代码更新

This commit is contained in:
mkm 2023-08-08 12:04:15 +08:00
parent 65ba131190
commit 37d21a36ac
16 changed files with 921 additions and 82 deletions

View File

@ -158,83 +158,4 @@ class AdminController extends BaseAdminController
$result = AdminLogic::editSelf($params);
return $this->success('操作成功', [], 1, 1);
}
// /**生成合同 */
public function Draftingcontracts()
{
$params = Request::param();
$result = AdminLogic::detail($params);
if ($result && $result['contract'] && $result['contract']['file'] != '') {
$data = [
'name' => $result['name'] . '合同',
'signatories' => [
['fullName' => $result['name'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['account'], 'noNeedVerify' => 1, 'signLevel' => 1],
['fullName' => $result['contract']['party_a_info']['company_name'], 'identityType' => 12, 'identityCard' => $result['contract']['party_a_info']['organization_code'], 'email' => $result['contract']['party_a_info']['master_email'], 'noNeedVerify' => 1, 'signLevel' => 1]
],
'url' => $result['contract']['file']
];
$res = app(JunziqianController::class)->Signing($data,$result['contract']['id']);
if ($res->success == true) {
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data]);
$data = array(
"applyNo" => $res->data, //TODO *
"fullName" => $result['name'], //TODO *
"identityCard" => $result['id_card'], //TODO *
"identityType" => 1, //TODO *
);
$res = app(JunziqianController::class)->SigningLink($data);
if ($res->success == true) {
Db::name('contract')->where('id', $result['contract']['id'])->update(['url' => $res->data]);
//发送短信
$sms = [
'mobile' => $result['phone'],
'name' => $result['name'],
'type' => '《' . $result['contract']['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id=' . $result['contract']['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return $this->success('发送成功');
} else {
return $this->fail(SmsLogic::getError());
}
} else {
return $this->fail($res->msg);
}
return $this->success('生成合同成功', [], 1, 1);
} else {
return $this->fail($res->msg);
}
} else {
return $this->fail('生成合同成功失败,联系管理员');
}
}
//**发送短信 */
public function postsms()
{
$params = Request::param();
$admin=Db::name('admin')->where('id',$params['id'])->find();
$find = Db::name('contract')->where('party_b', $params['id'])
->withAttr('contract_type_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
})
->find();
if ($find && $find['url'] != '') {
//发送短信
$sms = [
'mobile' => $admin['phone'],
'name' => $admin['name'],
'type' => '《' . $find['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id=' . $find['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return $this->success('发送成功');
} else {
return $this->fail(SmsLogic::getError());
}
}
}
}

View File

@ -0,0 +1,109 @@
<?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\task_scheduling;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\task_scheduling\TaskSchedulingLists;
use app\common\logic\task_scheduling\TaskSchedulingLogic;
use app\adminapi\validate\task_scheduling\TaskSchedulingValidate;
/**
* 任务公司排期控制器
* Class TaskSchedulingController
* @package app\adminapi\controller\task_scheduling
*/
class TaskSchedulingController extends BaseAdminController
{
/**
* @notes 获取任务公司排期列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function lists()
{
return $this->dataLists(new TaskSchedulingLists());
}
/**
* @notes 添加任务公司排期
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function add()
{
$params = (new TaskSchedulingValidate())->post()->goCheck('add');
$params['create_user_id']=$this->adminId;
$result = TaskSchedulingLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(TaskSchedulingLogic::getError());
}
/**
* @notes 编辑任务公司排期
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function edit()
{
$params = (new TaskSchedulingValidate())->post()->goCheck('edit');
$result = TaskSchedulingLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(TaskSchedulingLogic::getError());
}
/**
* @notes 删除任务公司排期
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function delete()
{
$params = (new TaskSchedulingValidate())->post()->goCheck('delete');
TaskSchedulingLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取任务公司排期详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function detail()
{
$params = (new TaskSchedulingValidate())->goCheck('detail');
$result = TaskSchedulingLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,112 @@
<?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\task_scheduling_plan;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\task_scheduling_plan\TaskSchedulingPlanLists;
use app\common\logic\task_scheduling_plan\TaskSchedulingPlanLogic;
use app\adminapi\validate\task_scheduling_plan\TaskSchedulingPlanValidate;
/**
* 任务排期日历控制器
* Class TaskSchedulingPlanController
* @package app\adminapi\controller\task_scheduling_plan
*/
class TaskSchedulingPlanController extends BaseAdminController
{
/**
* @notes 获取任务排期日历列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function lists()
{
return $this->dataLists(new TaskSchedulingPlanLists());
}
/**
* @notes 添加任务排期日历
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function add()
{
$params = (new TaskSchedulingPlanValidate())->post()->goCheck('add');
$params['create_user_id']=$this->adminId;
$time=strtotime($params['time']);
$params['start_time']=$time;
$params['end_time']=$time+86399;
$result = TaskSchedulingPlanLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(TaskSchedulingPlanLogic::getError());
}
/**
* @notes 编辑任务排期日历
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function edit()
{
$params = (new TaskSchedulingPlanValidate())->post()->goCheck('edit');
$result = TaskSchedulingPlanLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(TaskSchedulingPlanLogic::getError());
}
/**
* @notes 删除任务排期日历
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function delete()
{
$params = (new TaskSchedulingPlanValidate())->post()->goCheck('delete');
TaskSchedulingPlanLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取任务排期日历详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function detail()
{
$params = (new TaskSchedulingPlanValidate())->goCheck('detail');
$result = TaskSchedulingPlanLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,78 @@
<?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\lists\task_scheduling;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\task_scheduling\TaskScheduling;
use app\common\lists\ListsSearchInterface;
/**
* 任务公司排期列表
* Class TaskSchedulingLists
* @package app\adminapi\liststask_scheduling
*/
class TaskSchedulingLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function setSearch(): array
{
return [
'=' => ['create_user_id', 'template_id', 'company_id', 'type', 'status'],
];
}
/**
* @notes 获取任务公司排期列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function lists(): array
{
return TaskScheduling::where($this->searchWhere)
->with(['admin','data_type','template','company'])
->field(['id', 'create_user_id', 'template_id', 'company_id', 'type', 'status'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取任务公司排期数量
* @return int
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function count(): int
{
return TaskScheduling::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,85 @@
<?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\lists\task_scheduling_plan;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
use app\common\lists\ListsSearchInterface;
/**
* 任务排期日历列表
* Class TaskSchedulingPlanLists
* @package app\adminapi\liststask_scheduling_plan
*/
class TaskSchedulingPlanLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function setSearch(): array
{
return [
'=' => ['create_user_id', 'template_id', 'scheduling_id', 'status'],
'between_time'=> 'start_time'
];
}
/**
* @notes 获取任务排期日历列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function lists(): array
{
$where = [];
if($this->adminInfo['root']!=1){
$where[] = ['create_user_id','=',$this->adminId];
}
return TaskSchedulingPlan::where($this->searchWhere)
->where($where)
->with(['template'])
->field(['id', 'create_user_id', 'template_id', 'scheduling_id', 'start_time', 'end_time', 'status'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取任务排期日历数量
* @return int
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function count(): int
{
return TaskSchedulingPlan::where($this->searchWhere)->count();
}
}

View File

@ -56,6 +56,7 @@ class TaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterfa
{
return TaskTemplate::where($this->searchWhere)
->field(['id', 'title', 'admin_id', 'moeny', 'type', 'status', 'content'])
->with(['admin','data_type'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()

View File

@ -0,0 +1,94 @@
<?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\validate\task_scheduling;
use app\common\validate\BaseValidate;
/**
* 任务公司排期验证器
* Class TaskSchedulingValidate
* @package app\adminapi\validate\task_scheduling
*/
class TaskSchedulingValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
];
/**
* @notes 添加场景
* @return TaskSchedulingValidate
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function sceneAdd()
{
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return TaskSchedulingValidate
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function sceneEdit()
{
return $this->only(['id']);
}
/**
* @notes 删除场景
* @return TaskSchedulingValidate
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return TaskSchedulingValidate
* @author likeadmin
* @date 2023/08/08 10:08
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,94 @@
<?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\validate\task_scheduling_plan;
use app\common\validate\BaseValidate;
/**
* 任务排期日历验证器
* Class TaskSchedulingPlanValidate
* @package app\adminapi\validate\task_scheduling_plan
*/
class TaskSchedulingPlanValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
];
/**
* @notes 添加场景
* @return TaskSchedulingPlanValidate
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function sceneAdd()
{
return $this->only([]);
}
/**
* @notes 编辑场景
* @return TaskSchedulingPlanValidate
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function sceneEdit()
{
return $this->only(['id']);
}
/**
* @notes 删除场景
* @return TaskSchedulingPlanValidate
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return TaskSchedulingPlanValidate
* @author likeadmin
* @date 2023/08/08 10:34
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -39,7 +39,7 @@ class CompanyController extends BaseApiController
public function unsigned()
{
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
$query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18], 'is_contract' => 0]);
$query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18], 'is_contract' => 0])->where('id','<>',$this->userInfo['company_id']);
$count = $query->count();
$companies = $query->field('*,street street_name,area area_name,city city_name,province province_name')->select()->toArray();
return $this->success('', ['count' => $count, 'data' => $companies]);

View File

@ -170,6 +170,11 @@ class ContractLogic extends BaseLogic
$model->contract_no = time();
$model->create_time = time();
}
if($data['type']==1){
if($data['party_a'] == $data['party_b']){
return self::setError('甲方和乙方不能是同一个公司');
}
}
$model->check_status = 1;
$model->update_time = time();
$model->setAttrs($data);

View File

@ -0,0 +1,114 @@
<?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\common\logic\task_scheduling;
use app\common\model\task_scheduling\TaskScheduling;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 任务公司排期逻辑
* Class TaskSchedulingLogic
* @package app\adminapi\logic\task_scheduling
*/
class TaskSchedulingLogic extends BaseLogic
{
/**
* @notes 添加任务公司排期
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/08/08 10:08
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
TaskScheduling::create([
'create_user_id' => $params['create_user_id'],
'template_id' => $params['template_id'],
'company_id' => $params['company_id'],
'type' => $params['type'],
'status' => $params['status']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑任务公司排期
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/08/08 10:08
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
TaskScheduling::where('id', $params['id'])->update([
'create_user_id' => $params['create_user_id'],
'template_id' => $params['template_id'],
'company_id' => $params['company_id'],
'type' => $params['type'],
'status' => $params['status']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除任务公司排期
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/08/08 10:08
*/
public static function delete(array $params): bool
{
return TaskScheduling::destroy($params['id']);
}
/**
* @notes 获取任务公司排期详情
* @param $params
* @return array
* @author likeadmin
* @date 2023/08/08 10:08
*/
public static function detail($params): array
{
return TaskScheduling::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,119 @@
<?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\common\logic\task_scheduling_plan;
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
use app\common\logic\BaseLogic;
use app\common\model\task_template\TaskTemplate;
use think\facade\Db;
/**
* 任务排期日历逻辑
* Class TaskSchedulingPlanLogic
* @package app\adminapi\logic\task_scheduling_plan
*/
class TaskSchedulingPlanLogic extends BaseLogic
{
/**
* @notes 添加任务排期日历
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/08/08 10:34
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
TaskSchedulingPlan::create([
'create_user_id' => $params['create_user_id'],
'template_id' => $params['template_id'],
'scheduling_id' => $params['scheduling_id'],
'start_time' => $params['start_time'],
'end_time' => $params['end_time'],
'status' => 1
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑任务排期日历
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/08/08 10:34
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
TaskSchedulingPlan::where('id', $params['id'])->update([
'create_user_id' => $params['create_user_id'],
'template_id' => $params['template_id'],
'scheduling_id' => $params['scheduling_id'],
'start_time' => $params['start_time'],
'end_time' => $params['end_time'],
'status' => $params['status']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除任务排期日历
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/08/08 10:34
*/
public static function delete(array $params): bool
{
return TaskSchedulingPlan::destroy($params['id']);
}
/**
* @notes 获取任务排期日历详情
* @param $params
* @return array
* @author likeadmin
* @date 2023/08/08 10:34
*/
public static function detail($params): array
{
$data=TaskSchedulingPlan::findOrEmpty($params['id'])->toArray();
$data['task_info']=TaskTemplate::where('id',$data['template_id'])->with('dataType')->find();
return $data;
}
}

View File

@ -0,0 +1,52 @@
<?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\common\model\task_scheduling;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
use app\common\model\Company;
use app\common\model\dict\DictData;
use app\common\model\task_template\TaskTemplate;
use think\model\concern\SoftDelete;
/**
* 任务公司排期模型
* Class TaskScheduling
* @package app\common\model\task_scheduling
*/
class TaskScheduling extends BaseModel
{
use SoftDelete;
protected $name = 'task_scheduling';
protected $deleteTime = 'delete_time';
public function admin()
{
return $this->hasOne(Admin::class, 'id', 'create_user_id')->bind(['admin_name'=>'name']);
}
public function dataType()
{
return $this->hasOne(DictData::class, 'id', 'type')->bind(['type_name'=>'name']);
}
public function template()
{
return $this->hasOne(TaskTemplate::class, 'id', 'template_id')->bind(['template_name'=>'title']);
}
public function company()
{
return $this->hasOne(Company::class, 'id', 'company_id')->bind(['company_name']);
}
}

View File

@ -0,0 +1,46 @@
<?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\common\model\task_scheduling_plan;
use app\common\model\BaseModel;
use app\common\model\task_template\TaskTemplate;
use think\model\concern\SoftDelete;
/**
* 任务排期日历模型
* Class TaskSchedulingPlan
* @package app\common\model\task_scheduling_plan
*/
class TaskSchedulingPlan extends BaseModel
{
use SoftDelete;
protected $name = 'task_scheduling_plan';
protected $deleteTime = 'delete_time';
public function getStartTimeAttr($value)
{
return date('Y-m-d H:i:s', $value);
}
public function getEndTimeAttr($value)
{
return date('Y-m-d H:i:s', $value);
}
public function template()
{
return $this->hasOne(TaskTemplate::class, 'id', 'template_id')->bind(['template_name'=>'title']);
}
}

View File

@ -14,8 +14,9 @@
namespace app\common\model\task_template;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
use app\common\model\dict\DictData;
use think\model\concern\SoftDelete;
@ -30,5 +31,13 @@ class TaskTemplate extends BaseModel
protected $name = 'task_template';
protected $deleteTime = 'delete_time';
public function admin()
{
return $this->hasOne(Admin::class, 'id', 'admin_id')->bind(['admin_name'=>'name']);
}
public function dataType()
{
return $this->hasOne(DictData::class, 'id', 'type')->bind(['type_name'=>'name']);
}
}

@ -1 +1 @@
Subproject commit 1294ea49ff9ecc4532821f8798304816cbf8dd74
Subproject commit 9acc82cd23d807280ddd29df2117e7890094d049