提交服务端基础框架
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
.idea
|
.idea
|
||||||
|
Backend/dist
|
||||||
|
Backend/node_modules
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
VUE_APP_PREVIEW=false
|
VUE_APP_PREVIEW=false
|
||||||
VUE_APP_API_BASE_URL=http://xys.morefun.vip
|
VUE_APP_API_BASE_URL=http://yishi.com
|
||||||
VUE_APP_WWW_BASE_URL=http://xys.morefun.vip
|
VUE_APP_WWW_BASE_URL=http://yishi.com
|
||||||
VUE_APP_WEB_SOCKET_URL=ws://xys.morefun.vip:2348
|
VUE_APP_WEB_SOCKET_URL=ws://yishi.com:2348
|
||||||
VUE_APP_WEBSITE_NAME="管理后台"
|
VUE_APP_WEBSITE_NAME="管理后台"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
VUE_APP_PREVIEW=true
|
VUE_APP_PREVIEW=true
|
||||||
VUE_APP_API_BASE_URL=http://xyscript.com
|
VUE_APP_API_BASE_URL=http://yishi.com
|
||||||
VUE_APP_WWW_BASE_URL=http://xyscript.com
|
VUE_APP_WWW_BASE_URL=http://yishi.com
|
||||||
VUE_APP_WEB_SOCKET_URL=ws://xyscript.com:2348
|
VUE_APP_WEB_SOCKET_URL=ws://yishi.com:2348
|
||||||
VUE_APP_WEBSITE_NAME="管理后台"
|
VUE_APP_WEBSITE_NAME="管理后台"
|
||||||
4
Server/.gitignore
vendored
4
Server/.gitignore
vendored
@@ -3,4 +3,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
composer.lock
|
composer.lock
|
||||||
runtime
|
runtime
|
||||||
public/upload
|
public/upload
|
||||||
|
/public/.user.ini
|
||||||
|
/404.html
|
||||||
|
|||||||
37
Server/application/common/model/ProductGroupModel.php
Normal file
37
Server/application/common/model/ProductGroupModel.php
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Server/application/common/model/ProductModel.php
Normal file
26
Server/application/common/model/ProductModel.php
Normal 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 => '已使用',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,11 +15,11 @@ return [
|
|||||||
// 服务器地址
|
// 服务器地址
|
||||||
'hostname' => '127.0.0.1',
|
'hostname' => '127.0.0.1',
|
||||||
// 数据库名
|
// 数据库名
|
||||||
'database' => 'xianyu_script',
|
'database' => 'yishi',
|
||||||
// 用户名
|
// 用户名
|
||||||
'username' => 'xianyu_script',
|
'username' => 'yishi',
|
||||||
// 密码
|
// 密码
|
||||||
'password' => 'Mddfts7ex3LCMRWb',
|
'password' => 'KcankSjjdZ5CsTC7',
|
||||||
// 端口
|
// 端口
|
||||||
'hostport' => '',
|
'hostport' => '',
|
||||||
// 连接dsn
|
// 连接dsn
|
||||||
|
|||||||
Reference in New Issue
Block a user