mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-12 19:12:49 +00:00
升级2.5.3啦
This commit is contained in:
parent
293df35442
commit
95501df277
@ -235,10 +235,11 @@ class AuthApi extends AuthController{
|
||||
if($news!=0) $model->where('is_new',1);
|
||||
$baseOrder = '';
|
||||
if($priceOrder) $baseOrder = $priceOrder == 'desc' ? 'price DESC' : 'price ASC';
|
||||
if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';
|
||||
// if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';//真实销量
|
||||
if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'ficti DESC' : 'ficti ASC';//虚拟销量
|
||||
if($baseOrder) $baseOrder .= ', ';
|
||||
$model->order($baseOrder.'sort DESC, add_time DESC');
|
||||
$list = $model->limit($first,$limit)->field('id,store_name,cate_id,image,sales,price,stock')->select()->toArray();
|
||||
$list = $model->limit($first,$limit)->field('id,store_name,cate_id,image,sales,ficti,price,stock')->select()->toArray();
|
||||
return JsonService::successful($list);
|
||||
}
|
||||
/**
|
||||
@ -268,7 +269,7 @@ class AuthApi extends AuthController{
|
||||
}
|
||||
}
|
||||
$data['storeInfo'] = $storeInfo;
|
||||
$data['similarity'] = StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'],'id,store_name,image,price,sales',4);
|
||||
$data['similarity'] = StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'],'id,store_name,image,price,sales,ficti',4);
|
||||
$data['productAttr'] = $productAttr;
|
||||
$data['productValue'] = $productValue;
|
||||
$data['reply'] = StoreProductReply::getRecProductReply($storeInfo['id']);
|
||||
|
||||
@ -307,6 +307,7 @@ class AuthApi extends AuthController
|
||||
public function get_user_order_list($type = '',$first = 0, $limit = 8,$search = '')
|
||||
{
|
||||
// StoreOrder::delCombination();//删除拼团未支付订单
|
||||
$type=='null' && $type='';
|
||||
if($search){
|
||||
$order = StoreOrder::searchUserOrder($this->userInfo['uid'],$search)?:[];
|
||||
$list = $order == false ? [] : [$order];
|
||||
@ -496,10 +497,11 @@ class AuthApi extends AuthController
|
||||
if($news) $model->where('is_new',1);
|
||||
$baseOrder = '';
|
||||
if($priceOrder) $baseOrder = $priceOrder == 'desc' ? 'price DESC' : 'price ASC';
|
||||
if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';
|
||||
// if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';
|
||||
if($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'ficti DESC' : 'ficti ASC';
|
||||
if($baseOrder) $baseOrder .= ', ';
|
||||
$model->order($baseOrder.'sort DESC, add_time DESC');
|
||||
$list = $model->limit($first,$limit)->field('id,store_name,image,sales,price,stock')->select()->toArray();
|
||||
$list = $model->limit($first,$limit)->field('id,store_name,image,sales,ficti,price,stock')->select()->toArray();
|
||||
if($list) setView($this->uid,0,$sId,'search','product',$keyword);
|
||||
return JsonService::successful($list);
|
||||
}
|
||||
@ -740,4 +742,14 @@ class AuthApi extends AuthController
|
||||
else return JsonService::status('ERROR','砍价失败,请稍后再帮助朋友砍价');
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价分享添加次数
|
||||
* @param int $bargainId
|
||||
*/
|
||||
public function add_bargain_share($bargainId = 0){
|
||||
if(!$bargainId) return JsonService::successful();
|
||||
StoreBargain::addBargainShare($bargainId);
|
||||
return JsonService::successful();
|
||||
}
|
||||
|
||||
}
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
namespace app\wap\controller;
|
||||
|
||||
use app\wap\model\store\StoreCombination;
|
||||
use app\wap\model\store\StoreSeckill;
|
||||
use app\wap\model\store\StoreCategory;
|
||||
use app\wap\model\store\StoreOrder;
|
||||
@ -47,7 +48,9 @@ class Index extends AuthController
|
||||
->where('start_time','<',time())->where('stop_time','>',time())
|
||||
->limit($seckillnum)->order('sort desc')->select()->toArray();
|
||||
foreach($storeSeckill as $key=>$value){
|
||||
$round=round($value['sales']/$value['stock'],2)*100;
|
||||
if($value['stock']>0)
|
||||
$round = round($value['sales']/$value['stock'],2)*100;
|
||||
else $round = 100;
|
||||
if($round<100){
|
||||
$storeSeckill[$key]['round']=$round;
|
||||
}else{
|
||||
|
||||
@ -111,7 +111,7 @@ class Store extends AuthController
|
||||
$this->assign([
|
||||
'urlShare'=>$urlShare,
|
||||
'storeInfo'=>$storeInfo,
|
||||
'similarity'=>StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'],'id,store_name,image,price,sales',4),
|
||||
'similarity'=>StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'],'id,store_name,image,price,sales,ficti',4),
|
||||
'productAttr'=>$productAttr,
|
||||
'productValue'=>$productValue,
|
||||
'reply'=>StoreProductReply::getRecProductReply($storeInfo['id']),
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<div class="price">¥{$storeInfo.price|floatval}</div>
|
||||
<div class="oldprice">原价:¥{$storeInfo.ot_price|floatval}</div>
|
||||
<div class="info-amount flex"><span class="current">商品编号:{$storeInfo.id}</span> <span class="">库存:{$storeInfo.stock}{$storeInfo.unit_name}</span>
|
||||
<span class="fr">销量:{$storeInfo.sales}{$storeInfo.unit_name}</span></div>
|
||||
<span class="fr">销量:{$storeInfo.ficti}{$storeInfo.unit_name}</span></div>
|
||||
{gt name="storeInfo['give_integral']" value="0"}
|
||||
<div class="integral">积分:{$storeInfo.give_integral|floatval} <span>赠送</span></div>
|
||||
{/gt}
|
||||
@ -40,26 +40,21 @@
|
||||
</div>
|
||||
<div class="txt-info">{$reply.comment}</div>
|
||||
<div class="pro-parameter"><span>{$reply.add_time}</span> <span>{$reply.suk}</span></div>
|
||||
{gt name="replyCount" value="1"} <a class="more"
|
||||
href="{:url('reply_list',['productId'=>$storeInfo['id']])}">查看全部评价</a>
|
||||
{gt name="replyCount" value="1"}
|
||||
<a class="more" href="{:url('reply_list',['productId'=>$storeInfo['id']])}">查看全部评价</a>
|
||||
{/gt}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/notempty}
|
||||
<div class="item-box">
|
||||
<div class="item-tit"><i class="line"></i><i class="iconfont icon-icon-tupian"></i><span>详情</span><i
|
||||
class="line"></i></div>
|
||||
<div class="item-tit"><i class="line"></i><i class="iconfont icon-icon-tupian"></i><span>详情</span><i class="line"></i></div>
|
||||
<div class="con-box" ref="store_desc"></div>
|
||||
</div>
|
||||
<div class="footer-bar flex"><a href="{:Url('Service/service_list',array('mer_id'=>$mer_id))}"> <span
|
||||
class="iconfont icon-kefu"></span>
|
||||
<p>客服</p></a> <a class="collect-btn iconfont icon-xing1"
|
||||
:class="{'icon-xing2':product.userCollect == true}" @click="collect"
|
||||
href="javascript:void(0)"><p>收藏</p></a> <a href="{:Url('store/cart')}"> <span
|
||||
class="iconfont icon-icon-shoppingcart-02"></span>
|
||||
<p>购物车</p> <span class="cart_num" v-show="cartNum > 0" v-cloak=""
|
||||
v-text="cartNum"></span> </a>
|
||||
<div class="footer-bar flex">
|
||||
<a href="{:Url('Service/service_list',array('mer_id'=>$mer_id))}"> <span class="iconfont icon-kefu"></span><p>客服</p></a>
|
||||
<a class="collect-btn iconfont icon-xing1" :class="{'icon-xing2':product.userCollect == true}" @click="collect" href="javascript:void(0)"><p>收藏</p></a>
|
||||
<a href="{:Url('store/cart')}"> <span class="iconfont icon-icon-shoppingcart-02"></span> <p>购物车</p> <span class="cart_num" v-show="cartNum > 0" v-cloak="" v-text="cartNum"></span> </a>
|
||||
<div class="big-btn buy-car" @click="cardUp">加入购物车</div>
|
||||
<div class="big-btn confirm" @click="cardUp">立即购买</div>
|
||||
</div>
|
||||
@ -73,7 +68,8 @@
|
||||
<li><a href="{:url('store/detail',array('id'=>$store['id']))}">
|
||||
<div class="picture"><img src="{$store.image}"/></div>
|
||||
<div class="pro-info"><p class="title">{$store.store_name}</p>
|
||||
<p class="conut">已售{$store.sales}</p>
|
||||
<!--<p class="conut">已售{$store.sales}</p>-->
|
||||
<p class="conut">已售{$store.ficti}</p>
|
||||
<p class="price">¥{$store.price|floatval}</p></div>
|
||||
<div class="buy-car-btn"><i class="iconfont icon-gouwuche"></i></div>
|
||||
</a></li>
|
||||
@ -91,8 +87,8 @@
|
||||
window.$product = <?php unset($storeInfo['description']); echo json_encode($storeInfo);?>;
|
||||
window.$productAttr = <?php echo json_encode($productAttr) ?: '[]'; ?>;
|
||||
window.$productValue = <?php echo json_encode($productValue) ?: '{}'; ?>;</script>
|
||||
<script
|
||||
type="text/javascript"> requirejs(['vue', 'axios', 'helper', 'store', '{__WAP_PATH}crmeb/module/store/shop-card.js'], function (Vue, axios, $h, storeApi, shopCard) {
|
||||
<script type="text/javascript">
|
||||
requirejs(['vue', 'axios', 'helper', 'store', '{__WAP_PATH}crmeb/module/store/shop-card.js'], function (Vue, axios, $h, storeApi, shopCard) {
|
||||
new Vue({
|
||||
el: "#store_detail",
|
||||
components: {'shop-card': shopCard},
|
||||
@ -229,7 +225,7 @@
|
||||
desc: $product.store_info || $product.store_name,
|
||||
// imgUrl: location.origin + $product.image,
|
||||
imgUrl: $product.image,
|
||||
link: $urlShare || location.href
|
||||
link: $urlShare || "{:url('store/detail',array('id'=>$store['id'],'spuid'=>$userInfo['uid']))}"
|
||||
});
|
||||
});
|
||||
this.$nextTick(function () {
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<div class="img"><img :src="item.image" /></div>
|
||||
<div class="info-txt">
|
||||
<p class="name" v-text="item.store_name"></p>
|
||||
<span class="count">已售{{item.sales}}</span>
|
||||
<span class="count">已售{{item.ficti}}</span>
|
||||
<p class="price">¥{{item.price}}</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@ -234,7 +234,7 @@ switch ($step) {
|
||||
for ($i = $n; $i < $counts; $i++) {
|
||||
$sql = trim($sqlFormat[$i]);
|
||||
if (strstr($sql, 'CREATE TABLE')) {
|
||||
preg_match('/CREATE TABLE IF NOT EXISTS `eb_([^ ]*)`/is', $sql, $matches);
|
||||
preg_match('/CREATE TABLE `eb_([^ ]*)`/is', $sql, $matches);
|
||||
mysqli_query($conn,"DROP TABLE IF EXISTS `$matches[1]");
|
||||
$sql = str_replace('`eb_','`'.$dbPrefix,$sql);//替换表前缀
|
||||
$ret = mysqli_query($conn,$sql);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2017 http://thinkphp.cn All rights reserved.
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
@ -18,7 +18,7 @@ use think\exception\RouteNotFoundException;
|
||||
|
||||
/**
|
||||
* App 应用管理
|
||||
* @author liu21st <liu21st@gmail.com>
|
||||
* @author liu21st <liu21st@gmail.com>
|
||||
*/
|
||||
class App
|
||||
{
|
||||
@ -57,24 +57,32 @@ class App
|
||||
*/
|
||||
protected static $routeMust;
|
||||
|
||||
/**
|
||||
* @var array 请求调度分发
|
||||
*/
|
||||
protected static $dispatch;
|
||||
|
||||
/**
|
||||
* @var array 额外加载文件
|
||||
*/
|
||||
protected static $file = [];
|
||||
|
||||
/**
|
||||
* 执行应用程序
|
||||
* @access public
|
||||
* @param Request $request Request对象
|
||||
* @param Request $request 请求对象
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function run(Request $request = null)
|
||||
{
|
||||
is_null($request) && $request = Request::instance();
|
||||
$request = is_null($request) ? Request::instance() : $request;
|
||||
|
||||
try {
|
||||
$config = self::initCommon();
|
||||
|
||||
// 模块/控制器绑定
|
||||
if (defined('BIND_MODULE')) {
|
||||
// 模块/控制器绑定
|
||||
BIND_MODULE && Route::bind(BIND_MODULE);
|
||||
} elseif ($config['auto_bind_module']) {
|
||||
// 入口自动绑定
|
||||
@ -88,10 +96,8 @@ class App
|
||||
|
||||
// 默认语言
|
||||
Lang::range($config['default_lang']);
|
||||
if ($config['lang_switch_on']) {
|
||||
// 开启多语言机制 检测当前语言
|
||||
Lang::detect();
|
||||
}
|
||||
// 开启多语言机制 检测当前语言
|
||||
$config['lang_switch_on'] && Lang::detect();
|
||||
$request->langset(Lang::range());
|
||||
|
||||
// 加载系统语言包
|
||||
@ -100,12 +106,16 @@ class App
|
||||
APP_PATH . 'lang' . DS . $request->langset() . EXT,
|
||||
]);
|
||||
|
||||
// 监听 app_dispatch
|
||||
Hook::listen('app_dispatch', self::$dispatch);
|
||||
// 获取应用调度信息
|
||||
$dispatch = self::$dispatch;
|
||||
|
||||
// 未设置调度信息则进行 URL 路由检测
|
||||
if (empty($dispatch)) {
|
||||
// 进行URL路由检测
|
||||
$dispatch = self::routeCheck($request, $config);
|
||||
}
|
||||
|
||||
// 记录当前调度信息
|
||||
$request->dispatch($dispatch);
|
||||
|
||||
@ -116,10 +126,15 @@ class App
|
||||
Log::record('[ PARAM ] ' . var_export($request->param(), true), 'info');
|
||||
}
|
||||
|
||||
// 监听app_begin
|
||||
// 监听 app_begin
|
||||
Hook::listen('app_begin', $dispatch);
|
||||
|
||||
// 请求缓存检查
|
||||
$request->cache($config['request_cache'], $config['request_cache_expire'], $config['request_cache_except']);
|
||||
$request->cache(
|
||||
$config['request_cache'],
|
||||
$config['request_cache_expire'],
|
||||
$config['request_cache_except']
|
||||
);
|
||||
|
||||
$data = self::exec($dispatch, $config);
|
||||
} catch (HttpResponseException $exception) {
|
||||
@ -134,292 +149,33 @@ class App
|
||||
$response = $data;
|
||||
} elseif (!is_null($data)) {
|
||||
// 默认自动识别响应输出类型
|
||||
$isAjax = $request->isAjax();
|
||||
$type = $isAjax ? Config::get('default_ajax_return') : Config::get('default_return_type');
|
||||
$type = $request->isAjax() ?
|
||||
Config::get('default_ajax_return') :
|
||||
Config::get('default_return_type');
|
||||
|
||||
$response = Response::create($data, $type);
|
||||
} else {
|
||||
$response = Response::create();
|
||||
}
|
||||
|
||||
// 监听app_end
|
||||
// 监听 app_end
|
||||
Hook::listen('app_end', $response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前请求的调度信息
|
||||
* 初始化应用,并返回配置信息
|
||||
* @access public
|
||||
* @param array|string $dispatch 调度信息
|
||||
* @param string $type 调度类型
|
||||
* @return void
|
||||
*/
|
||||
public static function dispatch($dispatch, $type = 'module')
|
||||
{
|
||||
self::$dispatch = ['type' => $type, $type => $dispatch];
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行函数或者闭包方法 支持参数调用
|
||||
* @access public
|
||||
* @param string|array|\Closure $function 函数或者闭包
|
||||
* @param array $vars 变量
|
||||
* @return mixed
|
||||
*/
|
||||
public static function invokeFunction($function, $vars = [])
|
||||
{
|
||||
$reflect = new \ReflectionFunction($function);
|
||||
$args = self::bindParams($reflect, $vars);
|
||||
// 记录执行信息
|
||||
self::$debug && Log::record('[ RUN ] ' . $reflect->__toString(), 'info');
|
||||
return $reflect->invokeArgs($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用反射执行类的方法 支持参数绑定
|
||||
* @access public
|
||||
* @param string|array $method 方法
|
||||
* @param array $vars 变量
|
||||
* @return mixed
|
||||
*/
|
||||
public static function invokeMethod($method, $vars = [])
|
||||
{
|
||||
if (is_array($method)) {
|
||||
$class = is_object($method[0]) ? $method[0] : self::invokeClass($method[0]);
|
||||
$reflect = new \ReflectionMethod($class, $method[1]);
|
||||
} else {
|
||||
// 静态方法
|
||||
$reflect = new \ReflectionMethod($method);
|
||||
}
|
||||
$args = self::bindParams($reflect, $vars);
|
||||
|
||||
self::$debug && Log::record('[ RUN ] ' . $reflect->class . '->' . $reflect->name . '[ ' . $reflect->getFileName() . ' ]', 'info');
|
||||
return $reflect->invokeArgs(isset($class) ? $class : null, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用反射执行类的实例化 支持依赖注入
|
||||
* @access public
|
||||
* @param string $class 类名
|
||||
* @param array $vars 变量
|
||||
* @return mixed
|
||||
*/
|
||||
public static function invokeClass($class, $vars = [])
|
||||
{
|
||||
$reflect = new \ReflectionClass($class);
|
||||
$constructor = $reflect->getConstructor();
|
||||
if ($constructor) {
|
||||
$args = self::bindParams($constructor, $vars);
|
||||
} else {
|
||||
$args = [];
|
||||
}
|
||||
return $reflect->newInstanceArgs($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定参数
|
||||
* @access private
|
||||
* @param \ReflectionMethod|\ReflectionFunction $reflect 反射类
|
||||
* @param array $vars 变量
|
||||
* @return array
|
||||
*/
|
||||
private static function bindParams($reflect, $vars = [])
|
||||
{
|
||||
if (empty($vars)) {
|
||||
// 自动获取请求变量
|
||||
if (Config::get('url_param_type')) {
|
||||
$vars = Request::instance()->route();
|
||||
} else {
|
||||
$vars = Request::instance()->param();
|
||||
}
|
||||
}
|
||||
$args = [];
|
||||
if ($reflect->getNumberOfParameters() > 0) {
|
||||
// 判断数组类型 数字数组时按顺序绑定参数
|
||||
reset($vars);
|
||||
$type = key($vars) === 0 ? 1 : 0;
|
||||
$params = $reflect->getParameters();
|
||||
foreach ($params as $param) {
|
||||
$args[] = self::getParamValue($param, $vars, $type);
|
||||
}
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数值
|
||||
* @access private
|
||||
* @param \ReflectionParameter $param
|
||||
* @param array $vars 变量
|
||||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
private static function getParamValue($param, &$vars, $type)
|
||||
{
|
||||
$name = $param->getName();
|
||||
$class = $param->getClass();
|
||||
if ($class) {
|
||||
$className = $class->getName();
|
||||
$bind = Request::instance()->$name;
|
||||
if ($bind instanceof $className) {
|
||||
$result = $bind;
|
||||
} else {
|
||||
if (method_exists($className, 'invoke')) {
|
||||
$method = new \ReflectionMethod($className, 'invoke');
|
||||
if ($method->isPublic() && $method->isStatic()) {
|
||||
return $className::invoke(Request::instance());
|
||||
}
|
||||
}
|
||||
$result = method_exists($className, 'instance') ? $className::instance() : new $className;
|
||||
}
|
||||
} elseif (1 == $type && !empty($vars)) {
|
||||
$result = array_shift($vars);
|
||||
} elseif (0 == $type && isset($vars[$name])) {
|
||||
$result = $vars[$name];
|
||||
} elseif ($param->isDefaultValueAvailable()) {
|
||||
$result = $param->getDefaultValue();
|
||||
} else {
|
||||
throw new \InvalidArgumentException('method param miss:' . $name);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected static function exec($dispatch, $config)
|
||||
{
|
||||
switch ($dispatch['type']) {
|
||||
case 'redirect':
|
||||
// 执行重定向跳转
|
||||
$data = Response::create($dispatch['url'], 'redirect')->code($dispatch['status']);
|
||||
break;
|
||||
case 'module':
|
||||
// 模块/控制器/操作
|
||||
$data = self::module($dispatch['module'], $config, isset($dispatch['convert']) ? $dispatch['convert'] : null);
|
||||
break;
|
||||
case 'controller':
|
||||
// 执行控制器操作
|
||||
$vars = array_merge(Request::instance()->param(), $dispatch['var']);
|
||||
$data = Loader::action($dispatch['controller'], $vars, $config['url_controller_layer'], $config['controller_suffix']);
|
||||
break;
|
||||
case 'method':
|
||||
// 执行回调方法
|
||||
$vars = array_merge(Request::instance()->param(), $dispatch['var']);
|
||||
$data = self::invokeMethod($dispatch['method'], $vars);
|
||||
break;
|
||||
case 'function':
|
||||
// 执行闭包
|
||||
$data = self::invokeFunction($dispatch['function']);
|
||||
break;
|
||||
case 'response':
|
||||
$data = $dispatch['response'];
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException('dispatch type not support');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行模块
|
||||
* @access public
|
||||
* @param array $result 模块/控制器/操作
|
||||
* @param array $config 配置参数
|
||||
* @param bool $convert 是否自动转换控制器和操作名
|
||||
* @return mixed
|
||||
*/
|
||||
public static function module($result, $config, $convert = null)
|
||||
{
|
||||
if (is_string($result)) {
|
||||
$result = explode('/', $result);
|
||||
}
|
||||
$request = Request::instance();
|
||||
if ($config['app_multi_module']) {
|
||||
// 多模块部署
|
||||
$module = strip_tags(strtolower($result[0] ?: $config['default_module']));
|
||||
$bind = Route::getBind('module');
|
||||
$available = false;
|
||||
if ($bind) {
|
||||
// 绑定模块
|
||||
list($bindModule) = explode('/', $bind);
|
||||
if (empty($result[0])) {
|
||||
$module = $bindModule;
|
||||
$available = true;
|
||||
} elseif ($module == $bindModule) {
|
||||
$available = true;
|
||||
}
|
||||
} elseif (!in_array($module, $config['deny_module_list']) && is_dir(APP_PATH . $module)) {
|
||||
$available = true;
|
||||
}
|
||||
|
||||
// 模块初始化
|
||||
if ($module && $available) {
|
||||
// 初始化模块
|
||||
$request->module($module);
|
||||
$config = self::init($module);
|
||||
// 模块请求缓存检查
|
||||
$request->cache($config['request_cache'], $config['request_cache_expire'], $config['request_cache_except']);
|
||||
} else {
|
||||
throw new HttpException(404, 'module not exists:' . $module);
|
||||
}
|
||||
} else {
|
||||
// 单一模块部署
|
||||
$module = '';
|
||||
$request->module($module);
|
||||
}
|
||||
// 当前模块路径
|
||||
App::$modulePath = APP_PATH . ($module ? $module . DS : '');
|
||||
|
||||
// 是否自动转换控制器和操作名
|
||||
$convert = is_bool($convert) ? $convert : $config['url_convert'];
|
||||
// 获取控制器名
|
||||
$controller = strip_tags($result[1] ?: $config['default_controller']);
|
||||
$controller = $convert ? strtolower($controller) : $controller;
|
||||
|
||||
// 获取操作名
|
||||
$actionName = strip_tags($result[2] ?: $config['default_action']);
|
||||
$actionName = $convert ? strtolower($actionName) : $actionName;
|
||||
|
||||
// 设置当前请求的控制器、操作
|
||||
$request->controller(Loader::parseName($controller, 1))->action($actionName);
|
||||
|
||||
// 监听module_init
|
||||
Hook::listen('module_init', $request);
|
||||
|
||||
try {
|
||||
$instance = Loader::controller($controller, $config['url_controller_layer'], $config['controller_suffix'], $config['empty_controller']);
|
||||
} catch (ClassNotFoundException $e) {
|
||||
throw new HttpException(404, 'controller not exists:' . $e->getClass());
|
||||
}
|
||||
|
||||
// 获取当前操作名
|
||||
$action = $actionName . $config['action_suffix'];
|
||||
|
||||
$vars = [];
|
||||
if (is_callable([$instance, $action])) {
|
||||
// 执行操作方法
|
||||
$call = [$instance, $action];
|
||||
} elseif (is_callable([$instance, '_empty'])) {
|
||||
// 空操作
|
||||
$call = [$instance, '_empty'];
|
||||
$vars = [$actionName];
|
||||
} else {
|
||||
// 操作不存在
|
||||
throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()');
|
||||
}
|
||||
|
||||
Hook::listen('action_begin', $call);
|
||||
|
||||
return self::invokeMethod($call, $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化应用
|
||||
*/
|
||||
public static function initCommon()
|
||||
{
|
||||
if (empty(self::$init)) {
|
||||
if (defined('APP_NAMESPACE')) {
|
||||
self::$namespace = APP_NAMESPACE;
|
||||
}
|
||||
|
||||
Loader::addNamespace(self::$namespace, APP_PATH);
|
||||
|
||||
// 初始化应用
|
||||
@ -428,17 +184,21 @@ class App
|
||||
|
||||
// 应用调试模式
|
||||
self::$debug = Env::get('app_debug', Config::get('app_debug'));
|
||||
|
||||
if (!self::$debug) {
|
||||
ini_set('display_errors', 'Off');
|
||||
} elseif (!IS_CLI) {
|
||||
//重新申请一块比较大的buffer
|
||||
// 重新申请一块比较大的 buffer
|
||||
if (ob_get_level() > 0) {
|
||||
$output = ob_get_clean();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
if (!empty($output)) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty($config['root_namespace'])) {
|
||||
@ -459,11 +219,12 @@ class App
|
||||
// 设置系统时区
|
||||
date_default_timezone_set($config['default_timezone']);
|
||||
|
||||
// 监听app_init
|
||||
// 监听 app_init
|
||||
Hook::listen('app_init');
|
||||
|
||||
self::$init = true;
|
||||
}
|
||||
|
||||
return Config::get();
|
||||
}
|
||||
|
||||
@ -484,12 +245,13 @@ class App
|
||||
} elseif (is_file(RUNTIME_PATH . $module . 'init' . EXT)) {
|
||||
include RUNTIME_PATH . $module . 'init' . EXT;
|
||||
} else {
|
||||
$path = APP_PATH . $module;
|
||||
// 加载模块配置
|
||||
$config = Config::load(CONF_PATH . $module . 'config' . CONF_EXT);
|
||||
|
||||
// 读取数据库配置文件
|
||||
$filename = CONF_PATH . $module . 'database' . CONF_EXT;
|
||||
Config::load($filename, 'database');
|
||||
|
||||
// 读取扩展配置文件
|
||||
if (is_dir(CONF_PATH . $module . 'extra')) {
|
||||
$dir = CONF_PATH . $module . 'extra';
|
||||
@ -504,7 +266,7 @@ class App
|
||||
|
||||
// 加载应用状态配置
|
||||
if ($config['app_status']) {
|
||||
$config = Config::load(CONF_PATH . $module . $config['app_status'] . CONF_EXT);
|
||||
Config::load(CONF_PATH . $module . $config['app_status'] . CONF_EXT);
|
||||
}
|
||||
|
||||
// 加载行为扩展文件
|
||||
@ -513,6 +275,7 @@ class App
|
||||
}
|
||||
|
||||
// 加载公共文件
|
||||
$path = APP_PATH . $module;
|
||||
if (is_file($path . 'common' . EXT)) {
|
||||
include $path . 'common' . EXT;
|
||||
}
|
||||
@ -522,14 +285,335 @@ class App
|
||||
Lang::load($path . 'lang' . DS . Request::instance()->langset() . EXT);
|
||||
}
|
||||
}
|
||||
|
||||
return Config::get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前请求的调度信息
|
||||
* @access public
|
||||
* @param array|string $dispatch 调度信息
|
||||
* @param string $type 调度类型
|
||||
* @return void
|
||||
*/
|
||||
public static function dispatch($dispatch, $type = 'module')
|
||||
{
|
||||
self::$dispatch = ['type' => $type, $type => $dispatch];
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行函数或者闭包方法 支持参数调用
|
||||
* @access public
|
||||
* @param string|array|\Closure $function 函数或者闭包
|
||||
* @param array $vars 变量
|
||||
* @return mixed
|
||||
*/
|
||||
public static function invokeFunction($function, $vars = [])
|
||||
{
|
||||
$reflect = new \ReflectionFunction($function);
|
||||
$args = self::bindParams($reflect, $vars);
|
||||
|
||||
// 记录执行信息
|
||||
self::$debug && Log::record('[ RUN ] ' . $reflect->__toString(), 'info');
|
||||
|
||||
return $reflect->invokeArgs($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用反射执行类的方法 支持参数绑定
|
||||
* @access public
|
||||
* @param string|array $method 方法
|
||||
* @param array $vars 变量
|
||||
* @return mixed
|
||||
*/
|
||||
public static function invokeMethod($method, $vars = [])
|
||||
{
|
||||
if (is_array($method)) {
|
||||
$class = is_object($method[0]) ? $method[0] : self::invokeClass($method[0]);
|
||||
$reflect = new \ReflectionMethod($class, $method[1]);
|
||||
} else {
|
||||
// 静态方法
|
||||
$reflect = new \ReflectionMethod($method);
|
||||
}
|
||||
|
||||
$args = self::bindParams($reflect, $vars);
|
||||
|
||||
self::$debug && Log::record('[ RUN ] ' . $reflect->class . '->' . $reflect->name . '[ ' . $reflect->getFileName() . ' ]', 'info');
|
||||
|
||||
return $reflect->invokeArgs(isset($class) ? $class : null, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用反射执行类的实例化 支持依赖注入
|
||||
* @access public
|
||||
* @param string $class 类名
|
||||
* @param array $vars 变量
|
||||
* @return mixed
|
||||
*/
|
||||
public static function invokeClass($class, $vars = [])
|
||||
{
|
||||
$reflect = new \ReflectionClass($class);
|
||||
$constructor = $reflect->getConstructor();
|
||||
$args = $constructor ? self::bindParams($constructor, $vars) : [];
|
||||
|
||||
return $reflect->newInstanceArgs($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定参数
|
||||
* @access private
|
||||
* @param \ReflectionMethod|\ReflectionFunction $reflect 反射类
|
||||
* @param array $vars 变量
|
||||
* @return array
|
||||
*/
|
||||
private static function bindParams($reflect, $vars = [])
|
||||
{
|
||||
// 自动获取请求变量
|
||||
if (empty($vars)) {
|
||||
$vars = Config::get('url_param_type') ?
|
||||
Request::instance()->route() :
|
||||
Request::instance()->param();
|
||||
}
|
||||
|
||||
$args = [];
|
||||
if ($reflect->getNumberOfParameters() > 0) {
|
||||
// 判断数组类型 数字数组时按顺序绑定参数
|
||||
reset($vars);
|
||||
$type = key($vars) === 0 ? 1 : 0;
|
||||
|
||||
foreach ($reflect->getParameters() as $param) {
|
||||
$args[] = self::getParamValue($param, $vars, $type);
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数值
|
||||
* @access private
|
||||
* @param \ReflectionParameter $param 参数
|
||||
* @param array $vars 变量
|
||||
* @param string $type 类别
|
||||
* @return array
|
||||
*/
|
||||
private static function getParamValue($param, &$vars, $type)
|
||||
{
|
||||
$name = $param->getName();
|
||||
$class = $param->getClass();
|
||||
|
||||
if ($class) {
|
||||
$className = $class->getName();
|
||||
$bind = Request::instance()->$name;
|
||||
|
||||
if ($bind instanceof $className) {
|
||||
$result = $bind;
|
||||
} else {
|
||||
if (method_exists($className, 'invoke')) {
|
||||
$method = new \ReflectionMethod($className, 'invoke');
|
||||
|
||||
if ($method->isPublic() && $method->isStatic()) {
|
||||
return $className::invoke(Request::instance());
|
||||
}
|
||||
}
|
||||
|
||||
$result = method_exists($className, 'instance') ?
|
||||
$className::instance() :
|
||||
new $className;
|
||||
}
|
||||
} elseif (1 == $type && !empty($vars)) {
|
||||
$result = array_shift($vars);
|
||||
} elseif (0 == $type && isset($vars[$name])) {
|
||||
$result = $vars[$name];
|
||||
} elseif ($param->isDefaultValueAvailable()) {
|
||||
$result = $param->getDefaultValue();
|
||||
} else {
|
||||
throw new \InvalidArgumentException('method param miss:' . $name);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行调用分发
|
||||
* @access protected
|
||||
* @param array $dispatch 调用信息
|
||||
* @param array $config 配置信息
|
||||
* @return Response|mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected static function exec($dispatch, $config)
|
||||
{
|
||||
switch ($dispatch['type']) {
|
||||
case 'redirect': // 重定向跳转
|
||||
$data = Response::create($dispatch['url'], 'redirect')
|
||||
->code($dispatch['status']);
|
||||
break;
|
||||
case 'module': // 模块/控制器/操作
|
||||
$data = self::module(
|
||||
$dispatch['module'],
|
||||
$config,
|
||||
isset($dispatch['convert']) ? $dispatch['convert'] : null
|
||||
);
|
||||
break;
|
||||
case 'controller': // 执行控制器操作
|
||||
$vars = array_merge(Request::instance()->param(), $dispatch['var']);
|
||||
$data = Loader::action(
|
||||
$dispatch['controller'],
|
||||
$vars,
|
||||
$config['url_controller_layer'],
|
||||
$config['controller_suffix']
|
||||
);
|
||||
break;
|
||||
case 'method': // 回调方法
|
||||
$vars = array_merge(Request::instance()->param(), $dispatch['var']);
|
||||
$data = self::invokeMethod($dispatch['method'], $vars);
|
||||
break;
|
||||
case 'function': // 闭包
|
||||
$data = self::invokeFunction($dispatch['function']);
|
||||
break;
|
||||
case 'response': // Response 实例
|
||||
$data = $dispatch['response'];
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException('dispatch type not support');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行模块
|
||||
* @access public
|
||||
* @param array $result 模块/控制器/操作
|
||||
* @param array $config 配置参数
|
||||
* @param bool $convert 是否自动转换控制器和操作名
|
||||
* @return mixed
|
||||
* @throws HttpException
|
||||
*/
|
||||
public static function module($result, $config, $convert = null)
|
||||
{
|
||||
if (is_string($result)) {
|
||||
$result = explode('/', $result);
|
||||
}
|
||||
|
||||
$request = Request::instance();
|
||||
|
||||
if ($config['app_multi_module']) {
|
||||
// 多模块部署
|
||||
$module = strip_tags(strtolower($result[0] ?: $config['default_module']));
|
||||
$bind = Route::getBind('module');
|
||||
$available = false;
|
||||
|
||||
if ($bind) {
|
||||
// 绑定模块
|
||||
list($bindModule) = explode('/', $bind);
|
||||
|
||||
if (empty($result[0])) {
|
||||
$module = $bindModule;
|
||||
$available = true;
|
||||
} elseif ($module == $bindModule) {
|
||||
$available = true;
|
||||
}
|
||||
} elseif (!in_array($module, $config['deny_module_list']) && is_dir(APP_PATH . $module)) {
|
||||
$available = true;
|
||||
}
|
||||
|
||||
// 模块初始化
|
||||
if ($module && $available) {
|
||||
// 初始化模块
|
||||
$request->module($module);
|
||||
$config = self::init($module);
|
||||
|
||||
// 模块请求缓存检查
|
||||
$request->cache(
|
||||
$config['request_cache'],
|
||||
$config['request_cache_expire'],
|
||||
$config['request_cache_except']
|
||||
);
|
||||
} else {
|
||||
throw new HttpException(404, 'module not exists:' . $module);
|
||||
}
|
||||
} else {
|
||||
// 单一模块部署
|
||||
$module = '';
|
||||
$request->module($module);
|
||||
}
|
||||
|
||||
// 设置默认过滤机制
|
||||
$request->filter($config['default_filter']);
|
||||
|
||||
// 当前模块路径
|
||||
App::$modulePath = APP_PATH . ($module ? $module . DS : '');
|
||||
|
||||
// 是否自动转换控制器和操作名
|
||||
$convert = is_bool($convert) ? $convert : $config['url_convert'];
|
||||
|
||||
// 获取控制器名
|
||||
$controller = strip_tags($result[1] ?: $config['default_controller']);
|
||||
$controller = $convert ? strtolower($controller) : $controller;
|
||||
if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
|
||||
throw new HttpException(404, 'controller not exists:' . $controller);
|
||||
}
|
||||
|
||||
// 获取操作名
|
||||
$actionName = strip_tags($result[2] ?: $config['default_action']);
|
||||
if (!empty($config['action_convert'])) {
|
||||
$actionName = Loader::parseName($actionName, 1);
|
||||
} else {
|
||||
$actionName = $convert ? strtolower($actionName) : $actionName;
|
||||
}
|
||||
|
||||
// 设置当前请求的控制器、操作
|
||||
$request->controller(Loader::parseName($controller, 1))->action($actionName);
|
||||
|
||||
// 监听module_init
|
||||
Hook::listen('module_init', $request);
|
||||
|
||||
try {
|
||||
$instance = Loader::controller(
|
||||
$controller,
|
||||
$config['url_controller_layer'],
|
||||
$config['controller_suffix'],
|
||||
$config['empty_controller']
|
||||
);
|
||||
} catch (ClassNotFoundException $e) {
|
||||
throw new HttpException(404, 'controller not exists:' . $e->getClass());
|
||||
}
|
||||
|
||||
// 获取当前操作名
|
||||
$action = $actionName . $config['action_suffix'];
|
||||
|
||||
$vars = [];
|
||||
if (is_callable([$instance, $action])) {
|
||||
// 执行操作方法
|
||||
$call = [$instance, $action];
|
||||
// 严格获取当前操作方法名
|
||||
$reflect = new \ReflectionMethod($instance, $action);
|
||||
$methodName = $reflect->getName();
|
||||
$suffix = $config['action_suffix'];
|
||||
$actionName = $suffix ? substr($methodName, 0, -strlen($suffix)) : $methodName;
|
||||
$request->action($actionName);
|
||||
|
||||
} elseif (is_callable([$instance, '_empty'])) {
|
||||
// 空操作
|
||||
$call = [$instance, '_empty'];
|
||||
$vars = [$actionName];
|
||||
} else {
|
||||
// 操作不存在
|
||||
throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()');
|
||||
}
|
||||
|
||||
Hook::listen('action_begin', $call);
|
||||
|
||||
return self::invokeMethod($call, $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* URL路由检测(根据PATH_INFO)
|
||||
* @access public
|
||||
* @param \think\Request $request
|
||||
* @param array $config
|
||||
* @param \think\Request $request 请求实例
|
||||
* @param array $config 配置信息
|
||||
* @return array
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
@ -538,6 +622,7 @@ class App
|
||||
$path = $request->path();
|
||||
$depr = $config['pathinfo_depr'];
|
||||
$result = false;
|
||||
|
||||
// 路由检测
|
||||
$check = !is_null(self::$routeCheck) ? self::$routeCheck : $config['url_route_on'];
|
||||
if ($check) {
|
||||
@ -545,18 +630,14 @@ class App
|
||||
if (is_file(RUNTIME_PATH . 'route.php')) {
|
||||
// 读取路由缓存
|
||||
$rules = include RUNTIME_PATH . 'route.php';
|
||||
if (is_array($rules)) {
|
||||
Route::rules($rules);
|
||||
}
|
||||
is_array($rules) && Route::rules($rules);
|
||||
} else {
|
||||
$files = $config['route_config_file'];
|
||||
foreach ($files as $file) {
|
||||
if (is_file(CONF_PATH . $file . CONF_EXT)) {
|
||||
// 导入路由配置
|
||||
$rules = include CONF_PATH . $file . CONF_EXT;
|
||||
if (is_array($rules)) {
|
||||
Route::import($rules);
|
||||
}
|
||||
is_array($rules) && Route::import($rules);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,15 +645,18 @@ class App
|
||||
// 路由检测(根据路由定义返回不同的URL调度)
|
||||
$result = Route::check($request, $path, $depr, $config['url_domain_deploy']);
|
||||
$must = !is_null(self::$routeMust) ? self::$routeMust : $config['url_route_must'];
|
||||
|
||||
if ($must && false === $result) {
|
||||
// 路由无效
|
||||
throw new RouteNotFoundException();
|
||||
}
|
||||
}
|
||||
|
||||
// 路由无效 解析模块/控制器/操作/参数... 支持控制器自动搜索
|
||||
if (false === $result) {
|
||||
// 路由无效 解析模块/控制器/操作/参数... 支持控制器自动搜索
|
||||
$result = Route::parseUrl($path, $depr, $config['controller_auto_search']);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -150,61 +150,59 @@ Page({
|
||||
})
|
||||
},
|
||||
// 保存海报图片
|
||||
savePosterPath:function(){
|
||||
var that = this;
|
||||
console.log(that.data.posterImage);
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.writePhotosAlbum']) {
|
||||
wx.openSetting({
|
||||
success(tag) {
|
||||
if (tag.authSetting["scope.writePhotosAlbum"]) { // 用户在设置页选择同意授权
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: that.data.posterImage,
|
||||
success: function (res) {
|
||||
that.posterImageClose();
|
||||
wx.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
fail: function (res) {
|
||||
wx.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
complete: function (res) { },
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: that.data.posterImage,
|
||||
success: function (res) {
|
||||
that.posterImageClose();
|
||||
wx.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
fail: function (res) {
|
||||
wx.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
complete: function (res) { },
|
||||
})
|
||||
}
|
||||
savePosterPath: function () {
|
||||
var that = this;
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.writePhotosAlbum']) {
|
||||
wx.authorize({
|
||||
scope: 'scope.writePhotosAlbum',
|
||||
success() {
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: that.data.posterImage,
|
||||
success: function (res) {
|
||||
that.posterImageClose();
|
||||
wx.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
fail: function (res) {
|
||||
wx.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
complete: function (res) { },
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
} else {
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: that.data.posterImage,
|
||||
success: function (res) {
|
||||
that.posterImageClose();
|
||||
wx.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
fail: function (res) {
|
||||
wx.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
})
|
||||
},
|
||||
complete: function (res) { },
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//生成海报获取文字
|
||||
textByteLength: function(text, num) { // text为传入的文本 num为单行显示的字节长度
|
||||
let strLength = 0;
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<view class='count-wrapper flex'>
|
||||
<view>原价:¥{{storeInfo.ot_price}}</view>
|
||||
<view>库存:{{storeInfo.stock}}{{storeInfo.unit_name}}</view>
|
||||
<view>销量:{{storeInfo.sales}}{{storeInfo.unit_name}}</view>
|
||||
<view>销量:{{storeInfo.ficti}}{{storeInfo.unit_name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='block-bar' bindtap='goCoupon'>
|
||||
|
||||
@ -26,6 +26,7 @@ Page({
|
||||
sid:'',
|
||||
price:'',
|
||||
sales:'',
|
||||
ficti: '',
|
||||
t:1,
|
||||
sortyi:[],
|
||||
offset: 0,
|
||||
@ -253,7 +254,7 @@ Page({
|
||||
var n = t + 1;
|
||||
if (n%2>0) salesOrder = 'asc';
|
||||
else salesOrder='desc';
|
||||
that.setData({ sales: salesOrder, t: n, })
|
||||
that.setData({ ficti: salesOrder, t: n, })
|
||||
that.getProductList();
|
||||
},
|
||||
navactive2: function (e) {
|
||||
@ -554,7 +555,7 @@ Page({
|
||||
var cid = that.data.cid;
|
||||
var limit = 20;
|
||||
var priceOrder = that.data.price;
|
||||
var salesOrder = that.data.sales;
|
||||
var salesOrder = that.data.ficti;
|
||||
var offset = 0;
|
||||
var startpage = limit * offset;
|
||||
wx.request({
|
||||
@ -596,7 +597,7 @@ Page({
|
||||
var cid = that.data.cid;
|
||||
var limit = 20;
|
||||
var priceOrder = that.data.price;
|
||||
var salesOrder = that.data.sales;
|
||||
var salesOrder = that.data.ficti;
|
||||
var offset = that.data.offset;
|
||||
var startpage = limit * offset;
|
||||
var header = {
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<view class='list-text {{_num==1?"list-text2":""}}'>{{item.store_name}}</view>
|
||||
<view class='list-money flex'>
|
||||
<view>
|
||||
<view class='list-num {{_num==1?"list-num2":""}}'>已售{{item.sales}}</view>
|
||||
<view class='list-num {{_num==1?"list-num2":""}}'>已售{{item.ficti}}</view>
|
||||
<view class='money-red'><text class='list-f'>¥</text><text class='money-num'>{{item.price}}</text><text class='list-oo'></text><text class='list-tip'>精</text></view>
|
||||
</view>
|
||||
<view class='iconfont icon-102 list-gwc {{_num==1?"list-gwc2":""}}' data-id="{{item.id}}" bindtap='cart' ></view>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user