初始化项目

This commit is contained in:
2026-09-01 22:15:50 +08:00
commit b5a26a8848
11217 changed files with 1710987 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\Express as ExpressModel;
/**
* 物流公司模型
* Class Express
* @package app\console\model
*/
class Express extends ExpressModel
{
}
+25
View File
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\Goods as GoodsModel;
/**
* 商品模型
* Class Goods
* @package app\console\model
*/
class Goods extends GoodsModel
{
}
+25
View File
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\GoodsSku as GoodsSkuModel;
/**
* 商品规格模型
* Class GoodsSku
* @package app\console\model
*/
class GoodsSku extends GoodsSkuModel
{
}
+173
View File
@@ -0,0 +1,173 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\enum\order\DeliveryStatus;
use app\common\enum\order\ReceiptStatus;
use app\common\model\Order as OrderModel;
use app\common\enum\order\PayStatus as PayStatusEnum;
use app\common\enum\order\OrderStatus as OrderStatusEnum;
use app\common\enum\order\DeliveryStatus as DeliveryStatusEnum;
/**
* 订单模型
* Class Order
* @package app\common\model
*/
class Order extends OrderModel
{
/**
* 获取订单列表
* @param int $storeId 商城ID
* @param array $filter
* @param array $with
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(int $storeId, $filter = [], $with = [])
{
return $this->with($with)
->where($filter)
->where('store_id', '=', $storeId)
->where('is_delete', '=', 0)
->select();
}
/**
* 获取订单ID集
* @param int $storeId 商城ID
* @param array $filter
* @return array
*/
public function getOrderIds(int $storeId, $filter = [])
{
return $this->where($filter)
->where('store_id', '=', $storeId)
->where('is_delete', '=', 0)
->column('order_id');
}
/**
* 查询截止时间未支付的订单列表
* @param int $storeId 商城ID
* @param int $deadlineTime 截止日期的时间戳
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getListByClose(int $storeId, int $deadlineTime)
{
// 查询条件
$filter = [
['pay_status', '=', PayStatusEnum::PENDING],
['order_status', '=', OrderStatusEnum::NORMAL],
['create_time', '<=', $deadlineTime],
];
// 查询列表记录
return $this->getList($storeId, $filter, ['goods', 'user']);
}
/**
* 查询截止时间已完成的订单列表
* @param int $storeId 商城ID
* @param array $orderIds 订单ID集
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getListByOrderIds(int $storeId, array $orderIds)
{
// 查询条件
$filter = [['order_id', 'in', $orderIds]];
// 查询列表记录
return $this->getList($storeId, $filter, ['goods' => ['refund']]);
}
/**
* 查询截止时间未确认收货的订单ID集
* @param int $storeId 商城ID
* @param int $deadlineTime 截止时间
* @return array
*/
public function getOrderIdsByReceive(int $storeId, int $deadlineTime)
{
// 查询条件
$filter = [
['pay_status', '=', PayStatusEnum::SUCCESS],
['delivery_status', '=', DeliveryStatus::DELIVERED],
['receipt_status', '=', ReceiptStatus::NOT_RECEIVED],
['delivery_time', '<=', $deadlineTime]
];
// 查询列表记录
return $this->getOrderIds($storeId, $filter);
}
/**
* 查询截止时间确认收货的订单列表
* @param int $storeId 商城ID
* @param int $deadlineTime 截止时间
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getOrderListBySettled(int $storeId, int $deadlineTime)
{
// 查询条件
$filter = [
['order_status', '=', OrderStatusEnum::COMPLETED],
['receipt_time', '<=', $deadlineTime],
['is_settled', '=', 0]
];
// 查询列表记录
return $this->getList($storeId, $filter, ['goods.refund']);
}
/**
* 批量更新订单状态为已收货
* @param array $orderIds
* @return false|int
*/
public function onUpdateReceived(array $orderIds)
{
return $this->onBatchUpdate($orderIds, [
'receipt_status' => ReceiptStatus::RECEIVED,
'receipt_time' => time(),
// 'order_status' => OrderStatusEnum::COMPLETED
]);
}
/**
* 查询已完成未发货的订单
* @param int $storeId 商城ID
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getListByDelivery(int $storeId)
{
// 查询条件
$filter = [
['order_status', 'in', [OrderStatusEnum::NORMAL, OrderStatusEnum::COMPLETED]],
['transaction_id', '<>', ''],
['delivery_status', '=', DeliveryStatusEnum::NOT_DELIVERED],
];
// 查询列表记录
return $this->getList($storeId, $filter, ['goods', 'user']);
}
}
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\OrderAddress as OrderAddressModel;
/**
* 订单收货地址模型
* Class OrderAddress
* @package app\console\model
*/
class OrderAddress extends OrderAddressModel
{
}
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\OrderGoods as OrderGoodsModel;
/**
* 订单商品模型
* Class OrderGoods
* @package app\console\model
*/
class OrderGoods extends OrderGoodsModel
{
}
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\OrderRefund as OrderRefundModel;
/**
* 售后单模型
* Class OrderRefund
* @package app\console\model
*/
class OrderRefund extends OrderRefundModel
{
}
+25
View File
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\store\Setting as SettingModel;
/**
* 系统设置模型
* Class Wxapp
* @package app\console\model
*/
class Setting extends SettingModel
{
}
+37
View File
@@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\Store as StoreModel;
/**
* 商家记录表模型
* Class Store
* @package app\admin\model
*/
class Store extends StoreModel
{
/**
* 获取商城ID集
* @param bool $isRecycle
* @return array
*/
public static function getStoreIds(bool $isRecycle = false)
{
$static = new static;
return $static->where('is_recycle', '=', (int)$isRecycle)
->where('is_delete', '=', 0)
->order(['create_time' => 'desc', $static->getPk()])
->column('store_id');
}
}
+88
View File
@@ -0,0 +1,88 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\User as UserModel;
use app\common\model\user\Grade as UserGradeModel;
use app\console\model\user\GradeLog as GradeLogModel;
use app\common\enum\user\grade\log\ChangeType as ChangeTypeEnum;
/**
* 用户模型
* Class User
* @package app\console\model
*/
class User extends UserModel
{
/**
* 查询满足会员等级升级条件的用户列表
* @param int $storeId 商城ID
* @param UserGradeModel $upgradeGrade 会员等级
* @param array $excludedUserIds 排除的会员ID集
* @return mixed
*/
public static function getUpgradeUserList(int $storeId, UserGradeModel $upgradeGrade, $excludedUserIds = [])
{
// 实例化查询对象
$query = (new static)->getNewQuery();
// 检索查询条件
if (!empty($excludedUserIds)) {
$query->where('user.user_id', 'not in', $excludedUserIds);
}
// 查询列表记录
return $query->alias('user')
->field(['user.user_id', 'user.grade_id'])
->join('user_grade grade', 'grade.grade_id = user.grade_id', 'LEFT')
->where(function ($query) use ($upgradeGrade) {
$query->where('user.grade_id', '=', 0);
$query->whereOr('grade.weight', '<', $upgradeGrade['weight']);
})
->where('user.expend_money', '>=', $upgradeGrade['upgrade']['expend_money'])
->where('user.store_id', '=', $storeId)
->where('user.is_delete', '=', 0)
->select();
}
/**
* 批量设置会员等级
* @param int $storeId 商城ID
* @param array $data 会员等级更新数据
* @return bool
*/
public function setBatchGrade(int $storeId, array $data)
{
// 批量更新会员等级的数据
$userData = [];
// 批量新增会员等级变更记录的数据
$logData = [];
foreach ($data as $item) {
$userData[] = [
'where' => ['user_id' => $item['user_id']],
'data' => ['grade_id' => $item['new_grade_id']]
];
$logData[] = [
'user_id' => $item['user_id'],
'old_grade_id' => $item['old_grade_id'],
'new_grade_id' => $item['new_grade_id'],
'change_type' => ChangeTypeEnum::AUTO_UPGRADE,
'store_id' => $storeId,
];
}
// 批量更新会员等级
$this->updateAll($userData);
// 批量新增会员等级变更记录
(new GradeLogModel)->records($logData);
return true;
}
}
@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model;
use app\common\model\UserCoupon as UserCouponModel;
/**
* 用户优惠券模型
* Class UserCoupon
* @package app\console\model
*/
class UserCoupon extends UserCouponModel
{
// 是否允许全局查询store_id
protected $isGlobalScopeStoreId = false;
/**
* 获取已过期的优惠券ID集
* @param int $storeId
* @return array
*/
public function getExpiredCouponIds(int $storeId): array
{
$time = time();
return $this->where('is_expire', '=', 0)
->where('is_use', '=', 0)
->where('end_time', '<=', time())
->where('store_id', '=', $storeId)
->column('user_coupon_id');
}
/**
* 设置优惠券过期状态
* @param array $couponIds
* @return bool
*/
public function setIsExpire(array $couponIds): bool
{
if (empty($couponIds)) {
return false;
}
return $this->updateBase(['is_expire' => 1], [['user_coupon_id', 'in', $couponIds]]);
}
}
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model\recharge;
use app\common\model\recharge\Order as OrderModel;
/**
* 用户充值订单模型
* Class Order
* @package app\console\model\recharge
*/
class Order extends OrderModel
{
}
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model\user;
use app\common\model\user\BalanceLog as BalanceLogModel;
/**
* 用户余额变动明细模型
* Class BalanceLog
* @package app\console\model\user
*/
class BalanceLog extends BalanceLogModel
{
}
@@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model\user;
use app\common\model\user\Grade as GradeModel;
/**
* 用户会员等级模型
* Class Grade
* @package app\console\model\user
*/
class Grade extends GradeModel
{
/**
* 获取可用的会员等级列表
* @param int $storeId
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function getUsableList(int $storeId)
{
return (new static)->where('status', '=', 1)
->where('is_delete', '=', 0)
->where('store_id', '=', $storeId)
->order(['weight' => 'desc'])
->select();
}
}
@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model\user;
use app\common\model\user\GradeLog as GradeLogModel;
/**
* 用户会员等级变更记录模型
* Class GradeLog
* @package app\console\model\user
*/
class GradeLog extends GradeLogModel
{
}
@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\console\model\user;
use app\common\model\user\PointsLog as PointsLogModel;
/**
* 用户余额变动明细模型
* Class PointsLog
* @package app\console\model\user
*/
class PointsLog extends PointsLogModel
{
}