Skip to content

Commit

Permalink
쿠폰 적용
Browse files Browse the repository at this point in the history
쿠폰 적용
  • Loading branch information
wangta69 committed Dec 26, 2024
1 parent 5d73645 commit 88583af
Show file tree
Hide file tree
Showing 96 changed files with 2,629 additions and 1,097 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wangta69/laravel-market",
"description": "e-commerce plugins",
"keywords": ["laravel", "market", "pondol" , "쇼핑몰", "mall", "독립형", "korea", "라라벨"],
"homepage": "https://mall.onstory.fun",
"homepage": "https://www.onstory.fun/packages/laravel-market",
"license": "MIT",
"authors": [
{
Expand All @@ -25,6 +25,7 @@
"wangta69/laravel-delivery-tracking": "*",
"wangta69/laravel-mailer": "*",
"wangta69/laravel-visitors-statistics": "*",
"wangta69/laravel-meta": "*",
"wangta69/laravel-index-now": "*"
},
"autoload": {
Expand Down
32 changes: 31 additions & 1 deletion src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function handle()
{
$type = $this->argument('type');
return $this->installBladeStack($type);

}


Expand Down Expand Up @@ -112,6 +111,37 @@ protected function replaceInFile($search, $replace, $path)
{
file_put_contents($path, str_replace($search, $replace, file_get_contents($path)));
}

protected function chageOtherConfig() {
$configs = [
'pondol-auth'=>[
'component.admin.layout'=>['pondol-auth::admin', 'market::app-admin'],
'route_auth_admin.prefix'=>['auth/admin', 'admin/auth']
],
'pondol-mailer'=>[
'component.admin.layout'=>['pondol-mailer::admin', 'market::app-admin'],
'prefix'=>['mailer', 'admin/mailer']
],
'pondol-visitor'=>[
'component.admin.layout'=>['visitors::admin', 'market::app-admin'],
'route_admin.prefix'=>['visitors/admin', 'admin/visitors']
]
];

foreach($configs as $key => $val) {
foreach($val as $k => $v) {
if (config($key.'.'.$k) == $v[0]) {
$this->comment( $key);
$this->comment( $k);
$this->comment( $v[0]);
$this->comment( $v[1]);
set_config($key, [$k => $v[1]]);
}
}
}
}



/*
protected static function flushNodeModules()
Expand Down
15 changes: 12 additions & 3 deletions src/Console/InstallsBladeStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ protected function installBladeStack($type)
$this->updateWebpackMix();

// 기존 web.php 백업시킨다.
copy(base_path('routes/web.php'), base_path('routes/web.back.php'));
copy(__DIR__.'/../routes/web-blank.php', base_path('routes/web.php'));
// copy(base_path('routes/web.php'), base_path('routes/web.back.php'));
// copy(__DIR__.'/../routes/web-blank.php', base_path('routes/web.php'));

$this->replaceInFile('/home', '/', app_path('Providers/RouteServiceProvider.php'));

$this->call('pondol:install-editor');
$this->call('pondol:install-auth', ['type'=> 'only']);
$this->call('pondol:install-auth', ['type'=> 'simple']);
$this->call('pondol:install-mailer', ['type'=> 'only']);
// laravel board
\Artisan::call('vendor:publish', [
Expand All @@ -73,11 +73,20 @@ protected function installBladeStack($type)
'--provider' => 'Pondol\Market\MarketServiceProvider'
]);

// meta install
\Artisan::call('vendor:publish', [
'--force'=> true,
'--provider' => 'Pondol\Meta\MetaServiceProvider'
]);

// auth 관련 변경
configSet('pondol-auth', ['activate' => 'auto', 'template.user'=>'default-market', 'template.mail'=>'default-market']); //

\Artisan::call('migrate');

// 연관 패키지의 config 변경
$this->chageOtherConfig();

$this->comment('Please execute the "npm install" && "npm run dev" commands to build your assets.');
}
}
4 changes: 1 addition & 3 deletions src/Events/OrderShipped.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ class OrderShipped
* @return void
*/
public $order;
public $user;

public function __construct($user, $order)
public function __construct($order)
{
$this->user = $user;
$this->order = $order;

}
Expand Down
14 changes: 14 additions & 0 deletions src/Facades/DeliveryFee.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Pondol\Market\Facades;

use Illuminate\Support\Facades\Facade;

class DeliveryFee extends Facade
{

protected static $cached = false;
protected static function getFacadeAccessor()
{
return 'market-delivery-fee';
}
}
51 changes: 31 additions & 20 deletions src/Http/Controllers/Admin/CancelReturnExchangeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
namespace Pondol\Market\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Log;

use Carbon\Carbon;
use File;
use Storage;

use Pondol\Market\Models\MarketExchangeReturn;
use Pondol\Market\Traits\CancelReturnExchange;

use App\Http\Controllers\Controller;

class CancelReturnExchangeController extends Controller
{

use CancelReturnExchange;
/**
* Create a new controller instance.
*
Expand All @@ -25,30 +27,39 @@ public function __construct()
}

public function index(Request $request) {
$items = MarketExchangeReturn::from('market_exchange_returns as re') ->select(
're.id', 're.type', 're.created_at', 're.qty', 're.item_price', 're.option_price','re.options',
're.status',
'it.name', 'it.model', 'it.image',
'o.o_id', 'o.created_at as order_created_at'
)->withTrashed()


->join('market_items as it', function($join){
$join->on('it.id', '=', 're.item_id');
})
// \DB::enableQueryLog();
$types = $request->types;
$from_date = $request->from_date;
$to_date = $request->to_date;

if (!$types) {
$types = ['refund', 'exchange'];
$request->merge(['types' => $types]);
}

->join('market_orders as o', function($join){
$join->on('re.order_id', '=', 'o.id');
})

->whereNull("re.deleted_at")
->orderBy('re.id', 'desc')->paginate(15)->withQueryString();
$items = $this->_index();
$items = $items->whereIn('re.type', $types);
// $items = $items->whereIn('re.type', ['refund', 'exchange']);
if ($from_date) {
if (!$to_date) {
$to_date = date("Y-m-d");
}

$from_date = Carbon::createFromFormat('Y-m-d', $from_date);
$to_date = Carbon::createFromFormat('Y-m-d', $to_date);
$items = $items->whereBetween('re.created_at', [$from_date->startOfDay(), $to_date->endOfDay()]);
}


$items = $items->orderBy('re.id', 'desc')
->paginate(15)->withQueryString();

foreach($items as $item) {
$item->displayOptions = extractOptions($item);
}

// print_r(\DB::getQueryLog());

return view('market::admin.cancel-return-exchange.index', [
'items'=>$items,
'return_status' => config('pondol-market.return_status'),
Expand Down
8 changes: 2 additions & 6 deletions src/Http/Controllers/Admin/Config/BankController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Log;
use Pondol\Market\Services\ConfigService;
use Pondol\Market\Models\MarketBank;

class BankController extends Controller
Expand All @@ -16,11 +15,8 @@ class BankController extends Controller
* @return void
*/
public function __construct(
ConfigService $configSvc
)
{
// $this->middleware('auth');
$this->configSvc = $configSvc;
}

/**
Expand All @@ -34,7 +30,7 @@ public function index()
// $cat1 = $this->subCategory('');

$banks = MarketBank::where('type', 'manager')->paginate(20)->appends(request()->query());
$codes = $this->configSvc->get('banks');
$codes = config('pondol-market.banks');
return view('market::admin.config.bank', [
'banks'=>$banks,
'codes' => $codes
Expand All @@ -45,7 +41,7 @@ public function create() {


// [TACKBAE_MONEY] => 1000
$codes = $this->configSvc->get('banks');
$codes = config('pondol-market.banks');
return view('market::admin.config.bank-create', [
'codes' => $codes
]);
Expand Down
22 changes: 10 additions & 12 deletions src/Http/Controllers/Admin/Config/CompanyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Log;
use Pondol\Market\Services\ConfigService;
use Pondol\Market\Models\MarketBank;

use Pondol\Common\Facades\JsonKeyValue;
// use Pondol\Auth\Models\User\UserConfig;

class CompanyController extends Controller
Expand All @@ -17,11 +17,8 @@ class CompanyController extends Controller
* @return void
*/
public function __construct(
ConfigService $configSvc
)
{
// $this->middleware('auth');
$this->configSvc = $configSvc;
}

/**
Expand All @@ -32,13 +29,12 @@ public function __construct(
public function index()
{

$company = $this->configSvc->get('company');
// $termsOfUse = UserConfig::where('key', 'termsOfUse')->first();
// $termsOfPersonal = UserConfig::where('key', 'termsOfPersonal')->first();

$company = JsonKeyValue::getAsJson('company');
$company->copyright = isset($company->copyright) ? $company->copyright: '';


return view('market::admin.config.company', [
'company'=>$company
]);
return view('market::admin.config.company', compact('company'));
}

public function update(Request $request) {
Expand All @@ -51,9 +47,11 @@ public function update(Request $request) {
'representative' => $request->representative,
'tel1' => $request->tel1,
'fax1' => $request->fax1,
'copyright' => $request->copyright,
];

$this->configSvc->set('company', $params );
set_config('pondol-market.company', $params );
JsonKeyValue::storeAsJson('company', $params);
return response()->json(['error'=>false]);
}

Expand Down
8 changes: 2 additions & 6 deletions src/Http/Controllers/Admin/Config/DeliveryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Log;
use Pondol\Market\Services\ConfigService;


class DeliveryController extends Controller
Expand All @@ -16,11 +15,8 @@ class DeliveryController extends Controller
* @return void
*/
public function __construct(
ConfigService $configSvc
)
{
// $this->middleware('auth');
$this->configSvc = $configSvc;
}

/**
Expand All @@ -33,7 +29,7 @@ public function index()
// config()->set('app.name','My Project App');
// $cat1 = $this->subCategory('');
// \Artisan::call('config:clear'); // 만약 production mode이고 config를 cache 하여 사용하면
$cfg = $this->configSvc->get();
$cfg = config('pondol-market');

return view('market::admin.config.delivery', [
'cfg'=>$cfg
Expand All @@ -47,7 +43,7 @@ public function update(Request $request) {
'min' => $request->min
];
// [TACKBAE_MONEY] => 1000
$this->configSvc->set('delivery', $config );
set_config('pondol-market.delivery', $config );


}
Expand Down
9 changes: 2 additions & 7 deletions src/Http/Controllers/Admin/Config/PgController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Log;
use Pondol\Market\Services\ConfigService;
use Pondol\Market\Models\MarketBank;

class PgController extends Controller
Expand All @@ -16,11 +15,8 @@ class PgController extends Controller
* @return void
*/
public function __construct(
ConfigService $configSvc
)
{
// $this->middleware('auth');
$this->configSvc = $configSvc;
}

/**
Expand All @@ -34,8 +30,7 @@ public function index()
// $cat1 = $this->subCategory('');

// $banks = MarketBank::paginate(20)->appends(request()->query());
// $codes = $this->configSvc->get('banks');
$payment = $this->configSvc->get('payment');
$payment = config('pondol-market.payment');
$pgs = ['inicis'=>'Inicis', 'kcp'=>'KCP', 'lg'=>'LG'];
$simples = ['naver'=>'네이버 페이', 'kakao'=>'카카오 페이']; // simplePayments
return view('market::admin.config.pg', [
Expand All @@ -57,7 +52,7 @@ public function update(Request $request) {
'kakao' => $request->kakao ? true : false,
];
Log::info($params);
$this->configSvc->set('payment', $params );
set_config('pondol-market.payment', $params );
return response()->json(['error'=>false]);
}

Expand Down
Loading

0 comments on commit 88583af

Please sign in to comment.