supply 商户端api

This commit is contained in:
mkm 2024-02-20 18:11:01 +08:00
parent cf8c232b96
commit 88e5749618
52 changed files with 185 additions and 74 deletions

View File

@ -34,9 +34,11 @@ class AllowOriginMiddleware extends BaseMiddleware
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Headers' => 'X-Token, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With,Form-type,Referer,Connection,Content-Length,Host,Origin,Authorization,Authori-zation,Accept,Accept-Encoding,uuid',
//,Host,Origin,Authorization,Authori-zation,Accept,Accept-Encoding
//'Access-Control-Allow-Headers' => '*',
// 'Access-Control-Allow-Headers' => '*',
'Access-Control-Allow-Methods' => 'GET,POST,PATCH,PUT,DELETE,OPTIONS',
'Access-Control-Max-Age' => '1728000'
'Access-Control-Max-Age' => '1728000',
'Access-Control-Allow-Credentials' => 'true',
];
public function before(Request $request)
@ -53,6 +55,7 @@ class AllowOriginMiddleware extends BaseMiddleware
public function after(Response $response)
{
$response->header($this->header);
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\repositories\store;
use app\common\repositories\system\config\ConfigValueRepository;
class SupplyTakeRepository
{
public function get($merId)
{
return merchantConfig($merId, [
'mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time'
]);
}
public function set($merId, array $data)
{
$configValueRepository = app()->make(ConfigValueRepository::class);
$configValueRepository->setFormData($data, $merId);
}
public function has($merId)
{
return merchantConfig($merId, 'mer_take_status') == '1';
}
}

View File

@ -208,4 +208,28 @@ class Menu extends BaseController
return 0 == $v['pid'];
})));
}
/**供应
* @return mixed
* @author xaboy
* @day 2020-04-10
*/
public function supplyMenus()
{
$pre = '/' . config('admin.merchant_prefix');
$merchant = $this->request->merchant();
if ($this->request->adminInfo()->level) {
$menus = $this->repository->ruleByMenuList($this->request->adminRule(), $this->merchant);
} else {
$menus = $merchant->type_id ? $this->repository->typesByValidMenuList($merchant->type_id) : $this->repository->getValidMenuList($this->merchant);
}
foreach ($menus as $k => $menu) {
$menu['path'] = $pre . $menu['path'];
$menus[$k] = $menu;
}
return app('json')->success(array_values(array_filter(formatCategory($menus, 'id'), function ($v) {
return 0 == $v['pid'];
})));
}
}

View File

@ -279,12 +279,12 @@ class Common extends BaseController
return app('json')->success($data);
}
public function getMerchantCount()
public function getSupplyCount()
{
return app('json')->success(app()->make(CountRepository::class)->getMerchantCount($this->request->merId()));
}
public function getMerchantTodo()
public function getSupplyTodo()
{
return app('json')->success(app()->make(CountRepository::class)->getMerchantTodo($this->request->merId()));
}

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
namespace app\controller\supply\store;
use app\common\repositories\store\ExcelRepository;
use crmeb\exceptions\UploadException;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
namespace app\controller\supply\store;
use crmeb\basic\BaseController;

View File

@ -9,7 +9,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
namespace app\controller\supply\store;
use app\common\repositories\store\order\StoreImportDeliveryRepository;
use crmeb\jobs\ImportSpreadsheetExcelJob;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
namespace app\controller\supply\store;
use app\common\repositories\store\StorePrinterRepository;
use think\App;

View File

@ -10,7 +10,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
namespace app\controller\supply\store;
use app\common\repositories\store\product\ProductReplyRepository;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store\broadcast;
namespace app\controller\supply\store\broadcast;
use app\common\repositories\store\broadcast\BroadcastAssistantRepository;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store\broadcast;
namespace app\controller\supply\store\broadcast;
use app\common\repositories\store\broadcast\BroadcastGoodsRepository;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store\broadcast;
namespace app\controller\supply\store\broadcast;
use app\common\repositories\store\broadcast\BroadcastAssistantRepository;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store\coupon;
namespace app\controller\supply\store\coupon;
use app\common\repositories\store\coupon\StoreCouponSendRepository;

View File

@ -10,7 +10,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store\coupon;
namespace app\controller\supply\store\coupon;
use app\common\repositories\store\coupon\StoreCouponSendRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\delivery;
namespace app\controller\supply\store\delivery;
use app\common\repositories\delivery\DeliveryOrderRepository;
use think\App;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\delivery;
namespace app\controller\supply\store\delivery;
use app\common\repositories\system\serve\ServeOrderRepository;
use crmeb\services\DeliverySevices;

View File

