This commit is contained in:
mkm 2023-08-30 21:08:12 +08:00
parent 9077c21d2c
commit acf5c32434
8 changed files with 50 additions and 38 deletions

@ -12,6 +12,7 @@ use app\common\model\user\User as UserModel;
use app\common\model\user\UserAccountLog;
use think\facade\Log;
use app\job\TaskAdd;
use app\job\TaskInformationJob;
class CeshiController extends BaseApiController
{
@ -22,10 +23,16 @@ class CeshiController extends BaseApiController
*/
public function index()
{
// $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
// foreach($all as $k=>$v){
// queue(TaskInformationJob::class,$v);
// }
return true;
$plan_all = TaskScheduling::where('id',99)->with('company_info')->select()->toArray();
$plan_ids = [];
foreach ($plan_all as $k => $v) {
$all = TaskTemplate::where('id', 111)->where('task_scheduling', $v['id'])->limit(30)->select()->toArray();
$all = TaskTemplate::where('status', 1)->where('task_scheduling', $v['id'])->limit(30)->select()->toArray();
$plan_ids[] = $v['id'];
if ($all) {
$plan_all[$k]['template'] = $all;

@ -23,7 +23,7 @@ class CronController extends BaseApiController
* 结算
*/
public function settlement(){
$all=TaskSchedulingPlan::whereDay('end_time','yesterday')->where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
$all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
foreach($all as $k=>$v){
queue(TaskInformationJob::class,$v);
}

@ -122,20 +122,20 @@ class RemoteController extends BaseApiController
];
switch ($company['company_type']) {
case 18:
$parmas['brigade_id'] = $company['brigade'];
$parmas['brigade_id'] = $company['responsible_area'];
$parmas['village_code'] = $company['village'];
$parmas['street_code'] = $company['street'];
$parmas['district_code'] = $company['area'];
$parmas['city_code'] = $company['city'];
break;
case 17:
$parmas['village_code'] = $company['village'];
$parmas['village_code'] = $company['responsible_area'];
$parmas['street_code'] = $company['street'];
$parmas['district_code'] = $company['area'];
$parmas['city_code'] = $company['city'];
break;
case 16:
$parmas['street_code'] = $company['street'];
$parmas['street_code'] = $company['responsible_area'];
$parmas['district_code'] = $company['area'];
$parmas['city_code'] = $company['city'];
break;
@ -153,12 +153,13 @@ class RemoteController extends BaseApiController
if(isset($querys['page'])){
$parmas['page']=$querys['page'];
}
try{
$list = HttpClient::create()->request('GET', 'https://crmeb-test.shop.lihaink.cn/api/region/order', [
'query' => $parmas,
]);
$json_list = json_decode($list->getContent(), true);
$data=[];
if($json_list['status'] == 200){
$data=$json_list['data']['list'];

@ -86,8 +86,8 @@ class TaskController extends BaseApiController
}
$transaction_pool=TaskTemplate::where('id',$task['template_id'])->value('transaction_pool');
$company = Company::where('id', $task['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足
// $find = App(RemoteController::class)->shang_date_total_price($company);
$company = Company::where('id', $task['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade,responsible_area')->find(); // 可能要判断预存金是否满足
// $list = App(RemoteController::class)->shang_date_list($company, 1, $parmas);
$parmas['start_time']=date('Y-m-d',$task['start_time']);
$parmas['end_time']=$task['end_time'].' 23:59:59';
$list = App(RemoteController::class)->shang_date_list($company, 1, $parmas);

@ -46,7 +46,6 @@ class RechargeLogic extends BaseLogic
'pay_status' => PayEnum::UNPAID,
'order_amount' => $params['money'],
];
Log::error($params);
if(isset($params['task_id']) &&$params['task_id']>0){
$data['extend']=json_encode(['task_id'=>$params['task_id'],'type'=>1]);
}

@ -64,33 +64,35 @@ class PayNotifyLogic extends BaseLogic
public static function recharge($orderSn, $extra = [])
{
$order = RechargeOrder::where('sn', $orderSn)->findOrEmpty();
// 增加用户累计充值金额及用户余额
$user = User::findOrEmpty($order->user_id);
$user->total_recharge_amount += $order->order_amount;
$user->user_money += $order->order_amount;
$user->save();
// 记录账户流水
AccountLogLogic::add(
$order->user_id,
AccountLogEnum::UM_INC_RECHARGE,
AccountLogEnum::INC,
$order->order_amount,
$order->sn,
'用户充值'
);
if ($order && isset($order['extend']['type']) && $order['extend']['type'] == 1) {
$find = Task::where('id', $order['extend']['task_id'])->find();
$extend=$find['extend'];
$extend['shareholder']['order_sn']=$order->sn;
Task::where('id', $order['extend']['task_id'])->update(['status' => 3,'extend'=>json_encode($extend)]);
TaskTemplate::where('id', $find['template_id'])->update(['over_decimal' => $order->order_amount]);
} else {
// 增加用户累计充值金额及用户余额
$user = User::findOrEmpty($order->user_id);
$user->total_recharge_amount += $order->order_amount;
$user->user_money += $order->order_amount;
$user->save();
// 记录账户流水
AccountLogLogic::add(
$order->user_id,
AccountLogEnum::UM_INC_RECHARGE,
AccountLogEnum::INC,
$order->order_amount,
$order->sn,
'用户充值'
);
}
// 更新充值订单状态
$order->transaction_id = $extra['transaction_id'];
$order->pay_status = PayEnum::ISPAID;
$order->pay_time = time();
$order->save();
if ($order && isset($order['extend']['type']) && $order['extend']['type'] == 1) {
$find = Task::where('id', $order['extend']['task_id'])->find();
Task::where('id', $order['extend']['task_id'])->update(['status' => 3]);
TaskTemplate::where('id', $find['template_id'])->update(['over_decimal' => $order->order_amount]);
}
}
}

@ -61,9 +61,9 @@ class ShareProfit
}elseif($data['company_account_type']==2){
$company_money_count = bcadd($company['shareholder_money'], $data['money'],2);
$this->AccountLog($data['company_id'],$company_money_count,$data['money'],1,2);
Company::where('id', $data['company_id'])->update(['shareholder_money'=>Db::raw('shareholder_money+' . $data['money'])]);
Company::where('id', $data['company_id'])->update(['deposit'=>Db::raw('deposit+' . $master_maoney),
'company_money'=>Db::raw('company_money+' .$master_maoney),
'shareholder_money'=>Db::raw('shareholder_money+' . $datas['template_info']['over_decimal'])]);
}
if(isset($datas['template_info']['type']) && $datas['template_info']['type'] ==35){

@ -53,7 +53,7 @@ class TaskInformationJob
if(bcadd($shang_date_total_price['arr']['total_price'],$transaction_pool,2)>$shang_date_total_price['arr']['day_money']){
Task::where('id', $data['task_id'])->update(['status' => 3,'extend'=>json_encode($shang_date_total_price)]);
$day_money=bcsub($shang_date_total_price['arr']['total_price'],$shang_date_total_price['arr']['day_money'],2);//当天还剩多少
TaskTemplate::whrer('id',$data['template_info']['id'])->update(['transaction_pool'=>bcadd($transaction_pool,$day_money,2)]);
TaskTemplate::where('id',$data['template_info']['id'])->update(['transaction_pool'=>bcadd($transaction_pool,$day_money,2)]);
$shang_date_total_price['arr']['status']=1;
}
$name = $shang_date_total_price['name'];
@ -75,13 +75,13 @@ class TaskInformationJob
}elseif
//入股任务
($data['template_info']['type'] == 35){
$task_35 = Task::where('id', $data['task_id'])->field('status')->with('director_info')->find();
$task_35 = Task::where('id', $data['task_id'])->field('director_uid,status,money')->with('director_info')->find();
if($task_35){
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
if($task_35['status']==3 && $day<=$data['template_info']['day_count']){
if($task_35['status']==3 && $data['template_info']['day_count']<=$day){
$name = $task_35['director_info']['nickname'];
$arr['status'] = 1;
$arr['money'] = $$data['template_info']['over_decimal'];
$arr['money'] = $task_35['money'];
$arr['company_account_type'] = 2;
}else{
if($day<=$data['template_info']['day_count']){
@ -93,6 +93,9 @@ class TaskInformationJob
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
return false;
}
}else{
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
return false;
}
}
else {
@ -115,7 +118,7 @@ class TaskInformationJob
$arr['sn'] = $data['sn'];
$arr['id'] = $data['id'];
} catch (\Exception $e) {
Log::error('异常报错:任务结算失败:' . $data['template_info']['title'] . $e->getMessage() . json_encode($data));
Log::error('line:'.$e->getLine().'异常报错:任务结算失败:' . $data['template_info']['title'] . $e->getMessage() . json_encode($data));
return false;
}
if ($arr['status'] == 1) {