提交服务端基础框架

This commit is contained in:
wanghao
2025-03-12 12:58:14 +08:00
parent 8e19156555
commit f4e36f1921
7 changed files with 78 additions and 11 deletions

2
.gitignore vendored
View File

@@ -1 +1,3 @@
.idea
Backend/dist
Backend/node_modules

View File

@@ -1,6 +1,6 @@
NODE_ENV=production
VUE_APP_PREVIEW=false
VUE_APP_API_BASE_URL=http://xys.morefun.vip
VUE_APP_WWW_BASE_URL=http://xys.morefun.vip
VUE_APP_WEB_SOCKET_URL=ws://xys.morefun.vip:2348
VUE_APP_API_BASE_URL=http://yishi.com
VUE_APP_WWW_BASE_URL=http://yishi.com
VUE_APP_WEB_SOCKET_URL=ws://yishi.com:2348
VUE_APP_WEBSITE_NAME="管理后台"

View File

@@ -1,6 +1,6 @@
NODE_ENV=development
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=http://xyscript.com
VUE_APP_WWW_BASE_URL=http://xyscript.com
VUE_APP_WEB_SOCKET_URL=ws://xyscript.com:2348
VUE_APP_API_BASE_URL=http://yishi.com
VUE_APP_WWW_BASE_URL=http://yishi.com
VUE_APP_WEB_SOCKET_URL=ws://yishi.com:2348
VUE_APP_WEBSITE_NAME="管理后台"

2
Server/.gitignore vendored
View File

@@ -4,3 +4,5 @@
composer.lock
runtime
public/upload
/public/.user.ini
/404.html

View File

@@ -0,0 +1,37 @@
<?php
namespace app\common\model;
use think\Model;
class ProductGroupModel extends Model {
/**
* 获取关联数组
*
* @return array
*/
static public function assoc() {
$assoc = NULL;
if (is_null($assoc)) {
$assoc = [];
foreach (static::where(1)
->order('id', 'DESC')
->select() as $model) {
$assoc[$model->getAttr('id')] = $model->getAttr('name');
}
}
return $assoc;
}
/**
* 商品数量
*
* @return ProductModel
*/
public function productNum() {
return ProductModel::where(1)
->where('group_id', $this->getAttr('id'))
->count();
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace app\common\model;
use think\Model;
class ProductModel extends Model {
const IS_USED_NO = 0;
const IS_USED_YES = 10;
protected $json = ['cb', 'images', 'labels', 'themes', 'opts'];
protected $jsonAssoc = TRUE;
/**
* 获取是否使用
*
* @return string[]
*/
static public function isUsedAssoc() {
return [
static::IS_USED_NO => '未使用',
static::IS_USED_YES => '已使用',
];
}
}

View File

@@ -15,11 +15,11 @@ return [
// 服务器地址
'hostname' => '127.0.0.1',
// 数据库名
'database' => 'xianyu_script',
'database' => 'yishi',
// 用户名
'username' => 'xianyu_script',
'username' => 'yishi',
// 密码
'password' => 'Mddfts7ex3LCMRWb',
'password' => 'KcankSjjdZ5CsTC7',
// 端口
'hostport' => '',
// 连接dsn