更新
This commit is contained in:
parent
0f15fd7688
commit
c617f4b887
@ -123,9 +123,6 @@ class CompanyLogic extends BaseLogic
|
||||
'company_type'=>$params['company_type'],
|
||||
];
|
||||
TaskScheduling::create($scheduling);
|
||||
// if ($level_one > 0) {
|
||||
// $contractId = self::contract($data['id'], $params);
|
||||
// }
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -5,6 +5,7 @@ namespace app\common\logic\finance;
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\logic\AccountLogLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
@ -46,7 +47,22 @@ class ShareProfit
|
||||
$this->Account($arr_two);
|
||||
}
|
||||
//公司
|
||||
Company::where('id', $data['company_id'])->update(['deposit'=>Db::raw('deposit+' . $master_maoney), 'company_money'=>Db::raw('company_money+' .$master_maoney)]);
|
||||
if($data['company_account_type']==1){
|
||||
$deposit_count = bcadd($company['deposit'], $master_maoney,2);
|
||||
$this->AccountLog($data['company_id'],$deposit_count,$master_maoney);
|
||||
|
||||
$company_money_count = bcadd($company['company_money'], $master_maoney,2);
|
||||
$this->AccountLog($data['company_id'],$company_money_count,$master_maoney);
|
||||
|
||||
Company::where('id', $data['company_id'])->update(['deposit'=>Db::raw('deposit+' . $master_maoney), 'company_money'=>Db::raw('company_money+' .$master_maoney)]);
|
||||
|
||||
}elseif($data['company_account_type']==2){
|
||||
$company_money_count = bcadd($company['shareholder_money'], $master_maoney,2);
|
||||
$this->AccountLog($data['company_id'],$company_money_count,$master_maoney,1,2);
|
||||
|
||||
Company::where('id', $data['company_id'])->update(['shareholder_money'=>Db::raw('shareholder_money+' . $master_maoney)]);
|
||||
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -56,6 +72,19 @@ class ShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function AccountLog($companyId,$left_amount,$changeAmount,$change_object=1,$change_type=1,$action=1){
|
||||
$company_log = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id'=>$companyId,
|
||||
'change_object' => $change_object,//变动对象
|
||||
'change_type' => $change_type,//变动类型
|
||||
'action' => $action,//1-增加 2-减少
|
||||
'left_amount' => $left_amount,//变动后数量
|
||||
'change_amount' => $changeAmount,//变动数量
|
||||
'status'=>1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log);
|
||||
}
|
||||
/**负责人的分润
|
||||
* @param $data
|
||||
*/
|
||||
|
32
app/common/model/company/CompanyAccountLog.php
Normal file
32
app/common/model/company/CompanyAccountLog.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\company;
|
||||
|
||||
use think\model\concern\SoftDelete;
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
/**
|
||||
* 公司流水模型
|
||||
* Class CompanyProperty
|
||||
* @package app\common\model
|
||||
*/
|
||||
class CompanyAccountLog extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
@ -26,8 +26,9 @@ class TaskInformationJob
|
||||
// }
|
||||
try {
|
||||
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 1]);
|
||||
$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(); // 可能要判断预存金是否满足
|
||||
$company = Company::where('id', $data['company_id'])->field('id,deposit,company_money,shareholder_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足
|
||||
$arr['status'] = 0;
|
||||
$arr['company_account_type'] = 1;
|
||||
//信息更新
|
||||
if ($data['template_info']['type'] == 31) {
|
||||
if ($data['template_info']['information_count'] < $data['template_info']['information_day_count']) {
|
||||
@ -78,6 +79,7 @@ class TaskInformationJob
|
||||
$name = $task_35['director_info']['nickname'];
|
||||
$arr['status'] = 1;
|
||||
$arr['money'] = $task_35['over_decimal'];
|
||||
$arr['company_account_type'] = 2;
|
||||
}else{
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user