更新
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'));
|
||||
// $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){
|
||||
$all=TaskTemplate::where('status',1)->where('task_scheduling',$v['id'])->limit(30)->select()->toArray();
|
||||
if($all){
|
||||
@ -49,53 +49,7 @@ class CeshiController extends BaseApiController
|
||||
}
|
||||
$company_id=[];
|
||||
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){
|
||||
halt($v);
|
||||
TaskLogic::CronAdd($vv,$v);
|
||||
}
|
||||
$company_id[]=$v['company_id'];
|
||||
|
@ -84,7 +84,6 @@ class PayNotifyLogic extends BaseLogic
|
||||
$order->pay_status = PayEnum::ISPAID;
|
||||
$order->pay_time = time();
|
||||
$order->save();
|
||||
Log::error($order->toArray());
|
||||
if($order && isset($order['extend']['type']) &&$order['extend']['type']==1){
|
||||
$find=Task::where('id',$order['extend']['task_id'])->find();
|
||||
if($find &&isset($find['extend']['shareholder'])){
|
||||
|
@ -84,45 +84,6 @@ class TaskLogic extends BaseLogic
|
||||
'sn' => User::createUserSn(),
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
//入股任务
|
||||
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 = [
|
||||
'template_id' => $v['id'],
|
||||
@ -158,6 +119,19 @@ class TaskLogic extends BaseLogic
|
||||
if ($v['type'] == 32) {
|
||||
$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);
|
||||
TaskSchedulingPlan::where('id', $TaskSchedulingPlan['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
||||
// TaskTemplate::where('id', $v['id'])->update(['cron_time' => time()]);
|
||||
|
@ -81,6 +81,9 @@ class TaskTemplateLogic extends BaseLogic
|
||||
if($params['types']!=33){
|
||||
$params['money_three']=0;
|
||||
}
|
||||
if($params['type']==35){
|
||||
$params['extend']=['shareholder'=>['user_id'=>$params['task_admin']]];
|
||||
}
|
||||
TaskTemplate::create([
|
||||
'title' => $params['title'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user