初始化项目:添加后端代码、ThinkPHP框架、前端资源

This commit is contained in:
amb
2026-09-03 12:42:39 +08:00
commit 482bece22e
3726 changed files with 416708 additions and 0 deletions
@@ -0,0 +1,74 @@
<?php
namespace app\common\model\app\physical;
use think\Model;
class Goods extends Model
{
protected $name = 'app_physical_goods';
protected $autoWriteTimestamp = 'integer';
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
protected $append = [
'status_text',
'spec_type_text'
];
public function getStatusList()
{
return [1 => '上架', 0 => '下架'];
}
public function getSpecTypeList()
{
return ['single' => '单规格', 'multi' => '多规格'];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getSpecTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['spec_type']) ? $data['spec_type'] : '');
$list = $this->getSpecTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getCarouselAttr($value, $data)
{
$value = $value ? $value : (isset($data['carousel']) ? $data['carousel'] : '');
if (empty($value)) {
return [];
}
$carousel = json_decode($value, true);
return is_array($carousel) ? $carousel : [];
}
public function getParamsAttr($value, $data)
{
$value = $value ? $value : (isset($data['params']) ? $data['params'] : '');
if (empty($value)) {
return [];
}
$params = json_decode($value, true);
return is_array($params) ? $params : [];
}
public function skus()
{
return $this->hasMany('app\admin\model\app\goods\Sku', 'goods_id', 'id');
}
public function skuPrices()
{
return $this->hasMany('app\admin\model\app\goods\SkuPrice', 'goods_id', 'id');
}
}
@@ -0,0 +1,40 @@
<?php
namespace app\common\model\app\physical;
use think\Model;
/**
* 实物商品订单地址模型
*/
class OrderAddress extends Model
{
protected $name = 'app_physical_order_address';
protected $autoWriteTimestamp = 'integer';
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
/**
* 根据订单ID获取地址
* @param int $orderId 订单ID
* @return array|null
*/
public static function getByOrderId($orderId)
{
$address = self::where([
'order_id' => $orderId,
'uniacid' => UNIACID
])->field([
'mobile',
'city_name',
'province_name',
'district_name',
'address',
'consignee'
])->find();
return $address ? $address->toArray() : null;
}
}
@@ -0,0 +1,73 @@
<?php
namespace app\common\model\app\physical;
use think\Model;
/**
* 实物商品快递包裹模型
*/
class OrderExpress extends Model
{
protected $name = 'app_physical_order_express';
protected $autoWriteTimestamp = 'integer';
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
protected $append = ['status_text'];
/**
* 根据订单ID获取快递信息
* @param int $orderId 订单ID
* @return array|null
*/
public static function getByOrderId($orderId)
{
$express = self::where([
'order_id' => $orderId,
'uniacid' => UNIACID
])->find();
return $express ? $express->toArray() : null;
}
/**
* 获取物流轨迹
* @param int $expressId 快递包裹ID
* @return array
*/
public function getLogs()
{
$logs = OrderExpressLog::where([
'order_express_id' => $this->id,
'uniacid' => UNIACID
])->order('change_date', 'desc')
->select();
if (is_array($logs)) {
return $logs;
}
return $logs->toArray();
}
public function getStatusTextAttr($value, $data)
{
$statusList = [
'noinfo' => '暂无信息',
'collect' => '已揽件',
'transport' => '运输中',
'delivery' => '派送中',
'signfor' => '已签收',
'refuse' => '用户拒收',
'difficulty' => '问题件',
'invalid' => '无效件',
'timeout' => '超时单',
'fail' => '签收失败',
'back' => '退回'
];
return $statusList[$data['status']] ?? '';
}
}
@@ -0,0 +1,18 @@
<?php
namespace app\common\model\app\physical;
use think\Model;
/**
* 实物商品物流信息模型
*/
class OrderExpressLog extends Model
{
protected $name = 'app_physical_order_express_log';
protected $autoWriteTimestamp = 'integer';
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
}