商品、订单部分相关代码生成,下一步先把商品搞完再搞订单
This commit is contained in:
@@ -29,6 +29,10 @@ class BaseService
|
||||
* @var int 角色ID,默认值为0,表示未登录状态
|
||||
*/
|
||||
protected int $roleId = 0;
|
||||
/**
|
||||
* @var int 商家ID
|
||||
*/
|
||||
protected int $mallId = 0;
|
||||
|
||||
/**
|
||||
* @var array 用户信息
|
||||
@@ -95,6 +99,7 @@ class BaseService
|
||||
$this->userInfo = JWTService::getInstance()->getToken()->getUserInfo();
|
||||
$this->userId = $this->userInfo['id'] ?? 0;
|
||||
$this->roleId = $this->userInfo['role_id'] ?? 0;
|
||||
$this->mallId = $this->userInfo['mall_id'] ?? 0;
|
||||
$this->utils = UtilsService::getInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\StoreClassificationService;
|
||||
use App\Service\CodeGeneration\MallClassificationService;
|
||||
|
||||
class StoreClassificationController extends BaseController
|
||||
class MallClassificationController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
@@ -13,6 +13,6 @@ class StoreClassificationController extends BaseController
|
||||
parent::__construct();
|
||||
$this->insertField = ["name","pid"];
|
||||
$this->updateField = ["id","name","pid"];
|
||||
$this->service = StoreClassificationService::getInstance();
|
||||
$this->service = MallClassificationService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\StoreService;
|
||||
use App\Service\CodeGeneration\MallService;
|
||||
|
||||
class StoreController extends BaseController
|
||||
class MallController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
@@ -13,6 +13,6 @@ class StoreController extends BaseController
|
||||
parent::__construct();
|
||||
$this->insertField = ["name","level","avatar","introduction","description","phone","person", "classification_id","id_card","is_featured","business_license","id_card_portrait_side","id_card_national_emblem_side","chain","business_suspended"];
|
||||
$this->updateField = ["id","name","level","avatar","introduction","description","phone","person", "classification_id","is_featured","business_license","id_card_portrait_side","id_card_national_emblem_side","chain","business_suspended"];
|
||||
$this->service = StoreService::getInstance();
|
||||
$this->service = MallService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\MallMembershipLevelService;
|
||||
|
||||
class MallMembershipLevelController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["name","experience"];
|
||||
$this->updateField = ["id","name","experience"];
|
||||
$this->service = MallMembershipLevelService::getInstance();
|
||||
}
|
||||
}
|
||||
18
app/Http/Controllers/Api/CodeGeneration/OrderController.php
Normal file
18
app/Http/Controllers/Api/CodeGeneration/OrderController.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\OrderService;
|
||||
|
||||
class OrderController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["user_id","order_no","order_status","total_amount"];
|
||||
$this->updateField = ["id","user_id","order_no","order_status","total_amount"];
|
||||
$this->service = OrderService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\OrderDetailService;
|
||||
|
||||
class OrderDetailController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["order_id","product_id","quantity","price","subtotal","snapshot"];
|
||||
$this->updateField = ["id","order_id","product_id","quantity","price","subtotal","snapshot"];
|
||||
$this->service = OrderDetailService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ class ProductController extends BaseController
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["title","introduction","cover", "images","description","price","classification_id"];
|
||||
$this->updateField = ["id","title","introduction","cover", "images","description","price","classification_id"];
|
||||
$this->insertField = ["title","introduction","cover", "images", "labels","description","price","classification_id"];
|
||||
$this->updateField = ["id","title","introduction","cover", "images", "labels","description","price","classification_id"];
|
||||
$this->service = ProductService::getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\ProductLabelRelationsService;
|
||||
|
||||
class ProductLabelRelationsController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["product_id","label_id"];
|
||||
$this->updateField = ["id","product_id","label_id"];
|
||||
$this->service = ProductLabelRelationsService::getInstance();
|
||||
}
|
||||
}
|
||||
18
app/Http/Controllers/Api/CodeGeneration/SkuController.php
Normal file
18
app/Http/Controllers/Api/CodeGeneration/SkuController.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\SkuService;
|
||||
|
||||
class SkuController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["product_id","cover", "name","inventory","price"];
|
||||
$this->updateField = ["id","product_id","cover", "name","inventory","price"];
|
||||
$this->service = SkuService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\UserBrowsingHistoryService;
|
||||
|
||||
class UserBrowsingHistoryController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["user_id","product_id"];
|
||||
$this->updateField = ["id","user_id","product_id"];
|
||||
$this->service = UserBrowsingHistoryService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\UserCollectService;
|
||||
|
||||
class UserCollectController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["user_id","product_id"];
|
||||
$this->updateField = ["id","user_id","product_id"];
|
||||
$this->service = UserCollectService::getInstance();
|
||||
}
|
||||
}
|
||||
18
app/Http/Controllers/Api/CodeGeneration/UserController.php
Normal file
18
app/Http/Controllers/Api/CodeGeneration/UserController.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\UserService;
|
||||
|
||||
class UserController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["nick_name","phone","email","level","balance","avatar","integral"];
|
||||
$this->updateField = ["id","nick_name","phone","email","level","balance","avatar","integral"];
|
||||
$this->service = UserService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\UserMembershipService;
|
||||
|
||||
class UserMembershipController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["name","experience"];
|
||||
$this->updateField = ["id","name","experience"];
|
||||
$this->service = UserMembershipService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CodeGeneration\UserReceivingAddressService;
|
||||
|
||||
class UserReceivingAddressController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ["user_id","province","city","district","detailed_address","complete_address"];
|
||||
$this->updateField = ["id","user_id","province","city","district","detailed_address","complete_address"];
|
||||
$this->service = UserReceivingAddressService::getInstance();
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class StoreClassificationModel extends BaseModel
|
||||
class MallClassificationModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'store_classification';
|
||||
protected $table = 'mall_classification';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
26
app/Models/MallMembershipLevelModel.php
Normal file
26
app/Models/MallMembershipLevelModel.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class MallMembershipLevelModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'mall_membership_level';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(ProductModel::class, 'id', 'product_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(UserModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class StoreModel extends BaseModel
|
||||
class MallModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'store';
|
||||
protected $table = 'mall';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
17
app/Models/OrderDetailModel.php
Normal file
17
app/Models/OrderDetailModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class OrderDetailModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'order_detail';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
}
|
||||
17
app/Models/OrderModel.php
Normal file
17
app/Models/OrderModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class OrderModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'order';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
}
|
||||
17
app/Models/ProductLabelRelationsModel.php
Normal file
17
app/Models/ProductLabelRelationsModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class ProductLabelRelationsModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'product_label_relations';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -20,4 +20,30 @@ class ProductModel extends BaseModel
|
||||
{
|
||||
return $this->hasMany(ProductImageModel::class, 'product_id', 'id');
|
||||
}
|
||||
|
||||
public function mall()
|
||||
{
|
||||
return $this->hasOne(MallModel::class, 'id', 'mall_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(AdminModel::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
public function labels()
|
||||
{
|
||||
// return $this->hasMany(ProductLabelRelationsModel::class, 'product_id', 'id');
|
||||
return $this->belongsToMany(ProductLabelModel::class, 'product_label_relations', 'product_id', 'label_id');
|
||||
}
|
||||
|
||||
public function classification()
|
||||
{
|
||||
return $this->hasOne(ProductClassificationModel::class, 'id', 'classification_id');
|
||||
}
|
||||
|
||||
public function skus()
|
||||
{
|
||||
return $this->hasMany(SkuModel::class, 'product_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Models/SkuModel.php
Normal file
22
app/Models/SkuModel.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class SkuModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'sku';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(ProductModel::class, 'id', 'product_id');
|
||||
}
|
||||
}
|
||||
27
app/Models/UserBrowsingHistoryModel.php
Normal file
27
app/Models/UserBrowsingHistoryModel.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class UserBrowsingHistoryModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'user_browsing_history';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(ProductModel::class, 'id', 'product_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(UserModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
||||
26
app/Models/UserCollectModel.php
Normal file
26
app/Models/UserCollectModel.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class UserCollectModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'user_collect';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(ProductModel::class, 'id', 'product_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(UserModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
||||
17
app/Models/UserMembershipModel.php
Normal file
17
app/Models/UserMembershipModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class UserMembershipModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'user_membership';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
}
|
||||
17
app/Models/UserModel.php
Normal file
17
app/Models/UserModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class UserModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'user';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
}
|
||||
22
app/Models/UserReceivingAddressModel.php
Normal file
22
app/Models/UserReceivingAddressModel.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
class UserReceivingAddressModel extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'user_receiving_address';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(UserModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
||||
@@ -3,19 +3,19 @@
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\StoreClassificationModel;
|
||||
use App\Models\MallClassificationModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class StoreClassificationService extends BaseService
|
||||
class MallClassificationService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "name", "pid", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['name' => 'like','pid' => '=,status='];
|
||||
$this->model = StoreClassificationModel::class;
|
||||
$this->model = MallClassificationModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
87
app/Service/CodeGeneration/MallMembershipLevelService.php
Normal file
87
app/Service/CodeGeneration/MallMembershipLevelService.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\MallMembershipLevelModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class MallMembershipLevelService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "name", "experience", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['name' => '=,status='];
|
||||
$this->model = MallMembershipLevelModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺会员等级列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺会员等级详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺会员等级下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建店铺会员等级
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑店铺会员等级
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店铺会员等级
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,19 +3,19 @@
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\StoreModel;
|
||||
use App\Models\MallModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class StoreService extends BaseService
|
||||
class MallService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "name", "level", "avatar", "introduction", "classification_id", "description", "phone", "person", "id_card", "qr_code", "is_featured", "business_license", "id_card_portrait_side", "id_card_national_emblem_side", "chain", "business_suspended", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['name' => '=','level' => '=','phone' => 'like','person' => '=','classification_id' => '=','is_featured' => '=','chain' => '=','business_suspended' => '=,status='];
|
||||
$this->model = StoreModel::class;
|
||||
$this->model = MallModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
87
app/Service/CodeGeneration/OrderDetailService.php
Normal file
87
app/Service/CodeGeneration/OrderDetailService.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\OrderDetailModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class OrderDetailService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "order_id", "product_id", "quantity", "price", "subtotal", "snapshot", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['order_id' => '=','product_id' => '=,status='];
|
||||
$this->model = OrderDetailModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单详情
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑订单详情
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单详情
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
87
app/Service/CodeGeneration/OrderService.php
Normal file
87
app/Service/CodeGeneration/OrderService.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\OrderModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class OrderService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "user_id", "order_no", "order_status", "total_amount", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['user_id' => '=','order_no' => 'like','order_status' => '=,status='];
|
||||
$this->model = OrderModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单管理列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单管理详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单管理下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单管理
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑订单管理
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单管理
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
87
app/Service/CodeGeneration/ProductLabelRelationsService.php
Normal file
87
app/Service/CodeGeneration/ProductLabelRelationsService.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\ProductLabelRelationsModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class ProductLabelRelationsService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "product_id", "label_id", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['product_id' => '=','label_id' => '=,status='];
|
||||
$this->model = ProductLabelRelationsModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品标签关联列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品标签关联详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品标签关联下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建商品标签关联
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑商品标签关联
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品标签关联
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\ProductImageModel;
|
||||
use App\Models\ProductLabelRelationsModel;
|
||||
use App\Models\ProductModel;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -19,7 +20,12 @@ class ProductService extends BaseService
|
||||
$this->queryField = ['title' => 'like','mall_id' => '=','classification_id' => '=,status='];
|
||||
$this->model = ProductModel::class;
|
||||
$this->with = [
|
||||
'images:id,product_id,url'
|
||||
'images:id,product_id,url',
|
||||
'mall:id,name,avatar',
|
||||
'user:id,nick_name,avatar',
|
||||
'labels',
|
||||
'classification',
|
||||
'skus:id,product_id,name,cover,price,inventory',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -34,6 +40,8 @@ class ProductService extends BaseService
|
||||
$result = $this->getPageList();
|
||||
foreach ($result['items'] as &$v) {
|
||||
$v['images'] = array_column($v['images'], 'url');
|
||||
$v['labels_name'] = array_column($v['labels'], 'name');
|
||||
$v['labels'] = array_column($v['labels'], 'id');
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -46,7 +54,14 @@ class ProductService extends BaseService
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
$result = $this->getDetail($id);
|
||||
$result = $result->toArray();
|
||||
$items = [];
|
||||
foreach ($result['images'] as $v) {
|
||||
$items[] = $v['url'];
|
||||
}
|
||||
$result['images'] = $items;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +70,7 @@ class ProductService extends BaseService
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
$this->optionField = ['id', 'title'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
@@ -68,8 +83,10 @@ class ProductService extends BaseService
|
||||
public function create($params): mixed
|
||||
{
|
||||
$images = $params['images'];
|
||||
unset($params['images']);
|
||||
$labels = $params['labels'];
|
||||
unset($params['images'], $params['labels']);
|
||||
$params['user_id'] = $this->userId;
|
||||
$params['mall_id'] = $this->mallId;
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
|
||||
@@ -81,7 +98,20 @@ class ProductService extends BaseService
|
||||
'url' => $v
|
||||
];
|
||||
}
|
||||
|
||||
$imageModel = ProductImageModel::insert($insertData);
|
||||
|
||||
$labelInsertData = [];
|
||||
foreach ($labels as $v) {
|
||||
$labelInsertData[] = [
|
||||
'product_id' => $result,
|
||||
'label_id' => $v
|
||||
];
|
||||
}
|
||||
$labelModel = ProductLabelRelationsModel::insert($labelInsertData);
|
||||
if (!$imageModel || !$labelModel) {
|
||||
$this->utils->errorThrow('操作失败');
|
||||
}
|
||||
DB::commit();
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
@@ -102,7 +132,8 @@ class ProductService extends BaseService
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$images = $params['images'];
|
||||
unset($params['images']);
|
||||
$labels = $params['labels'];
|
||||
unset($params['images'], $params['labels']);
|
||||
// 1. 更新产品基本信息
|
||||
$model = $this->save($id, $params);
|
||||
|
||||
@@ -139,6 +170,39 @@ class ProductService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 处理标签逻辑
|
||||
if (isset($images)) {
|
||||
$newLabels = $labels;
|
||||
|
||||
// 获取当前产品已有的图片URL列表
|
||||
$existingLabels = ProductLabelRelationsModel::where('product_id', $id)
|
||||
->pluck('label_id')
|
||||
->toArray();
|
||||
|
||||
// 计算新增的图片和被删除的图片
|
||||
$addedLabels = array_diff($newLabels, $existingLabels);
|
||||
$deletedLabels = array_diff($existingLabels, $newLabels);
|
||||
|
||||
// 删除不再需要的图片记录
|
||||
if (!empty($deletedLabels)) {
|
||||
ProductLabelRelationsModel::where('product_id', $id)
|
||||
->whereIn('label_id', $deletedLabels)
|
||||
->delete();
|
||||
}
|
||||
|
||||
// 添加新图片记录
|
||||
if (!empty($addedLabels)) {
|
||||
$insertData = [];
|
||||
foreach ($addedLabels as $url) {
|
||||
$insertData[] = [
|
||||
'product_id' => $id,
|
||||
'label_id' => $url
|
||||
];
|
||||
}
|
||||
ProductLabelRelationsModel::insert($insertData);
|
||||
}
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
|
||||
90
app/Service/CodeGeneration/SkuService.php
Normal file
90
app/Service/CodeGeneration/SkuService.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\SkuModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class SkuService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "product_id", "name", "cover", "inventory", "price", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['product_id' => '=,status='];
|
||||
$this->model = SkuModel::class;
|
||||
$this->with = [
|
||||
'product:id,title'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取sku管理列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取sku管理详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* sku管理下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建sku管理
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑sku管理
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除sku管理
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
91
app/Service/CodeGeneration/UserBrowsingHistoryService.php
Normal file
91
app/Service/CodeGeneration/UserBrowsingHistoryService.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\UserBrowsingHistoryModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class UserBrowsingHistoryService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "user_id", "product_id", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['user_id' => '=','product_id' => '=,status='];
|
||||
$this->model = UserBrowsingHistoryModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户浏览记录列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
$this->with = [
|
||||
'user:id,nick_name,avatar',
|
||||
'product'
|
||||
];
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户浏览记录详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户浏览记录下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户浏览记录
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户浏览记录
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户浏览记录
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
91
app/Service/CodeGeneration/UserCollectService.php
Normal file
91
app/Service/CodeGeneration/UserCollectService.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\UserCollectModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class UserCollectService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "user_id", "product_id", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['user_id' => '=','product_id' => '=,status='];
|
||||
$this->model = UserCollectModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收藏列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
$this->with = [
|
||||
'user:id,nick_name,avatar',
|
||||
'product'
|
||||
];
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收藏详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户收藏下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户收藏
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户收藏
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户收藏
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
87
app/Service/CodeGeneration/UserMembershipService.php
Normal file
87
app/Service/CodeGeneration/UserMembershipService.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\UserMembershipModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class UserMembershipService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "name", "experience", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['name' => '=,status='];
|
||||
$this->model = UserMembershipModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户会员列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户会员详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户会员下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户会员
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户会员
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户会员
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
87
app/Service/CodeGeneration/UserReceivingAddressService.php
Normal file
87
app/Service/CodeGeneration/UserReceivingAddressService.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\UserReceivingAddressModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class UserReceivingAddressService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "user_id", "province", "city", "district", "detailed_address", "complete_address", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['user_id' => '=','province' => '=','city' => '=','district' => '=','detailed_address' => '=','complete_address' => '=,status='];
|
||||
$this->model = UserReceivingAddressModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收货地址列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收货地址详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户收货地址下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户收货地址
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户收货地址
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户收货地址
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
88
app/Service/CodeGeneration/UserService.php
Normal file
88
app/Service/CodeGeneration/UserService.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\UserModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class UserService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "open_id", "nick_name", "phone", "email", "level", "balance", "avatar", "integral", "wx_open_id", "zfb_open_id", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['open_id' => '=','nick_name' => 'like','phone' => '=','email' => '=','level' => '=,status='];
|
||||
$this->model = UserModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
$params['open_id'] = $this->utils->genOpenId();
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,6 +55,7 @@ class LoginService extends BaseNotAuthService
|
||||
'avatar' => $userModel->avatar,
|
||||
'email' => $userModel->email,
|
||||
'role_id' => $userModel->role_id,
|
||||
'mall_id' => $userModel->mall_id,
|
||||
'role_name' => $userModel->role->name,
|
||||
'role_value' => $userModel->role->value,
|
||||
'ip' => $userModel->ip,
|
||||
|
||||
@@ -15,7 +15,9 @@ class CodeGenerationService
|
||||
{
|
||||
const TEXT_TYPE = [
|
||||
'LONGTEXT',
|
||||
'TEXT'
|
||||
'TEXT',
|
||||
'longtext',
|
||||
'text',
|
||||
];
|
||||
const INT_TYPE = [
|
||||
'INT',
|
||||
@@ -23,6 +25,13 @@ class CodeGenerationService
|
||||
'BIGINT',
|
||||
'SMALLINT',
|
||||
'FLOAT',
|
||||
'DECIMAL',
|
||||
'int',
|
||||
'tinyint',
|
||||
'bigint',
|
||||
'smallint',
|
||||
'float',
|
||||
'decimal',
|
||||
];
|
||||
private static mixed $_instance;
|
||||
|
||||
@@ -140,6 +149,8 @@ class CodeGenerationService
|
||||
'created_at' => time(),
|
||||
'updated_at' => time(),
|
||||
]);
|
||||
// 删除Store/app/www
|
||||
Storage::deleteDirectory('www');
|
||||
return [
|
||||
'id' => $insertModel->id,
|
||||
'file_name' => $insertModel->file_name
|
||||
|
||||
Reference in New Issue
Block a user