更新字段
This commit is contained in:
parent
ebb03938e5
commit
6b294d9571
@ -89,6 +89,14 @@ class TaskController extends BaseApiController
|
||||
return $this->success('ok');
|
||||
}
|
||||
|
||||
/**
|
||||
* 入股
|
||||
*/
|
||||
public function shareholder(){
|
||||
$parmas = $this->request->param();
|
||||
$task = TaskLogic::detail($parmas);
|
||||
return $this->success('ok', $task);
|
||||
}
|
||||
/**
|
||||
* 三轮车详情
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ class TaskLogic extends BaseLogic
|
||||
{
|
||||
try {
|
||||
$time=strtotime(date('Y-m-d'));
|
||||
$TaskSchedulingPlan=TaskSchedulingPlan::create([
|
||||
$TaskSchedulingPlan_data=[
|
||||
'create_user_id' => 0,
|
||||
'company_id' => $v['company_id'],
|
||||
'template_id' => $v['id'],
|
||||
@ -83,7 +83,47 @@ class TaskLogic extends BaseLogic
|
||||
'end_time' => $time+86399,
|
||||
'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'=>['moeny'=>$v['recharge'],'over_decimal'=>$v['over_decimal'],'count_moeny'=>$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'],
|
||||
'scheduling_plan_id' => $TaskSchedulingPlan['id'],
|
||||
|
@ -98,6 +98,7 @@ class TaskTemplateLogic extends BaseLogic
|
||||
'proportion_one' => $params['proportion_one']??0,
|
||||
'stage_day_two' => $params['stage_day_two']??0,
|
||||
'proportion_two' => $params['proportion_two']??0,
|
||||
'recharge' => $params['recharge']??0,
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
@ -173,6 +174,7 @@ class TaskTemplateLogic extends BaseLogic
|
||||
'proportion_one' => $params['proportion_one']??0,
|
||||
'stage_day_two' => $params['stage_day_two']??0,
|
||||
'proportion_two' => $params['proportion_two']??0,
|
||||
'recharge' => $params['recharge']??0,
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user