提交服务端基础框架
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
.idea
|
||||
Backend/dist
|
||||
Backend/node_modules
|
||||
@@ -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="管理后台"
|
||||
@@ -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
2
Server/.gitignore
vendored
@@ -4,3 +4,5 @@
|
||||
composer.lock
|
||||
runtime
|
||||
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',
|
||||
// 数据库名
|
||||
'database' => 'xianyu_script',
|
||||
'database' => 'yishi',
|
||||
// 用户名
|
||||
'username' => 'xianyu_script',
|
||||
'username' => 'yishi',
|
||||
// 密码
|
||||
'password' => 'Mddfts7ex3LCMRWb',
|
||||
'password' => 'KcankSjjdZ5CsTC7',
|
||||
// 端口
|
||||
'hostport' => '',
|
||||
// 连接dsn
|
||||
|
||||
Reference in New Issue
Block a user