Skip to content

Commit

Permalink
tes
Browse files Browse the repository at this point in the history
  • Loading branch information
nongzhenli committed Jul 1, 2018
1 parent eca801a commit 75d8fc8
Show file tree
Hide file tree
Showing 15,347 changed files with 699,348 additions and 202 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?php
namespace app\api\controller\v1;
namespace app\admin\controller\v1;

use app\api\model\Banner as BannerModel;
use app\api\validate\IDMustBePostiveINT;
use app\lib\exception\BannerMissException;
use app\admin\model\Marketing as MarketingModel;

class Banner
class Marketing
{
public function getBanner($id)
// 获取营销活动列表
public function getList()
{
/**
* 获取指定的banner信息
* @url /banner/:id
* @http GET
* @id banner的id号
*/
$marketingList = MarketingModel::select();
return $marketingList;
}

/**
* 获取指定的marketing信息
* @param id marketing的id号
* @url /banner/:id
* @http GET
*/
public function marketing($id)
{
// 自定义验证规则,校验如果返回false,则此处被拦截,之后的代码都不被执行
(new IDMustBePostiveINT())->goCheck();
/**
Expand All @@ -25,7 +29,7 @@ public function getBanner($id)
*/
$banner = BannerModel::getBannerByID($id);
// $banner = BannerModel::get($id);
if(!$banner){
if (!$banner) {
throw new BannerMissException();
// throw new Exception ('内部错误');
}
Expand Down
19 changes: 19 additions & 0 deletions Server/application/admin/model/Marketing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
namespace app\admin\model;

use think\Model;

// public 表示全局,类内部外部子类都可以访问;
// private 表示私有的,只有本类内部可以使用;
// protected 表示受保护的,只有本类或子类或父类中可以访问;
class Marketing extends Model
{
/**
* getMarketingList 获取营销活动列表
* @param $type 营销类型
*/
public static function getMarketingList($type = '')
{

}
}
142 changes: 71 additions & 71 deletions element/build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,97 +5,97 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')

exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory

return path.posix.join(assetsSubDirectory, _path)
return path.posix.join(assetsSubDirectory, _path)
}

exports.cssLoaders = function (options) {
options = options || {}
options = options || {}

const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
}

const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
}

// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]

if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
// generate loader string to be used with extract text plugin
function generateLoaders(loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]

if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}

// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}

// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}

// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}

// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)

for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}

return output
const output = []
const loaders = exports.cssLoaders(options)

for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}

return output
}

exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
const notifier = require('node-notifier')

return (severity, errors) => {
if (severity !== 'error') return
return (severity, errors) => {
if (severity !== 'error') return

const error = errors[0]
const filename = error.file && error.file.split('!').pop()
const error = errors[0]
const filename = error.file && error.file.split('!').pop()

notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}
28 changes: 14 additions & 14 deletions element/build/vue-loader.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
? config.build.productionSourceMap
: config.dev.cssSourceMap

module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
6 changes: 5 additions & 1 deletion element/build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ module.exports = {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
},
{
test: /\.less$/,
loader: "style-loader!css-loader!less-loader",
},
]
},
node: {
Expand Down
4 changes: 2 additions & 2 deletions element/config/dev.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ const prodEnv = require('./prod.env')

module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"',
// BASE_API: '"https://www.easy-mock.com/mock/5b31d5225b00583c51b94abe/mqwxadmin"',
// BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"',
BASE_API: '"https://www.easy-mock.com/mock/5b31d5225b00583c51b94abe/mqwxadmin"'
})
Loading

0 comments on commit 75d8fc8

Please sign in to comment.