update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
51
dev/app-bak/Services/SyS/BusinessStructur.php
Normal file
51
dev/app-bak/Services/SyS/BusinessStructur.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use App\Cron\BusinessUsersStore;
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Models\SySetting;
|
||||
|
||||
class BusinessStructur
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
$month = 2;
|
||||
$year = 2021;
|
||||
dd("function on: php artisan business:store month year");
|
||||
|
||||
/*$businessUsersStore = new BusinessUsersStore($month, $year);
|
||||
$businessUsersStore->storeUserBusinessStructure();
|
||||
$businessUsersStore->storeBusinessUsersDetail();
|
||||
$businessUsersStore->storeBusinessCompleted();*/
|
||||
|
||||
|
||||
$data = [
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
];
|
||||
|
||||
return view('sys.tools.business_structur', $data);
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
if($data['id'] === "new"){
|
||||
$model = SySetting::create($data);
|
||||
}else{
|
||||
$model = SySetting::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('sysadmin_tool', ['sales_members']));
|
||||
|
||||
}
|
||||
}
|
||||
80
dev/app-bak/Services/SyS/BuyingsProducts.php
Normal file
80
dev/app-bak/Services/SyS/BuyingsProducts.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Models\SySetting;
|
||||
use App\Models\ProductBuying;
|
||||
use App\Cron\BusinessUsersStore;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
|
||||
class BuyingsProducts
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
|
||||
$data = [
|
||||
];
|
||||
|
||||
return view('sys.tools.buyings_products', $data);
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 37)->get();
|
||||
$count = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
|
||||
ProductBuying::create([
|
||||
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
|
||||
'product_id' => 37,
|
||||
'amount' => 1
|
||||
]);
|
||||
$count ++;
|
||||
}
|
||||
|
||||
}
|
||||
dump("ADD ".$count." product_id 37");
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 100)->get();
|
||||
$count = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
|
||||
ProductBuying::create([
|
||||
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
|
||||
'product_id' => 118,
|
||||
'amount' => 1
|
||||
]);
|
||||
$count ++;
|
||||
}
|
||||
|
||||
}
|
||||
dump("ADD ".$count." product_id 100 to 118");
|
||||
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 118)->get();
|
||||
$count = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
|
||||
ProductBuying::create([
|
||||
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
|
||||
'product_id' => 118,
|
||||
'amount' => 1
|
||||
]);
|
||||
$count ++;
|
||||
}
|
||||
|
||||
}
|
||||
dump("ADD ".$count." product_id 118");
|
||||
|
||||
|
||||
die();
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('sysadmin_tool', ['buyings_products']));
|
||||
|
||||
}
|
||||
}
|
||||
67
dev/app-bak/Services/SyS/ChangeUserBusinesses.php
Normal file
67
dev/app-bak/Services/SyS/ChangeUserBusinesses.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
use App\Models\UserBusiness;
|
||||
|
||||
|
||||
class ChangeUserBusinesses
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
|
||||
dump("ChangeUserBusinesses");
|
||||
dd('check function');
|
||||
$UserBusiness = UserBusiness::all();
|
||||
$c = 0;
|
||||
foreach($UserBusiness as $user_business){
|
||||
|
||||
if($user_business->qual_user_level){
|
||||
$qual_user_level = $user_business->qual_user_level;
|
||||
if(isset($qual_user_level['qual_tp'])){
|
||||
$qual_user_level['qual_pp'] = $qual_user_level['qual_tp'];
|
||||
unset($qual_user_level['qual_tp']);
|
||||
}
|
||||
if(!isset($qual_user_level['paylines'])){
|
||||
$qual_user_level['paylines'] = 6;
|
||||
|
||||
}
|
||||
$user_business->qual_user_level = $qual_user_level;
|
||||
$c ++;
|
||||
$user_business->save();
|
||||
}
|
||||
|
||||
if($user_business->next_qual_user_level){
|
||||
$next_qual_user_level = $user_business->next_qual_user_level;
|
||||
if(isset($next_qual_user_level['qual_tp'])){
|
||||
$next_qual_user_level['qual_pp'] = $next_qual_user_level['qual_tp'];
|
||||
unset($next_qual_user_level['qual_tp']);
|
||||
}
|
||||
if(!isset($next_qual_user_level['paylines'])){
|
||||
$next_qual_user_level['paylines'] = 6;
|
||||
}
|
||||
$user_business->next_qual_user_level = $next_qual_user_level;
|
||||
|
||||
$c ++;
|
||||
$user_business->save();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
dump("counter");
|
||||
dd($c);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
102
dev/app-bak/Services/SyS/CleanHTMLProductDescription.php
Normal file
102
dev/app-bak/Services/SyS/CleanHTMLProductDescription.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use App\Models\Product;
|
||||
use Request;
|
||||
use App\Models\TransProduct;
|
||||
use App\Models\UserCreditItem;
|
||||
|
||||
class CleanHTMLProductDescription
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
dump("CleanHTMLProductDescription");
|
||||
// dd('check function');
|
||||
$TransProducts = TransProduct::limit(2000)->get();
|
||||
dump(count($TransProducts));
|
||||
$c = 0;
|
||||
foreach($TransProducts as $item){
|
||||
if($item->value){
|
||||
$item->value = self::cleanHTML($item->value);
|
||||
$item->save();
|
||||
|
||||
//dump($item->value);
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
dump("counter TransProduct");
|
||||
dump($c);
|
||||
|
||||
$Products = Product::limit(2000)->get();
|
||||
dump(count($Products));
|
||||
$c = 0;
|
||||
foreach($Products as $item){
|
||||
if($item){
|
||||
$item->copy = self::cleanHTML($item->copy);
|
||||
$item->description = self::cleanHTML($item->description);
|
||||
$item->usage = self::cleanHTML($item->usage);
|
||||
$item->ingredients = self::cleanHTML($item->ingredients);
|
||||
|
||||
$item->save();
|
||||
|
||||
//dump($item->value);
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
||||
dump("counter");
|
||||
dd($c);
|
||||
}
|
||||
|
||||
public static function cleanHTML($html)
|
||||
{
|
||||
// $html = preg_replace("/(</?)div/", "$1p", $html);
|
||||
|
||||
$html = str_replace('<p> </p>', '', $html);
|
||||
$html = str_replace('<p></p>', '', $html);
|
||||
$html = str_replace('<p><br></p>', '', $html);
|
||||
$html = str_replace('<p><br></p>', '', $html);
|
||||
|
||||
$html = str_replace('<br>', '', $html);
|
||||
$html = str_replace('text -primary', 'text-primary', $html);
|
||||
$html = str_replace('fa -check', 'fa-check', $html);
|
||||
$html = str_replace('text- primary', 'text-primary', $html);
|
||||
$html = str_replace('fa- check', 'fa-check', $html);
|
||||
$html = str_replace('<ul class="list-unstyled list-icons" style="padding-left: 15px;"> </ul>', '', $html);
|
||||
|
||||
$html = str_replace('</span>', '', $html);
|
||||
$html = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $html);
|
||||
|
||||
$html = str_replace('<li></li>', '', $html);
|
||||
$html = str_replace('<li> </li>', '', $html);
|
||||
$html = str_replace('< i', '<i', $html);
|
||||
$html = str_replace('< li>', '<li>', $html);
|
||||
|
||||
$html = str_replace('</ i>', '</i>', $html);
|
||||
$html = str_replace('</ li>', '</li>', $html);
|
||||
|
||||
$html = str_replace('</ b>', '</b>', $html);
|
||||
$html = str_replace('< /b>', '</b>', $html);
|
||||
|
||||
$html = str_replace('</ p>', '</p>', $html);
|
||||
$html = str_replace('< /p>', '</p>', $html);
|
||||
|
||||
$html = str_replace('< /i>', '</i>', $html);
|
||||
$html = str_replace('< /li>', '</li>', $html);
|
||||
$html = str_replace('<div>', '', $html);
|
||||
$html = str_replace('</div>', '', $html);
|
||||
$html = str_replace('>>', '>', $html);
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
307
dev/app-bak/Services/SyS/Correction.php
Normal file
307
dev/app-bak/Services/SyS/Correction.php
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Models\Product;
|
||||
use App\Models\Homeparty;
|
||||
use App\Models\SySetting;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserSalesVolume;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Repositories\ImportRepository;
|
||||
use App\Services\BusinessPlan\SalesPointsVolume;
|
||||
|
||||
class Correction
|
||||
{
|
||||
|
||||
private static function calcuUserSalesVolume($order){
|
||||
/*
|
||||
status
|
||||
1 => 'hinzugefügt aus Bestellung',
|
||||
2 => 'hinzugefügt aus Shop',
|
||||
3 => 'hinzugefügt aus Shop / pending',
|
||||
|
||||
*/
|
||||
$status = SalesPointsVolume::getStatusByOrderPaymentFor($order);
|
||||
$user_id = $order->auth_user_id ? $order->auth_user_id : $order->member_id;
|
||||
//akuteller tag / Monat.
|
||||
$month = $order->created_at->format('m');
|
||||
$year = $order->created_at->format('Y');
|
||||
$date = $order->created_at->format('d.m.Y');
|
||||
|
||||
|
||||
if($status === 3){ //shop bestellung User pending
|
||||
$user_id = $order->auth_user_id ? $order->auth_user_id : $order->member_id;
|
||||
$month_points = 0;
|
||||
$month_total_net = 0;
|
||||
$month_shop_points = 0;
|
||||
$month_shop_total_net = 0;
|
||||
}else{
|
||||
$month_points = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
$month_shop_points = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_shop_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
}
|
||||
switch ($status) {
|
||||
case 1: //Bestellung
|
||||
$month_points += $order->points;
|
||||
$month_total_net += $order->subtotal;
|
||||
break;
|
||||
case 2: //Shop
|
||||
$month_shop_points += $order->points;
|
||||
$month_shop_total_net += $order->subtotal;
|
||||
break;
|
||||
}
|
||||
|
||||
return UserSalesVolume::create([
|
||||
'user_id' => $user_id,
|
||||
'shopping_order_id' => $order->id,
|
||||
'month' => $month,
|
||||
'year' => $year,
|
||||
'date' => $date,
|
||||
'points' => $order->points,
|
||||
'month_points' => $month_points,
|
||||
'month_shop_points' => $month_shop_points,
|
||||
'total_net' => $order->subtotal,
|
||||
'month_total_net' => $month_total_net,
|
||||
'month_shop_total_net' => $month_shop_total_net,
|
||||
'message' => '',
|
||||
'status' => $status,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function show()
|
||||
{
|
||||
// abort(403, 'STOP funtion not online');
|
||||
|
||||
$c = 0;
|
||||
|
||||
if(false){ //11
|
||||
dump("calculate user_sales_volumes from Orders");
|
||||
dd('check function');
|
||||
$year = 21;
|
||||
$months = range(1, 12);
|
||||
foreach($months as $month){
|
||||
$ShoppingOrders = ShoppingOrder::where('txaction', 'paid')->where('created_at', '>=', $year.'-'.$month.'-01 00:00:00')->where('created_at', '<=', $year.'-'.$month.'-31 23:59:59')->get();
|
||||
foreach($ShoppingOrders as $item){
|
||||
|
||||
if(UserSalesVolume::whereShoppingOrderId($item->id)->count() === 0){
|
||||
dump($item->id);
|
||||
self::calcuUserSalesVolume($item);
|
||||
}
|
||||
$c ++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
dump("counter");
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //11
|
||||
dump("set Discount to Order Items");
|
||||
dd('check function');
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('discount', null)
|
||||
//$ShoppingOrderItems = ShoppingOrderItem::where('discount', 0)->get();
|
||||
->skip(0)->take(1000)->get();
|
||||
//->skip(2000)->take(2000)->get();
|
||||
foreach($ShoppingOrderItems as $item){
|
||||
$no_commission = $item->product ? $item->product->no_commission : false;
|
||||
$item->discount = $no_commission ? 0 : $item->shopping_order->getUserDiscount();
|
||||
$item->save();
|
||||
//dump($item->discount);
|
||||
|
||||
$c ++;
|
||||
}
|
||||
dump("counter");
|
||||
dd($c);
|
||||
}
|
||||
|
||||
|
||||
if(false){ //10
|
||||
dump("set ProduktPoints to Order Items");
|
||||
dd('check function');
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('points', null)->get();
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('points', 0)->get();
|
||||
//->skip(0)->take(500)->get();
|
||||
//->skip(500)->take(500)->get();
|
||||
foreach($ShoppingOrderItems as $item){
|
||||
if($item->product){
|
||||
$item->points = $item->product->points;
|
||||
$item->save();
|
||||
}else{
|
||||
|
||||
}
|
||||
$c ++;
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //9
|
||||
dump("make getOrderPaymentFor in shopping_order");
|
||||
dd('check function');
|
||||
$ShoppingOrders = ShoppingOrder::where('payment_for', '=', NULL)->get();
|
||||
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
dump($ShoppingOrder->id);
|
||||
dump($ShoppingOrder->shopping_user->getOrderPaymentFor());
|
||||
$ShoppingOrder->payment_for = $ShoppingOrder->shopping_user->getOrderPaymentFor();
|
||||
$ShoppingOrder->save();
|
||||
|
||||
$c ++;
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
|
||||
if(false){ //8
|
||||
dump("make homeparty tax_split in shopping_order");
|
||||
dd('check function');
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
|
||||
//->skip(0)->take(500)->get();
|
||||
//->skip(500)->take(500)->get();
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
$ShoppingOrder->makeHomepartyTaxSplit();
|
||||
$c ++;
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //7
|
||||
dump("make homeparty shipping_tax in homeparty order user_cart");
|
||||
dd('check function');
|
||||
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
|
||||
//->skip(0)->take(500)->get();
|
||||
//->skip(500)->take(500)->get();
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
if(isset($ShoppingOrder->homeparty->order['user_carts'])){
|
||||
$user_carts = [];
|
||||
foreach($ShoppingOrder->homeparty->order['user_carts'] as $id => $values){
|
||||
$values['shipping_tax'] = round($values['shipping_price'] - $values['shipping_price_net'], 2);
|
||||
dump($values['shipping_tax']);
|
||||
$user_carts[$id] = $values;
|
||||
}
|
||||
$order = $ShoppingOrder->homeparty->order;
|
||||
$order['user_carts'] = $user_carts;
|
||||
$ShoppingOrder->homeparty->order = $order;
|
||||
$ShoppingOrder->homeparty->save();
|
||||
|
||||
}
|
||||
$c ++;
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //6
|
||||
dump("make tax_split in shopping_order");
|
||||
dd('check function');
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '=', NULL)//->get();
|
||||
->skip(0)->take(3000)->get();
|
||||
//->skip(3000)->take(5000)->get();
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
$ShoppingOrder->makeTaxSplit();
|
||||
$c ++;
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //5
|
||||
//run after make points etc.
|
||||
dump("correction shopping_order homeparty");
|
||||
dd('check function');
|
||||
$ShoppingOrders = ShoppingOrder::where('payment_for', 5)->get();
|
||||
//->skip(0)->take(500)->get();
|
||||
//->skip(500)->take(500)->get();
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
$homeparty = Homeparty::find($ShoppingOrder->homeparty_id);
|
||||
if($homeparty && $homeparty->completed && $homeparty->step > 10){
|
||||
$ShoppingOrder->subtotal = $homeparty->order['ek_price_net'];
|
||||
$ShoppingOrder->subtotal_ws = 0;
|
||||
$ShoppingOrder->tax = $ShoppingOrder->total - $homeparty->order['ek_price_net'];
|
||||
$ShoppingOrder->points = $homeparty->order['points'] - $homeparty->order['bonus_points_diff'];
|
||||
$ShoppingOrder->save();
|
||||
$c ++;
|
||||
}
|
||||
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //4
|
||||
dump("make tax in ShoppingOrderItem");
|
||||
dd('check function');
|
||||
$ShoppingOrderItems = ShoppingOrderItem::all();
|
||||
//->skip(0)->take(500)->get();
|
||||
//->skip(500)->take(500)->get();
|
||||
foreach($ShoppingOrderItems as $item){
|
||||
$item->tax = $item->price - $item->price_net;
|
||||
$item->save();
|
||||
$c ++;
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(false){ //3
|
||||
dump("make price_net in ShoppingOrderItem");
|
||||
dd('check function');
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('price_net', '=', NULL)->get();
|
||||
//->skip(0)->take(500)->get();
|
||||
//->skip(500)->take(500)->get();
|
||||
foreach($ShoppingOrderItems as $item){
|
||||
$item->price_net = $item->price / (100 + $item->tax_rate) * 100;
|
||||
$item->save();
|
||||
$c ++;
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //2
|
||||
dump("add payment_for in shopping_order");
|
||||
dd('check function');
|
||||
$ShoppingUsers = ShoppingUser::all();
|
||||
foreach($ShoppingUsers as $ShoppingUser){
|
||||
if($ShoppingUser->shopping_order){
|
||||
$ShoppingUser->shopping_order->payment_for = $ShoppingUser->getOrderPaymentFor();
|
||||
$ShoppingUser->shopping_order->save();
|
||||
$c ++;
|
||||
}
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
|
||||
if(false){ //1
|
||||
dump("make points in shopping_order_item and total in ShoppingOrder");
|
||||
dd('check function');
|
||||
$ShoppingOrders = ShoppingOrder::all();
|
||||
//->skip(0)->take(500)->get();
|
||||
//->skip(500)->take(500)->get();
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
$points_total = 0;
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
$points = $shopping_order_item->product ? $shopping_order_item->product->points : 0;
|
||||
$points_total += $points;
|
||||
$shopping_order_item->points = $points;
|
||||
$shopping_order_item->save();
|
||||
$c ++;
|
||||
}
|
||||
$ShoppingOrder->points = $points_total;
|
||||
$ShoppingOrder->save();
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
abort(403, 'STOP funtion not online');
|
||||
}
|
||||
|
||||
}
|
||||
32
dev/app-bak/Services/SyS/CronJobs.php
Normal file
32
dev/app-bak/Services/SyS/CronJobs.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
|
||||
class CronJobs
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
//$user_shops = UserShop::all();
|
||||
$text = "";
|
||||
$values = [
|
||||
'Prüft die Dauer der Mitgliedschaft und sendet Erinnerungsmails' => route('cron_jobs_action', ['check_payments_account', 'key'])
|
||||
];
|
||||
$data = [
|
||||
'values' => $values,
|
||||
'text' => $text,
|
||||
];
|
||||
return view('sys.tools.cronjobs', $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
||||
}
|
||||
63
dev/app-bak/Services/SyS/Customers.php
Normal file
63
dev/app-bak/Services/SyS/Customers.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Services\CustomerPriority;
|
||||
use App\Repositories\ContractPDFRepository;
|
||||
|
||||
class Customers
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
$shopping_users = ShoppingUser::where('member_id', '=', NULL)->where('auth_user_id', '=', NULL)->get();
|
||||
$data = [
|
||||
'values' => $shopping_users,
|
||||
'text' => '',
|
||||
];
|
||||
|
||||
return view('sys.tools.customers', $data);
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if($data['action'] === 'makePaymentMethodsDefault'){
|
||||
$users = User::where('payment_methods', '=', NULL)->get();
|
||||
//$users = User::all();
|
||||
foreach ($users as $user){
|
||||
$user->payment_methods = PaymentMethod::getDefaultAsArray();
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
if($data['action'] === 'checkForAll'){
|
||||
$shopping_users = CustomerPriority::checkForAll();
|
||||
}
|
||||
|
||||
if($data['action'] === 'checkContractPDF'){
|
||||
//create PDF
|
||||
$user = User::findOrFail(80);
|
||||
|
||||
$pdf = new ContractPDFRepository($user);
|
||||
$pdf->_set('disk', 'user');
|
||||
$pdf->_set('dir', '/'.$user->id.'/documents/');
|
||||
$pdf->_set('user_id', $user->id);
|
||||
$pdf->_set('identifier', 'contract');
|
||||
$pdf->createContractPDF();
|
||||
}
|
||||
|
||||
if(strpos($data['action'], 'checkOne_') !== false){
|
||||
$id = (int) str_replace('checkOne_', '', $data['action']);
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
$ret = CustomerPriority::checkOne($shopping_user);
|
||||
}
|
||||
\Session()->flash('alert-success', $ret);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
198
dev/app-bak/Services/SyS/DomainSSL.php
Normal file
198
dev/app-bak/Services/SyS/DomainSSL.php
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
use App\Models\UserShop;
|
||||
use App\Http\Controllers\Api\KasController;
|
||||
use App\Http\Controllers\Api\KasSLLController;
|
||||
|
||||
class DomainSSL
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
$user_shops = UserShop::limit(1000)->get();
|
||||
$text = "";
|
||||
|
||||
$kas = new KasController();
|
||||
//$domain = 'mivita.care';
|
||||
// $ssl = KasSLLController::getApiSSLParameter();
|
||||
$SubDomains = [];
|
||||
|
||||
$get_subdomains = $kas->action('get_subdomains');
|
||||
foreach ($get_subdomains as $subdomain){
|
||||
if(isset($subdomain['subdomain_name'])){
|
||||
if(strpos($subdomain['subdomain_name'], 'www.') !== false){
|
||||
continue;
|
||||
}
|
||||
if(strpos($subdomain['subdomain_name'], 'api.') !== false){
|
||||
continue;
|
||||
}
|
||||
if(strpos($subdomain['subdomain_name'], 'checkout.') !== false){
|
||||
continue;
|
||||
}
|
||||
$SubDomains[$subdomain['subdomain_name']] =
|
||||
[
|
||||
'ssl_certificate_sni' => $subdomain['ssl_certificate_sni'],
|
||||
'php_version' => $subdomain['php_version'],
|
||||
];
|
||||
|
||||
}else{
|
||||
@dump($subdomain);
|
||||
}
|
||||
|
||||
|
||||
/* if($subdomain['ssl_certificate_sni'] !== "Y"){
|
||||
$pra = array(
|
||||
'hostname' => $subdomain['subdomain_name'],
|
||||
);
|
||||
$pra = array_merge($pra, $ssl);
|
||||
$value = $kas->action('update_ssl', $pra);
|
||||
$text .= $value;
|
||||
}else{
|
||||
if(isset($subdomain['ssl_certificate_sni_is_active'])){
|
||||
$text .= $subdomain['ssl_certificate_sni_is_active'].'-is_active';
|
||||
}else{
|
||||
$text .= '-CHECK!';
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
//$text .= "\n";
|
||||
}
|
||||
|
||||
$dobbleDomains = [];
|
||||
|
||||
foreach($user_shops as $user_shop){
|
||||
$user_shop->hasSubdomain = false;
|
||||
$user_shop->hasSSL = false;
|
||||
$user_shop->PHPversion = "";
|
||||
if(array_key_exists($user_shop->slug.'.mivita.care', $SubDomains)){
|
||||
$user_shop->hasSubdomain = true;
|
||||
$user_shop->hasSSL = $SubDomains[$user_shop->slug.'.mivita.care']['ssl_certificate_sni'] === 'Y' ? true : false;
|
||||
$user_shop->PHPversion = $SubDomains[$user_shop->slug.'.mivita.care']['php_version'];
|
||||
unset($SubDomains[$user_shop->slug.'.mivita.care']);
|
||||
}
|
||||
$dobbleDomains[$user_shop->user_id][$user_shop->id] = $user_shop->slug.'.mivita.care';
|
||||
}
|
||||
foreach($dobbleDomains as $key => $dobbleDomain){
|
||||
if(count($dobbleDomain) === 1){
|
||||
unset($dobbleDomains[$key]);
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'values' => $user_shops,
|
||||
'text' => $text,
|
||||
'SubDomains' => $SubDomains,
|
||||
'dobbleDomains' => $dobbleDomains,
|
||||
|
||||
];
|
||||
|
||||
return view('sys.tools.domain-ssl', $data);
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
if(isset($data['delete_sub_kas'])){
|
||||
$kas = new KasController();
|
||||
$pra = array(
|
||||
'subdomain_name' => $data['delete_sub_kas'],
|
||||
);
|
||||
$value = $kas->action('delete_subdomain', $pra);
|
||||
\Session()->flash('alert-success', 'subdomain: '.$value.' gelöscht');
|
||||
|
||||
}
|
||||
if(isset($data['delete_user_shop'])){
|
||||
$user_shop = UserShop::findOrFail($data['delete_user_shop']);
|
||||
$subdomain_name = $user_shop->slug.'.mivita.care';
|
||||
$user_shop->name = "delete".$user_shop->id;
|
||||
$user_shop->slug = "delete".$user_shop->id;
|
||||
$user_shop->save();
|
||||
$user_shop->delete();
|
||||
$kas = new KasController();
|
||||
$pra = array(
|
||||
'subdomain_name' => $subdomain_name,
|
||||
);
|
||||
$value = $kas->action('delete_subdomain', $pra);
|
||||
\Session()->flash('alert-success', 'shop/subdomain: '.$value.' gelöscht');
|
||||
|
||||
}
|
||||
|
||||
if(isset($data['update_ssl'])){
|
||||
|
||||
//prüfen ob subdomain existiert
|
||||
$user_shop = UserShop::findOrFail($data['update_ssl']);
|
||||
$subdomain_name = $user_shop->slug.'.mivita.care';
|
||||
|
||||
$kas = new KasController();
|
||||
$subdomain = $kas->action('get_subdomains', ['subdomain_name' => $subdomain_name]);
|
||||
if(!isset($subdomain[0]['subdomain_name'])){ //not found
|
||||
self::makeNewSubDomain($user_shop->slug);
|
||||
\Session()->flash('alert-danger', 'subdomain: '.$subdomain_name.' nicht gefunden');
|
||||
return back();
|
||||
}else{
|
||||
self::updateSubDomain($subdomain_name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
private static function updateSubDomain($subdomain_name){
|
||||
|
||||
$kas = new KasController();
|
||||
$ssl = KasSLLController::getApiSSLParameter();
|
||||
$pra = array(
|
||||
'hostname' => $subdomain_name
|
||||
);
|
||||
$pra = array_merge($pra, $ssl);
|
||||
$value = $kas->action('update_ssl', $pra);
|
||||
\Session()->flash('alert-success', 'update SSL: '.$value.'');
|
||||
return $value;
|
||||
}
|
||||
|
||||
private static function makeNewSubDomain($slug){
|
||||
|
||||
$kas = new KasController();
|
||||
$domain = 'mivita.care';
|
||||
|
||||
//check if exisist
|
||||
$subdomains = $kas->action('get_subdomains');
|
||||
foreach ($subdomains as $subdomain){
|
||||
if(!isset($subdomain['subdomain_name'])){
|
||||
continue;
|
||||
}
|
||||
$sub = str_replace(".".$domain, '', $subdomain['subdomain_name']);
|
||||
if($sub == $slug){
|
||||
\Session()->flash('alert-danger', __('shop.error_subdomain_exists'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//add
|
||||
$full_subdomain_name = $slug.".".$domain;
|
||||
$pra = array(
|
||||
'subdomain_name' => $slug,
|
||||
'domain_name' => $domain,
|
||||
'subdomain_path' => '/mein.mivita.care/public/',
|
||||
'php_version' => config('app.php_version'),
|
||||
//'ssl_proxy' => 'Y',
|
||||
//'redirect_status' => 0
|
||||
);
|
||||
$add_subdomain = $kas->action('add_subdomain', $pra);
|
||||
if($add_subdomain == $full_subdomain_name){
|
||||
\Session()->flash('alert-success', 'Add Subdomain: '.$add_subdomain.'');
|
||||
return $add_subdomain;
|
||||
}
|
||||
\Session()->flash('alert-danger', 'Fehler: '.$add_subdomain.'');
|
||||
return $add_subdomain;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
49
dev/app-bak/Services/SyS/Import.php
Normal file
49
dev/app-bak/Services/SyS/Import.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Models\SySetting;
|
||||
use App\Repositories\ImportRepository;
|
||||
|
||||
class Import
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
abort(403, 'STOP funtion not online');
|
||||
|
||||
return view('sys.tools.import', []);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
abort(403, 'STOP funtion not online');
|
||||
}
|
||||
|
||||
|
||||
public function importStore()
|
||||
{
|
||||
$input = Request::all();
|
||||
$import_repo = new ImportRepository();
|
||||
|
||||
return $import_repo->upload($input);
|
||||
}
|
||||
|
||||
public function importShow($type, $file, $skip = 0, $limit = 4000)
|
||||
{
|
||||
$import_repo = new ImportRepository();
|
||||
$import = $import_repo->read($type, $file, $skip, $limit);
|
||||
$data = [
|
||||
'limit' => $limit,
|
||||
'type' => $type,
|
||||
'file' => $file,
|
||||
'import' => $import,
|
||||
'skip' => $skip,
|
||||
];
|
||||
return view('sys.tools.import-show', $data);
|
||||
|
||||
}
|
||||
}
|
||||
84
dev/app-bak/Services/SyS/ImportDbipCountry.php
Normal file
84
dev/app-bak/Services/SyS/ImportDbipCountry.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use App\Models\DbipLookup;
|
||||
use App\Services\dbip\DBIP;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Request;
|
||||
|
||||
class ImportDbipCountry
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
dump("ImportDbipCountry");
|
||||
// dd('check function');
|
||||
|
||||
|
||||
self::read('dbip-country-lite-2024-07.csv', 0, 0);
|
||||
$c = 0;
|
||||
dump("okay counter");
|
||||
dd($c);
|
||||
|
||||
}
|
||||
|
||||
public static function read($filename, $skip = 0, $limit = 0)
|
||||
{
|
||||
/*$find = inet_pton("1.10.128.0");
|
||||
dump($find);
|
||||
dd(DbipLookup::where('ip_start', "<=", $find)->orderBy('ip_start', 'desc')->first());
|
||||
if(!Storage::disk('import')->has($filename)){
|
||||
die("File not found in import folder: ".$filename);
|
||||
}*/
|
||||
|
||||
$path = Storage::disk('import')->path($filename);
|
||||
$fileContents = file($path);
|
||||
$c = 0;
|
||||
foreach ($fileContents as $line) {
|
||||
$row = str_getcsv($line);
|
||||
$row[] = self::addrType($row[0]);
|
||||
|
||||
|
||||
//
|
||||
//base64_encode(file_get_contents($path))
|
||||
// dump($row);
|
||||
\DB::table('dbip_lookup')->insert([
|
||||
'ip_start' => inet_pton($row[0]),
|
||||
'ip_end' => inet_pton($row[1]),
|
||||
'country' => $row[2],
|
||||
'addr_type' => $row[3]
|
||||
]);
|
||||
|
||||
|
||||
//dump(inet_pton($row[0]));
|
||||
/* DbipLookup::create([
|
||||
'ip_start' => ,
|
||||
'ip_end' => inet_pton($row[1]),
|
||||
'country' => $row[2],
|
||||
'addr_type' => $row[3]
|
||||
]);*/
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
private static function addrType($addr) {
|
||||
if (ip2long($addr) !== false) {
|
||||
return "ipv4";
|
||||
} else if (preg_match('/^[0-9a-fA-F:]+$/', $addr) && @inet_pton($addr)) {
|
||||
return "ipv6";
|
||||
}
|
||||
die("unknown address type for {$addr}");
|
||||
}
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
45
dev/app-bak/Services/SyS/RepairSalesVolumeInvoice.php
Normal file
45
dev/app-bak/Services/SyS/RepairSalesVolumeInvoice.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
use App\Models\UserBusiness;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Models\UserSalesVolume;
|
||||
|
||||
class RepairSalesVolumeInvoice
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
|
||||
dump("RepairSalesVolumeInvoice");
|
||||
dd('check function');
|
||||
$UserSalesVolumes = UserSalesVolume::where('status', '<', 3)->where('user_invoice_id', null)->orderBy('id', 'desc')->limit(1000)->get();
|
||||
dump(count($UserSalesVolumes));
|
||||
$c = 0;
|
||||
foreach($UserSalesVolumes as $user_sales_volume){
|
||||
|
||||
if($user_sales_volume->shopping_order_id){
|
||||
$UserInvoice = UserInvoice::where('shopping_order_id', $user_sales_volume->shopping_order_id)->first();
|
||||
if($UserInvoice){
|
||||
$user_sales_volume->user_invoice_id = $UserInvoice->id;
|
||||
$user_sales_volume->save();
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
dump("counter");
|
||||
dd($c);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
65
dev/app-bak/Services/SyS/Sales.php
Normal file
65
dev/app-bak/Services/SyS/Sales.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
use Carbon;
|
||||
use App\Models\SySetting;
|
||||
use App\Models\ShoppingOrder;
|
||||
|
||||
class Sales
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
$start = 2019;
|
||||
$end = date('Y');
|
||||
$years = range($start, $end);
|
||||
|
||||
if(Request::get('filter_sales_year')){
|
||||
$active_year = Request::get('filter_sales_year');
|
||||
}else{
|
||||
$active_year = $end;
|
||||
}
|
||||
|
||||
$date1 = Carbon::parse('01.01.'.$active_year." 00:00:00")->format('Y-m-d H:i:s');
|
||||
$date2 = Carbon::parse('31.12.'.$active_year." 23:59:59")->toDateString();
|
||||
|
||||
|
||||
$values = ShoppingOrder::where('shopping_orders.auth_user_id', '!=', NULL) //::with('shopping_user', )->select('shopping_orders.*')
|
||||
->where('mode', '=', 'live')
|
||||
->where('paid', '=', 1)
|
||||
->whereHas('shopping_order_items', function($q) {
|
||||
|
||||
$q->where('product_id', 34)->OrWhere('product_id', 35)->OrWhere('product_id', 36)->OrWhere('product_id', 67)->OrWhere('product_id', 69);
|
||||
})
|
||||
->whereBetween('created_at', [$date1, $date2])
|
||||
->get();
|
||||
|
||||
$data = [
|
||||
'years' => $years,
|
||||
'active_year' => $active_year,
|
||||
'values' => $values,
|
||||
];
|
||||
return view('sys.tools.sales', $data);
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
if($data['id'] === "new"){
|
||||
$model = SySetting::create($data);
|
||||
}else{
|
||||
$model = SySetting::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('sysadmin_tool', ['sales_members']));
|
||||
|
||||
}
|
||||
}
|
||||
65
dev/app-bak/Services/SyS/ShoppingOrders.php
Normal file
65
dev/app-bak/Services/SyS/ShoppingOrders.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
use App\Services\Shop;
|
||||
use App\Models\UserShop;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Services\ShoppingUserService;
|
||||
use App\Http\Controllers\Api\KasController;
|
||||
use App\Http\Controllers\Api\KasSLLController;
|
||||
|
||||
class ShoppingOrders
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
abort(403, 'STOP funtion not online');
|
||||
|
||||
$shopping_users = ShoppingUser::all();
|
||||
$data = [
|
||||
'values' => $shopping_users,
|
||||
'text' => '',
|
||||
];
|
||||
return view('sys.tools.shopping-orders', $data);
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
abort(403, 'STOP funtion not online');
|
||||
dd("");
|
||||
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'first_run'){
|
||||
$shopping_users = ShoppingUser::whereHas('shopping_order', function($q) {
|
||||
$q->where('txaction', 'paid')->OrWhere('txaction', 'appointed');
|
||||
})->get();
|
||||
|
||||
$order_email = [];
|
||||
$order_number = [];
|
||||
|
||||
foreach ($shopping_users as $shopping_user){
|
||||
$order_email[$shopping_user->billing_email] = isset($order_email[$shopping_user->billing_email]) ? $order_email[$shopping_user->billing_email] + 1 : 1;
|
||||
if($shopping_user->number) {
|
||||
$order_number[$shopping_user->number] = isset($order_number[$shopping_user->number]) ? $order_number[$shopping_user->number] + 1 : 1;
|
||||
$shopping_user->orders = $order_number[$shopping_user->number];
|
||||
}else {
|
||||
$shopping_user->orders = $order_email[$shopping_user->billing_email];
|
||||
}
|
||||
$shopping_user->save();
|
||||
|
||||
}
|
||||
\Session()->flash('alert-save', true);
|
||||
}
|
||||
|
||||
if($data['action'] === 'next_run'){
|
||||
ShoppingUserService::snycOrdersByShoppingUser($shopping_user);
|
||||
\Session()->flash('alert-save', true);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
}
|
||||
48
dev/app-bak/Services/SyS/UserCreditItemsAddFrom.php
Normal file
48
dev/app-bak/Services/SyS/UserCreditItemsAddFrom.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
use Carbon;
|
||||
use App\Models\SySetting;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\User;
|
||||
|
||||
class UserCreditItemsAddFrom
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
UserCreditItem::all()->each(function($item){
|
||||
$date = self::getExplodeMessage($item);
|
||||
$item->from_month = $date['n'];
|
||||
$item->from_year = $date['Y'];
|
||||
$item->save();
|
||||
});
|
||||
dd("done");
|
||||
}
|
||||
|
||||
|
||||
private static function getExplodeMessage($item){
|
||||
$date = [];
|
||||
if(strpos($item->message, '#')){
|
||||
$em = explode("#", $item->message);
|
||||
|
||||
if(isset($em[1])){ //month
|
||||
$data['n'] =$em[1];
|
||||
}
|
||||
if(isset($em[2])){ //year
|
||||
$data['Y'] =$em[2];
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function store()
|
||||
{
|
||||
abort(403, 'STOP funtion not online');
|
||||
dd("");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
88
dev/app-bak/Services/SyS/UserCreditItemsChangeMessage.php
Normal file
88
dev/app-bak/Services/SyS/UserCreditItemsChangeMessage.php
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Request;
|
||||
use App\Models\UserBusiness;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Models\UserSalesVolume;
|
||||
|
||||
class UserCreditItemsChangeMessage
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
|
||||
dump("UserCreditItemsChangeMessage");
|
||||
dd('check function');
|
||||
$UserCreditItems = UserCreditItem::orderBy('id', 'desc')->limit(1000)->get();
|
||||
dump(count($UserCreditItems));
|
||||
$c = 0;
|
||||
foreach($UserCreditItems as $item){
|
||||
if($item->message){
|
||||
$item->message = self::convertMessage($item->message);
|
||||
$item->save();
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
dump("counter");
|
||||
dd($c);
|
||||
}
|
||||
|
||||
public static function convertMessage($message){
|
||||
$months = [
|
||||
'Januar' => "1#",
|
||||
'Februar' => "2#",
|
||||
'März' => "3#",
|
||||
'April' => "4#",
|
||||
'Mai' => "5#",
|
||||
'Juni' => "6#",
|
||||
'Juli' => "7#",
|
||||
'August' => "8#",
|
||||
'September' => "9#",
|
||||
'Oktober' => "10#",
|
||||
'November' => "11#",
|
||||
'Dezember' => "12#",
|
||||
];
|
||||
|
||||
$em = explode(" ", $message);
|
||||
$new_message = "";
|
||||
if($em[0] === "Provision"){
|
||||
switch ($em[1]) {
|
||||
case 'Shop':
|
||||
$new_message .= 'payment.commission_shop#';
|
||||
break;
|
||||
case 'Team':
|
||||
$new_message .= 'payment.commission_team#';
|
||||
break;
|
||||
case 'Payline':
|
||||
$new_message .= 'payment.commission_payline#';
|
||||
break;
|
||||
case 'Wachstumsbonus':
|
||||
$new_message .= 'payment.commission_growth_bonus#';
|
||||
break;
|
||||
default:
|
||||
dd("Error: ".$message);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($months[$em[2]])){
|
||||
$new_message .= $months[$em[2]];
|
||||
}
|
||||
$new_message .= $em[3];
|
||||
return $new_message;
|
||||
}
|
||||
|
||||
return $message;
|
||||
|
||||
}
|
||||
|
||||
public static function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue