更新
This commit is contained in:
parent
eba96151f6
commit
ff1bbc4733
@ -55,7 +55,6 @@ class TaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return TaskTemplate::where($this->searchWhere)
|
return TaskTemplate::where($this->searchWhere)
|
||||||
->field(['id', 'title', 'admin_id', 'money', 'type', 'status', 'content','stage_day_one','proportion_one','stage_day_two','proportion_two'])
|
|
||||||
->with(['admin','data_type'])
|
->with(['admin','data_type'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
|
@ -19,6 +19,7 @@ use app\common\model\task\Task;
|
|||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
use app\common\model\informationg\UserInformationg;
|
use app\common\model\informationg\UserInformationg;
|
||||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||||
|
use app\common\model\task_template\TaskTemplate;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\Log;
|
use think\facade\Log;
|
||||||
|
|
||||||
@ -71,52 +72,8 @@ class TaskLogic extends BaseLogic
|
|||||||
public static function CronAdd(array $v): bool
|
public static function CronAdd(array $v): bool
|
||||||
{
|
{
|
||||||
if ($v['template_info'] != null) {
|
if ($v['template_info'] != null) {
|
||||||
try{
|
try {
|
||||||
if ($v['template_info']['type'] == 31) {
|
|
||||||
$res = self::random_informationg($v['scheduling']['company_id']);
|
|
||||||
if(!$res){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
$task_id=[];
|
|
||||||
foreach ($res as $key => $value) {
|
|
||||||
$extend['informationg']['arr'] = $value['id'];
|
|
||||||
$extend['informationg']['arr_count'] = 1;
|
|
||||||
$extend['informationg']['create_user_id'] = $value['create_user_id'];
|
|
||||||
$extend['informationg']['update'] = 0;
|
|
||||||
$extend['informationg']['update_count'] = 0;
|
|
||||||
$arr = [
|
|
||||||
'template_id' => $v['template_id'],
|
|
||||||
'scheduling_plan_id' => $v['id'],
|
|
||||||
'company_id' => $v['scheduling']['company_id'],
|
|
||||||
'director_uid' => $value['create_user_id'],
|
|
||||||
'title' => $v['template_info']['title'],
|
|
||||||
'money' => $v['template_info']['money'],
|
|
||||||
'type' => $v['template_info']['type'],
|
|
||||||
'content' => $v['template_info']['content'],
|
|
||||||
'start_time' => strtotime($v['start_time']),
|
|
||||||
'end_time' => strtotime($v['end_time']),
|
|
||||||
"extend" => json_encode($extend),
|
|
||||||
'create_time' => time(),
|
|
||||||
'update_time' => time(),
|
|
||||||
];
|
|
||||||
$data = $arr;
|
|
||||||
if($v['company']&& $v['company']['day_count']>$v['template_info']['stage_day_one']){
|
|
||||||
$data['proportion']=$v['template_info']['proportion_two'];
|
|
||||||
}else{
|
|
||||||
$data['proportion']=$v['template_info']['proportion_one'];
|
|
||||||
}
|
|
||||||
$task_id[] = (new Task())->insertGetId($data);
|
|
||||||
}
|
|
||||||
TaskSchedulingPlan::where('id', $v['id'])->update(['task_id' => implode(',', $task_id), 'is_execute' => 1]);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
// foreach ($res as $key => $value) {
|
|
||||||
// $extend['informationg']['arr']=$value['id'];
|
|
||||||
// $extend['informationg']['arr_count']=1;
|
|
||||||
// $extend['informationg']['create_user_id']=$value['create_user_id'];
|
|
||||||
// $extend['informationg']['update']=0;
|
|
||||||
// $extend['informationg']['update_count']=0;
|
|
||||||
// }
|
|
||||||
$arr = [
|
$arr = [
|
||||||
'template_id' => $v['template_id'],
|
'template_id' => $v['template_id'],
|
||||||
'scheduling_plan_id' => $v['id'],
|
'scheduling_plan_id' => $v['id'],
|
||||||
@ -132,26 +89,48 @@ class TaskLogic extends BaseLogic
|
|||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
];
|
];
|
||||||
$data = $arr;
|
$data = $arr;
|
||||||
if($v['company']&& $v['company']['day_count']>$v['template_info']['stage_day_one']){
|
$data['money'] = self::task_money($v);
|
||||||
$data['proportion']=$v['template_info']['proportion_two'];
|
if ($v['template_info']['type'] == 32) {
|
||||||
}else{
|
$data['director_uid'] = $v['company']['user_id'];
|
||||||
$data['proportion']=$v['template_info']['proportion_one'];
|
|
||||||
}
|
|
||||||
if($v['template_info']['type'] == 32){
|
|
||||||
$data['director_uid']=$v['company']['user_id'];
|
|
||||||
}
|
}
|
||||||
$task_id = (new Task())->insertGetId($data);
|
$task_id = (new Task())->insertGetId($data);
|
||||||
TaskSchedulingPlan::where('id', $v['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
TaskSchedulingPlan::where('id', $v['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('定时任务添加失败', [$e->getMessage()]);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}catch(\Exception $e){
|
|
||||||
Log::error('定时任务添加失败',[$e->getMessage()]);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//任务金额
|
||||||
|
private static function task_money($v)
|
||||||
|
{
|
||||||
|
if ($v['template_info']['types'] == 1 || $v['template_info']['types'] == 3) {
|
||||||
|
if ($v['company'] && $v['company']['day_count'] <= $v['template_info']['stage_day_one']) {
|
||||||
|
return $v['template_info']['money'];
|
||||||
|
} else {
|
||||||
|
return $v['template_info']['money_two'];
|
||||||
|
}
|
||||||
|
} elseif ($v['template_info']['types'] == 2) {
|
||||||
|
if ($v['company'] && $v['company']['day_count'] <= $v['template_info']['stage_day_one']) {
|
||||||
|
return $v['template_info']['money'];
|
||||||
|
} elseif ($v['company'] && $v['company']['day_count'] <= $v['template_info']['stage_day_two']) {
|
||||||
|
return $v['template_info']['money_two'];
|
||||||
|
} else {
|
||||||
|
return $v['template_info']['money_three'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($v['company'] && $v['company']['day_count'] <= $v['template_info']['stage_day_one']) {
|
||||||
|
$a = $v['template_info']['money'];
|
||||||
|
} else {
|
||||||
|
$a = $v['template_info']['money_two'];
|
||||||
|
}
|
||||||
|
if($v['company'] && $v['company']['day_count']>=$v['template_info']['stage_day_two']){
|
||||||
|
TaskTemplate::where('id',$v['template_id'])->update(['status'=>0]);
|
||||||
|
}
|
||||||
|
return $a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 随机生成信息更新任务
|
* @notes 随机生成信息更新任务
|
||||||
|
@ -48,7 +48,7 @@ class TaskSchedulingPlan extends BaseModel
|
|||||||
}
|
}
|
||||||
public function templateInfo()
|
public function templateInfo()
|
||||||
{
|
{
|
||||||
return $this->hasOne(TaskTemplate::class, 'id', 'template_id');
|
return $this->hasOne(TaskTemplate::class, 'id', 'template_id')->where('status',1);
|
||||||
}
|
}
|
||||||
public function company()
|
public function company()
|
||||||
{
|
{
|
||||||
|
2
vendor/ebaoquan/junziqian_sdk
vendored
2
vendor/ebaoquan/junziqian_sdk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1294ea49ff9ecc4532821f8798304816cbf8dd74
|
Subproject commit 9acc82cd23d807280ddd29df2117e7890094d049
|
Loading…
x
Reference in New Issue
Block a user