提交 f097e136 authored 作者: 李大见's avatar 李大见

定时扣费,查询经销商,供货价维护

上级 c956cc5c
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
class DeductionFee extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'DeductionFee';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command DeductionFee';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$find_data = DB::table('admin')
->groupBy('company_id')
->get();
foreach ($find_data as $key => $value) {
$find_balance = DB::table('admin_recharge')
->where('adre_company_id', $value['company_id'])
->first();
if (empty($find_balance)) {
$add_data['adre_company_id'] = $value['company_id'];
$add_data['adre_banlance'] = -100;
$add_data['adre_first_monthFee'] = date('Y-m-d H:i:s');
$add_data['adre_next_monthFee'] = date('Y-m-d H:i:s', strtotime('+1 month'));
$add_res = DB::table('admin_recharge')->insertGetId($add_data);
} else {
if (empty($find_balance['adre_next_monthFee'])) {
$update['adre_banlance'] = $find_balance['adre_banlance'] - 100;
$update['adre_first_monthFee'] = date('Y-m-d H:i:s');
$update['adre_next_monthFee'] = date('Y-m-d H:i:s', strtotime('+1 month'));
$update_res = DB::table('admin_recharge')
->where('adre_id', $find_balance['adre_id'])
->update($update);
} else {
if (time() >= strtotime($find_balance['adre_next_monthFee'])) {
$update['adre_banlance'] = $find_balance['adre_banlance'] - 100;
$update['adre_next_monthFee'] = date('Y-m-d H:i:s', strtotime($find_balance['adre_next_monthFee'],'+1 month'));
$update_res = DB::table('admin_recharge')
->where('adre_id', $find_balance['adre_id'])
->update($update);
}
}
}
$order_number = 'YF'.date('YmdHis').rand(1000,9999);
$recharge_order['reo_adm_id'] = $value['id'];
$recharge_order['reo_company_id'] = $value['company_id'];
$recharge_order['reo_order_number'] = $order_number;
$recharge_order['reo_price'] = -100;
$recharge_order['reo_pay_state'] = 1;
$recharge_order['reo_state'] = 1;
$recharge_order['reo_type'] = 3;//扣月费
if ($value['admin_groupnew'] == 2) {
$recharge_order['reo_client_type'] = 1;
} elseif ($value['admin_groupnew'] == 3) {
$recharge_order['reo_client_type'] = 2;
} else {
$recharge_order['reo_client_type'] = 3;
}
$recharge_order['reo_pay_way'] = 1;
$recharge_order['reo_create_time'] = date('Y-m-d H:i:s');
$recharge_order['reo_pay_time'] = date('Y-m-d H:i:s');
$add_res = DB::table('recharge_order')->insertGetId($recharge_order);
}
}
}
......@@ -18,6 +18,7 @@ class Kernel extends ConsoleKernel
Commands\GetJdSelfOrder::class,
Commands\GetJdSelfRefund::class,
Commands\GetJdSelfShhOrder::class
Commands\DeductionFee::class
];
/**
......@@ -35,6 +36,7 @@ class Kernel extends ConsoleKernel
$schedule->command('getJdSelfOrder')->everyFiveMinutes();//每五分钟执行一次
$schedule->command('getJdSelfRefund')->everyFiveMinutes();//每五分钟执行一次
$schedule->command('GetJdSelfShhOrder')->everyFiveMinutes();//每五分钟执行一次
$schedule->command('DeductionFee')->everyFiveMinutes();//每五分钟执行一次
}
/**
......
......@@ -370,7 +370,7 @@ class CommonController extends BaseController
$com_parent_id = array_filter($com_parent_id, function($value) {
return $value != 1; // 这里可以修改条件来移除不同的值
});
// 重置数组键名
// 重置数组键名
$com_parent_id = array_values($com_parent_id);
}
$parameter['company_id_searchin'] = $com_parent_id;
......@@ -384,7 +384,6 @@ class CommonController extends BaseController
unset($parameter['token']);
unset($parameter['Login_id']);
unset($parameter['Pri_id']);
// $parameter['enable'] = 1;
switch ( $type )
{
case 1:
......@@ -1264,4 +1263,40 @@ class CommonController extends BaseController
}
/**
* 获取公司
* @authors ldj
* @email 909490343@qq.com
* @date 2024-09-20
* @param Request $request [description]
* @return [type] [description]
*/
public function getCompany(Request $request){
$session = $request->get('session_token');
$data = new Company();
$data = $data->where('com_type', 1)->where('id', '!=', 1)->select('com_id','com_name')->get()->toarray();
return $this->success('获取成功', $data);
}
/**
* 查询经销商
* @authors ldj
* @email 909490343@qq.com
* @date 2024-09-20
* @param Request $request [description]
* @return [type] [description]
*/
public function getDistributor ( Request $request )
{
$list = DB::table('admin')
->where('admin_groupnew', 3)
->select('id', 'admin_acc', 'admin_name')
->get()->toarray();
if($list){
return $this->success('操作成功', $list);
}else{
return $this->error('无数据', ErrorInc::DATA_EMPTY, []);
}
}
}
......@@ -112,8 +112,9 @@ class PayController extends BaseController
}elseif($v['reo_type'] == 2){
$list[$k]['reo_type_name'] = "扣费";
$list[$k]['reo_pay_way_name'] = "派单扣费";
} else {
$list[$k]['reo_type_name'] = "--";
} elseif($v['reo_type'] == 3) {
$list[$k]['reo_type_name'] = "扣费";
$list[$k]['reo_pay_way_name'] = "月费扣费";
}
if ($v['reo_pay_state'] == 1){
......
......@@ -98,7 +98,8 @@ public function index(Request $request)
$priId = $request->input('Pri_id');
$data = $this->dataService->formatPageContent($token, $priId, $data);
}
$data['service_type'][] = ['type'=>1,'name'=>'自营'];
$data['service_type'][] = ['type'=>2,'name'=>'平台'];
if (!empty($data['list'])) {
return $this->success('获取成功', $data);
......
......@@ -72,7 +72,9 @@ class SupplierPriceService extends Service
$time = date('Y-m-d H:i:s', strtotime($param['end_time']));
$Db = $Db->where("create_time", '<=', $time);
}
if (!empty($param['type'])) { //结束时间
$Db = $Db->where("type", $param['type']);
}
if ($session['admin_groupnew'] != 7){//管理员可以看全部 && $session['admin_groupnew'] != 8
$Db = $Db->where("gh_price.company_id",$session['company_id']);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论