@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\guarantee;
namespace app\controller\supply\store\guarantee;
use app\common\repositories\store\GuaranteeRepository;
use app\common\repositories\store\GuaranteeTemplateRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
namespace app\controller\supply\store\order;
use app\common\repositories\store\order\SupplyReconciliationRepository;
use app\common\repositories\store\order\StoreOrderRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
namespace app\controller\supply\store\order;
use think\App;
use crmeb\basic\BaseController;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
namespace app\controller\supply\store\order;
use think\App;
use crmeb\basic\BaseController;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
namespace app\controller\supply\store\order;
use app\common\repositories\store\order\SupplyReconciliationRepository;
use app\common\repositories\store\order\StoreOrderProductRepository;

View File

@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\StoreDiscountRepository;
use app\validate\supply\StoreDiscountsValidate;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\order\StoreCartRepository;
use app\common\repositories\store\product\ProductAttrValueRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductAssistRepository as repository;
use app\common\repositories\store\product\ProductRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductAssistSetRepository as repository;
use app\common\repositories\store\product\ProductAssistUserRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\system\supply\SupplyRepository;
use think\App;

View File

@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\store\product\SpuRepository;

View File

@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductGroupUserRepository;
use think\App;

View File

@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductLabelRepository;
use app\validate\admin\ProductLabelValidate;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductPresellRepository as repository;
use app\common\repositories\store\product\ProductRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductLabelRepository;
use app\common\repositories\store\product\SpuRepository;

View File

@ -1,6 +1,6 @@
<?php
namespace app\validate\supply\store\product;
namespace app\controller\supply\store\product;
use app\common\repositories\store\product\ProductUnitRepository as repository;
use app\validate\admin\ProductUnitValidate;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\store\service;
namespace app\controller\supply\store\service;
use app\common\repositories\store\service\StoreServiceLogRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\service;
namespace app\controller\supply\store\service;
use app\common\repositories\store\service\StoreServiceReplyRepository;
use app\validate\supply\ServiceReplyValidate;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
namespace app\controller\supply\store\shipping;
use app\common\repositories\store\CityAreaRepository;
use Overtrue\Pinyin\Pinyin;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
namespace app\controller\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
namespace app\controller\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
namespace app\controller\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
namespace app\controller\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;

View File

