提交 48106524 authored 作者: 窦斌's avatar 窦斌

edit

上级 0d08e7ee
......@@ -2,6 +2,8 @@
namespace App\Console\Commands;
use App\Models\Company;
use App\Services\CommonService;
use Illuminate\Console\Command;
use DB;
......@@ -38,56 +40,64 @@ class DeductionFee extends Command
*/
public function handle()
{
$find_data = DB::table('admin')
->groupBy('company_id')
->get();
// $find_data = DB::table('admin')
// ->groupBy('company_id')
// ->get();
$time = date('Y-m-d H:i:s');
$find_data = Company::whereRaw("(com_next_monthFee<'".$time."' or com_next_monthFee is null) and com_type=1")->limit(10)->get();
$find_data = CommonService::dataToArray($find_data);
if($find_data) {
foreach ($find_data as $key => $value) {
$find_balance = DB::table('admin_recharge')
->where('adre_company_id', $value['company_id'])
->where('adre_company_id', $value['com_id'])
->first();
if (empty($find_balance)) {
$add_data['adre_company_id'] = $value['company_id'];
$add_data['adre_company_id'] = $value['com_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);
$add_data['adre_next_monthFee'] = date('Y-m-d 00:00:00', strtotime('+1 month'));
$update_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['adre_next_monthFee'] = date('Y-m-d 00:00:00', 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['adre_next_monthFee'] = date('Y-m-d 00:00:00', 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'];
if($update_res) {
Company::where('com_id',$value['com_id'])->update(['com_next_monthFee'=>date('Y-m-d 00:00:00', strtotime('+1 month'))]);
$order_number = 'YF' . date('YmdHis') . rand(1000, 9999);
$recharge_order['reo_adm_id'] = 0;
$recharge_order['reo_company_id'] = $value['com_id'];
$recharge_order['reo_order_number'] = $order_number;
$recharge_order['reo_price'] = -100;
$recharge_order['reo_pay_state'] = 1;
$recharge_order['reo_pay_state'] = 2;
$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 {
// 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);
}
}
}
}
}
......@@ -17,8 +17,8 @@ class Kernel extends ConsoleKernel
Commands\GetJdOrder::class,
Commands\GetJdSelfOrder::class,
Commands\GetJdSelfRefund::class,
Commands\GetJdSelfShhOrder::class
// Commands\DeductionFee::class
Commands\GetJdSelfShhOrder::class,
Commands\DeductionFee::class
];
/**
......@@ -36,7 +36,7 @@ class Kernel extends ConsoleKernel
$schedule->command('getJdSelfOrder')->everyFiveMinutes();//每五分钟执行一次
// $schedule->command('getJdSelfRefund')->everyFiveMinutes();//每五分钟执行一次
$schedule->command('GetJdSelfShhOrder')->everyFiveMinutes();//每五分钟执行一次
// $schedule->command('DeductionFee')->everyFiveMinutes();//每五分钟执行一次
$schedule->command('DeductionFee')->everyFiveMinutes();//每三十分钟执行一次 everyThirtyMinutes
}
/**
......
......@@ -24,6 +24,7 @@ class TipsController extends BaseController
* @date 2021/9/10
*/
public function index(Request $request){
$list = array();
if($request->get('session_token')['admin_groupnew'] == 2 || $request->get('session_token')['admin_groupnew'] == 3){
$orderList = OrderList::where('stauas',20)->where('ser_id',$request->get('session_token')['id'])->get();
if(count($orderList)>0) {
......@@ -35,6 +36,23 @@ class TipsController extends BaseController
$list = [];
}
return $this->success('获取成功', $list); exit;
}else{
$list = [];
}
$num = count($list);
if($request->get('session_token')['com_type']==1 && !in_array($request->get('session_token')['company_id'], [11,12,13,19])){
$adre_banlance = Db::table('admin_recharge')->where('adre_company_id',$request->get('session_token')['company_id'])->value('adre_banlance');
$adre_banlance = $adre_banlance??0;
if($adre_banlance<100 && $adre_banlance>=0){
$list[$num]['msg'] = "账号余额已不足100元";
$list[$num]['count'] = $adre_banlance;
$list[$num]['url'] = '';
}
if($adre_banlance<0){
$list[$num]['msg'] = "账号已欠费请及时充值";
$list[$num]['count'] = $adre_banlance;
$list[$num]['url'] = '';
}
}
$date = time();
$time = mktime(17,0,0,date('m'),date('d'),date('Y'));
......@@ -84,8 +102,7 @@ class TipsController extends BaseController
}
$massage_power = $request->input('massage_power');
$function = explode(',',$massage_power);
$list = array();
$num = 0;
$num = count($list);
foreach ($function as $key => $value) {
if($function[$key] == 1 && $Aftersale != 0){
$list[$num]['msg'] = "你有新的售后单未处理";
......
......@@ -143,10 +143,13 @@ class AotuorderController extends BaseController
$data['code']='2';
if($data['code']=='1'){
}else{
if($sheng == '北京s' && $shi=='大兴s'){
if($sheng == '江苏' || $sheng == '江苏省'){
$where = ' and (admin_groupnew=3 or (admin_groupnew=2 and company_type=2))';
}else{
$where = ' and admin_groupnew=2 and company_type=1 and company_id='.$order['company_id'];
if($order['company_id']==14){
$where = $where." or admin.id in (91)";
}
}
if(empty($or_ser_id)) {
if ($xian == 1) {
......
......@@ -51,7 +51,11 @@ class PayController extends BaseController
}
if($request->filled('reo_type')){ //类型
$reo_type = $request->input('reo_type');
$Db = $Db->where('reo_type',$reo_type);
if($reo_type == 2){
$Db = $Db->whereIn('reo_type',[2,3]);
}else {
$Db = $Db->where('reo_type', $reo_type);
}
}
if($request->filled('reo_client_type')){ //类型
$reo_client_type = $request->input('reo_client_type');
......
......@@ -1405,7 +1405,7 @@ class OrderListService extends Model
$input['shi'] = $request['shi'];
$input['xian'] = $request['xian'];
$input['address'] = $request['address'];
$data = OrderService::getService($input);
$data = OrderService::getService($input,$session);
return $data;
}else {
$list = Admin::whereIn('admin_groupnew', [2, 3])
......
......@@ -1578,9 +1578,9 @@ class OrderService extends Service
$xian = 2;
}
if ($xian == 1) {
$serPro = Bserviss::whereRaw("find_in_set('" . $dress['are_id'] . "',bs_areid) and bs_status='1'")->get();
$serPro = Bserviss::leftJoin('admin','admin.id','=','bservisnew.bs_serid')->whereRaw("find_in_set('" . $dress['are_id'] . "',bs_areid) and bs_status='1' and enable=1 and (company_id = '".$session['company_id']."') or admin_groupnew=3")->get();
} else {
$serPro = Bserviss::whereRaw("bs_sid='" . $dress['are_sid'] . "' and bs_status='1'")->get();
$serPro = Bserviss::leftJoin('admin','admin.id','=','bservisnew.bs_serid')->whereRaw("bs_sid='" . $dress['are_sid'] . "' and bs_status='1' and enable=1 and (company_id = '".$session['company_id']."') or admin_groupnew=3")->get();
}
if ($serPro) {
$serPro = $serPro->toarray();
......
......@@ -1157,7 +1157,7 @@ Route::group(
});
#系统任务 >> 电话通知
Route::group(['prefix'=>'getCallByTtsCost'], function (){
Route::get('getCallByTtsCost', 'SysCallByTtsCostController@getCallByTtsCost');//电通知扣费
Route::get('getCallByTtsCost', 'SysCallByTtsCostController@getCallByTtsCost');//电通知扣费
});
#天猫服务单
/* Route::group(['prefix'=>'tmOrder'], function (){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论