更新
This commit is contained in:
parent
3a492b431f
commit
6b9912b2d8
@ -7,6 +7,7 @@ use app\common\model\Company;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use think\facade\Log;
|
||||
use app\job\TaskInformationJob;
|
||||
|
||||
class CeshiController extends BaseApiController
|
||||
{
|
||||
@ -14,6 +15,11 @@ class CeshiController extends BaseApiController
|
||||
|
||||
public function index()
|
||||
{
|
||||
$all=TaskSchedulingPlan::whereDay('start_time','yesterday')->where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
|
||||
foreach($all as $k=>$v){
|
||||
queue(TaskInformationJob::class,$v);
|
||||
}
|
||||
halt(1);
|
||||
//,'yesterday'
|
||||
$all=TaskSchedulingPlan::whereDay('end_time')->where('is_pay',0)->with(['template_info','scheduling'])->select();
|
||||
foreach($all as $k=>$data){
|
||||
|
@ -40,7 +40,7 @@ class AccountLogLogic extends BaseLogic
|
||||
* @author 段誉
|
||||
* @date 2023/2/23 12:03
|
||||
*/
|
||||
public static function add($userId, $changeType, $action, $changeAmount, string $sourceSn = '', string $remark = '', array $extra = [])
|
||||
public static function add($userId, $changeType, $action, $changeAmount, string $sourceSn = '', string $remark = '', array $extra = [],$status=1)
|
||||
{
|
||||
$user = User::findOrEmpty($userId);
|
||||
if($user->isEmpty()) {
|
||||
@ -80,6 +80,7 @@ class AccountLogLogic extends BaseLogic
|
||||
'source_sn' => $sourceSn,
|
||||
'remark' => $remark,
|
||||
'extra' => $extra,
|
||||
'status'=>$status,
|
||||
];
|
||||
return UserAccountLog::create($data);
|
||||
}
|
||||
|
@ -31,19 +31,19 @@ class ShareProfit
|
||||
//负责人
|
||||
Db::startTrans();
|
||||
try {
|
||||
$arr=[$company['user_id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC,$master_maoney_user,$data['sn'],$data['msg'].'获得收益'.$master_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion]];
|
||||
$arr=[$company['user_id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC,$master_maoney_user,$data['sn'],$data['msg'].'获得收益'.$master_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion],$data['status']];
|
||||
$this->master($arr);
|
||||
|
||||
|
||||
$arr=[$company['user_id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC,$master_maoney_user,$data['sn'],$data['msg'].'获得账户余额'.$master_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion]];
|
||||
$arr=[$company['user_id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC,$master_maoney_user,$data['sn'],$data['msg'].'获得账户余额'.$master_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion],$data['status']];
|
||||
$this->master($arr);
|
||||
|
||||
//成员
|
||||
foreach ($userAll as $key => $value) {
|
||||
$company_money+=$member_maoney_user;
|
||||
$arr=[$value['id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC,$member_maoney_user,$data['sn'],$data['msg'].'获得收益'.$member_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion]];
|
||||
$arr=[$value['id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC,$member_maoney_user,$data['sn'],$data['msg'].'获得收益'.$member_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion],$data['status']];
|
||||
$this->member($arr);
|
||||
$arr=[$value['id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC,$member_maoney_user,$data['sn'],$data['msg'].'获得账户余额'.$member_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion]];
|
||||
$arr=[$value['id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC,$member_maoney_user,$data['sn'],$data['msg'].'获得账户余额'.$member_maoney_user.'元',['company_id'=>$data['company_id'],'proportion'=>$proportion],$data['status']];
|
||||
$this->member($arr);
|
||||
}
|
||||
//公司
|
||||
@ -62,13 +62,19 @@ class ShareProfit
|
||||
* @param $data
|
||||
*/
|
||||
private function master($data){
|
||||
return AccountLogLogic::add($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6]);
|
||||
if($data[7]==1){
|
||||
User::where('id',$data[0])->inc('user_money',$data[3])->inc('deposit',$data[3])->update();
|
||||
}
|
||||
return AccountLogLogic::add($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6],$data[7]);
|
||||
}
|
||||
|
||||
/**成员分润
|
||||
* @param $data
|
||||
*/
|
||||
private function member($data){
|
||||
return AccountLogLogic::add($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6]);
|
||||
if($data[7]==1){
|
||||
User::where('id',$data[0])->inc('user_money',$data[3])->inc('deposit',$data[3])->update();
|
||||
}
|
||||
return AccountLogLogic::add($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6],$data[7]);
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ class TaskInformationJob
|
||||
// //通过这个方法可以检查这个任务已经重试了几次了
|
||||
// }
|
||||
$company = Company::where('id', $data['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足
|
||||
|
||||
$arr['status']=0;
|
||||
if ($data['template_info']['type'] == 31) {
|
||||
$task_id = explode(',', $data['task_id']);
|
||||
$task_count = Task::where('id', 'in', $task_id)->field('director_uid')->with('director_info')->select();
|
||||
@ -35,10 +35,20 @@ class TaskInformationJob
|
||||
$name_arr[$key] = $value['director_info']['nickname'];
|
||||
}
|
||||
$name = implode('、', $name_arr);
|
||||
$arr['status']=1;
|
||||
}else{
|
||||
Log::error('任务结算失败,任务id:' . $task_id);
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
$task_count = Task::where('id', $data['task_id'])->field('director_uid')->with('director_info')->find();
|
||||
if (empty($task_count)) {
|
||||
Log::error('任务结算失败,任务id:' . $data['task_id']);
|
||||
return false;
|
||||
}
|
||||
$name = $task_count['director_info']['nickname'];
|
||||
$arr['status']=1;
|
||||
|
||||
}
|
||||
if ($data['template_info']['type'] == 32) {
|
||||
$yesterday = date('Y-m-d', strtotime('-1 day', time()));
|
||||
@ -88,6 +98,9 @@ class TaskInformationJob
|
||||
$json = json_decode($res->getContent(), true);
|
||||
if ($json['status'] == 200) {
|
||||
$arr['total_price'] = $json['data']['total_price'];
|
||||
if($json['data']['total_price']>100){
|
||||
$arr['status']=1;
|
||||
}
|
||||
} else {
|
||||
$arr['total_price'] = 0;
|
||||
Log::error('获取订单金额失败:' . $json . '参数:' . json_encode($parmas));
|
||||
@ -107,7 +120,7 @@ class TaskInformationJob
|
||||
$arr['sn'] = $data['sn'];
|
||||
$arr['id'] = $data['id'];
|
||||
} catch (\Exception $e) {
|
||||
Log::error('任务结算失败:' . $e->getMessage());
|
||||
Log::error('任务结算失败:' . $e->getMessage().json_encode($data));
|
||||
return false;
|
||||
}
|
||||
(new ShareProfit())->first($arr, $company);
|
||||
|
Loading…
x
Reference in New Issue
Block a user