@ -11,42 +11,42 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system;
namespace app\controller\supply\system;
use app\common\repositories\store\MerchantTakeRepository;
use app\common\repositories\store\SupplyTakeRepository;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\system\config\ConfigValueRepository;
use app\common\repositories\system\operate\OperateLogRepository;
use app\common\repositories\system\serve\ServeOrderRepository;
use app\common\repositories\user\UserBillRepository;
use app\validate\merchant\MerchantTakeValidate;
use app\validate\supply\MerchantTakeValidate;
use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantRepository;
use app\validate\merchant\MerchantUpdateValidate;
use crmeb\jobs\ChangeMerchantStatusJob;
use app\common\repositories\system\supply\SupplyRepository;
use app\validate\supply\MerchantUpdateValidate;
use crmeb\jobs\ChangeSupplyStatusJob;
use think\App;
use think\facade\Queue;
/**
* Class Merchant
* @package app\controller\merchant\system
* Class Supply
* @package app\controller\Supply\system
* @author xaboy
* @day 2020/6/25
*/
class Merchant extends BaseController
class Supply extends BaseController
{
/**
* @var MerchantRepository
* @var SupplyRepository
*/
protected $repository;
/**
* Merchant constructor.
* @param App $app
* @param MerchantRepository $repository
* @param SupplyRepository $repository
*/
public function __construct(App $app, MerchantRepository $repository)
public function __construct(App $app, SupplyRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
@ -69,7 +69,7 @@ class Merchant extends BaseController
* @author xaboy
* @day 2020/6/25
*/
public function update(MerchantUpdateValidate $validate, MerchantTakeValidate $takeValidate, MerchantTakeRepository $repository)
public function update(MerchantUpdateValidate $validate, MerchantTakeValidate $takeValidate, SupplyTakeRepository $repository)
{
$type = $this->request->param('type',1);
$merchant = $this->request->merchant();
@ -138,7 +138,7 @@ class Merchant extends BaseController
],
]);
Queue::push(ChangeMerchantStatusJob::class, $this->request->merId());
Queue::push(ChangeSupplyStatusJob::class, $this->request->merId());
return app('json')->success('修改成功');
}
@ -148,7 +148,7 @@ class Merchant extends BaseController
* @author xaboy
* @day 2020/7/21
*/
public function info(MerchantTakeRepository $repository)
public function info(SupplyTakeRepository $repository)
{
$merchant = $this->request->merchant();
$adminInfo = $this->request->adminInfo();
@ -168,12 +168,12 @@ class Merchant extends BaseController
}
/**
* @param MerchantTakeRepository $repository
* @param SupplyTakeRepository $repository
* @return mixed
* @author xaboy
* @day 2020/8/1
*/
public function takeInfo(MerchantTakeRepository $repository)
public function takeInfo(SupplyTakeRepository $repository)
{
$merId = $this->request->merId();
return app('json')->success($repository->get($merId) + systemConfig(['tx_map_key']));
@ -181,12 +181,12 @@ class Merchant extends BaseController
/**
* @param MerchantTakeValidate $validate
* @param MerchantTakeRepository $repository
* @param SupplyTakeRepository $repository
* @return mixed
* @author xaboy
* @day 2020/8/1
*/
public function take(MerchantTakeValidate $validate, MerchantTakeRepository $repository)
public function take(MerchantTakeValidate $validate, SupplyTakeRepository $repository)
{
$data = $this->request->params(['mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time']);
$validate->check($data);

View File

@ -11,28 +11,28 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system;
namespace app\controller\supply\system;
use app\validate\merchant\MerchantApplymentsValidate;
use app\validate\supply\MerchantApplymentsValidate;
use think\App;
use think\facade\Config;
use think\facade\Queue;
use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantApplymentsRepository;
use app\common\repositories\system\supply\SupplyApplymentsRepository;
class MerchantApplyments extends BaseController
class SupplyApplyments extends BaseController
{
/**
* @var MerchantRepository
* @var SupplyRepository
*/
protected $repository;
/**
* Merchant constructor.
* Supply constructor.
* @param App $app
* @param MerchantRepository $repository
*/
public function __construct(App $app, MerchantApplymentsRepository $repository)
public function __construct(App $app, SupplyApplymentsRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system\admin;
namespace app\controller\supply\system\admin;
use crmeb\basic\BaseController;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system\admin;
namespace app\controller\supply\system\admin;
use app\common\repositories\system\auth\RoleRepository;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system\auth;
namespace app\controller\supply\system\auth;
use crmeb\basic\BaseController;

View File

@ -9,7 +9,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\diy;
namespace app\controller\supply\system\diy;
use app\common\repositories\article\ArticleRepository;
use app\common\repositories\store\product\ProductRepository;

View File

@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\financial;
namespace app\controller\supply\system\financial;
use app\common\repositories\system\financial\FinancialRepository;
use app\validate\supply\MerchantFinancialAccountValidate;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system\notice;
namespace app\controller\supply\system\notice;
use app\common\repositories\system\notice\SystemNoticeLogRepository;

View File

@ -10,7 +10,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\openapi;
namespace app\controller\supply\system\openapi;
use app\common\repositories\openapi\OpenAuthRepository;
use app\validate\supply\OpenAuthValidate;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system\serve;
namespace app\controller\supply\system\serve;
use app\common\repositories\system\config\ConfigValueRepository;
use app\common\repositories\system\serve\ServeOrderRepository;

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
namespace app\validate\supply\system\serve;
namespace app\controller\supply\system\serve;
use app\common\repositories\system\serve\ServeMealRepository;
use app\common\repositories\system\serve\ServeOrderRepository;

View File

@ -23,9 +23,11 @@ return [
'captcha_exp' => 30, //30分钟
'admin_prefix' => 'admin',
'merchant_prefix' => 'merchant',
'supply_prefix' => 'supply',
'service_prefix' => 'kefu',
'api_admin_prefix' => 'sys',
'api_merchant_prefix' => 'mer',
'api_supply_prefix' => 'sply',
'api_service_prefix' => 'ser',
'api_openapi_prefix' => 'openapi',
'vic_word_status' => 0,

44
route/supply.php Normal file
View File

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\CheckSiteOpenMiddleware;
use app\common\middleware\InstallMiddleware;
use think\facade\Route;
use app\common\middleware\RequestLockMiddleware;
Route::group(config('admin.supply_prefix'), function () {
Route::miss(function () {
$DB = DIRECTORY_SEPARATOR;
return view(app()->getRootPath() . 'public' . $DB . 'mer.html');
});
})->middleware(InstallMiddleware::class)
->middleware(CheckSiteOpenMiddleware::class);
Route::group(config('admin.api_supply_prefix') . '/', function () {
$path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR.'supply';
$files = scandir($path);
foreach ($files as $file) {
if($file != '.' && $file != '..'){
include $path . DIRECTORY_SEPARATOR . $file;
}
}
Route::miss(function () {
return app('json')->fail('接口不存在');
})->middleware(AllowOriginMiddleware::class);
})
->option([
'_lock' => true
])
->middleware(InstallMiddleware::class)
->middleware(CheckSiteOpenMiddleware::class)
->middleware(RequestLockMiddleware::class);