终极提交~

This commit is contained in:
2019-10-27 20:15:29 +08:00
parent df11660e6a
commit 4131f1ac50
17 changed files with 588 additions and 118 deletions

View File

@ -114,32 +114,61 @@ class Orders extends Base{
$flag = -1;
$type = input('param.type');
$status = [];
switch ($type) {
case 'waitPay':
$status=[-2];
break;
case 'waitDeliver':
$status=[0];
break;
case 'waitReceive':
$status=[1];
break;
case 'waitAppraise':
$status=[2];
$flag=0;
break;
case 'finish':
$status=[2];
break;
case 'abnormal': // 退款/拒收 与取消合并
$status=[-1,-3];
break;
default:
$status=[-5,-4,-3,-2,-1,0,1,2];
break;
}
$m = new M();
$rs = $m->userOrdersByPage($status,$flag);
$m = new M();
if(strpos($type, "zg")===0){
switch ($type) {
case 'zgwaitPay':
$status=[-2];
break;
case 'zgwaitDeliver':
$status=[0];
break;
case 'zgwaitReceive':
$status=[1];
break;
case 'zgwaitAppraise':
$status=[2];
$flag=0;
break;
case 'zgfinish':
$status=[2];
break;
case 'zgabnormal': // 退款/拒收 与取消合并
$status=[-1,-3];
break;
case 'zgall':
default:
$status=[-5,-4,-3,-2,-1,0,1,2];
break;
}
$rs = $m->userZgOrdersByPage($status,$flag);
}else{
switch ($type) {
case 'waitPay':
$status=[-2];
break;
case 'waitDeliver':
$status=[0];
break;
case 'waitReceive':
$status=[1];
break;
case 'waitAppraise':
$status=[2];
$flag=0;
break;
case 'finish':
$status=[2];
break;
case 'abnormal': // 退款/拒收 与取消合并
$status=[-1,-3];
break;
default:
$status=[-5,-4,-3,-2,-1,0,1,2];
break;
}
$rs = $m->userOrdersByPage($status,$flag);
}
foreach($rs['Rows'] as $k=>$v){
if(!empty($v['list'])){
foreach($v['list'] as $k1=>$v1){
@ -152,6 +181,17 @@ class Orders extends Base{
exit(jsonReturn('',1,$rs));
}
public function confirmHelpSale(){
$m = new M();
$id = (int)input('orderId');
exit(jsonReturn('',1,$m->confirmHelpSale($id)));
}
public function cancelHelpSale(){
$m = new M();
$id = (int)input('orderId');
exit(jsonReturn('',1,$m->cancelHelpSale($id)));
}
/**
* 订单详情
*/

View File

@ -14,6 +14,14 @@ class Shopping extends Base{
public function getHelpCarousel(){
$m = new M();
exit(json_encode($m->getHelpCarousel()));
}
/**
* 获取助微吧轮播
* @return [type] [description]
*/
public function getHelpShopCarousel(){
$m = new M();
exit(json_encode($m->getHelpShopCarousel()));
}
/**
* 搜索助微吧商品列表

View File

@ -2,6 +2,7 @@
namespace wstmart\app\controller;
use think\Db;
use wstmart\app\model\Users;
use wstmart\common\model\UserLevel as UL;
use wstmart\common\model\UserTrees as UT;
@ -30,7 +31,7 @@ class UserLevel extends Base
public function index()
{
$userId = get_my_id();
$User = UT::getMyLevel($userId);
$User = UT::realGetMyChildren($userId, [$userId]);
return $User;
}
@ -45,24 +46,28 @@ class UserLevel extends Base
public function TreeList()
{
$userId = get_my_id();
$count = UL::where(['uid' => $userId])->group("level")->count();
$treeArr = [];
$newLevel = 1;
$goodsType = 3;
$min = Db::name('orders')->where(compact('userId','goodsType'))->min('helpUserLevel');
if(0 == $min){$min = 1;}
$max = Db::name('orders')->where(compact('userId','goodsType'))->max('helpUserLevel');
$newLevel = 0;
do {
if ($newLevel > 10) break;
$treeArr[$newLevel]['level'] = UT::$level[$newLevel];
$ptree = UT::where(['uid' => $userId])->find();// 找到我的层级
$userId = $ptree->pid;// 上级uid
if ($userId == 0) $userId = 1;// 上级uid
$plevel = UL::where(['uid' => $userId, 'level' => $newLevel])->find();// 查看上级是否有权限助购
if ($plevel) {// 如果有,则使用上级信息
$newLevel++;
$userId = UT::getUpperId($userId);// 找到我的层级
if ($userId == null) $userId = 1;// 上级uid
if (($newLevel >= $min) && UT::checkUserCanDisplay($userId)) {// 如果有,则使用上级信息
if($newLevel>10){
$treeArr[$newLevel]['level'] = "".$newLevel."";
}else{
$treeArr[$newLevel]['level'] = UT::$level[$newLevel];
}
$treeArr[$newLevel]['level_id'] = $newLevel;
$treeArr[$newLevel]['userId'] = $userId;
$user = Users::where(['userId' => $plevel->uid])->find();
$treeArr[$newLevel]['userName'] = $user->userName ?: $user->loginName;
$newLevel++;
}
// 如果没有,则递归查询上级信息
} while ($newLevel < ($count + 2));
$treeArr[$newLevel]['userName'] = '';
}else{$newLevel--;}
if ($userId <= 1)break;
} while (($newLevel <= $max) && ($newLevel <= (int)dataConf("helpSaleMaxLevel")));
// pd($treeArr);
return $treeArr;
}

View File

@ -228,7 +228,8 @@ class Users extends Base{
$userId = $this->getUserId();
$m = Model('common/Table');
$m->setTable('user_vouchers_summary');
$data = $m->getInfo(['userId'=>$userId],'expectedProductNum,expectedCouponsNum');
$data = $m->getInfo(['userId'=>$userId],'expectedProductNum,expectedCouponsNum,alreadyProductNum,alreadyCouponsNum');
$data = $m->getInfo(['userId'=>$userId],'expectedProductNum,expectedCouponsNum,alreadyProductNum,alreadyCouponsNum');
$m->setTable('shops');
$shopIds = $m->getColumn(['status'=>1,'userId'=>$userId],'shopId');
if($shopIds){

View File

@ -57,10 +57,23 @@ class Uservouchers extends Base{
$m->setTable('shops');
$shopIds = $m->getColumn(['status'=>1,'userId'=>$userId],'shopId');
$m->setTable('log_moneys');
$list = db('log_moneys')->where("((targetType = 0 AND targetId = $userId ) OR (targetType = 1 AND targetId IN (".implode(',',$shopIds) ."))) AND moneyName = $vouchersType AND dataFlag=1")->field('money num,remark,moneyType,createTime')->order('id DESC')->paginate(input('pageSize/d',10))->toArray();
$list = db('log_moneys')->where("((targetType = 0 AND targetId = $userId ) OR (targetType = 1 AND targetId IN ('".implode("','",$shopIds) ."'))) AND moneyName = $vouchersType AND dataFlag=1")->field('money num,remark,moneyType,createTime')->order('id DESC')->paginate(input('pageSize/d',10))->toArray();
//dump(db()->_sql());
// $list = $m->getSelect(['targetType'=>0,'targetId'=>$userId,'moneyName'=>$vouchersType,'dataFlag'=>1],'money num,remark,moneyType,createTime','id DESC');
}
exit(jsonReturn('',1,$list));
}
public function getHelpGet(){
$m = Model('common/Table');
$userId = $this->getUserId();
$list = [];
$m->setTable('user_help_get_notice');
$list = $m->getSelect(['userId'=>$userId,'isShow'=>1],'helpGet,remark,isAdd,createTime','id DESC');
if(!empty($list['Rows'])){
foreach ($list['Rows'] as &$v) {
$v['createTime'] = date('Y-m-d H:i:s',$v['createTime']);
}
}
exit(jsonReturn('',1,$list));
}
}