更新
This commit is contained in:
parent
3404f9eb7a
commit
8bc511ce71
@ -38,7 +38,7 @@ class CeshiController extends BaseApiController
|
|||||||
$time=strtotime(date('Y-m-d'));
|
$time=strtotime(date('Y-m-d'));
|
||||||
// $time=strtotime(date('Y-m-d'));
|
// $time=strtotime(date('Y-m-d'));
|
||||||
// $tiem_end=$time+86399;where('cron_time','<',$time)->
|
// $tiem_end=$time+86399;where('cron_time','<',$time)->
|
||||||
$plan_all=TaskScheduling::where('status',1)->with('company_info')->select()->toArray();
|
$plan_all=TaskScheduling::where('id',99)->with('company_info')->select()->toArray();
|
||||||
foreach($plan_all as $k=>$v){
|
foreach($plan_all as $k=>$v){
|
||||||
$all=TaskTemplate::where('status',1)->where('task_scheduling',$v['id'])->limit(30)->select()->toArray();
|
$all=TaskTemplate::where('status',1)->where('task_scheduling',$v['id'])->limit(30)->select()->toArray();
|
||||||
if($all){
|
if($all){
|
||||||
@ -49,53 +49,7 @@ class CeshiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
$company_id=[];
|
$company_id=[];
|
||||||
foreach($plan_all as $k=>$v){
|
foreach($plan_all as $k=>$v){
|
||||||
|
|
||||||
foreach($v['template'] as $kkk=>$vvv){
|
|
||||||
if ($v['types'] == 1 ||$vvv['types'] == 3) {
|
|
||||||
if ($v['company_info'] && $v['company_info']['day_count'] <=$vvv['stage_day_one']) {
|
|
||||||
$res=$this->stage_inspection($v['template'],'moeny','一');
|
|
||||||
if($res==false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$res=$this->stage_inspection($v['template'],'money_two','二');
|
|
||||||
if($res==false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ($v['types'] == 2) {
|
|
||||||
if ($v['company_info']['day_count'] <=$vvv['stage_day_one']) {
|
|
||||||
$res=$this->stage_inspection($v['template'],'moeny','一');
|
|
||||||
if($res==false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} elseif ($v['company_info']['day_count'] <=$vvv['stage_day_two']) {
|
|
||||||
$res=$this->stage_inspection($v['template'],'money_two','二');
|
|
||||||
if($res==false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$res=$this->stage_inspection($v['template'],'money_three','三');
|
|
||||||
if($res==false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( $v['company_info']['day_count'] <=$vvv['stage_day_one']) {
|
|
||||||
$res=$this->stage_inspection($v['template'],'money_three','三');
|
|
||||||
if($res==false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$res=$this->stage_inspection($v['template'],'money_two','二');
|
|
||||||
if($res==false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach($v['template'] as $kk=>$vv){
|
foreach($v['template'] as $kk=>$vv){
|
||||||
halt($v);
|
|
||||||
TaskLogic::CronAdd($vv,$v);
|
TaskLogic::CronAdd($vv,$v);
|
||||||
}
|
}
|
||||||
$company_id[]=$v['company_id'];
|
$company_id[]=$v['company_id'];
|
||||||
|
@ -84,7 +84,6 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$order->pay_status = PayEnum::ISPAID;
|
$order->pay_status = PayEnum::ISPAID;
|
||||||
$order->pay_time = time();
|
$order->pay_time = time();
|
||||||
$order->save();
|
$order->save();
|
||||||
Log::error($order->toArray());
|
|
||||||
if($order && isset($order['extend']['type']) &&$order['extend']['type']==1){
|
if($order && isset($order['extend']['type']) &&$order['extend']['type']==1){
|
||||||
$find=Task::where('id',$order['extend']['task_id'])->find();
|
$find=Task::where('id',$order['extend']['task_id'])->find();
|
||||||
if($find &&isset($find['extend']['shareholder'])){
|
if($find &&isset($find['extend']['shareholder'])){
|
||||||
|
@ -70,60 +70,21 @@ class TaskLogic extends BaseLogic
|
|||||||
/**
|
/**
|
||||||
* 定时添加任务
|
* 定时添加任务
|
||||||
*/
|
*/
|
||||||
public static function CronAdd(array $v,$datas): bool
|
public static function CronAdd(array $v, $datas): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$time=strtotime(date('Y-m-d'));
|
$time = strtotime(date('Y-m-d'));
|
||||||
$TaskSchedulingPlan_data=[
|
$TaskSchedulingPlan_data = [
|
||||||
'create_user_id' => 0,
|
'create_user_id' => 0,
|
||||||
'company_id' => $v['company_id'],
|
'company_id' => $v['company_id'],
|
||||||
'template_id' => $v['id'],
|
'template_id' => $v['id'],
|
||||||
'scheduling_id' => $v['task_scheduling'],
|
'scheduling_id' => $v['task_scheduling'],
|
||||||
'start_time' => $time,
|
'start_time' => $time,
|
||||||
'end_time' => $time+86399,
|
'end_time' => $time + 86399,
|
||||||
'sn' =>User::createUserSn(),
|
'sn' => User::createUserSn(),
|
||||||
'status' => 1
|
'status' => 1
|
||||||
];
|
];
|
||||||
|
$TaskSchedulingPlan = TaskSchedulingPlan::create($TaskSchedulingPlan_data);
|
||||||
//入股任务
|
|
||||||
if($v['type']==35){
|
|
||||||
$user_ids=User::where('company_id', $v['company_id'])->where('is_captain',1)->field('id,nickname')->select();
|
|
||||||
if($user_ids){
|
|
||||||
foreach($user_ids as $u_k=>$u_v){
|
|
||||||
$find_35=Task::where('company_id', $v['company_id'])->where('id', $v['id'])->where('type',35)->where('director_uid',$u_v['id'])->where('status',3)->find();
|
|
||||||
if(!$find_35){
|
|
||||||
$TaskSchedulingPlan=TaskSchedulingPlan::create($TaskSchedulingPlan_data);
|
|
||||||
$arr = [
|
|
||||||
'template_id' => $v['id'],
|
|
||||||
'scheduling_plan_id' => $TaskSchedulingPlan['id'],
|
|
||||||
'company_id' => $v['company_id'],
|
|
||||||
'title' => $v['title'],
|
|
||||||
'money' => $v['money'],
|
|
||||||
'type' => $v['type'],
|
|
||||||
'content' => $v['content'],
|
|
||||||
'start_time' => $time,
|
|
||||||
'end_time' => $time+86399,
|
|
||||||
'create_time' => time(),
|
|
||||||
'update_time' => time(),
|
|
||||||
];
|
|
||||||
$data = $arr;
|
|
||||||
$data['money'] = 0;
|
|
||||||
$data['extend'] = json_encode(['shareholder'=>['money'=>$v['recharge'],'over_decimal'=>$v['over_decimal'],'count_money'=>$v['recharge']*count($user_ids)]]);
|
|
||||||
$data['type'] = 35;
|
|
||||||
$data['title'] = $u_v['nickname'].'的入股任务';
|
|
||||||
$data['status'] = 2;
|
|
||||||
$data['director_uid'] = $u_v['id'];
|
|
||||||
$task_id = (new Task())->insertGetId($data);
|
|
||||||
TaskSchedulingPlan::where('id', $TaskSchedulingPlan['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
Log::info('没有队长,任务下发失败'. json_encode($v));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$TaskSchedulingPlan=TaskSchedulingPlan::create($TaskSchedulingPlan_data);
|
|
||||||
$arr = [
|
$arr = [
|
||||||
'template_id' => $v['id'],
|
'template_id' => $v['id'],
|
||||||
'scheduling_plan_id' => $TaskSchedulingPlan['id'],
|
'scheduling_plan_id' => $TaskSchedulingPlan['id'],
|
||||||
@ -133,23 +94,23 @@ class TaskLogic extends BaseLogic
|
|||||||
'type' => $v['type'],
|
'type' => $v['type'],
|
||||||
'content' => $v['content'],
|
'content' => $v['content'],
|
||||||
'start_time' => $time,
|
'start_time' => $time,
|
||||||
'end_time' => $time+86399,
|
'end_time' => $time + 86399,
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
];
|
];
|
||||||
$data = $arr;
|
$data = $arr;
|
||||||
$data['money'] = self::task_money($v,$datas);
|
$data['money'] = self::task_money($v, $datas);
|
||||||
$data['extend'] = json_encode($v['extend']);
|
$data['extend'] = json_encode($v['extend']);
|
||||||
//信息更新
|
//信息更新
|
||||||
if ($v['type'] == 31) {
|
if ($v['type'] == 31) {
|
||||||
$finds=TaskTemplate::where('id', $v['id'])->field('information_count,information_day_count')->find();
|
$finds = TaskTemplate::where('id', $v['id'])->field('information_count,information_day_count')->find();
|
||||||
$update=0;
|
$update = 0;
|
||||||
if($finds['information_count']>$finds['information_day_count']){
|
if ($finds['information_count'] > $finds['information_day_count']) {
|
||||||
$day_count=$finds['information_count']-$finds['information_day_count'];
|
$day_count = $finds['information_count'] - $finds['information_day_count'];
|
||||||
if($day_count>=5){
|
if ($day_count >= 5) {
|
||||||
$update=5;
|
$update = 5;
|
||||||
}else{
|
} else {
|
||||||
$update=$day_count;
|
$update = $day_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data["extend"] = json_encode(['informationg' => ['count' => 5, 'update' => $update]]);
|
$data["extend"] = json_encode(['informationg' => ['count' => 5, 'update' => $update]]);
|
||||||
@ -158,6 +119,19 @@ class TaskLogic extends BaseLogic
|
|||||||
if ($v['type'] == 32) {
|
if ($v['type'] == 32) {
|
||||||
$data['director_uid'] = $datas['company_info']['user_id'];
|
$data['director_uid'] = $datas['company_info']['user_id'];
|
||||||
}
|
}
|
||||||
|
//入股任务
|
||||||
|
if ($v['type'] == 35) {
|
||||||
|
$user_ids = User::where('company_id', $v['company_id'])->where('is_captain', 1)->field('id,nickname')->select();
|
||||||
|
if(isset($v['extend']['shareholder'])){
|
||||||
|
$v['extend']['shareholder']['money']=$v['recharge'];
|
||||||
|
$v['extend']['shareholder']['over_decimal']=$v['over_decimal'];
|
||||||
|
foreach($user_ids as $kkk=>$vvv){
|
||||||
|
$v['extend']['shareholder']['user_list'][$kkk]=['name'=>$vvv['nickname'],'money'=>bcdiv($v['recharge'],count($user_ids),2),'time'=>$v['create_time']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['extend']=json_encode($v['extend']);
|
||||||
|
}
|
||||||
|
halt($data);
|
||||||
$task_id = (new Task())->insertGetId($data);
|
$task_id = (new Task())->insertGetId($data);
|
||||||
TaskSchedulingPlan::where('id', $TaskSchedulingPlan['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
TaskSchedulingPlan::where('id', $TaskSchedulingPlan['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
||||||
// TaskTemplate::where('id', $v['id'])->update(['cron_time' => time()]);
|
// TaskTemplate::where('id', $v['id'])->update(['cron_time' => time()]);
|
||||||
@ -168,7 +142,7 @@ class TaskLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//任务金额
|
//任务金额
|
||||||
private static function task_money($v,$datas)
|
private static function task_money($v, $datas)
|
||||||
{
|
{
|
||||||
if ($v['types'] == 1 || $v['types'] == 3) {
|
if ($v['types'] == 1 || $v['types'] == 3) {
|
||||||
if ($datas['company_info'] && $datas['company_info']['day_count'] <= $v['stage_day_one']) {
|
if ($datas['company_info'] && $datas['company_info']['day_count'] <= $v['stage_day_one']) {
|
||||||
@ -185,7 +159,7 @@ class TaskLogic extends BaseLogic
|
|||||||
return $v['money_three'];
|
return $v['money_three'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( $datas['company_info']['day_count'] <= $v['stage_day_one']) {
|
if ($datas['company_info']['day_count'] <= $v['stage_day_one']) {
|
||||||
$a = $v['money'];
|
$a = $v['money'];
|
||||||
} else {
|
} else {
|
||||||
$a = $v['money_two'];
|
$a = $v['money_two'];
|
||||||
|
@ -81,6 +81,9 @@ class TaskTemplateLogic extends BaseLogic
|
|||||||
if($params['types']!=33){
|
if($params['types']!=33){
|
||||||
$params['money_three']=0;
|
$params['money_three']=0;
|
||||||
}
|
}
|
||||||
|
if($params['type']==35){
|
||||||
|
$params['extend']=['shareholder'=>['user_id'=>$params['task_admin']]];
|
||||||
|
}
|
||||||
TaskTemplate::create([
|
TaskTemplate::create([
|
||||||
'title' => $params['title'],
|
'title' => $params['title'],
|
||||||
'admin_id' => $params['admin_id'],
|
'admin_id' => $params['admin_id'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user