diff --git a/application/admin/common.php b/application/admin/common.php index 90f292c1..3c137dcf 100644 --- a/application/admin/common.php +++ b/application/admin/common.php @@ -10,50 +10,7 @@ // +---------------------------------------------------------------------- // 应用公共文件 -/** - * 获取用户名称 - * @param $uid - * @return mixed - */ -function getUserNickname($uid){ - return \app\admin\model\user\User::where('uid',$uid)->value('nickname'); -} -/** - * 获取产品名称 - * @param $id - * @return mixed - */ -function getProductName($id){ - return \app\admin\model\store\StoreProduct::where('id',$id)->value('store_name'); -} - -/** - * 获取拼团名称 - * @param $id - * @return mixed - */ -function getCombinationTitle($id){ - return \app\admin\model\store\StoreCombination::where('id',$id)->value('title'); -} - -/** - * 获取订单编号 - * @param $id - */ -function getOrderId($id){ - return \app\admin\model\order\StoreOrder::where('id',$id)->value('order_id'); -} - - -/** - * 根据用户uid获取订单数 - * @param $uid - * @return int|string - */ -function getOrderCount($uid){ - return \app\admin\model\order\StoreOrder::where('uid',$uid)->where('paid',1)->where('refund_status',0)->where('status',2)->count(); -} /** * 格式化属性 * @param $arr @@ -98,6 +55,12 @@ function attrFormat($arr){ return [$data,$res]; } +/** + * 格式化月份 + * @param string $time + * @param int $ceil + * @return array + */ function getMonth($time='',$ceil=0){ if(empty($time)){ $firstday = date("Y-m-01",time()); @@ -118,3 +81,24 @@ function getMonth($time='',$ceil=0){ } return array($firstday,$lastday); } +/**删除目录下所有文件 + * @param $path 目录或者文件路径 + * @param string $ext + * @return bool + */ +function clearfile($path,$ext = '*.log') +{ + $files = (array) glob($path.DS.'*'); + foreach ($files as $path) { + if (is_dir($path)) { + $matches = glob($path . '/'.$ext); + if (is_array($matches)) { + array_map('unlink', $matches); + } + rmdir($path); + } else { + unlink($path); + } + } + return true; +} diff --git a/application/admin/controller/agent/AgentManage.php b/application/admin/controller/agent/AgentManage.php index 39a6ba02..4b205292 100644 --- a/application/admin/controller/agent/AgentManage.php +++ b/application/admin/controller/agent/AgentManage.php @@ -3,6 +3,7 @@ namespace app\admin\controller\agent; use app\admin\controller\AuthController; +use app\admin\model\order\StoreOrder; use app\admin\model\user\User; use app\admin\model\wechat\WechatUser as UserModel; use app\admin\library\FormBuilder; @@ -74,6 +75,7 @@ class AgentManage extends AuthController ->order('u.add_time DESC') ->select() ->toArray(); + foreach ($list as $key=>$value) $list[$key]['orderCount'] = StoreOrder::getOrderCount($value['uid']); $this->assign('list',$list); return $this->fetch(); } diff --git a/application/admin/controller/article/Article.php b/application/admin/controller/article/Article.php index c14c6898..49051bde 100644 --- a/application/admin/controller/article/Article.php +++ b/application/admin/controller/article/Article.php @@ -4,6 +4,7 @@ namespace app\admin\controller\article; use app\admin\controller\AuthController; use service\UtilService as Util; +use service\PHPTreeService as Phptree; use service\JsonService as Json; use service\UploadService as Upload; use think\Request; @@ -22,18 +23,24 @@ class Article extends AuthController * 显示后台管理员添加的图文 * @return mixed */ - public function index($cid = 0) + public function index($pid = 0) { $where = Util::getMore([ - ['title',''] + ['title',''], + ['cid',''] ],$this->request); - if($cid) - $where['cid'] = $cid; - else - $where['cid'] = ''; + $pid = $this->request->param('pid'); $this->assign('where',$where); $where['merchant'] = 0;//区分是管理员添加的图文显示 0 还是 商户添加的图文显示 1 - $this->assign('cid',$cid); + $catlist = ArticleCategoryModel::where('is_del',0)->select()->toArray(); + //获取分类列表 + $tree = Phptree::makeTreeForHtml($catlist); + $this->assign(compact('tree')); + if($pid){ + $pids = Util::getChildrenPid($tree,$pid); + $where['cid'] = ltrim($pid.$pids); + } + $this->assign('cate',ArticleCategoryModel::getTierList()); $this->assign(ArticleModel::getAll($where)); return $this->fetch(); @@ -121,8 +128,6 @@ class Article extends AuthController 'synopsis', 'share_title', 'share_synopsis', - 'is_banner', - 'is_hot', ['visit',0], ['sort',0], 'url', diff --git a/application/admin/controller/wechat/WechatUser.php b/application/admin/controller/wechat/WechatUser.php index 59b3bd2a..bc1a1df3 100644 --- a/application/admin/controller/wechat/WechatUser.php +++ b/application/admin/controller/wechat/WechatUser.php @@ -1 +1 @@ -request); $tagidList = explode(',',$where['tagid_list']); foreach ($tagidList as $k=>$v){ if(!$v){ unset($tagidList[$k]); } } $tagidList = array_unique($tagidList); $where['tagid_list'] = implode(',',$tagidList); $this->assign([ 'where'=>$where, 'groupList'=>UserModel::getUserGroup(), 'tagList'=>UserModel::getUserTag() ]); $limitTimeList = [ 'today'=>implode(' - ',[date('Y/m/d'),date('Y/m/d',strtotime('+1 day'))]), 'week'=>implode(' - ',[ date('Y/m/d', (time() - ((date('w') == 0 ? 7 : date('w')) - 1) * 24 * 3600)), date('Y-m-d', (time() + (7 - (date('w') == 0 ? 7 : date('w'))) * 24 * 3600)) ]), 'month'=>implode(' - ',[date('Y/m').'/01',date('Y/m').'/'.date('t')]), 'quarter'=>implode(' - ',[ date('Y').'/'.(ceil((date('n'))/3)*3-3+1).'/01', date('Y').'/'.(ceil((date('n'))/3)*3).'/'.date('t',mktime(0,0,0,(ceil((date('n'))/3)*3),1,date('Y'))) ]), 'year'=>implode(' - ',[ date('Y').'/01/01',date('Y/m/d',strtotime(date('Y').'/01/01 + 1year -1 day')) ]) ]; $uidAll = UserModel::getAll($where); $this->assign(compact('limitTimeList','uidAll')); $this->assign(UserModel::systemPage($where,true)); return $this->fetch(); } public function edit_user_tag($openid) { if(!$openid) return JsonService::fail('参数错误!'); $list = Collection::make(UserModel::getUserTag())->each(function($item){ return ['value'=>$item['id'],'label'=>$item['name']]; }); $tagList = UserModel::where('openid',$openid)->value('tagid_list'); $tagList = explode(',',$tagList)?:[]; $f = [Form::select('tag_id','用户标签',$tagList)->setOptions($list->toArray())->multiple(1)]; $form = Form::make_post_form('标签名称',$f,Url::build('update_user_tag',compact('openid'))); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } public function update_user_tag(Request $request,$openid) { if(!$openid) return JsonService::fail('参数错误!'); $tagId = $request->post('tag_id/a',[]); if(!$tagId) return JsonService::fail('请选择用户标签!'); $tagList = explode(',',UserModel::where('openid',$openid)->value('tagid_list'))?:[]; UserModel::beginTrans(); if(!$tagId[0])unset($tagId[0]); UserModel::edit(['tagid_list'=>$tagId],$openid,'openid'); try{ foreach ($tagList as $tag){ if($tag) WechatService::userTagService()->batchUntagUsers([$openid],$tag); } foreach ($tagId as $tag){ WechatService::userTagService()->batchTagUsers([$openid],$tag); } }catch (\Exception $e){ UserModel::rollbackTrans(); return JsonService::fail($e->getMessage()); } UserModel::commitTrans(); return JsonService::successful('修改成功!'); } public function edit_user_group($openid) { if(!$openid) return JsonService::fail('参数错误!'); $list = Collection::make(UserModel::getUserGroup())->each(function($item){ return ['value'=>$item['id'],'label'=>$item['name']]; }); $groupId = UserModel::where('openid',$openid)->value('groupid'); $f = [Form::select('tag_id','用户标签',(string)$groupId)->setOptions($list->toArray())]; $form = Form::make_post_form('标签名称',$f,Url::build('update_user_group',compact('openid'))); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } public function update_user_group(Request $request,$openid) { if(!$openid) return JsonService::fail('参数错误!'); $groupId = $request->post('group_id'); if(!$groupId) return JsonService::fail('请选择用户分组!'); UserModel::beginTrans(); UserModel::edit(['groupid'=>$groupId],$openid,'openid'); try{ WechatService::userGroupService()->moveUser($openid,$groupId); }catch (\Exception $e){ UserModel::rollbackTrans(); return JsonService::fail($e->getMessage()); } UserModel::commitTrans(); return JsonService::successful('修改成功!'); } /** * 用户标签列表 */ public function tag($refresh = 0) { if($refresh == 1) { UserModel::clearUserTag(); $this->redirect(Url::build('tag')); } $list = UserModel::getUserTag(); $this->assign(compact('list')); return $this->fetch(); } /** * 添加标签 * @return mixed */ public function create_tag() { $f = [Form::input('name','标签名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('save_tag')); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 添加 * @param Request $request * @return \think\response\Json */ public function save_tag(Request $request) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入标签名称!'); try{ WechatService::userTagService()->create($tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserTag(); return JsonService::successful('添加标签成功!'); } /** * 修改标签 * @param $id * @return mixed */ public function edit_tag($id) { $f = [Form::input('name','标签名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('update_tag',['id'=>$id])); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 修改标签 * @param Request $request * @param $id * @return \think\response\Json */ public function update_tag(Request $request, $id) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入标签名称!'); try{ WechatService::userTagService()->update($id,$tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserTag(); return JsonService::successful('修改标签成功!'); } /** * 删除标签 * @param $id * @return \think\response\Json */ public function delete_tag($id) { try{ WechatService::userTagService()->delete($id); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserTag(); return JsonService::successful('删除标签成功!'); } /** * 用户分组列表 */ public function group($refresh = 0) { if($refresh == 1) { UserModel::clearUserGroup(); $this->redirect(Url::build('group')); } $list = UserModel::getUserGroup(); $this->assign(compact('list')); return $this->fetch(); } /** * 添加分组 * @return mixed */ public function create_group() { $f = [Form::input('name','分组名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('save_group')); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 添加 * @param Request $request * @return \think\response\Json */ public function save_group(Request $request) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入分组名称!'); try{ WechatService::userGroupService()->create($tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserGroup(); return JsonService::successful('添加分组成功!'); } /** * 修改分组 * @param $id * @return mixed */ public function edit_group($id) { $f = [Form::input('name','分组名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('update_group',compact('id'))); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 修改分组 * @param Request $request * @param $id * @return \think\response\Json */ public function update_group(Request $request, $id) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入分组名称!'); try{ WechatService::userGroupService()->update($id,$tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserGroup(); return JsonService::successful('修改分组成功!'); } /** * 删除分组 * @param $id * @return \think\response\Json */ public function delete_group($id) { try{ WechatService::userTagService()->delete($id); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserGroup(); return JsonService::successful('删除分组成功!'); } public function synchro_tag($openid){ if(!$openid) return JsonService::fail('参数错误!'); $data = array(); if(UserModel::be($openid,'openid')){ try{ $tag = WechatService::userTagService()->userTags($openid)->toArray(); }catch (\Exception $e) { return JsonService::fail($e->getMessage()); } if($tag['tagid_list']) $data['tagid_list'] = implode(',',$tag['tagid_list']); else $data['tagid_list'] = ''; $res = UserModel::edit($data,$openid,'openid'); if($res) return JsonService::successful('同步成功'); else return JsonService::fail('同步失败!'); }else return JsonService::fail('参数错误!'); } /** * 一级推荐人页面 * @return mixed */ public function stair($uid = ''){ if($uid == '') return $this->failed('参数错误'); $list = User::alias('u') ->where('u.spread_uid',$uid) ->field('u.avatar,u.nickname,u.now_money,u.add_time,u.uid') ->where('u.status',1) ->order('u.add_time DESC') ->select() ->toArray(); $this->assign('list',$list); return $this->fetch(); } /** * 个人资金详情页面 * @return mixed */ public function now_money($uid = ''){ if($uid == '') return $this->failed('参数错误'); $list = UserBill::where('uid',$uid)->where('category','now_money') ->field('mark,pm,number,add_time') ->where('status',1)->order('add_time DESC')->select()->toArray(); foreach ($list as &$v){ $v['add_time'] = date('Y-m-d H:i:s',$v['add_time']); } $this->assign('list',$list); return $this->fetch(); } } \ No newline at end of file +request); $tagidList = explode(',',$where['tagid_list']); foreach ($tagidList as $k=>$v){ if(!$v){ unset($tagidList[$k]); } } $tagidList = array_unique($tagidList); $where['tagid_list'] = implode(',',$tagidList); $this->assign([ 'where'=>$where, 'groupList'=>UserModel::getUserGroup(), 'tagList'=>UserModel::getUserTag() ]); $limitTimeList = [ 'today'=>implode(' - ',[date('Y/m/d'),date('Y/m/d',strtotime('+1 day'))]), 'week'=>implode(' - ',[ date('Y/m/d', (time() - ((date('w') == 0 ? 7 : date('w')) - 1) * 24 * 3600)), date('Y-m-d', (time() + (7 - (date('w') == 0 ? 7 : date('w'))) * 24 * 3600)) ]), 'month'=>implode(' - ',[date('Y/m').'/01',date('Y/m').'/'.date('t')]), 'quarter'=>implode(' - ',[ date('Y').'/'.(ceil((date('n'))/3)*3-3+1).'/01', date('Y').'/'.(ceil((date('n'))/3)*3).'/'.date('t',mktime(0,0,0,(ceil((date('n'))/3)*3),1,date('Y'))) ]), 'year'=>implode(' - ',[ date('Y').'/01/01',date('Y/m/d',strtotime(date('Y').'/01/01 + 1year -1 day')) ]) ]; $uidAll = UserModel::getAll($where); $this->assign(compact('limitTimeList','uidAll')); $this->assign(UserModel::systemPage($where)); return $this->fetch(); } public function edit_user_tag($openid) { if(!$openid) return JsonService::fail('参数错误!'); $list = Collection::make(UserModel::getUserTag())->each(function($item){ return ['value'=>$item['id'],'label'=>$item['name']]; }); $tagList = UserModel::where('openid',$openid)->value('tagid_list'); $tagList = explode(',',$tagList)?:[]; $f = [Form::select('tag_id','用户标签',$tagList)->setOptions($list->toArray())->multiple(1)]; $form = Form::make_post_form('标签名称',$f,Url::build('update_user_tag',compact('openid'))); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } public function update_user_tag(Request $request,$openid) { if(!$openid) return JsonService::fail('参数错误!'); $tagId = $request->post('tag_id/a',[]); if(!$tagId) return JsonService::fail('请选择用户标签!'); $tagList = explode(',',UserModel::where('openid',$openid)->value('tagid_list'))?:[]; UserModel::beginTrans(); if(!$tagId[0])unset($tagId[0]); UserModel::edit(['tagid_list'=>$tagId],$openid,'openid'); try{ foreach ($tagList as $tag){ if($tag) WechatService::userTagService()->batchUntagUsers([$openid],$tag); } foreach ($tagId as $tag){ WechatService::userTagService()->batchTagUsers([$openid],$tag); } }catch (\Exception $e){ UserModel::rollbackTrans(); return JsonService::fail($e->getMessage()); } UserModel::commitTrans(); return JsonService::successful('修改成功!'); } public function edit_user_group($openid) { if(!$openid) return JsonService::fail('参数错误!'); $list = Collection::make(UserModel::getUserGroup())->each(function($item){ return ['value'=>$item['id'],'label'=>$item['name']]; }); $groupId = UserModel::where('openid',$openid)->value('groupid'); $f = [Form::select('tag_id','用户标签',(string)$groupId)->setOptions($list->toArray())]; $form = Form::make_post_form('标签名称',$f,Url::build('update_user_group',compact('openid'))); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } public function update_user_group(Request $request,$openid) { if(!$openid) return JsonService::fail('参数错误!'); $groupId = $request->post('group_id'); if(!$groupId) return JsonService::fail('请选择用户分组!'); UserModel::beginTrans(); UserModel::edit(['groupid'=>$groupId],$openid,'openid'); try{ WechatService::userGroupService()->moveUser($openid,$groupId); }catch (\Exception $e){ UserModel::rollbackTrans(); return JsonService::fail($e->getMessage()); } UserModel::commitTrans(); return JsonService::successful('修改成功!'); } /** * 用户标签列表 */ public function tag($refresh = 0) { if($refresh == 1) { UserModel::clearUserTag(); $this->redirect(Url::build('tag')); } $list = UserModel::getUserTag(); $this->assign(compact('list')); return $this->fetch(); } /** * 添加标签 * @return mixed */ public function create_tag() { $f = [Form::input('name','标签名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('save_tag')); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 添加 * @param Request $request * @return \think\response\Json */ public function save_tag(Request $request) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入标签名称!'); try{ WechatService::userTagService()->create($tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserTag(); return JsonService::successful('添加标签成功!'); } /** * 修改标签 * @param $id * @return mixed */ public function edit_tag($id) { $f = [Form::input('name','标签名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('update_tag',['id'=>$id])); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 修改标签 * @param Request $request * @param $id * @return \think\response\Json */ public function update_tag(Request $request, $id) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入标签名称!'); try{ WechatService::userTagService()->update($id,$tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserTag(); return JsonService::successful('修改标签成功!'); } /** * 删除标签 * @param $id * @return \think\response\Json */ public function delete_tag($id) { try{ WechatService::userTagService()->delete($id); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserTag(); return JsonService::successful('删除标签成功!'); } /** * 用户分组列表 */ public function group($refresh = 0) { if($refresh == 1) { UserModel::clearUserGroup(); $this->redirect(Url::build('group')); } $list = UserModel::getUserGroup(); $this->assign(compact('list')); return $this->fetch(); } /** * 添加分组 * @return mixed */ public function create_group() { $f = [Form::input('name','分组名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('save_group')); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 添加 * @param Request $request * @return \think\response\Json */ public function save_group(Request $request) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入分组名称!'); try{ WechatService::userGroupService()->create($tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserGroup(); return JsonService::successful('添加分组成功!'); } /** * 修改分组 * @param $id * @return mixed */ public function edit_group($id) { $f = [Form::input('name','分组名称')]; $form = Form::make_post_form('标签名称',$f,Url::build('update_group',compact('id'))); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /** * 修改分组 * @param Request $request * @param $id * @return \think\response\Json */ public function update_group(Request $request, $id) { $tagName = $request->post('name'); if(!$tagName) return JsonService::fail('请输入分组名称!'); try{ WechatService::userGroupService()->update($id,$tagName); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserGroup(); return JsonService::successful('修改分组成功!'); } /** * 删除分组 * @param $id * @return \think\response\Json */ public function delete_group($id) { try{ WechatService::userTagService()->delete($id); }catch (\Exception $e){ return JsonService::fail($e->getMessage()); } UserModel::clearUserGroup(); return JsonService::successful('删除分组成功!'); } public function synchro_tag($openid){ if(!$openid) return JsonService::fail('参数错误!'); $data = array(); if(UserModel::be($openid,'openid')){ try{ $tag = WechatService::userTagService()->userTags($openid)->toArray(); }catch (\Exception $e) { return JsonService::fail($e->getMessage()); } if($tag['tagid_list']) $data['tagid_list'] = implode(',',$tag['tagid_list']); else $data['tagid_list'] = ''; $res = UserModel::edit($data,$openid,'openid'); if($res) return JsonService::successful('同步成功'); else return JsonService::fail('同步失败!'); }else return JsonService::fail('参数错误!'); } /** * 一级推荐人页面 * @return mixed */ public function stair($uid = ''){ if($uid == '') return $this->failed('参数错误'); $list = User::alias('u') ->where('u.spread_uid',$uid) ->field('u.avatar,u.nickname,u.now_money,u.add_time,u.uid') ->where('u.status',1) ->order('u.add_time DESC') ->select() ->toArray(); foreach ($list as $key=>$value) $list[$key]['orderCount'] = StoreOrder::getOrderCount($value['uid']); $this->assign('list',$list); return $this->fetch(); } /** * 个人资金详情页面 * @return mixed */ public function now_money($uid = ''){ if($uid == '') return $this->failed('参数错误'); $list = UserBill::where('uid',$uid)->where('category','now_money') ->field('mark,pm,number,add_time') ->where('status',1)->order('add_time DESC')->select()->toArray(); foreach ($list as &$v){ $v['add_time'] = date('Y-m-d H:i:s',$v['add_time']); } $this->assign('list',$list); return $this->fetch(); } } \ No newline at end of file diff --git a/application/admin/model/order/StoreOrder.php b/application/admin/model/order/StoreOrder.php index d1d53c78..a341e19c 100644 --- a/application/admin/model/order/StoreOrder.php +++ b/application/admin/model/order/StoreOrder.php @@ -26,11 +26,168 @@ class StoreOrder extends ModelBasic { use ModelTrait; + public static function orderCount(){ + $data['wz']=self::statusByWhere(0,new self())->count(); + $data['wf']=self::statusByWhere(1,new self())->count(); + $data['ds']=self::statusByWhere(2,new self())->count(); + $data['dp']=self::statusByWhere(3,new self())->count(); + $data['jy']=self::statusByWhere(4,new self())->count(); + $data['tk']=self::statusByWhere(-1,new self())->count(); + $data['yt']=self::statusByWhere(-2,new self())->count(); + $data['general']=self::where(['pink_id'=>0,'combination_id'=>0,'seckill_id'=>0])->count(); + $data['pink']=self::where('pink_id|combination_id','neq',0)->count(); + $data['seckill']=self::where('seckill_id','neq',0)->count(); + return $data; + } + + public static function OrderList($where){ + $model = self::getOrderWhere($where,self::alias('a')->join('user r','r.uid=a.uid','LEFT'),'a.','r')->field('a.*,r.nickname'); + if($where['order']!=''){ + $model = $model->order(self::setOrder($where['order'])); + }else{ + $model = $model->order('a.id desc'); + } + $data=($data=$model->page((int)$where['page'],(int)$where['limit'])->select()) && count($data) ? $data->toArray() : []; + foreach ($data as &$item){ + $_info = db('store_order_cart_info')->where('oid',$item['id'])->field('cart_info')->select(); + foreach ($_info as $k=>$v){ + $_info[$k]['cart_info'] = json_decode($v['cart_info'],true); + } + $item['_info'] = $_info; + if($item['pink_id'] && $item['combination_id']){ + $pinkStatus = StorePink::where('order_id_key',$item['id'])->value('status'); + switch ($pinkStatus){ + case 1: + $item['pink_name'] = '[拼团订单]正在进行中'; + $item['color'] = '#f00'; + break; + case 2: + $item['pink_name'] = '[拼团订单]已完成'; + $item['color'] = '#00f'; + break; + case 3: + $item['pink_name'] = '[拼团订单]未完成'; + $item['color'] = '#f0f'; + break; + default: + $item['pink_name'] = '[拼团订单]历史订单'; + $item['color'] = '#457856'; + break; + } + }else{ + if($item['seckill_id']){ + $item['pink_name'] = '[秒杀订单]'; + $item['color'] = '#32c5e9'; + }else{ + $item['pink_name'] = '[普通订单]'; + $item['color'] = '#895612'; + } + } + if($item['paid']==1){ + switch ($item['pay_type']){ + case 'weixin': + $item['pay_type_name']='微信支付'; + break; + case 'yue': + $item['pay_type_name']='微信支付'; + break; + case 'offline': + $item['pay_type_name']='线下支付'; + break; + default: + $item['pay_type_name']='其他支付'; + break; + } + }else{ + switch ($item['pay_type']){ + default: + $item['pay_type_name']='未支付'; + break; + case 'offline': + $item['pay_type_name']='线下支付'; + $item['pay_type_info']=1; + break; + } + } + if($item['paid']==0 && $item['status']==0){ + $item['status_name']='未支付'; + }else if($item['paid']==1 && $item['status']==0 && $item['refund_status']==0){ + $item['status_name']='未发货'; + }else if($item['paid']==1 && $item['status']==1 && $item['refund_status']==0){ + $item['status_name']='待收货'; + }else if($item['paid']==1 && $item['status']==2 && $item['refund_status']==0){ + $item['status_name']='待评价'; + }else if($item['paid']==1 && $item['status']==3 && $item['refund_status']==0){ + $item['status_name']='待评价'; + }else if($item['paid']==1 && $item['refund_status']==1){ + $item['status_name']=<<申请退款
+退款原因:{$item['refund_reason_wap']} +HTML; + }else if($item['paid']==1 && $item['refund_status']==2){ + $item['status_name']='已退款'; + } + if($item['paid']==0 && $item['status']==0 && $item['refund_status']==0){ + $item['_status']=1; + }else if($item['paid']==1 && $item['status']==0 && $item['refund_status']==0){ + $item['_status']=2; + }else if($item['paid']==1 && $item['refund_status']==1){ + $item['_status']=3; + }else if($item['paid']==1 && $item['status']==1 && $item['refund_status']==0){ + $item['_status']=4; + }else if($item['paid']==1 && $item['status']==2 && $item['refund_status']==0){ + $item['_status']=5; + }else if($item['paid']==1 && $item['status']==3 && $item['refund_status']==0){ + $item['_status']=6; + }else if($item['paid']==1 && $item['refund_status']==2){ + $item['_status']=7; + } + } + if(isset($where['excel']) && $where['excel']==1){ + self::SaveExcel($data); + } + $count=self::getOrderWhere($where,self::alias('a')->join('user r','r.uid=a.uid','LEFT'),'a.','r')->count(); + return compact('count','data'); + } + /* + * 保存并下载excel + * $list array + * return + */ + public static function SaveExcel($list){ + $export = []; + foreach ($list as $index=>$item){ + $_info = db('store_order_cart_info')->where('oid',$item['id'])->column('cart_info'); + $goodsName = []; + foreach ($_info as $k=>$v){ + $v = json_decode($v,true); + $goodsName[] = implode( + [$v['productInfo']['store_name'], + isset($v['productInfo']['attrInfo']) ? '('.$v['productInfo']['attrInfo']['suk'].')' : '', + "[{$v['cart_num']} * {$v['truePrice']}]" + ],' '); + } + $item['cartInfo'] = $_info; + $export[] = [ + $item['order_id'],$item['pay_type_name'], + $item['total_num'],$item['total_price'],$item['total_postage'],$item['pay_price'],$item['refund_price'], + $item['mark'],$item['remark'], + [$item['real_name'],$item['user_phone'],$item['user_address']], + $goodsName, + [$item['paid'] == 1? '已支付':'未支付','支付时间: '.($item['pay_time'] > 0 ? date('Y/md H:i',$item['pay_time']) : '暂无')] + ]; + } + PHPExcelService::setExcelHeader(['订单号','支付方式','商品总数','商品总价','邮费','支付金额','退款金额','用户备注','管理员备注','收货人信息','商品信息','支付状态']) + ->setExcelTile('订单导出','订单信息'.time(),' 生成时间:'.date('Y-m-d H:i:s',time())) + ->setExcelContent($export) + ->ExcelSave(); + } + /** * @param $where * @return array */ - public static function systemPage($where,$userid){ + public static function systemPage($where,$userid=false){ $model = self::getOrderWhere($where,self::alias('a')->join('user r','r.uid=a.uid','LEFT'),'a.','r')->field('a.*,r.nickname'); if($where['order']){ $model = $model->order('a.'.$where['order']); @@ -80,7 +237,6 @@ class StoreOrder extends ModelBasic ->ExcelSave(); } return self::page($model,function ($item){ - $item['nickname'] = WechatUser::where('uid',$item['uid'])->value('nickname'); $_info = db('store_order_cart_info')->where('oid',$item['id'])->field('cart_info')->select(); foreach ($_info as $k=>$v){ $_info[$k]['cart_info'] = json_decode($v['cart_info'],true); @@ -88,29 +244,32 @@ class StoreOrder extends ModelBasic $item['_info'] = $_info; if($item['pink_id'] && $item['combination_id']){ $pinkStatus = StorePink::where('order_id_key',$item['id'])->value('status'); - if($pinkStatus == 1){ - $item['pink_name'] = '[拼团订单]正在进行中'; - $item['color'] = '#f00'; - }else if($pinkStatus == 2){ - $item['pink_name'] = '[拼团订单]已完成'; - $item['color'] = '#00f'; - }else if($pinkStatus == 3){ - $item['pink_name'] = '[拼团订单]未完成'; - $item['color'] = '#f0f'; - }else{ - $item['pink_name'] = '[拼团订单]历史订单'; - $item['color'] = '#457856'; + switch ($pinkStatus){ + case 1: + $item['pink_name'] = '[拼团订单]正在进行中'; + $item['color'] = '#f00'; + break; + case 2: + $item['pink_name'] = '[拼团订单]已完成'; + $item['color'] = '#00f'; + break; + case 3: + $item['pink_name'] = '[拼团订单]未完成'; + $item['color'] = '#f0f'; + break; + default: + $item['pink_name'] = '[拼团订单]历史订单'; + $item['color'] = '#457856'; + break; } }else{ - if($item['seckill_id']){ - $item['pink_name'] = '[秒杀订单]'; - $item['color'] = '#32c5e9'; - }else{ - $item['pink_name'] = '[普通订单]'; - $item['color'] = '#895612'; - } - - + if($item['seckill_id']){ + $item['pink_name'] = '[秒杀订单]'; + $item['color'] = '#32c5e9'; + }else{ + $item['pink_name'] = '[普通订单]'; + $item['color'] = '#895612'; + } } },$where); } @@ -193,27 +352,107 @@ class StoreOrder extends ModelBasic // $model = $model->where('combination_id',0); if($where['status'] != '') $model = self::statusByWhere($where['status'],$model,$aler); if($where['is_del'] != '' && $where['is_del'] != -1) $model = $model->where($aler.'is_del',$where['is_del']); - if($where['combination_id'] =='普通订单'){ - $model = $model->where($aler.'combination_id',0)->where($aler.'seckill_id',0); + if(isset($where['combination_id'])){ + if($where['combination_id'] =='普通订单'){ + $model = $model->where($aler.'combination_id',0)->where($aler.'seckill_id',0); + } + if($where['combination_id'] =='拼团订单'){ + $model = $model->where($aler.'combination_id',">",0)->where($aler.'pink_id',">",0); + } + if($where['combination_id'] =='秒杀订单'){ + $model = $model->where($aler.'seckill_id',">",0); + } } - if($where['combination_id'] =='拼团订单'){ - $model = $model->where($aler.'combination_id',">",0)->where($aler.'pink_id',">",0); - } - if($where['combination_id'] =='秒杀订单'){ - $model = $model->where($aler.'seckill_id',">",0); + if(isset($where['type'])){ + switch ($where['type']){ + case 1: + $model = $model->where($aler.'combination_id',0)->where($aler.'seckill_id',0); + break; + case 2: + $model = $model->where($aler.'combination_id',">",0)->where($aler.'pink_id',">",0); + break; + case 3: + $model = $model->where($aler.'seckill_id',">",0); + break; + } } if($where['real_name'] != ''){ $model = $model->where($aler.'order_id|'.$aler.'real_name|'.$aler.'user_phone'.($join ? '|'.$join.'.nickname|'.$join.'.uid':''),'LIKE',"%$where[real_name]%"); } if($where['data'] !== ''){ - list($startTime,$endTime) = explode(' - ',$where['data']); - $model = $model->where($aler.'add_time','>',strtotime($startTime)); - $model = $model->where($aler.'add_time','<',strtotime($endTime)); + $model = self::getModelTime($where,$model,$aler.'add_time'); } return $model; } - + public static function getBadge($where){ + $price=self::getOrderPrice($where); + return [ + [ + 'name'=>'订单数量', + 'field'=>'件', + 'count'=>$price['total_num'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'售出商品', + 'field'=>'件', + 'count'=>$price['total_num'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'订单金额', + 'field'=>'元', + 'count'=>$price['pay_price'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'退款金额', + 'field'=>'元', + 'count'=>$price['refund_price'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'微信支付金额', + 'field'=>'元', + 'count'=>$price['pay_price_wx'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'余额支付金额', + 'field'=>'元', + 'count'=>$price['pay_price_yue'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'线下支付金额', + 'field'=>'元', + 'count'=>$price['pay_price_offline'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'积分抵扣', + 'field'=>'分', + 'count'=>$price['use_integral'].'(抵扣金额:¥'.$price['deduction_price'].')', + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ], + [ + 'name'=>'退回积分', + 'field'=>'元', + 'count'=>$price['back_integral'], + 'background_color'=>'layui-bg-blue', + 'col'=>2 + ] + ]; + } /** * 处理订单金额 * @param $where @@ -655,4 +894,14 @@ class StoreOrder extends ModelBasic // } // return $refundlist; // } + + /** + * 获取订单总数 + * @param int $uid + * @return int|string + */ + public static function getOrderCount($uid = 0){ + if(!$uid) return 0; + return self::where('uid',$uid)->where('paid',1)->where('refund_status',0)->where('status',2)->count(); + } } \ No newline at end of file diff --git a/application/admin/model/store/StoreProduct.php b/application/admin/model/store/StoreProduct.php index 36998f4d..b806c656 100644 --- a/application/admin/model/store/StoreProduct.php +++ b/application/admin/model/store/StoreProduct.php @@ -71,13 +71,7 @@ class StoreProduct extends ModelBasic $model = $model->where('p.store_name|p.keyword|p.id','LIKE',"%$where[store_name]%"); } if(isset($where['cate_id']) && trim($where['cate_id'])!=''){ - $cate=CategoryModel::where('id',$where['cate_id'])->find(); - if($cate['pid']==0){ - $arr=CategoryModel::where('pid',$cate['id'])->column('id'); - $model = $model->where('p.cate_id','in',$arr); - }else{ - $model = $model->where('p.cate_id','LIKE',"%$where[cate_id]%"); - } + $model = $model->where('p.cate_id','LIKE',"%$where[cate_id]%"); } if(isset($where['order']) && $where['order']!=''){ $model = $model->order(self::setOrder($where['order'])); @@ -386,7 +380,7 @@ class StoreProduct extends ModelBasic ->select(); $count=self::setWhere($where)->where('a.is_pay',1)->group('a.product_id')->count(); foreach ($data as &$item){ - $item['sum_price']=bcdiv($item['num_product'],$item['price'],2); + $item['sum_price']=bcmul($item['num_product'],$item['price'],2); } return compact('data','count'); } diff --git a/application/admin/view/agent/agent_manage/stair.php b/application/admin/view/agent/agent_manage/stair.php index 8214cf7c..f96da913 100644 --- a/application/admin/view/agent/agent_manage/stair.php +++ b/application/admin/view/agent/agent_manage/stair.php @@ -28,7 +28,7 @@ {$vo.add_time|date="Y-m-d H:i:s",###} - {$vo.uid|getOrderCount} + {$vo.orderCount} {$vo.now_money} diff --git a/application/admin/view/article/article/create.php b/application/admin/view/article/article/create.php index 2ffa5788..aeb06bc2 100644 --- a/application/admin/view/article/article/create.php +++ b/application/admin/view/article/article/create.php @@ -1 +1 @@ -{extend name="public/container"} {block name="head_top"} {/block} {block name="content"}
文章列表
{if condition="$news['image_input']"}
{else/}
{/if}
文章内容编辑
标题
作者
文章分类 {volist name="all" id="vo" key="k"} {if condition="$key eq $cid"} {elseif condition="in_array($key,$news['cid'])"} {else/} {/if} {/volist}
{if condition="$news['image_input']"}
{else/}
{/if}

封面大图片建议尺寸:900像素 * 500像素



{/block} {block name="script"} {/block} \ No newline at end of file +{extend name="public/container"} {block name="head_top"} {/block} {block name="content"}
文章列表
{if condition="$news['image_input']"}
{else/}
{/if}
文章内容编辑
标题
作者
文章分类 {volist name="all" id="vo" key="k"} {if condition="$key eq $cid"} {elseif condition="in_array($key,$news['cid'])"} {else/} {/if} {/volist}
{if condition="$news['image_input']"}
{else/}
{/if}

封面大图片建议尺寸:900像素 * 500像素



{/block} {block name="script"} {/block} \ No newline at end of file diff --git a/application/admin/view/article/article/index.php b/application/admin/view/article/article/index.php index 072584a3..ffd82f5e 100644 --- a/application/admin/view/article/article/index.php +++ b/application/admin/view/article/article/index.php @@ -1,26 +1,33 @@ {extend name="public/container"} {block name="head_top"} - + {/block} {block name="content"}
-
+
+
+
分类
+
+ +
+
+
+
- +
- +
@@ -33,28 +40,26 @@ id - 分类 图片 - 标题 - 简介 - 操作 + [分类]标题 + 浏览量 + 添加时间 + 操作 {volist name="list" id="vo"} - {$vo.id} - {$vo.catename} - + {$vo.id} + - {$vo.title} - - {$vo.synopsis} - + [{$vo.catename}]{$vo.title} + {$vo.visit} + {$vo.add_time|date="Y-m-d H:i:s",###} - +
+
+ {include file="public/inner_page"} +
+
-
- {include file="public/inner_page"} -
+ {/block} {block name="script"} - - - - - -{/block} {block name="content"} -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- 订单状态: - - - - - - - - - -
-
- 订单类型: - - - - - -
-
- 创建时间: - - - - - - -
- +
+
+ +
+
+
搜索条件
+
+ +
+ + +
+
+
+ {{item.name}} + {{item.field}} +
+
+

{{item.count}}

+

+ {{item.content}} + {{item.sum}} +

+
+
+
+ +
+ +
+
+
+
订单列表
+
+
+ + + + + + + + + + + + + +
+
- + {/block} {block name="script"} {/block} diff --git a/application/admin/view/store/store_product/index.php b/application/admin/view/store/store_product/index.php index 52c4a79f..8fa05ddb 100644 --- a/application/admin/view/store/store_product/index.php +++ b/application/admin/view/store/store_product/index.php @@ -98,7 +98,7 @@ {/block} \ No newline at end of file diff --git a/application/admin/view/ump/store_combination/order_pink.php b/application/admin/view/ump/store_combination/order_pink.php index 6c373503..a6578788 100644 --- a/application/admin/view/ump/store_combination/order_pink.php +++ b/application/admin/view/ump/store_combination/order_pink.php @@ -36,7 +36,7 @@ {$vo.nickname} - {$vo.order_id} + {$vo.order_id} ¥{$vo.price} diff --git a/application/admin/view/ump/store_coupon/grant_all.php b/application/admin/view/ump/store_coupon/grant_all.php index 6667c72f..13c5dbf6 100644 --- a/application/admin/view/ump/store_coupon/grant_all.php +++ b/application/admin/view/ump/store_coupon/grant_all.php @@ -46,7 +46,7 @@ {$vo.coupon_time}天 - diff --git a/application/admin/view/ump/store_coupon/grant_group.php b/application/admin/view/ump/store_coupon/grant_group.php index b94aead6..cbf60f72 100644 --- a/application/admin/view/ump/store_coupon/grant_group.php +++ b/application/admin/view/ump/store_coupon/grant_group.php @@ -46,7 +46,7 @@ {$vo.coupon_time}天 - diff --git a/application/admin/view/ump/store_coupon/grant_subscribe.php b/application/admin/view/ump/store_coupon/grant_subscribe.php index 2744b733..394e0b7e 100644 --- a/application/admin/view/ump/store_coupon/grant_subscribe.php +++ b/application/admin/view/ump/store_coupon/grant_subscribe.php @@ -46,7 +46,7 @@ {$vo.coupon_time}天 - diff --git a/application/admin/view/ump/store_coupon/grant_tag.php b/application/admin/view/ump/store_coupon/grant_tag.php index ad8d475b..17905d3b 100644 --- a/application/admin/view/ump/store_coupon/grant_tag.php +++ b/application/admin/view/ump/store_coupon/grant_tag.php @@ -46,7 +46,7 @@ {$vo.coupon_time}天 - diff --git a/application/admin/view/ump/store_seckill/index.php b/application/admin/view/ump/store_seckill/index.php index c8f1bea9..3a6a01cc 100644 --- a/application/admin/view/ump/store_seckill/index.php +++ b/application/admin/view/ump/store_seckill/index.php @@ -103,7 +103,7 @@ {field: 'start_name', title: '秒杀状态',width:'13%',toolbar:"#statusCn",unresize:true}, {field: 'stop_time', title: '结束时间', width: '13%',toolbar: '#stopTime',unresize:true}, {field: 'status', title: '状态',width:'6%',toolbar:"#status",unresize:true}, - {fixed: 'right', title: '操作', width: '5%', align: 'center', toolbar: '#barDemo',unresize:true} + {field: 'right', title: '操作', width: '5%', align: 'center', toolbar: '#barDemo',unresize:true} ] }); setTime(); diff --git a/application/admin/view/wechat/wechat_user/stair.php b/application/admin/view/wechat/wechat_user/stair.php index 8214cf7c..f96da913 100644 --- a/application/admin/view/wechat/wechat_user/stair.php +++ b/application/admin/view/wechat/wechat_user/stair.php @@ -28,7 +28,7 @@ {$vo.add_time|date="Y-m-d H:i:s",###} - {$vo.uid|getOrderCount} + {$vo.orderCount} {$vo.now_money} diff --git a/application/routine/controller/AuthApi.php b/application/routine/controller/AuthApi.php index a7f3fd4d..06dbb3e5 100644 --- a/application/routine/controller/AuthApi.php +++ b/application/routine/controller/AuthApi.php @@ -668,8 +668,6 @@ class AuthApi extends AuthController{ }else return JsonService::fail('添加收货地址失败!'); } - - } /** @@ -1341,7 +1339,7 @@ class AuthApi extends AuthController{ $arr = User::where('spread_uid',$this->userInfo['uid'])->column('uid'); $list = StoreOrder::getUserOrderCount(implode(',',$arr),$type); $price = []; - foreach ($list as $k=>$v) $price[]=$v['pay_price']; + if(!empty($list)) foreach ($list as $k=>$v) $price[]=$v['pay_price']; $cont = count($list); $sum = array_sum($price); return JsonService::successful(['cont'=>$cont,'sum'=>$sum]); @@ -1433,11 +1431,15 @@ class AuthApi extends AuthController{ header('content-type:image/jpg'); if(!$this->userInfo['uid']) return JsonService::fail('授权失败,请重新授权'); $path = 'public/uploads/routine/'.$this->userInfo['uid'].'.jpg'; - $domain=SystemConfigService::get('site_url').'/'; + $domain = SystemConfigService::get('site_url').'/'; + $domainTop = substr($domain,0,5); + if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain)); if(file_exists($path)) return JsonService::successful($domain.$path); else{ - $dir = iconv("UTF-8", "GBK", "public/uploads/routine"); - mkdir ($dir,0775,true); + if(!file_exists('public/uploads/routine')){ + $dir = iconv("UTF-8", "GBK", "public/uploads/routine"); + mkdir ($dir,0775,true); + } file_put_contents($path,RoutineCode::getCode($this->userInfo['uid'])); } return JsonService::successful($domain.$path); diff --git a/application/routine/model/store/StoreProductReply.php b/application/routine/model/store/StoreProductReply.php index da07eb22..abd044fa 100644 --- a/application/routine/model/store/StoreProductReply.php +++ b/application/routine/model/store/StoreProductReply.php @@ -57,8 +57,8 @@ class StoreProductReply extends ModelBasic ->join('__STORE_ORDER_CART_INFO__ C','A.unique = C.unique'); $baseOrder = 'A.add_time DESC,A.product_score DESC, A.service_score DESC'; if($order == 'new') $model->order($baseOrder); - else if($order == 'pic') $model->where('A.pics',['<>',''],['<>','[]'])->order('LENGTH(A.comment) DESC,'.$baseOrder); - else $model->order('LENGTH(A.comment) DESC,'.$baseOrder); + else if($order == 'pic') $model->where('A.pics',['<>',''],['<>','[]'])->order('A.add_time DESC,'.$baseOrder); + else $model->order('A.add_time DESC,'.$baseOrder); $list = $model->limit($first,$limit)->select()->toArray()?:[]; foreach ($list as $k=>$reply){ $list[$k] = self::tidyProductReply($reply); @@ -90,7 +90,7 @@ class StoreProductReply extends ModelBasic ->field('A.product_score,A.service_score,A.comment,A.merchant_reply_content,A.merchant_reply_time,A.pics,A.add_time,B.nickname,B.avatar,C.cart_info') ->join('__USER__ B','A.uid = B.uid') ->join('__STORE_ORDER_CART_INFO__ C','A.unique = C.unique') - ->order('LENGTH(A.comment) DESC,A.product_score DESC, A.service_score DESC, A.add_time DESC')->find(); + ->order('A.add_time DESC,A.product_score DESC, A.service_score DESC, A.add_time DESC')->find(); if(!$res) return null; return self::tidyProductReply($res->toArray()); } diff --git a/application/wap/model/store/StoreCouponUser.php b/application/wap/model/store/StoreCouponUser.php index b6a74c60..af177254 100644 --- a/application/wap/model/store/StoreCouponUser.php +++ b/application/wap/model/store/StoreCouponUser.php @@ -105,7 +105,7 @@ class StoreCouponUser extends ModelBasic $data['coupon_price'] = $couponInfo['coupon_price']; $data['use_min_price'] = $couponInfo['use_min_price']; $data['add_time'] = time(); - $data['end_time'] = $couponInfo['add_time']+$couponInfo['coupon_time']*86400; + $data['end_time'] = $data['add_time']+$couponInfo['coupon_time']*86400; $data['type'] = $type; return self::set($data); } diff --git a/application/wap/model/store/StorePink.php b/application/wap/model/store/StorePink.php index 312fe9e5..3fb99aca 100644 --- a/application/wap/model/store/StorePink.php +++ b/application/wap/model/store/StorePink.php @@ -206,7 +206,7 @@ class StorePink extends ModelBasic $model = $model->join('StoreCombination c','c.id=p.cid'); return self::page($model,function($item)use($where){ $item['count_people'] = bcadd(self::where('k_id',$item['id'])->count(),1,0); - },$where); + $item['nickName'] = User::getUserInfo($item['uid'])['nickname'];},$where); } public static function isPinkBe($data,$id){ diff --git a/application/wap/model/store/StoreProductReply.php b/application/wap/model/store/StoreProductReply.php index 0eb2fdab..e1c649d7 100644 --- a/application/wap/model/store/StoreProductReply.php +++ b/application/wap/model/store/StoreProductReply.php @@ -57,8 +57,8 @@ class StoreProductReply extends ModelBasic ->join('__STORE_ORDER_CART_INFO__ C','A.unique = C.unique'); $baseOrder = 'A.add_time DESC,A.product_score DESC, A.service_score DESC'; if($order == 'new') $model->order($baseOrder); - else if($order == 'pic') $model->where('A.pics',['<>',''],['<>','[]'])->order('LENGTH(A.comment) DESC,'.$baseOrder); - else $model->order('LENGTH(A.comment) DESC,'.$baseOrder); + else if($order == 'pic') $model->where('A.pics',['<>',''],['<>','[]'])->order('A.add_time DESC,'.$baseOrder); + else $model->order('A.add_time DESC,'.$baseOrder); $list = $model->limit($first,$limit)->select()->toArray()?:[]; foreach ($list as $k=>$reply){ $list[$k] = self::tidyProductReply($reply); @@ -89,7 +89,7 @@ class StoreProductReply extends ModelBasic ->field('A.product_score,A.service_score,A.comment,A.pics,A.add_time,B.nickname,B.avatar,C.cart_info') ->join('__USER__ B','A.uid = B.uid') ->join('__STORE_ORDER_CART_INFO__ C','A.unique = C.unique') - ->order('LENGTH(A.comment) DESC,A.product_score DESC, A.service_score DESC, A.add_time DESC')->find(); + ->order('A.add_time DESC,A.product_score DESC, A.service_score DESC, A.add_time DESC')->find(); if(!$res) return null; return self::tidyProductReply($res->toArray()); } diff --git a/application/wap/view/first/index/index.html b/application/wap/view/first/index/index.html index 65d168db..5f8c1842 100644 --- a/application/wap/view/first/index/index.html +++ b/application/wap/view/first/index/index.html @@ -15,22 +15,23 @@
-
+ -
+ {notempty name="banner"} {/notempty} +
+
+ 拼团 . 花少钱买好货 +
+
+
+
+
+ +
+
+
{{item.title}}
+
+ ¥{{item.price}} + ¥{{item.product_price}} + 已拼{{item.sales}}单 +
+ + {{item.people}}人团 + 去开团 + + +
+
+
+
@@ -155,31 +182,41 @@
-
- +
+
+
+ {/block} \ No newline at end of file + }()); +{/block} \ No newline at end of file diff --git a/application/wap/view/first/my/order_pink_after.html b/application/wap/view/first/my/order_pink_after.html index a7b9ba98..e777f25e 100644 --- a/application/wap/view/first/my/order_pink_after.html +++ b/application/wap/view/first/my/order_pink_after.html @@ -116,7 +116,7 @@ that = this; storeApi.goBuy({ cartNum: that.cartNum, - uniqueId: '', + uniqueId: 0, productId: this.product.product_id, combinationId: this.product.id }, function (cartId) { diff --git a/application/wap/view/first/store/confirm_order.html b/application/wap/view/first/store/confirm_order.html index 63174de7..4e492c21 100644 --- a/application/wap/view/first/store/confirm_order.html +++ b/application/wap/view/first/store/confirm_order.html @@ -106,9 +106,9 @@ var $key = ''; var $seckill_id = ''; var $bargain_id = ''; - var wap_path = '{__WAP_PATH}'; - requirejs(['vue','store','helper','{__WAP_PATH}crmeb/module/store/use-coupon.js','{__WAP_PATH}crmeb/module/store/use-address.js','layer'],function(Vue,storeApi,$h,useCoupon,useAddress,layer){ + requirejs(['vue','store','helper','{__WAP_PATH}crmeb/module/store/use-coupon.js' + ,'{__WAP_PATH}crmeb/module/store/use-address.js','layer'],function(Vue,storeApi,$h,useCoupon,useAddress,layer){ Vue.use(useCoupon); Vue.use(useAddress); diff --git a/application/wap/view/first/store/detail.html b/application/wap/view/first/store/detail.html index e5179486..58554e97 100644 --- a/application/wap/view/first/store/detail.html +++ b/application/wap/view/first/store/detail.html @@ -13,6 +13,7 @@
{$storeInfo.store_name}
+
¥{$storeInfo.price|floatval}
原价:¥{$storeInfo.ot_price|floatval}
商品编号:{$storeInfo.id} 库存:{$storeInfo.stock}{$storeInfo.unit_name} 销量:{$storeInfo.sales}{$storeInfo.unit_name}
@@ -20,13 +21,12 @@
积分:{$storeInfo.give_integral|floatval} 赠送
{/gt}
-
选择 {{productAttrCate}}
+ {notempty name="reply"}
评价