mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-02-12 10:15:34 +00:00
commit
06f31dab53
@ -160,7 +160,7 @@ class Index extends AuthController
|
|||||||
->group("FROM_UNIXTIME(add_time, '%Y%m%e')")
|
->group("FROM_UNIXTIME(add_time, '%Y%m%e')")
|
||||||
->order('add_time asc')
|
->order('add_time asc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
if(empty($order_list)) return false;
|
if(empty($order_list)) return Json::fail('无数据');
|
||||||
foreach ($order_list as $k=>&$v){
|
foreach ($order_list as $k=>&$v){
|
||||||
$order_list[$v['day']] = $v;
|
$order_list[$v['day']] = $v;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -162,37 +162,38 @@ class SystemGroupData extends AuthController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$fvalue = isset($GroupDataValue[$value['title']]['value'])?$GroupDataValue[$value['title']]['value']:'';
|
||||||
switch ($value['type']){
|
switch ($value['type']){
|
||||||
case 'input':
|
case 'input':
|
||||||
$f[] = Form::input($value['title'],$value['name'],$GroupDataValue[$value['title']]['value']);
|
$f[] = Form::input($value['title'],$value['name'],$fvalue);
|
||||||
break;
|
break;
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
$f[] = Form::input($value['title'],$value['name'],$GroupDataValue[$value['title']]['value'])->type('textarea');
|
$f[] = Form::input($value['title'],$value['name'],$fvalue)->type('textarea');
|
||||||
break;
|
break;
|
||||||
case 'radio':
|
case 'radio':
|
||||||
|
|
||||||
$f[] = Form::radio($value['title'],$value['name'],$GroupDataValue[$value['title']]['value'])->options($info);
|
$f[] = Form::radio($value['title'],$value['name'],$fvalue)->options($info);
|
||||||
break;
|
break;
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
$f[] = Form::checkbox($value['title'],$value['name'],$GroupDataValue[$value['title']]['value'])->options($info);
|
$f[] = Form::checkbox($value['title'],$value['name'],$fvalue)->options($info);
|
||||||
break;
|
break;
|
||||||
case 'upload':
|
case 'upload':
|
||||||
if(!empty($GroupDataValue[$value['title']]['value'])){
|
if(!empty($fvalue)){
|
||||||
$image = is_string($GroupDataValue[$value['title']]['value']) ? $GroupDataValue[$value['title']]['value'] : $GroupDataValue[$value['title']]['value'][0];
|
$image = is_string($fvalue) ? $fvalue : $fvalue[0];
|
||||||
}else{
|
}else{
|
||||||
$image = '';
|
$image = '';
|
||||||
}
|
}
|
||||||
$f[] = Form::frameImageOne($value['title'],$value['name'],Url::build('admin/widget.images/index',array('fodder'=>$value['title'],'big'=>1)),$image)->icon('image');
|
$f[] = Form::frameImageOne($value['title'],$value['name'],Url::build('admin/widget.images/index',array('fodder'=>$value['title'],'big'=>1)),$image)->icon('image');
|
||||||
break;
|
break;
|
||||||
case 'uploads':
|
case 'uploads':
|
||||||
$images = !empty($GroupDataValue[$value['title']]['value']) ? $GroupDataValue[$value['title']]['value']:[];
|
$images = !empty($fvalue) ? $fvalue:[];
|
||||||
$f[] = Form::frameImages($value['title'],$value['name'],Url::build('admin/widget.images/index', array('fodder' => $value['title'],'big'=>1)),$images)->maxLength(5)->icon('images')->width('100%')->height('550px')->spin(0);
|
$f[] = Form::frameImages($value['title'],$value['name'],Url::build('admin/widget.images/index', array('fodder' => $value['title'],'big'=>1)),$images)->maxLength(5)->icon('images')->width('100%')->height('550px')->spin(0);
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$f[] = Form::select($value['title'],$value['name'],$GroupDataValue[$value['title']]['value'])->setOptions($info);
|
$f[] = Form::select($value['title'],$value['name'],$fvalue)->setOptions($info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$f[] = Form::input($value['title'],$value['name'],$GroupDataValue[$value['title']]['value']);
|
$f[] = Form::input($value['title'],$value['name'],$fvalue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ class SystemCleardata extends AuthController
|
|||||||
}
|
}
|
||||||
//修改用户默认密码
|
//修改用户默认密码
|
||||||
public function userdate(){
|
public function userdate(){
|
||||||
SystemCleardata::ClearData('user',1);
|
// SystemCleardata::ClearData('user',1);
|
||||||
$headimgurl= WechatUser::Where('uid',1)->value('headimgurl');
|
$headimgurl= WechatUser::Where('uid',1)->value('headimgurl');
|
||||||
$data['account']='crmeb';
|
$data['account']='crmeb';
|
||||||
$data['pwd']=md5(123456);
|
$data['pwd']=md5(123456);
|
||||||
@ -141,7 +141,7 @@ class SystemCleardata extends AuthController
|
|||||||
}
|
}
|
||||||
//递归删除文件
|
//递归删除文件
|
||||||
function delDirAndFile($dirName,$subdir=true){
|
function delDirAndFile($dirName,$subdir=true){
|
||||||
if ($handle = opendir("$dirName")){
|
if ($handle = @opendir("$dirName")){
|
||||||
while(false !== ($item = readdir($handle))){
|
while(false !== ($item = readdir($handle))){
|
||||||
if($item != "." && $item != ".."){
|
if($item != "." && $item != ".."){
|
||||||
if(is_dir("$dirName/$item"))
|
if(is_dir("$dirName/$item"))
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class SystemGroupData extends ModelBasic
|
|||||||
$model = new self;
|
$model = new self;
|
||||||
if($params['gid'] !== '') $model = $model->where('gid',$params['gid']);
|
if($params['gid'] !== '') $model = $model->where('gid',$params['gid']);
|
||||||
if($params['status'] !== '') $model = $model->where('status',$params['status']);
|
if($params['status'] !== '') $model = $model->where('status',$params['status']);
|
||||||
|
$model = $model->order('sort desc,id ASC');
|
||||||
return self::page($model,function($item,$key){
|
return self::page($model,function($item,$key){
|
||||||
$info = json_decode($item->value,true);
|
$info = json_decode($item->value,true);
|
||||||
foreach ($info as $index => $value) {
|
foreach ($info as $index => $value) {
|
||||||
|
|||||||
@ -84,12 +84,12 @@
|
|||||||
elem: '#fileList'
|
elem: '#fileList'
|
||||||
,url:"{:Url('fileList')}"
|
,url:"{:Url('fileList')}"
|
||||||
,cols: [[
|
,cols: [[
|
||||||
{field: 'filename', title: '备份名称', sort: true},
|
{field: 'filename', title: '备份名称', sort: true,width:'25%'},
|
||||||
{field: 'part', title: 'part'},
|
{field: 'part', title: 'part',width:'10%'},
|
||||||
{field: 'size', title: '大小'},
|
{field: 'size', title: '大小',width:'10%'},
|
||||||
{field: 'compress', title: 'compress'},
|
{field: 'compress', title: 'compress',width:'10%'},
|
||||||
{field: 'backtime', title: '时间'},
|
{field: 'backtime', title: '时间',width:'20%'},
|
||||||
{fixed: 'right', title: '操作', width: '20%', align: 'center', toolbar: '#fileListtool'}
|
{fixed: 'right', title: '操作', width: '25%', align: 'center', toolbar: '#fileListtool'}
|
||||||
]]
|
]]
|
||||||
,page: false
|
,page: false
|
||||||
});
|
});
|
||||||
@ -128,11 +128,11 @@
|
|||||||
,toolbar: '#toolbarDemo'
|
,toolbar: '#toolbarDemo'
|
||||||
,cols: [[
|
,cols: [[
|
||||||
{type:'checkbox'},
|
{type:'checkbox'},
|
||||||
{field: 'name', title: '表名称', sort: true},
|
{field: 'name', title: '表名称', sort: true,width:'20%'},
|
||||||
{field: 'comment', title: '备注' },
|
{field: 'comment', title: '备注',width:'20%'},
|
||||||
{field: 'engine', title: '类型', sort: true},
|
{field: 'engine', title: '类型', sort: true,width:'10%'},
|
||||||
{field: 'data_length', title: '大小', sort: true,totalRow: true},
|
{field: 'data_length', title: '大小',width:'10%', sort: true,totalRow: true},
|
||||||
{field: 'update_time', title: '更新时间', sort: true},
|
{field: 'update_time', title: '更新时间',width:'20%', sort: true},
|
||||||
{field: 'rows', title: '行数'},
|
{field: 'rows', title: '行数'},
|
||||||
{fixed: 'right', title: '操作', width: '10%', align: 'center', toolbar: '#barDemo'}
|
{fixed: 'right', title: '操作', width: '10%', align: 'center', toolbar: '#barDemo'}
|
||||||
]]
|
]]
|
||||||
|
|||||||
@ -471,7 +471,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var str = chk_value.join(',');
|
var str = chk_value.join(',');
|
||||||
var url = "http://"+window.location.host+"/admin/store.store_coupon/grant/id/"+str;
|
var url = "http://"+window.location.host+"/admin/ump.store_coupon/grant/id/"+str;
|
||||||
$eb.createModalFrame(this.innerText,url,{'w':800});
|
$eb.createModalFrame(this.innerText,url,{'w':800});
|
||||||
})
|
})
|
||||||
$('.news').on('click',function (e) {
|
$('.news').on('click',function (e) {
|
||||||
@ -494,7 +494,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var str = chk_value.join(',');
|
var str = chk_value.join(',');
|
||||||
var url = "http://"+window.location.host+"/admin/wechat.wechat_news_category/send_news/id/"+str;
|
var url = "{:Url('wechat.wechat_news_category/send_news')}?id="+str;
|
||||||
$eb.createModalFrame(this.innerText,url,{'w':800});
|
$eb.createModalFrame(this.innerText,url,{'w':800});
|
||||||
})
|
})
|
||||||
$('.synchro').on('click',function(){
|
$('.synchro').on('click',function(){
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class AuthApi extends AuthController{
|
|||||||
$new = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,unit_name,sort',3);//今日上新
|
$new = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,unit_name,sort',3);//今日上新
|
||||||
$hot = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name,sort',6);//猜你喜欢
|
$hot = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name,sort',6);//猜你喜欢
|
||||||
$data['banner'] = $banner;
|
$data['banner'] = $banner;
|
||||||
$data['lovely'] = $lovely;
|
$data['lovely'] = $lovely[0];
|
||||||
$data['menus'] = $menus;
|
$data['menus'] = $menus;
|
||||||
$data['best'] = $best;
|
$data['best'] = $best;
|
||||||
$data['new'] = $new;
|
$data['new'] = $new;
|
||||||
@ -235,10 +235,11 @@ class AuthApi extends AuthController{
|
|||||||
if($news!=0) $model->where('is_new',1);
|
if($news!=0) $model->where('is_new',1);
|
||||||
$baseOrder = '';
|
$baseOrder = '';
|
||||||
if($priceOrder) $baseOrder = $priceOrder == 'desc' ? 'price DESC' : 'price ASC';
|
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 .= ', ';
|
if($baseOrder) $baseOrder .= ', ';
|
||||||
$model->order($baseOrder.'sort DESC, add_time DESC');
|
$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);
|
return JsonService::successful($list);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -268,7 +269,7 @@ class AuthApi extends AuthController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data['storeInfo'] = $storeInfo;
|
$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['productAttr'] = $productAttr;
|
||||||
$data['productValue'] = $productValue;
|
$data['productValue'] = $productValue;
|
||||||
$data['reply'] = StoreProductReply::getRecProductReply($storeInfo['id']);
|
$data['reply'] = StoreProductReply::getRecProductReply($storeInfo['id']);
|
||||||
@ -341,7 +342,7 @@ class AuthApi extends AuthController{
|
|||||||
$lovely = GroupDataService::getData('routine_lovely')?:[];//banner图
|
$lovely = GroupDataService::getData('routine_lovely')?:[];//banner图
|
||||||
$seckill = StoreSeckill::where('is_del',0)->where('status',1)->where('start_time','<',time())->where('stop_time','>',time())->order('sort desc')->select()->toArray();
|
$seckill = StoreSeckill::where('is_del',0)->where('status',1)->where('start_time','<',time())->where('stop_time','>',time())->order('sort desc')->select()->toArray();
|
||||||
$data['seckill'] = $seckill;
|
$data['seckill'] = $seckill;
|
||||||
$data['lovely'] = $lovely;
|
$data['lovely'] = $lovely[1];
|
||||||
return JsonService::successful($data);
|
return JsonService::successful($data);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -1441,7 +1442,9 @@ class AuthApi extends AuthController{
|
|||||||
if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain));
|
if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain));
|
||||||
if(file_exists($picname)) return JsonService::successful($domain.$picname);
|
if(file_exists($picname)) return JsonService::successful($domain.$picname);
|
||||||
else{
|
else{
|
||||||
file_put_contents($picname,RoutineCode::getCode($this->userInfo['uid']));
|
$res = RoutineCode::getCode($this->userInfo['uid'],$picname);
|
||||||
|
if($res) file_put_contents($picname,$res);
|
||||||
|
else return JsonService::fail('二维码生成失败');
|
||||||
}
|
}
|
||||||
return JsonService::successful($domain.$picname);
|
return JsonService::successful($domain.$picname);
|
||||||
}
|
}
|
||||||
@ -1474,7 +1477,7 @@ class AuthApi extends AuthController{
|
|||||||
$banner = $banner[0];
|
$banner = $banner[0];
|
||||||
$bargainUser = StoreBargainUser::getBargainUserStatusSuccess();
|
$bargainUser = StoreBargainUser::getBargainUserStatusSuccess();
|
||||||
$data['bargain'] = $bargain;
|
$data['bargain'] = $bargain;
|
||||||
$data['lovely'] = $lovely;
|
$data['lovely'] = $lovely[2];
|
||||||
$data['banner'] = $banner;
|
$data['banner'] = $banner;
|
||||||
$data['bargainUser'] = $bargainUser;
|
$data['bargainUser'] = $bargainUser;
|
||||||
return JsonService::successful($data);
|
return JsonService::successful($data);
|
||||||
@ -1728,9 +1731,14 @@ class AuthApi extends AuthController{
|
|||||||
return JsonService::successful($store_combination);
|
return JsonService::successful($store_combination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取拼团列表顶部图
|
||||||
|
* @param int $offset
|
||||||
|
* @param int $limit
|
||||||
|
*/
|
||||||
public function get_combination_list_banner(){
|
public function get_combination_list_banner(){
|
||||||
$lovely = GroupDataService::getData('routine_lovely')?:[];//banner图
|
$lovely = GroupDataService::getData('routine_lovely')?:[];//banner图
|
||||||
return JsonService::successful($lovely[2]);
|
return JsonService::successful($lovely[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1949,6 +1957,27 @@ class AuthApi extends AuthController{
|
|||||||
return JsonService::successful($content);
|
return JsonService::successful($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品海报二维码
|
||||||
|
* @param int $id
|
||||||
|
*/
|
||||||
|
public function product_promotion_code($id = 0){
|
||||||
|
if(!$id) return JsonService::fail('参数错误');
|
||||||
|
$count = StoreProduct::validWhere()->count();
|
||||||
|
if(!$count) return JsonService::fail('参数错误');
|
||||||
|
$path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product';
|
||||||
|
$codePath = $path.DS.$id.'_'.$this->userInfo['uid'].'.jpg';
|
||||||
|
$domain = SystemConfigService::get('site_url').'/';
|
||||||
|
if(!file_exists($codePath)){
|
||||||
|
if(!is_dir($path)) mkdir($path,0777,true);
|
||||||
|
$res = RoutineCode::getCode($this->userInfo['uid'],$codePath,[],'/pages/product-con/index?id='.$id,'product_spread');
|
||||||
|
if($res) file_put_contents($codePath,$res);
|
||||||
|
else return JsonService::fail('二维码生成失败');
|
||||||
|
}
|
||||||
|
return JsonService::successful($domain.$codePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function poster($id = 0){
|
public function poster($id = 0){
|
||||||
if(!$id) return JsonService::fail('参数错误');
|
if(!$id) return JsonService::fail('参数错误');
|
||||||
$productInfo = StoreProduct::getValidProduct($id,'store_name,id,price,image,code_path');
|
$productInfo = StoreProduct::getValidProduct($id,'store_name,id,price,image,code_path');
|
||||||
@ -1957,9 +1986,8 @@ class AuthApi extends AuthController{
|
|||||||
$path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product';
|
$path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product';
|
||||||
$codePath = $path.DS.$productInfo['id'].'.jpg';
|
$codePath = $path.DS.$productInfo['id'].'.jpg';
|
||||||
if(!file_exists($codePath)){
|
if(!file_exists($codePath)){
|
||||||
if(!is_dir($path))
|
if(!is_dir($path)) mkdir($path,0777,true);
|
||||||
mkdir($path,0777,true);
|
$res = file_put_contents($codePath,RoutineCode::getPages('pages/product-con/index?id='.$productInfo['id']));
|
||||||
file_put_contents($codePath,RoutineCode::getPages('pages/product-con/index?id='.$productInfo['id']));
|
|
||||||
}
|
}
|
||||||
$res = StoreProduct::edit(['code_path'=>$codePath],$id);
|
$res = StoreProduct::edit(['code_path'=>$codePath],$id);
|
||||||
if($res) $productInfo['code_path'] = $codePath;
|
if($res) $productInfo['code_path'] = $codePath;
|
||||||
|
|||||||
@ -30,7 +30,9 @@ class Login extends Controller{
|
|||||||
else $data['unionid'] = '';
|
else $data['unionid'] = '';
|
||||||
$data['routine_openid'] = $res['openid'];
|
$data['routine_openid'] = $res['openid'];
|
||||||
$data['session_key'] = $res['session_key'];
|
$data['session_key'] = $res['session_key'];
|
||||||
$data['uid'] = RoutineUser::routineOauth($data);
|
$dataOauthInfo = RoutineUser::routineOauth($data);
|
||||||
|
$data['uid'] = $dataOauthInfo['uid'];
|
||||||
|
$data['page'] = $dataOauthInfo['page'];
|
||||||
$data['status'] = RoutineUser::isUserStatus($data['uid']);
|
$data['status'] = RoutineUser::isUserStatus($data['uid']);
|
||||||
return JsonService::successful($data);
|
return JsonService::successful($data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,22 +10,32 @@ class RoutineCode{
|
|||||||
* @param array $color 二维码线条颜色
|
* @param array $color 二维码线条颜色
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getCode($uid = 0,$color = array()){
|
public static function getCode($uid = 0,$imgUrl = '',$color = array(),$page = '',$thirdType = 'spread'){
|
||||||
$accessToken = RoutineServer::get_access_token();
|
$accessToken = RoutineServer::get_access_token();
|
||||||
$url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".$accessToken;
|
$res = RoutineQrcode::setRoutineQrcodeForever($uid,$thirdType,$page,$imgUrl);
|
||||||
if($uid) $data['scene'] = $uid;
|
if($res){
|
||||||
else $data['scene'] = 0;
|
$url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".$accessToken;
|
||||||
if(empty($color)){
|
if($uid) $data['scene'] = $res->id;
|
||||||
$color['r'] = 0;
|
else $data['scene'] = 0;
|
||||||
$color['g'] = 0;
|
if(empty($color)){
|
||||||
$color['b'] = 0;
|
$color['r'] = 0;
|
||||||
}
|
$color['g'] = 0;
|
||||||
$data['page'] = '';
|
$color['b'] = 0;
|
||||||
$data['width'] = 430;
|
}
|
||||||
$data['auto_color'] = false;
|
$data['page'] = '';
|
||||||
$data['line_color'] = $color;
|
$data['width'] = 430;
|
||||||
$data['is_hyaline'] = false;
|
$data['auto_color'] = false;
|
||||||
return RoutineServer::curlPost($url,json_encode($data));
|
$data['line_color'] = $color;
|
||||||
|
$data['is_hyaline'] = false;
|
||||||
|
$resCode = RoutineServer::curlPost($url,json_encode($data));
|
||||||
|
if($resCode){
|
||||||
|
$dataQrcode['status'] = 1;
|
||||||
|
$dataQrcode['url_time'] = time();
|
||||||
|
$res = RoutineQrcode::setRoutineQrcodeFind($res->id,$dataQrcode);
|
||||||
|
if($res) return $resCode;
|
||||||
|
else return false;
|
||||||
|
}else return false;
|
||||||
|
}else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
74
application/routine/model/routine/RoutineQrcode.php
Normal file
74
application/routine/model/routine/RoutineQrcode.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\routine\model\routine;
|
||||||
|
|
||||||
|
|
||||||
|
use basic\ModelBasic;
|
||||||
|
use traits\ModelTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序二维码Model
|
||||||
|
* Class RoutineQrcode
|
||||||
|
* @package app\routine\model\routine
|
||||||
|
*/
|
||||||
|
class RoutineQrcode extends ModelBasic {
|
||||||
|
|
||||||
|
use ModelTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加二维码记录
|
||||||
|
* @param string $thirdType
|
||||||
|
* @param int $thirdId
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public static function setRoutineQrcodeForever($thirdId = 0,$thirdType = 'spread',$page = '',$imgUrl = ''){
|
||||||
|
$data['third_type'] = $thirdType;
|
||||||
|
$data['third_id'] = $thirdId;
|
||||||
|
$data['status'] = 0;
|
||||||
|
$data['add_time'] = time();
|
||||||
|
$data['page'] = $page;
|
||||||
|
$data['url_time'] = '';
|
||||||
|
$data['qrcode_url'] = $imgUrl;
|
||||||
|
return self::set($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改二维码地址
|
||||||
|
* @param int $id
|
||||||
|
* @param array $data
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function setRoutineQrcodeFind($id = 0,$data = array()){
|
||||||
|
if(!$id) return false;
|
||||||
|
$count = self::getRoutineQrcodeFind($id);
|
||||||
|
if(!$count) return false;
|
||||||
|
return self::edit($data,$id,'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取二维码是否存在
|
||||||
|
* @param int $id
|
||||||
|
* @return int|string
|
||||||
|
*/
|
||||||
|
public static function getRoutineQrcodeFind($id = 0){
|
||||||
|
if(!$id) return 0;
|
||||||
|
return self::where('id',$id)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取小程序二维码信息
|
||||||
|
* @param int $id
|
||||||
|
* @param string $field
|
||||||
|
* @return array|bool|false|\PDOStatement|string|\think\Model
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @throws \think\exception\DbException
|
||||||
|
*/
|
||||||
|
public static function getRoutineQrcodeFindType($id = 0,$field = 'third_type,third_id,page'){
|
||||||
|
if(!$id) return false;
|
||||||
|
$count = self::getRoutineQrcodeFind($id);
|
||||||
|
if(!$count) return false;
|
||||||
|
return self::where('id',$id)->where('status',1)->field($field)->find();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace app\routine\model\user;
|
namespace app\routine\model\user;
|
||||||
|
|
||||||
|
use app\routine\model\routine\RoutineQrcode;
|
||||||
use basic\ModelBasic;
|
use basic\ModelBasic;
|
||||||
use traits\ModelTrait;
|
use traits\ModelTrait;
|
||||||
use app\routine\model\user\User;
|
use app\routine\model\user\User;
|
||||||
@ -33,6 +34,16 @@ class RoutineUser extends ModelBasic
|
|||||||
$routineInfo['session_key'] = $routine['session_key'];//会话密匙
|
$routineInfo['session_key'] = $routine['session_key'];//会话密匙
|
||||||
$routineInfo['unionid'] = $routine['unionid'];//用户在开放平台的唯一标识符
|
$routineInfo['unionid'] = $routine['unionid'];//用户在开放平台的唯一标识符
|
||||||
$routineInfo['user_type'] = 'routine';//用户类型
|
$routineInfo['user_type'] = 'routine';//用户类型
|
||||||
|
$page = '';//跳转小程序的页面
|
||||||
|
$spid = 0;//绑定关系uid
|
||||||
|
//获取是否有扫码进小程序
|
||||||
|
if($routine['spid']){
|
||||||
|
$info = RoutineQrcode::getRoutineQrcodeFindType($routine['spid']);
|
||||||
|
if($info){
|
||||||
|
$spid = $info['third_id'];
|
||||||
|
$page = $info['page'];
|
||||||
|
}
|
||||||
|
}
|
||||||
// 判断unionid 存在根据unionid判断
|
// 判断unionid 存在根据unionid判断
|
||||||
if($routineInfo['unionid'] != '' && WechatUser::be(['unionid'=>$routineInfo['unionid']])){
|
if($routineInfo['unionid'] != '' && WechatUser::be(['unionid'=>$routineInfo['unionid']])){
|
||||||
WechatUser::edit($routineInfo,$routineInfo['unionid'],'unionid');
|
WechatUser::edit($routineInfo,$routineInfo['unionid'],'unionid');
|
||||||
@ -41,21 +52,18 @@ class RoutineUser extends ModelBasic
|
|||||||
}else if(WechatUser::be(['routine_openid'=>$routineInfo['routine_openid']])){ //根据小程序openid判断
|
}else if(WechatUser::be(['routine_openid'=>$routineInfo['routine_openid']])){ //根据小程序openid判断
|
||||||
WechatUser::edit($routineInfo,$routineInfo['routine_openid'],'routine_openid');
|
WechatUser::edit($routineInfo,$routineInfo['routine_openid'],'routine_openid');
|
||||||
$uid = WechatUser::where('routine_openid',$routineInfo['routine_openid'])->value('uid');
|
$uid = WechatUser::where('routine_openid',$routineInfo['routine_openid'])->value('uid');
|
||||||
if(!User::be(['uid'=>$uid])){
|
User::updateWechatUser($routineInfo,$uid);
|
||||||
$routineInfo = WechatUser::where('uid',$uid)->find();
|
|
||||||
User::setRoutineUser($routineInfo);
|
|
||||||
}else{
|
|
||||||
User::updateWechatUser($routineInfo,$uid);
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
$routineInfo['add_time'] = time();//用户添加时间
|
$routineInfo['add_time'] = time();//用户添加时间
|
||||||
$routineInfo = WechatUser::set($routineInfo);
|
$routineInfo = WechatUser::set($routineInfo);
|
||||||
if(User::isUserSpread($routine['spid'])) {
|
if(User::isUserSpread($spid)) {
|
||||||
$res = User::setRoutineUser($routineInfo,$routine['spid']); //用户上级
|
$res = User::setRoutineUser($routineInfo,$spid); //用户上级
|
||||||
} else $res = User::setRoutineUser($routineInfo);
|
}else $res = User::setRoutineUser($routineInfo);
|
||||||
$uid = $res->uid;
|
$uid = $res->uid;
|
||||||
}
|
}
|
||||||
return $uid;
|
$data['page'] = $page;
|
||||||
|
$data['uid'] = $uid;
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -307,6 +307,7 @@ class AuthApi extends AuthController
|
|||||||
public function get_user_order_list($type = '',$first = 0, $limit = 8,$search = '')
|
public function get_user_order_list($type = '',$first = 0, $limit = 8,$search = '')
|
||||||
{
|
{
|
||||||
// StoreOrder::delCombination();//删除拼团未支付订单
|
// StoreOrder::delCombination();//删除拼团未支付订单
|
||||||
|
$type=='null' && $type='';
|
||||||
if($search){
|
if($search){
|
||||||
$order = StoreOrder::searchUserOrder($this->userInfo['uid'],$search)?:[];
|
$order = StoreOrder::searchUserOrder($this->userInfo['uid'],$search)?:[];
|
||||||
$list = $order == false ? [] : [$order];
|
$list = $order == false ? [] : [$order];
|
||||||
@ -496,10 +497,11 @@ class AuthApi extends AuthController
|
|||||||
if($news) $model->where('is_new',1);
|
if($news) $model->where('is_new',1);
|
||||||
$baseOrder = '';
|
$baseOrder = '';
|
||||||
if($priceOrder) $baseOrder = $priceOrder == 'desc' ? 'price DESC' : 'price ASC';
|
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 .= ', ';
|
if($baseOrder) $baseOrder .= ', ';
|
||||||
$model->order($baseOrder.'sort DESC, add_time DESC');
|
$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);
|
if($list) setView($this->uid,0,$sId,'search','product',$keyword);
|
||||||
return JsonService::successful($list);
|
return JsonService::successful($list);
|
||||||
}
|
}
|
||||||
@ -740,4 +742,14 @@ class AuthApi extends AuthController
|
|||||||
else return JsonService::status('ERROR','砍价失败,请稍后再帮助朋友砍价');
|
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;
|
namespace app\wap\controller;
|
||||||
|
|
||||||
|
use app\wap\model\store\StoreCombination;
|
||||||
use app\wap\model\store\StoreSeckill;
|
use app\wap\model\store\StoreSeckill;
|
||||||
use app\wap\model\store\StoreCategory;
|
use app\wap\model\store\StoreCategory;
|
||||||
use app\wap\model\store\StoreOrder;
|
use app\wap\model\store\StoreOrder;
|
||||||
@ -47,7 +48,9 @@ class Index extends AuthController
|
|||||||
->where('start_time','<',time())->where('stop_time','>',time())
|
->where('start_time','<',time())->where('stop_time','>',time())
|
||||||
->limit($seckillnum)->order('sort desc')->select()->toArray();
|
->limit($seckillnum)->order('sort desc')->select()->toArray();
|
||||||
foreach($storeSeckill as $key=>$value){
|
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){
|
if($round<100){
|
||||||
$storeSeckill[$key]['round']=$round;
|
$storeSeckill[$key]['round']=$round;
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@ -107,9 +107,11 @@ class Store extends AuthController
|
|||||||
$storeInfo['userCollect'] = StoreProductRelation::isProductRelation($id,$this->userInfo['uid'],'collect');
|
$storeInfo['userCollect'] = StoreProductRelation::isProductRelation($id,$this->userInfo['uid'],'collect');
|
||||||
list($productAttr,$productValue) = StoreProductAttr::getProductAttrDetail($id);
|
list($productAttr,$productValue) = StoreProductAttr::getProductAttrDetail($id);
|
||||||
setView($this->userInfo['uid'],$id,$storeInfo['cate_id'],'viwe');
|
setView($this->userInfo['uid'],$id,$storeInfo['cate_id'],'viwe');
|
||||||
|
$urlShare = SystemConfigService::get('site_url').Url::build('wap/Store/detail',['id'=>$id,'spuid'=>$this->uid]);
|
||||||
$this->assign([
|
$this->assign([
|
||||||
|
'urlShare'=>$urlShare,
|
||||||
'storeInfo'=>$storeInfo,
|
'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,
|
'productAttr'=>$productAttr,
|
||||||
'productValue'=>$productValue,
|
'productValue'=>$productValue,
|
||||||
'reply'=>StoreProductReply::getRecProductReply($storeInfo['id']),
|
'reply'=>StoreProductReply::getRecProductReply($storeInfo['id']),
|
||||||
@ -176,10 +178,98 @@ class Store extends AuthController
|
|||||||
|
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function combination(){
|
||||||
|
$where = array();
|
||||||
|
$store_combination = StoreCombination::getAll(0,20);
|
||||||
|
$this->assign('list',$store_combination);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
//获取列表
|
//获取列表
|
||||||
public function get_list(){
|
public function get_list(){
|
||||||
return JsonService::successful(StoreCombination::get_list(20));
|
return JsonService::successful(StoreCombination::get_list(20));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function combination_detail($id = 0){
|
||||||
|
if(!$id) return $this->failed('拼团不存在或已下架');
|
||||||
|
$combinationOne = StoreCombination::getCombinationOne($id);
|
||||||
|
if(!$combinationOne) return $this->failed('拼团不存在或已下架');
|
||||||
|
$combinationOne['images'] = json_decode($combinationOne['images'],true);
|
||||||
|
$combinationOne['userLike'] = StoreProductRelation::isProductRelation($combinationOne['product_id'],$this->userInfo['uid'],'like');
|
||||||
|
$combinationOne['like_num'] = StoreProductRelation::productRelationNum($combinationOne['product_id'],'like');
|
||||||
|
$combinationOne['userCollect'] = StoreProductRelation::isProductRelation($combinationOne['product_id'],$this->userInfo['uid'],'collect');
|
||||||
|
$pink = StorePink::getPinkAll($id);//拼团列表
|
||||||
|
setView($this->userInfo['uid'],$id,$combinationOne['cate_id'],'viwe','combination');
|
||||||
|
StoreCombination::editIncBrowse($id);
|
||||||
|
$pindAll = array();
|
||||||
|
foreach ($pink as $k=>$v){
|
||||||
|
$pink[$k]['count'] = StorePink::getPinkPeople($v['id'],$v['people']);
|
||||||
|
$pink[$k]['h'] = date('H',$v['stop_time']);
|
||||||
|
$pink[$k]['i'] = date('i',$v['stop_time']);
|
||||||
|
$pink[$k]['s'] = date('s',$v['stop_time']);
|
||||||
|
$pindAll[] = $v['id'];//开团团长ID
|
||||||
|
}
|
||||||
|
$user = WechatUser::get($this->uid)->toArray();//用户信息
|
||||||
|
$site_name = SystemConfig::getValue('site_name');//网站名称
|
||||||
|
$site_logo = SystemConfig::getValue('site_logo');//网站LOGO
|
||||||
|
$wechat_qrcode = SystemConfig::getValue('wechat_qrcode');//公众号二维码
|
||||||
|
$this->assign([
|
||||||
|
'pink'=>$pink,
|
||||||
|
'user'=>$user,
|
||||||
|
'site_name'=>$site_name,
|
||||||
|
'site_logo'=>$site_logo,
|
||||||
|
'wechat_qrcode'=>$wechat_qrcode,
|
||||||
|
'pindAll'=>$pindAll,
|
||||||
|
'storeInfo'=>$combinationOne,
|
||||||
|
'reply'=>StoreProductReply::getRecProductReply($combinationOne['product_id']),
|
||||||
|
'replyCount'=>StoreProductReply::productValidWhere()->where('product_id',$combinationOne['product_id'])->count(),
|
||||||
|
'mer_id' => StoreProduct::where('id',$combinationOne['product_id'])->value('mer_id')
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function combination_order(Request $request){
|
||||||
|
$data = UtilService::getMore([
|
||||||
|
['cartId',0],
|
||||||
|
['pinkId',0],
|
||||||
|
],$request);
|
||||||
|
|
||||||
|
if($data['pinkId']) if(StorePink::getIsPinkUid($data['pinkId'])) return $this->redirect(Url::build('my/order',['uni'=>StoreOrder::getStoreIdPink($data['pinkId'])]));
|
||||||
|
if($data['pinkId']) if(StoreOrder::getIsOrderPink($data['pinkId'])) return $this->redirect(Url::build('my/order',['uni'=>StoreOrder::getStoreIdPink($data['pinkId'])]));;
|
||||||
|
$cartId = $data['cartId'];
|
||||||
|
$pinkId = $data['pinkId'];
|
||||||
|
if(!is_string($cartId) || !$cartId )
|
||||||
|
return $this->failed('请提交购买的商品!');
|
||||||
|
$cartGroup = StoreCart::getUserCombinationProductCartList($this->userInfo['uid'],$cartId);
|
||||||
|
if(count($cartGroup['invalid']))
|
||||||
|
return $this->failed($cartGroup['invalid'][0]['productInfo']['store_name'].'已失效!');
|
||||||
|
if(!$cartGroup['valid']) return $this->failed('请提交购买的商品!');
|
||||||
|
$cartInfo = $cartGroup['valid'];
|
||||||
|
foreach ($cartInfo as $k=>$cart){
|
||||||
|
if($cart['combination_id']){
|
||||||
|
$cartInfo[$k]['productInfo']['price'] = StoreCombination::where('id',$cart['combination_id'])->value('price');
|
||||||
|
$cartInfo[$k]['productInfo']['image'] = StoreCombination::where('id',$cart['combination_id'])->value('image');
|
||||||
|
$cartInfo[$k]['productInfo']['slider_image'] = json_decode(StoreCombination::where('id',$cart['combination_id'])->value('images'),true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$priceGroup = StoreOrder::getCombinationOrderPriceGroup($cartInfo);
|
||||||
|
$other = [
|
||||||
|
'offlinePostage'=>SystemConfigService::get('offline_postage'),
|
||||||
|
'integralRatio'=>SystemConfigService::get('integral_ratio')
|
||||||
|
];
|
||||||
|
$this->assign([
|
||||||
|
'cartInfo'=>$cartInfo,
|
||||||
|
'priceGroup'=>$priceGroup,
|
||||||
|
'orderKey'=>StoreOrder::cacheOrderInfo($this->userInfo['uid'],$cartInfo,$priceGroup,$other),
|
||||||
|
'offlinePostage'=>$other['offlinePostage'],
|
||||||
|
'userInfo'=>User::getUserInfo($this->userInfo['uid']),
|
||||||
|
'integralRatio'=>$other['integralRatio'],
|
||||||
|
'pinkId'=>$pinkId
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 秒杀列表页
|
* 秒杀列表页
|
||||||
*
|
*
|
||||||
@ -224,4 +314,75 @@ class Store extends AuthController
|
|||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function cut_list(){
|
||||||
|
$bargain = StoreBargain::getList();
|
||||||
|
$bargain = StoreBargainUser::getUserList($bargain);
|
||||||
|
$bargainUser = StoreBargainUser::getBargainUserStatusSuccess();
|
||||||
|
$this->assign([
|
||||||
|
'bargain'=>$bargain,
|
||||||
|
'bargainUser'=>$bargainUser,
|
||||||
|
]);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
public function cut_con($id = 0,$bargainUid = 0){
|
||||||
|
if(!$id) return $this->failed('参数错误');
|
||||||
|
//砍价产品
|
||||||
|
$bargain = StoreBargain::getBargainTerm($id);
|
||||||
|
$bargain['time'] = time();
|
||||||
|
$description = htmlspecialchars_decode($bargain['description']);
|
||||||
|
$rule = isset($bargain['rule']) ? htmlspecialchars_decode($bargain['rule']) : '';
|
||||||
|
if(!$bargainUid)
|
||||||
|
//判断当前登录人是不是砍价
|
||||||
|
if(!StoreBargainUser::isBargainUser($id,$this->userInfo['uid']))
|
||||||
|
// 参与砍价
|
||||||
|
if(!StoreBargainUser::setBargain($id,$this->userInfo['uid'])) return $this->failed('参与失败,请重新参与砍价',Url::build('store/bargain'));
|
||||||
|
//顶部人数
|
||||||
|
StoreBargain::addBargainLook($id);
|
||||||
|
$lookCount = StoreBargain::getBargainLook()['look'];//观看人数
|
||||||
|
$shareCount = StoreBargain::getBargainShare()['share'];//观看人数
|
||||||
|
//砍价
|
||||||
|
$selfCut = 0;
|
||||||
|
if(!$bargainUid){
|
||||||
|
$res = StoreBargainUserHelp::setBargainUserHelp($id,$bargainUid ? $bargainUid : $this->userInfo['uid'],$this->userInfo['uid']);
|
||||||
|
if($res) {
|
||||||
|
$selfCut = 1;
|
||||||
|
if(!StoreBargainUserHelp::getSurplusPrice($id,$bargainUid ? $bargainUid : $this->userInfo['uid'])){
|
||||||
|
$bargainUserTableId = StoreBargainUser::getBargainUserTableId($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
|
||||||
|
$bargain = StoreBargain::where('id',$id)->find()->toArray();
|
||||||
|
$bargainUser = StoreBargainUser::where('id',$bargainUserTableId)->find()->toArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$userInfoBargain = $this->userInfo;
|
||||||
|
}else $userInfoBargain = User::getUserInfo($bargainUid);
|
||||||
|
//砍价帮
|
||||||
|
$bargainUserTableId = StoreBargainUser::setUserBargain($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
|
||||||
|
$storeBargainUserHelp = StoreBargainUserHelp::getList($bargainUserTableId,15);
|
||||||
|
//获取砍价帮总人数
|
||||||
|
$count = StoreBargainUserHelp::getBargainUserHelpPeopleCount($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
|
||||||
|
//获取用户还剩余的砍价金额
|
||||||
|
$price = StoreBargainUserHelp::getSurplusPrice($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
|
||||||
|
//获取砍价进度条
|
||||||
|
$pricePercent = StoreBargainUserHelp::getSurplusPricePercent($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
|
||||||
|
$selfCutPrice = bcsub(bcsub($bargain['price'],$price,2),$bargain['min_price'],2);
|
||||||
|
//判断当前登录人是否砍价 1 微砍价 2 已砍价
|
||||||
|
$userInfoBargainBool = StoreBargainUserHelp::isBargainUserHelpCount($id,$bargainUid,$this->userInfo['uid']) ? 1 : 2;
|
||||||
|
$this->assign([
|
||||||
|
'userInfoBargainBool'=>$userInfoBargainBool,
|
||||||
|
'selfCut'=>$selfCut,
|
||||||
|
'userInfoBargain'=>$userInfoBargain,
|
||||||
|
'selfCutPrice'=>$selfCutPrice,
|
||||||
|
'bargain'=>$bargain,
|
||||||
|
'description'=>$description,
|
||||||
|
'rule'=>$rule,
|
||||||
|
'shareCount'=>$shareCount,
|
||||||
|
'lookCount'=>$lookCount,
|
||||||
|
'userCount'=>StoreBargainUser::count(),
|
||||||
|
'userHelpList'=>$storeBargainUserHelp,
|
||||||
|
'count'=>$count,
|
||||||
|
'price'=>$price,
|
||||||
|
'pricePercent'=>$pricePercent,
|
||||||
|
'bargainUid'=>$bargainUid,
|
||||||
|
]);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<div class="price">¥{$storeInfo.price|floatval}</div>
|
<div class="price">¥{$storeInfo.price|floatval}</div>
|
||||||
<div class="oldprice">原价:¥{$storeInfo.ot_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>
|
<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"}
|
{gt name="storeInfo['give_integral']" value="0"}
|
||||||
<div class="integral">积分:{$storeInfo.give_integral|floatval} <span>赠送</span></div>
|
<div class="integral">积分:{$storeInfo.give_integral|floatval} <span>赠送</span></div>
|
||||||
{/gt}
|
{/gt}
|
||||||
@ -40,26 +40,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="txt-info">{$reply.comment}</div>
|
<div class="txt-info">{$reply.comment}</div>
|
||||||
<div class="pro-parameter"><span>{$reply.add_time}</span> <span>{$reply.suk}</span></div>
|
<div class="pro-parameter"><span>{$reply.add_time}</span> <span>{$reply.suk}</span></div>
|
||||||
{gt name="replyCount" value="1"} <a class="more"
|
{gt name="replyCount" value="1"}
|
||||||
href="{:url('reply_list',['productId'=>$storeInfo['id']])}">查看全部评价</a>
|
<a class="more" href="{:url('reply_list',['productId'=>$storeInfo['id']])}">查看全部评价</a>
|
||||||
{/gt}
|
{/gt}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/notempty}
|
{/notempty}
|
||||||
<div class="item-box">
|
<div class="item-box">
|
||||||
<div class="item-tit"><i class="line"></i><i class="iconfont icon-icon-tupian"></i><span>详情</span><i
|
<div class="item-tit"><i class="line"></i><i class="iconfont icon-icon-tupian"></i><span>详情</span><i class="line"></i></div>
|
||||||
class="line"></i></div>
|
|
||||||
<div class="con-box" ref="store_desc"></div>
|
<div class="con-box" ref="store_desc"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-bar flex"><a href="{:Url('Service/service_list',array('mer_id'=>$mer_id))}"> <span
|
<div class="footer-bar flex">
|
||||||
class="iconfont icon-kefu"></span>
|
<a href="{:Url('Service/service_list',array('mer_id'=>$mer_id))}"> <span class="iconfont icon-kefu"></span><p>客服</p></a>
|
||||||
<p>客服</p></a> <a class="collect-btn iconfont icon-xing1"
|
<a class="collect-btn iconfont icon-xing1" :class="{'icon-xing2':product.userCollect == true}" @click="collect" href="javascript:void(0)"><p>收藏</p></a>
|
||||||
:class="{'icon-xing2':product.userCollect == true}" @click="collect"
|
<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>
|
||||||
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 buy-car" @click="cardUp">加入购物车</div>
|
||||||
<div class="big-btn confirm" @click="cardUp">立即购买</div>
|
<div class="big-btn confirm" @click="cardUp">立即购买</div>
|
||||||
</div>
|
</div>
|
||||||
@ -73,7 +68,8 @@
|
|||||||
<li><a href="{:url('store/detail',array('id'=>$store['id']))}">
|
<li><a href="{:url('store/detail',array('id'=>$store['id']))}">
|
||||||
<div class="picture"><img src="{$store.image}"/></div>
|
<div class="picture"><img src="{$store.image}"/></div>
|
||||||
<div class="pro-info"><p class="title">{$store.store_name}</p>
|
<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>
|
<p class="price">¥{$store.price|floatval}</p></div>
|
||||||
<div class="buy-car-btn"><i class="iconfont icon-gouwuche"></i></div>
|
<div class="buy-car-btn"><i class="iconfont icon-gouwuche"></i></div>
|
||||||
</a></li>
|
</a></li>
|
||||||
@ -86,11 +82,13 @@
|
|||||||
<script ref="store_desc_temp" type="text/template">{$storeInfo.description}</script>
|
<script ref="store_desc_temp" type="text/template">{$storeInfo.description}</script>
|
||||||
<div style="height:1rem;"></div>
|
<div style="height:1rem;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script> window.$product = <?php unset($storeInfo['description']); echo json_encode($storeInfo);?>;
|
<script>
|
||||||
|
window.$urlShare = "{$urlShare}";
|
||||||
|
window.$product = <?php unset($storeInfo['description']); echo json_encode($storeInfo);?>;
|
||||||
window.$productAttr = <?php echo json_encode($productAttr) ?: '[]'; ?>;
|
window.$productAttr = <?php echo json_encode($productAttr) ?: '[]'; ?>;
|
||||||
window.$productValue = <?php echo json_encode($productValue) ?: '{}'; ?>;</script>
|
window.$productValue = <?php echo json_encode($productValue) ?: '{}'; ?>;</script>
|
||||||
<script
|
<script type="text/javascript">
|
||||||
type="text/javascript"> requirejs(['vue', 'axios', 'helper', 'store', '{__WAP_PATH}crmeb/module/store/shop-card.js'], function (Vue, axios, $h, storeApi, shopCard) {
|
requirejs(['vue', 'axios', 'helper', 'store', '{__WAP_PATH}crmeb/module/store/shop-card.js'], function (Vue, axios, $h, storeApi, shopCard) {
|
||||||
new Vue({
|
new Vue({
|
||||||
el: "#store_detail",
|
el: "#store_detail",
|
||||||
components: {'shop-card': shopCard},
|
components: {'shop-card': shopCard},
|
||||||
@ -225,8 +223,9 @@
|
|||||||
this.onMenuShareAll({
|
this.onMenuShareAll({
|
||||||
title: $product.store_name,
|
title: $product.store_name,
|
||||||
desc: $product.store_info || $product.store_name,
|
desc: $product.store_info || $product.store_name,
|
||||||
imgUrl: location.origin + $product.image,
|
// imgUrl: location.origin + $product.image,
|
||||||
link: location.href
|
imgUrl: $product.image,
|
||||||
|
link: $urlShare || "{:url('store/detail',array('id'=>$store['id'],'spuid'=>$userInfo['uid']))}"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
<div class="img"><img :src="item.image" /></div>
|
<div class="img"><img :src="item.image" /></div>
|
||||||
<div class="info-txt">
|
<div class="info-txt">
|
||||||
<p class="name" v-text="item.store_name"></p>
|
<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>
|
<p class="price">¥{{item.price}}</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
{block name="head_top"}
|
{block name="head_top"}
|
||||||
<link rel="stylesheet" href="{__PLUG_PATH}swiper/swiper-3.4.1.min.css">
|
<link rel="stylesheet" href="{__PLUG_PATH}swiper/swiper-3.4.1.min.css">
|
||||||
<script type="text/javascript" src="{__PLUG_PATH}swiper/swiper-3.4.1.jquery.min.js"></script>
|
<script type="text/javascript" src="{__PLUG_PATH}swiper/swiper-3.4.1.jquery.min.js"></script>
|
||||||
|
<script type="text/javascript" src="{__PLUG_PATH}layer/layer.js"></script>
|
||||||
<script type="text/javascript" src="{__WAP_PATH}crmeb/js/jquery.downCount.js"></script>
|
<script type="text/javascript" src="{__WAP_PATH}crmeb/js/jquery.downCount.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.product-con .product-info{position: relative;}
|
.product-con .product-info{position: relative;}
|
||||||
@ -33,16 +34,10 @@
|
|||||||
<img class="logo" src="{$site.wechat_avatar}" alt="">
|
<img class="logo" src="{$site.wechat_avatar}" alt="">
|
||||||
<span>{$site.wechat_name}</span>
|
<span>{$site.wechat_name}</span>
|
||||||
</div>
|
</div>
|
||||||
<a class="go" href="javascript:void(0);" @click="qrShow = true">立即关注</a>
|
<a class="go" href="javascript:void(0);" @click="ShowQrcode">立即关注</a>
|
||||||
|
<!--<a class="go" href="javascript:void(0);" @click="qrShow = true">立即关注</a>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="model-bg" :class="{on:qrShow == true}" v-cloak="" @click="qrShow = false" @touchmove.prevent></div>
|
|
||||||
{/eq}
|
{/eq}
|
||||||
<div class="rw-code-model" v-cloak="" v-show="qrShow == true">
|
|
||||||
<div class="rw-code-title"><p>{$site.wechat_name}</p ></div>
|
|
||||||
<div class="rw-code-img"><img src="{$site.wechat_qrcode}"></div>
|
|
||||||
<div class="rw-code-tips">长按二维码即可关注公众号</div>
|
|
||||||
<div class="rw-code-close" @click="qrShow = false"></div>
|
|
||||||
</div>
|
|
||||||
<div class="banner">
|
<div class="banner">
|
||||||
<ul class="swiper-wrapper">
|
<ul class="swiper-wrapper">
|
||||||
{volist name="storeInfo.images" id="vo"}
|
{volist name="storeInfo.images" id="vo"}
|
||||||
@ -146,8 +141,10 @@
|
|||||||
window.$productAttr = <?php echo json_encode($productAttr)?:'[]'; ?>;
|
window.$productAttr = <?php echo json_encode($productAttr)?:'[]'; ?>;
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
window.$wechat_qrcode = "{$site.wechat_qrcode}";
|
||||||
|
window.$site_name = "{$site.wechat_name}";
|
||||||
(function ($) {
|
(function ($) {
|
||||||
requirejs(['vue','axios','helper','store','wap/crmeb/module/store/seckill-card'],function(Vue,axios,$h,storeApi,shopCard){
|
requirejs(['vue','axios','helper','store','{__WAP_PATH}crmeb/module/store/seckill-card.js'],function(Vue,axios,$h,storeApi,shopCard){
|
||||||
var mid = "<?=$mer_id?>";
|
var mid = "<?=$mer_id?>";
|
||||||
new Vue({
|
new Vue({
|
||||||
el:"#store_detail",
|
el:"#store_detail",
|
||||||
@ -157,6 +154,8 @@
|
|||||||
data:{
|
data:{
|
||||||
cardShow:false,
|
cardShow:false,
|
||||||
product:$product,
|
product:$product,
|
||||||
|
wechatQrcode: $wechat_qrcode,
|
||||||
|
siteName: $site_name,
|
||||||
productAttr:$productAttr || [],
|
productAttr:$productAttr || [],
|
||||||
productCardInfo:{},
|
productCardInfo:{},
|
||||||
status:{
|
status:{
|
||||||
@ -178,6 +177,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
ShowQrcode:function () {
|
||||||
|
that = this;
|
||||||
|
layer.open({
|
||||||
|
type: 1,
|
||||||
|
shade: true,
|
||||||
|
shadeClose : true,
|
||||||
|
anim : 2,
|
||||||
|
area: ['5rem', '5.1rem'],
|
||||||
|
title: false, //不显示标题
|
||||||
|
content: '<img src="'+that.wechatQrcode+'" alt="'+that.siteName+'" title="'+that.siteName+'" style="width: 5rem;"/>', //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
|
||||||
|
});
|
||||||
|
},
|
||||||
getProductTag:function(){
|
getProductTag:function(){
|
||||||
if(this.product.postage <= 0 || this.product.is_postage == 1)
|
if(this.product.postage <= 0 || this.product.is_postage == 1)
|
||||||
return ('<i class="send-txt">包邮</i>');
|
return ('<i class="send-txt">包邮</i>');
|
||||||
@ -344,7 +355,7 @@
|
|||||||
this.onMenuShareAll({
|
this.onMenuShareAll({
|
||||||
title:$product.store_name,
|
title:$product.store_name,
|
||||||
desc:$product.store_info || $product.store_name,
|
desc:$product.store_info || $product.store_name,
|
||||||
imgUrl:location.origin+$product.image,
|
imgUrl:$product.image,
|
||||||
link:location.href
|
link:location.href
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class UserBehavior
|
|||||||
public static function wechatOauthAfter($openid,$wechatInfo)
|
public static function wechatOauthAfter($openid,$wechatInfo)
|
||||||
{
|
{
|
||||||
Cookie::set('is_login',1);
|
Cookie::set('is_login',1);
|
||||||
if($wechatInfo['unionid'] != '' && WechatUser::be(['unionid'=>$wechatInfo['unionid']])){
|
if(isset($wechatInfo['unionid']) && $wechatInfo['unionid'] != '' && WechatUser::be(['unionid'=>$wechatInfo['unionid']])){
|
||||||
WechatUser::edit($wechatInfo,$wechatInfo['unionid'],'unionid');
|
WechatUser::edit($wechatInfo,$wechatInfo['unionid'],'unionid');
|
||||||
$uid = WechatUser::where('unionid',$wechatInfo['unionid'])->value('uid');
|
$uid = WechatUser::where('unionid',$wechatInfo['unionid'])->value('uid');
|
||||||
if(!User::be(['uid'=>$uid])){
|
if(!User::be(['uid'=>$uid])){
|
||||||
|
|||||||
@ -185,6 +185,22 @@ BEGIN;
|
|||||||
INSERT INTO `eb_routine_template` VALUES ('12', 'AT0177', '订单配送通知', '订单编号{{keyword1.DATA}}\n配送员{{keyword2.DATA}}\n联系电话{{keyword3.DATA}}\n配送时间{{keyword4.DATA}}\n备注{{keyword5.DATA}}', 'mCxm8mO_ZeETohNq7sFMlcf0vWdAnCJylKog71J68JM', '1534469109', '1'), ('13', 'AT0007', '订单发货提醒', '订单号{{keyword1.DATA}}\n快递公司{{keyword2.DATA}}\n快递单号{{keyword3.DATA}}\n发货时间{{keyword4.DATA}}\n备注{{keyword5.DATA}}', 'XQlyO_b3QocHBOrC69bfOCaOJq5kdKXQcdQtCO11sA0', '1534469928', '1'), ('14', 'AT0787', '退款成功通知', '订单号{{keyword1.DATA}}\n退款时间{{keyword2.DATA}}\n退款金额{{keyword3.DATA}}\n退款方式{{keyword4.DATA}}\n备注{{keyword5.DATA}}', 'gQi8X-wuOYAwdVRBXaJVwfAXQ0ngjMxYcYVS0GT1anI', '1534469993', '1'), ('15', 'AT0009', '订单支付成功通知', '单号{{keyword1.DATA}}\n下单时间{{keyword2.DATA}}\n订单状态{{keyword3.DATA}}\n支付金额{{keyword4.DATA}}\n支付方式{{keyword5.DATA}}', 'x5Jw630Rp63T34kv0Q43RaeVKtk5OFKDNkwcrwMp9FM', '1534470043', '1'), ('16', 'AT1173', '砍价成功通知', '商品名称{{keyword1.DATA}}\n砍价金额{{keyword2.DATA}}\n底价{{keyword3.DATA}}\n砍掉价格{{keyword4.DATA}}\n支付金额{{keyword5.DATA}}\n备注{{keyword6.DATA}}', 'FofE1ABYV1iXkNFIvEOUy4j5lInos20KCwIW6gyZ2nM', '1534470085', '1'), ('17', 'AT0036', '退款通知', '订单编号{{keyword1.DATA}}\n退款原因{{keyword2.DATA}}\n退款时间{{keyword3.DATA}}\n退款金额{{keyword4.DATA}}\n退款方式{{keyword5.DATA}}', 'JhmCRYO7ahP6nbCb6oO-BPYz8lIP2u9xs-CkZ63Z4HI', '1534470134', '1');
|
INSERT INTO `eb_routine_template` VALUES ('12', 'AT0177', '订单配送通知', '订单编号{{keyword1.DATA}}\n配送员{{keyword2.DATA}}\n联系电话{{keyword3.DATA}}\n配送时间{{keyword4.DATA}}\n备注{{keyword5.DATA}}', 'mCxm8mO_ZeETohNq7sFMlcf0vWdAnCJylKog71J68JM', '1534469109', '1'), ('13', 'AT0007', '订单发货提醒', '订单号{{keyword1.DATA}}\n快递公司{{keyword2.DATA}}\n快递单号{{keyword3.DATA}}\n发货时间{{keyword4.DATA}}\n备注{{keyword5.DATA}}', 'XQlyO_b3QocHBOrC69bfOCaOJq5kdKXQcdQtCO11sA0', '1534469928', '1'), ('14', 'AT0787', '退款成功通知', '订单号{{keyword1.DATA}}\n退款时间{{keyword2.DATA}}\n退款金额{{keyword3.DATA}}\n退款方式{{keyword4.DATA}}\n备注{{keyword5.DATA}}', 'gQi8X-wuOYAwdVRBXaJVwfAXQ0ngjMxYcYVS0GT1anI', '1534469993', '1'), ('15', 'AT0009', '订单支付成功通知', '单号{{keyword1.DATA}}\n下单时间{{keyword2.DATA}}\n订单状态{{keyword3.DATA}}\n支付金额{{keyword4.DATA}}\n支付方式{{keyword5.DATA}}', 'x5Jw630Rp63T34kv0Q43RaeVKtk5OFKDNkwcrwMp9FM', '1534470043', '1'), ('16', 'AT1173', '砍价成功通知', '商品名称{{keyword1.DATA}}\n砍价金额{{keyword2.DATA}}\n底价{{keyword3.DATA}}\n砍掉价格{{keyword4.DATA}}\n支付金额{{keyword5.DATA}}\n备注{{keyword6.DATA}}', 'FofE1ABYV1iXkNFIvEOUy4j5lInos20KCwIW6gyZ2nM', '1534470085', '1'), ('17', 'AT0036', '退款通知', '订单编号{{keyword1.DATA}}\n退款原因{{keyword2.DATA}}\n退款时间{{keyword3.DATA}}\n退款金额{{keyword4.DATA}}\n退款方式{{keyword5.DATA}}', 'JhmCRYO7ahP6nbCb6oO-BPYz8lIP2u9xs-CkZ63Z4HI', '1534470134', '1');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `eb_routine_qrcode`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `eb_routine_qrcode`;
|
||||||
|
CREATE TABLE `eb_routine_qrcode` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '微信二维码ID',
|
||||||
|
`third_type` varchar(32) NOT NULL COMMENT '二维码类型 spread(用户推广) product_spread(产品推广)',
|
||||||
|
`third_id` int(11) unsigned NOT NULL COMMENT '用户id',
|
||||||
|
`status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态 0不可用 1可用',
|
||||||
|
`add_time` varchar(255) DEFAULT NULL COMMENT '添加时间',
|
||||||
|
`page` varchar(255) DEFAULT NULL COMMENT '小程序页面路径带参数',
|
||||||
|
`qrcode_url` varchar(255) DEFAULT NULL COMMENT '小程序二维码路径',
|
||||||
|
`url_time` int(11) unsigned DEFAULT NULL COMMENT '二维码添加时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COMMENT='小程序二维码管理表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for `eb_store_bargain`
|
-- Table structure for `eb_store_bargain`
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -1220,7 +1236,7 @@ CREATE TABLE `eb_user` (
|
|||||||
`pwd` varchar(32) NOT NULL COMMENT '用户密码',
|
`pwd` varchar(32) NOT NULL COMMENT '用户密码',
|
||||||
`nickname` varchar(16) NOT NULL COMMENT '用户昵称',
|
`nickname` varchar(16) NOT NULL COMMENT '用户昵称',
|
||||||
`avatar` varchar(256) NOT NULL COMMENT '用户头像',
|
`avatar` varchar(256) NOT NULL COMMENT '用户头像',
|
||||||
`phone` char(15) NOT NULL COMMENT '手机号码',
|
`phone` char(15) DEFAULT NULL COMMENT '手机号码',
|
||||||
`add_time` int(11) unsigned NOT NULL COMMENT '添加时间',
|
`add_time` int(11) unsigned NOT NULL COMMENT '添加时间',
|
||||||
`add_ip` varchar(16) NOT NULL COMMENT '添加ip',
|
`add_ip` varchar(16) NOT NULL COMMENT '添加ip',
|
||||||
`last_time` int(11) unsigned NOT NULL COMMENT '最后一次登录时间',
|
`last_time` int(11) unsigned NOT NULL COMMENT '最后一次登录时间',
|
||||||
|
|||||||
@ -234,7 +234,7 @@ switch ($step) {
|
|||||||
for ($i = $n; $i < $counts; $i++) {
|
for ($i = $n; $i < $counts; $i++) {
|
||||||
$sql = trim($sqlFormat[$i]);
|
$sql = trim($sqlFormat[$i]);
|
||||||
if (strstr($sql, 'CREATE TABLE')) {
|
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]");
|
mysqli_query($conn,"DROP TABLE IF EXISTS `$matches[1]");
|
||||||
$sql = str_replace('`eb_','`'.$dbPrefix,$sql);//替换表前缀
|
$sql = str_replace('`eb_','`'.$dbPrefix,$sql);//替换表前缀
|
||||||
$ret = mysqli_query($conn,$sql);
|
$ret = mysqli_query($conn,$sql);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
// | 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 )
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
@ -18,7 +18,7 @@ use think\exception\RouteNotFoundException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* App 应用管理
|
* App 应用管理
|
||||||
* @author liu21st <liu21st@gmail.com>
|
* @author liu21st <liu21st@gmail.com>
|
||||||
*/
|
*/
|
||||||
class App
|
class App
|
||||||
{
|
{
|
||||||
@ -57,24 +57,32 @@ class App
|
|||||||
*/
|
*/
|
||||||
protected static $routeMust;
|
protected static $routeMust;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array 请求调度分发
|
||||||
|
*/
|
||||||
protected static $dispatch;
|
protected static $dispatch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array 额外加载文件
|
||||||
|
*/
|
||||||
protected static $file = [];
|
protected static $file = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行应用程序
|
* 执行应用程序
|
||||||
* @access public
|
* @access public
|
||||||
* @param Request $request Request对象
|
* @param Request $request 请求对象
|
||||||
* @return Response
|
* @return Response
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function run(Request $request = null)
|
public static function run(Request $request = null)
|
||||||
{
|
{
|
||||||
is_null($request) && $request = Request::instance();
|
$request = is_null($request) ? Request::instance() : $request;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$config = self::initCommon();
|
$config = self::initCommon();
|
||||||
|
|
||||||
|
// 模块/控制器绑定
|
||||||
if (defined('BIND_MODULE')) {
|
if (defined('BIND_MODULE')) {
|
||||||
// 模块/控制器绑定
|
|
||||||
BIND_MODULE && Route::bind(BIND_MODULE);
|
BIND_MODULE && Route::bind(BIND_MODULE);
|
||||||
} elseif ($config['auto_bind_module']) {
|
} elseif ($config['auto_bind_module']) {
|
||||||
// 入口自动绑定
|
// 入口自动绑定
|
||||||
@ -88,10 +96,8 @@ class App
|
|||||||
|
|
||||||
// 默认语言
|
// 默认语言
|
||||||
Lang::range($config['default_lang']);
|
Lang::range($config['default_lang']);
|
||||||
if ($config['lang_switch_on']) {
|
// 开启多语言机制 检测当前语言
|
||||||
// 开启多语言机制 检测当前语言
|
$config['lang_switch_on'] && Lang::detect();
|
||||||
Lang::detect();
|
|
||||||
}
|
|
||||||
$request->langset(Lang::range());
|
$request->langset(Lang::range());
|
||||||
|
|
||||||
// 加载系统语言包
|
// 加载系统语言包
|
||||||
@ -100,12 +106,16 @@ class App
|
|||||||
APP_PATH . 'lang' . DS . $request->langset() . EXT,
|
APP_PATH . 'lang' . DS . $request->langset() . EXT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// 监听 app_dispatch
|
||||||
|
Hook::listen('app_dispatch', self::$dispatch);
|
||||||
// 获取应用调度信息
|
// 获取应用调度信息
|
||||||
$dispatch = self::$dispatch;
|
$dispatch = self::$dispatch;
|
||||||
|
|
||||||
|
// 未设置调度信息则进行 URL 路由检测
|
||||||
if (empty($dispatch)) {
|
if (empty($dispatch)) {
|
||||||
// 进行URL路由检测
|
|
||||||
$dispatch = self::routeCheck($request, $config);
|
$dispatch = self::routeCheck($request, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录当前调度信息
|
// 记录当前调度信息
|
||||||
$request->dispatch($dispatch);
|
$request->dispatch($dispatch);
|
||||||
|
|
||||||
@ -116,10 +126,15 @@ class App
|
|||||||
Log::record('[ PARAM ] ' . var_export($request->param(), true), 'info');
|
Log::record('[ PARAM ] ' . var_export($request->param(), true), 'info');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听app_begin
|
// 监听 app_begin
|
||||||
Hook::listen('app_begin', $dispatch);
|
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);
|
$data = self::exec($dispatch, $config);
|
||||||
} catch (HttpResponseException $exception) {
|
} catch (HttpResponseException $exception) {
|
||||||
@ -134,292 +149,33 @@ class App
|
|||||||
$response = $data;
|
$response = $data;
|
||||||
} elseif (!is_null($data)) {
|
} elseif (!is_null($data)) {
|
||||||
// 默认自动识别响应输出类型
|
// 默认自动识别响应输出类型
|
||||||
$isAjax = $request->isAjax();
|
$type = $request->isAjax() ?
|
||||||
$type = $isAjax ? Config::get('default_ajax_return') : Config::get('default_return_type');
|
Config::get('default_ajax_return') :
|
||||||
|
Config::get('default_return_type');
|
||||||
|
|
||||||
$response = Response::create($data, $type);
|
$response = Response::create($data, $type);
|
||||||
} else {
|
} else {
|
||||||
$response = Response::create();
|
$response = Response::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听app_end
|
// 监听 app_end
|
||||||
Hook::listen('app_end', $response);
|
Hook::listen('app_end', $response);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置当前请求的调度信息
|
* 初始化应用,并返回配置信息
|
||||||
* @access public
|
* @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
|
* @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()
|
public static function initCommon()
|
||||||
{
|
{
|
||||||
if (empty(self::$init)) {
|
if (empty(self::$init)) {
|
||||||
if (defined('APP_NAMESPACE')) {
|
if (defined('APP_NAMESPACE')) {
|
||||||
self::$namespace = APP_NAMESPACE;
|
self::$namespace = APP_NAMESPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader::addNamespace(self::$namespace, APP_PATH);
|
Loader::addNamespace(self::$namespace, APP_PATH);
|
||||||
|
|
||||||
// 初始化应用
|
// 初始化应用
|
||||||
@ -428,17 +184,21 @@ class App
|
|||||||
|
|
||||||
// 应用调试模式
|
// 应用调试模式
|
||||||
self::$debug = Env::get('app_debug', Config::get('app_debug'));
|
self::$debug = Env::get('app_debug', Config::get('app_debug'));
|
||||||
|
|
||||||
if (!self::$debug) {
|
if (!self::$debug) {
|
||||||
ini_set('display_errors', 'Off');
|
ini_set('display_errors', 'Off');
|
||||||
} elseif (!IS_CLI) {
|
} elseif (!IS_CLI) {
|
||||||
//重新申请一块比较大的buffer
|
// 重新申请一块比较大的 buffer
|
||||||
if (ob_get_level() > 0) {
|
if (ob_get_level() > 0) {
|
||||||
$output = ob_get_clean();
|
$output = ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
if (!empty($output)) {
|
if (!empty($output)) {
|
||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($config['root_namespace'])) {
|
if (!empty($config['root_namespace'])) {
|
||||||
@ -459,11 +219,12 @@ class App
|
|||||||
// 设置系统时区
|
// 设置系统时区
|
||||||
date_default_timezone_set($config['default_timezone']);
|
date_default_timezone_set($config['default_timezone']);
|
||||||
|
|
||||||
// 监听app_init
|
// 监听 app_init
|
||||||
Hook::listen('app_init');
|
Hook::listen('app_init');
|
||||||
|
|
||||||
self::$init = true;
|
self::$init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Config::get();
|
return Config::get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,12 +245,13 @@ class App
|
|||||||
} elseif (is_file(RUNTIME_PATH . $module . 'init' . EXT)) {
|
} elseif (is_file(RUNTIME_PATH . $module . 'init' . EXT)) {
|
||||||
include RUNTIME_PATH . $module . 'init' . EXT;
|
include RUNTIME_PATH . $module . 'init' . EXT;
|
||||||
} else {
|
} else {
|
||||||
$path = APP_PATH . $module;
|
|
||||||
// 加载模块配置
|
// 加载模块配置
|
||||||
$config = Config::load(CONF_PATH . $module . 'config' . CONF_EXT);
|
$config = Config::load(CONF_PATH . $module . 'config' . CONF_EXT);
|
||||||
|
|
||||||
// 读取数据库配置文件
|
// 读取数据库配置文件
|
||||||
$filename = CONF_PATH . $module . 'database' . CONF_EXT;
|
$filename = CONF_PATH . $module . 'database' . CONF_EXT;
|
||||||
Config::load($filename, 'database');
|
Config::load($filename, 'database');
|
||||||
|
|
||||||
// 读取扩展配置文件
|
// 读取扩展配置文件
|
||||||
if (is_dir(CONF_PATH . $module . 'extra')) {
|
if (is_dir(CONF_PATH . $module . 'extra')) {
|
||||||
$dir = CONF_PATH . $module . 'extra';
|
$dir = CONF_PATH . $module . 'extra';
|
||||||
@ -504,7 +266,7 @@ class App
|
|||||||
|
|
||||||
// 加载应用状态配置
|
// 加载应用状态配置
|
||||||
if ($config['app_status']) {
|
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)) {
|
if (is_file($path . 'common' . EXT)) {
|
||||||
include $path . 'common' . EXT;
|
include $path . 'common' . EXT;
|
||||||
}
|
}
|
||||||
@ -522,14 +285,335 @@ class App
|
|||||||
Lang::load($path . 'lang' . DS . Request::instance()->langset() . EXT);
|
Lang::load($path . 'lang' . DS . Request::instance()->langset() . EXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Config::get();
|
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)
|
* URL路由检测(根据PATH_INFO)
|
||||||
* @access public
|
* @access public
|
||||||
* @param \think\Request $request
|
* @param \think\Request $request 请求实例
|
||||||
* @param array $config
|
* @param array $config 配置信息
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \think\Exception
|
* @throws \think\Exception
|
||||||
*/
|
*/
|
||||||
@ -538,6 +622,7 @@ class App
|
|||||||
$path = $request->path();
|
$path = $request->path();
|
||||||
$depr = $config['pathinfo_depr'];
|
$depr = $config['pathinfo_depr'];
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
// 路由检测
|
// 路由检测
|
||||||
$check = !is_null(self::$routeCheck) ? self::$routeCheck : $config['url_route_on'];
|
$check = !is_null(self::$routeCheck) ? self::$routeCheck : $config['url_route_on'];
|
||||||
if ($check) {
|
if ($check) {
|
||||||
@ -545,18 +630,14 @@ class App
|
|||||||
if (is_file(RUNTIME_PATH . 'route.php')) {
|
if (is_file(RUNTIME_PATH . 'route.php')) {
|
||||||
// 读取路由缓存
|
// 读取路由缓存
|
||||||
$rules = include RUNTIME_PATH . 'route.php';
|
$rules = include RUNTIME_PATH . 'route.php';
|
||||||
if (is_array($rules)) {
|
is_array($rules) && Route::rules($rules);
|
||||||
Route::rules($rules);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$files = $config['route_config_file'];
|
$files = $config['route_config_file'];
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (is_file(CONF_PATH . $file . CONF_EXT)) {
|
if (is_file(CONF_PATH . $file . CONF_EXT)) {
|
||||||
// 导入路由配置
|
// 导入路由配置
|
||||||
$rules = include CONF_PATH . $file . CONF_EXT;
|
$rules = include CONF_PATH . $file . CONF_EXT;
|
||||||
if (is_array($rules)) {
|
is_array($rules) && Route::import($rules);
|
||||||
Route::import($rules);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -564,15 +645,18 @@ class App
|
|||||||
// 路由检测(根据路由定义返回不同的URL调度)
|
// 路由检测(根据路由定义返回不同的URL调度)
|
||||||
$result = Route::check($request, $path, $depr, $config['url_domain_deploy']);
|
$result = Route::check($request, $path, $depr, $config['url_domain_deploy']);
|
||||||
$must = !is_null(self::$routeMust) ? self::$routeMust : $config['url_route_must'];
|
$must = !is_null(self::$routeMust) ? self::$routeMust : $config['url_route_must'];
|
||||||
|
|
||||||
if ($must && false === $result) {
|
if ($must && false === $result) {
|
||||||
// 路由无效
|
// 路由无效
|
||||||
throw new RouteNotFoundException();
|
throw new RouteNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 路由无效 解析模块/控制器/操作/参数... 支持控制器自动搜索
|
||||||
if (false === $result) {
|
if (false === $result) {
|
||||||
// 路由无效 解析模块/控制器/操作/参数... 支持控制器自动搜索
|
|
||||||
$result = Route::parseUrl($path, $depr, $config['controller_auto_search']);
|
$result = Route::parseUrl($path, $depr, $config['controller_auto_search']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
update.sql
16
update.sql
@ -125,4 +125,18 @@ ALTER TABLE `eb_store_combination` CHANGE COLUMN `mer_use` `mer_use`TINYINT(1) U
|
|||||||
ALTER TABLE `eb_store_product_reply` CHANGE COLUMN `merchant_reply_content` `merchant_reply_content` VARCHAR(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '管理员回复内容';
|
ALTER TABLE `eb_store_product_reply` CHANGE COLUMN `merchant_reply_content` `merchant_reply_content` VARCHAR(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '管理员回复内容';
|
||||||
ALTER TABLE `eb_store_product_reply` CHANGE COLUMN `merchant_reply_time` `merchant_reply_time` INT(11) NULL COMMENT '管理员回复时间';
|
ALTER TABLE `eb_store_product_reply` CHANGE COLUMN `merchant_reply_time` `merchant_reply_time` INT(11) NULL COMMENT '管理员回复时间';
|
||||||
ALTER TABLE `eb_store_cart` CHANGE COLUMN `combination_id` `combination_id` INT(11) UNSIGNED NULL DEFAULT '0' COMMENT '拼团id';
|
ALTER TABLE `eb_store_cart` CHANGE COLUMN `combination_id` `combination_id` INT(11) UNSIGNED NULL DEFAULT '0' COMMENT '拼团id';
|
||||||
ALTER TABLE `eb_store_order` CHANGE COLUMN `combination_id` `combination_id` int(11) UNSIGNED DEFAULT '0' COMMENT '拼团产品id0一般产品';
|
ALTER TABLE `eb_store_order` CHANGE COLUMN `combination_id` `combination_id` int(11) UNSIGNED DEFAULT '0' COMMENT '拼团产品id0一般产品';
|
||||||
|
|
||||||
|
--海报表新增
|
||||||
|
DROP TABLE IF EXISTS `eb_routine_qrcode`;
|
||||||
|
CREATE TABLE `eb_routine_qrcode` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '微信二维码ID',
|
||||||
|
`third_type` varchar(32) NOT NULL COMMENT '二维码类型 spread(用户推广) product_spread(产品推广)',
|
||||||
|
`third_id` int(11) unsigned NOT NULL COMMENT '用户id',
|
||||||
|
`status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态 0不可用 1可用',
|
||||||
|
`add_time` varchar(255) DEFAULT NULL COMMENT '添加时间',
|
||||||
|
`page` varchar(255) DEFAULT NULL COMMENT '小程序页面路径带参数',
|
||||||
|
`qrcode_url` varchar(255) DEFAULT NULL COMMENT '小程序二维码路径',
|
||||||
|
`url_time` int(11) unsigned DEFAULT NULL COMMENT '二维码添加时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COMMENT='小程序二维码管理表';
|
||||||
BIN
view/crmebN/images/poster-close.png
Normal file
BIN
view/crmebN/images/poster-close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
view/crmebN/images/posterbackgd.png
Normal file
BIN
view/crmebN/images/posterbackgd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@ -1,7 +1,8 @@
|
|||||||
<form>
|
<form>
|
||||||
<view class='head flex'>
|
<view class='head flex'>
|
||||||
<view class='txt'>购物数量({{cartNum}})</view>
|
<view class='txt'>购物数量({{cartNum}})</view>
|
||||||
<view class='btn' bindtap='btntap'>管理</view>
|
<view class='btn' bindtap='btntap' wx:if='{{!foothidden}}'>管理</view>
|
||||||
|
<view class='btn' bindtap='btntap' wx:if='{{foothidden}}'>取消</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='car-list'>
|
<view class='car-list'>
|
||||||
<block wx:for="{{cartList}}" wx:key>
|
<block wx:for="{{cartList}}" wx:key>
|
||||||
|
|||||||
@ -46,9 +46,15 @@ Page({
|
|||||||
url: app.globalData.openPages
|
url: app.globalData.openPages
|
||||||
})
|
})
|
||||||
} else {//跳转到首页
|
} else {//跳转到首页
|
||||||
wx.reLaunch({
|
if(res.data.data.page){
|
||||||
url: '/pages/index/index'
|
wx.navigateTo({
|
||||||
})
|
url: res.data.data.page
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
wx.reLaunch({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
<view class='miao-list'>
|
<view class='miao-list'>
|
||||||
<view class='header'>
|
<view class='header'>
|
||||||
<block wx:for="{{lovely}}">
|
<image src='{{url}}{{lovely.img}}'></image>
|
||||||
<image wx:if="{{index == 1}}" src='{{url}}{{item.img}}' ></image>
|
|
||||||
</block>
|
|
||||||
</view>
|
</view>
|
||||||
<view class='list-ul'>
|
<view class='list-ul'>
|
||||||
<block wx:for="{{Arraylist}}" wx:index="{{item}}">
|
<block wx:for="{{Arraylist}}" wx:index="{{item}}">
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,7 @@
|
|||||||
<view class='count-wrapper flex'>
|
<view class='count-wrapper flex'>
|
||||||
<view>原价:¥{{storeInfo.ot_price}}</view>
|
<view>原价:¥{{storeInfo.ot_price}}</view>
|
||||||
<view>库存:{{storeInfo.stock}}{{storeInfo.unit_name}}</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>
|
</view>
|
||||||
<view class='block-bar' bindtap='goCoupon'>
|
<view class='block-bar' bindtap='goCoupon'>
|
||||||
@ -78,10 +78,10 @@
|
|||||||
<view class='txt-msg'>{{reply.comment}}</view>
|
<view class='txt-msg'>{{reply.comment}}</view>
|
||||||
<view class='time-bar'>{{reply.add_time}}</view>
|
<view class='time-bar'>{{reply.add_time}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{reply.merchant_reply_content != null}}">
|
<view>
|
||||||
<view></view>
|
<view>管理员回复:</view>
|
||||||
<view class='time-bar'>回复:{{reply.merchant_reply_time}}</view>
|
<view class='txt-msg'>{{reply.merchant_reply_content}}</view>
|
||||||
<view class='txt-msg'>{{reply.merchant_reply_content}}</view>
|
<view class='time-bar'>{{reply.merchant_reply_time}}</view>
|
||||||
</view>
|
</view>
|
||||||
<navigator wx:if="{{replyCount > 0}}" hover-class="none" url="/pages/comment/comment?productId={{storeInfo.id}}">查看全部评价</navigator>
|
<navigator wx:if="{{replyCount > 0}}" hover-class="none" url="/pages/comment/comment?productId={{storeInfo.id}}">查看全部评价</navigator>
|
||||||
</view>
|
</view>
|
||||||
@ -116,6 +116,13 @@
|
|||||||
<view class='payment-btn' bindtap='goOrder'>确认下单</view>
|
<view class='payment-btn' bindtap='goOrder'>确认下单</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class='poster-pop' wx:if="{{posterImageStatus}}">
|
||||||
|
<image src='/images/poster-close.png' class='close' bindtap='posterImageClose'></image>
|
||||||
|
<image src='{{posterImage}}'></image>
|
||||||
|
<view class='save-poster' bindtap='savePosterPath'>保存到手机</view>
|
||||||
|
</view>
|
||||||
|
<view class='mask' wx:if="{{posterImageStatus}}"></view>
|
||||||
|
<canvas class="canvas" canvas-id='myCanvas' wx:if="{{canvasStatus}}"></canvas>
|
||||||
<include src="/pages/home/home.wxml"/>
|
<include src="/pages/home/home.wxml"/>
|
||||||
<include src="/pages/foo-tan/foo-tan.wxml"/>
|
<include src="/pages/foo-tan/foo-tan.wxml"/>
|
||||||
<import src="/wxParse/wxParse.wxml"/>
|
<import src="/wxParse/wxParse.wxml"/>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -26,6 +26,7 @@ Page({
|
|||||||
sid:'',
|
sid:'',
|
||||||
price:'',
|
price:'',
|
||||||
sales:'',
|
sales:'',
|
||||||
|
ficti: '',
|
||||||
t:1,
|
t:1,
|
||||||
sortyi:[],
|
sortyi:[],
|
||||||
offset: 0,
|
offset: 0,
|
||||||
@ -253,7 +254,7 @@ Page({
|
|||||||
var n = t + 1;
|
var n = t + 1;
|
||||||
if (n%2>0) salesOrder = 'asc';
|
if (n%2>0) salesOrder = 'asc';
|
||||||
else salesOrder='desc';
|
else salesOrder='desc';
|
||||||
that.setData({ sales: salesOrder, t: n, })
|
that.setData({ ficti: salesOrder, t: n, })
|
||||||
that.getProductList();
|
that.getProductList();
|
||||||
},
|
},
|
||||||
navactive2: function (e) {
|
navactive2: function (e) {
|
||||||
@ -554,7 +555,7 @@ Page({
|
|||||||
var cid = that.data.cid;
|
var cid = that.data.cid;
|
||||||
var limit = 20;
|
var limit = 20;
|
||||||
var priceOrder = that.data.price;
|
var priceOrder = that.data.price;
|
||||||
var salesOrder = that.data.sales;
|
var salesOrder = that.data.ficti;
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
var startpage = limit * offset;
|
var startpage = limit * offset;
|
||||||
wx.request({
|
wx.request({
|
||||||
@ -596,7 +597,7 @@ Page({
|
|||||||
var cid = that.data.cid;
|
var cid = that.data.cid;
|
||||||
var limit = 20;
|
var limit = 20;
|
||||||
var priceOrder = that.data.price;
|
var priceOrder = that.data.price;
|
||||||
var salesOrder = that.data.sales;
|
var salesOrder = that.data.ficti;
|
||||||
var offset = that.data.offset;
|
var offset = that.data.offset;
|
||||||
var startpage = limit * offset;
|
var startpage = limit * offset;
|
||||||
var header = {
|
var header = {
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
<view class='list-text {{_num==1?"list-text2":""}}'>{{item.store_name}}</view>
|
<view class='list-text {{_num==1?"list-text2":""}}'>{{item.store_name}}</view>
|
||||||
<view class='list-money flex'>
|
<view class='list-money flex'>
|
||||||
<view>
|
<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 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>
|
||||||
<view class='iconfont icon-102 list-gwc {{_num==1?"list-gwc2":""}}' data-id="{{item.id}}" bindtap='cart' ></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