diff --git a/application/admin/controller/ConsignmentOrderController.php b/application/admin/controller/ConsignmentOrderController.php index bf1e114..e1d85d5 100755 --- a/application/admin/controller/ConsignmentOrderController.php +++ b/application/admin/controller/ConsignmentOrderController.php @@ -140,12 +140,9 @@ class ConsignmentOrderController extends Controller $order_goods->save(); $goods_count=ConsignmentOrderGoods::where(array('order_id'=>$order_goods['order_id'],'refund_status'=>0))->count(); $quanbu=0; + $order = ConsignmentOrder::get(['id' =>$order_goods['order_id']]); if($goods_count==0){ - $order = ConsignmentOrder::get(['id' =>$order_goods['order_id']]); $order->order_status = 3; - $order->total_amount =$order['total_amount']+$param['evaluation_price']; - $order->update_time = time(); - $order->save(); //记录日志 ConsignmentOrderLog::record( $order['id'], @@ -160,6 +157,9 @@ class ConsignmentOrderController extends Controller Notice::noticeByScene($order['user_id'],$data_info); $quanbu=1; } + $order->total_amount =$order['total_amount']+$param['evaluation_price']; + $order->update_time = time(); + $order->save(); // 提交事务 ConsignmentOrderGoods::commit(); }catch(\Exception $e){ diff --git a/application/admin/controller/FinanceController.php b/application/admin/controller/FinanceController.php index 1e6aae9..66bc28f 100755 --- a/application/admin/controller/FinanceController.php +++ b/application/admin/controller/FinanceController.php @@ -5,18 +5,52 @@ */ namespace app\admin\controller; - -use app\admin\model\AdminLog; -use app\admin\model\AdminMenu; -use app\admin\model\AdminRole; -use app\admin\model\AdminUser; -use tools\SystemInfo; +use think\db; use think\Request; class FinanceController extends Controller { public function lists(Request $request) { + //本月订单金额 + $month_order_amount = Db::name('order') + ->where('order_status' , 'in', [1,2,3]) + ->whereTime('create_time', 'month') + ->sum('order_amount'); + + //订单总金额 + $order = Db::name('order') + ->field('sum(order_amount) as amount, count(id) as num') + ->where('order_status' , 'in', [1,2,3]) + ->find(); + + + //会员相关 + $user = Db::name('user') + ->field('sum(user_money) as money') + ->find(); + + //已提现佣金 + $have_withdraw_earnings = Db::name('withdraw_apply') + ->where(['status' =>2]) + ->sum('money'); + + //提现中 + $wait_withdraw_earnings = Db::name('withdraw_apply') + ->where(['status' =>1]) + ->sum('money'); + + $this->assign([ + 'month_order_amount' => round($month_order_amount, 2), + + 'total_amount' => round($order['amount'], 2), + 'order_num' => $order['num'] ?? 0, + + + 'total_user_money' => round($user['money'], 2), + 'have_withdraw_earnings' => round($have_withdraw_earnings, 2), + 'wait_earnings' => round($wait_withdraw_earnings, 2), + ]); return $this->fetch(); } diff --git a/application/admin/controller/GoodsController.php b/application/admin/controller/GoodsController.php index e4e46b2..c253dba 100755 --- a/application/admin/controller/GoodsController.php +++ b/application/admin/controller/GoodsController.php @@ -13,6 +13,7 @@ use app\common\model\GoodsBrand; use app\common\model\GoodsAttrCategory; use app\common\model\ShopConfig; use app\common\model\GoodsItem; +use app\common\model\PhaseConfig; use app\common\validate\GoodsValidate; @@ -38,7 +39,7 @@ class GoodsController extends Controller } //添加 - public function add(Request $request, Goods $model,MallImage $mimode,GoodsItem $gimode, GoodsValidate $validate) + public function add(Request $request, Goods $model,MallImage $mimode,GoodsItem $gimode,PhaseConfig $pcmode, GoodsValidate $validate) { if ($request->isPost()) { $param = $request->param(); @@ -83,6 +84,8 @@ class GoodsController extends Controller $size[$key]['size']=$value; $size[$key]['num']=0; } + //品相 + $phaseconfig =PhaseConfig::field('id,name')->select(); $this->assign([ 'goods_category_list' => $this->getSelectList(new GoodsCategory), 'brand_list' =>GoodsBrand::all(), @@ -90,6 +93,7 @@ class GoodsController extends Controller 'number'=>0, 'collocation_goods'=>array(), 'size_list' =>$size, + 'phaseconfig'=>$phaseconfig, 'goods_list' => Goods::all() ]); return $this->fetch(); @@ -153,6 +157,8 @@ class GoodsController extends Controller $num=$goods_item[$value]??'0'; $size[$key]['num']=$num; } + //品相 + $phaseconfig =PhaseConfig::field('id,name')->select(); $this->assign([ 'data' => $data, 'goods_category_list' => $this->getSelectList(new GoodsCategory, $data->goods_category_id), @@ -163,6 +169,7 @@ class GoodsController extends Controller 'number'=>count($collocation_goods), 'collocation_goods'=>$collocation_goods, 'size_list' =>$size, + 'phaseconfig'=>$phaseconfig, 'goods_list' => Goods::all() ]); return $this->fetch('add'); diff --git a/application/admin/controller/ShopConfigController.php b/application/admin/controller/ShopConfigController.php index 53fa2cd..7d9c709 100755 --- a/application/admin/controller/ShopConfigController.php +++ b/application/admin/controller/ShopConfigController.php @@ -85,6 +85,9 @@ class ShopConfigController extends Controller ShopConfig::set('website', 'MCHID', $param['MCHID']); ShopConfig::set('website', 'WXPAYKEY', $param['WXPAYKEY']); ShopConfig::set('website', 'notify_url', $param['notify_url']); + + ShopConfig::set('website', 'wxqrcode', $param['wxqrcode']); + ShopConfig::set('website', 'share_img', $param['share_img']); $url = URL_RELOAD; return success('添加成功',$url); } @@ -99,6 +102,8 @@ class ShopConfigController extends Controller 'MCHID' => ShopConfig::get('website', 'MCHID'), 'WXPAYKEY' => ShopConfig::get('website', 'WXPAYKEY'), 'notify_url' => ShopConfig::get('website', 'notify_url'), + 'wxqrcode' => ShopConfig::get('website', 'wxqrcode'), + 'share_img' => ShopConfig::get('website', 'share_img'), ]; $this->assign([ 'config' => $config, diff --git a/application/admin/controller/WithdrawController.php b/application/admin/controller/WithdrawController.php index 02b4502..8a75682 100755 --- a/application/admin/controller/WithdrawController.php +++ b/application/admin/controller/WithdrawController.php @@ -18,7 +18,6 @@ class WithdrawController extends Controller //列表 public function lists(Request $request, WithdrawApply $model) { - $WITHDRAW_TYPE=$model->WITHDRAW_TYPE; $STATUS_TYPE=$model->STATUS_TYPE; $param = $request->param(); @@ -68,7 +67,6 @@ class WithdrawController extends Controller 'data' => $data, 'page' => $data->render(), 'total' => $data->total(), - 'type_list' =>$WITHDRAW_TYPE, 'status_list'=>$STATUS_TYPE, ]); return $this->fetch(); @@ -126,7 +124,7 @@ class WithdrawController extends Controller //拒绝提现,回退佣金 $user = User::get($withdraw_apply['user_id']); - $user->integral = ['inc', $withdraw_apply['money']]; + $user->user_money = ['inc', $withdraw_apply['money']]; $user->save(); //增加账户变动记录 @@ -134,7 +132,7 @@ class WithdrawController extends Controller $withdraw_apply['user_id'], $withdraw_apply['money'], 1, - 130, + 110, '', $withdraw_apply['id'], $withdraw_apply['sn'] diff --git a/application/admin/view/consignment_order/examine.html b/application/admin/view/consignment_order/examine.html index 4d1ecc9..308f41d 100755 --- a/application/admin/view/consignment_order/examine.html +++ b/application/admin/view/consignment_order/examine.html @@ -126,7 +126,7 @@ - {if condition="$goods.refund_status=='0' && $goods.is_confirm=='1'"} + {if condition="$goods.refund_status=='0'"} {/if} diff --git a/application/admin/view/consignment_order/shelves.html b/application/admin/view/consignment_order/shelves.html index 5d0f788..6ab6b8b 100755 --- a/application/admin/view/consignment_order/shelves.html +++ b/application/admin/view/consignment_order/shelves.html @@ -91,7 +91,7 @@ - {if condition="$goods.refund_status=='1'"} + {if condition="$goods.refund_status=='1'&& $goods.is_confirm=='1'"} {/if} diff --git a/application/admin/view/finance/lists.html b/application/admin/view/finance/lists.html index 702b627..b0cbd43 100755 --- a/application/admin/view/finance/lists.html +++ b/application/admin/view/finance/lists.html @@ -36,6 +36,12 @@ margin-left: 42px; color: #333; font-size: 25px; + line-height: 36px; + padding: 5px 0 10px; + overflow: hidden; + text-overflow: ellipsis; + word-break: break-all; + white-space: nowrap; }
@@ -47,43 +53,27 @@
- +
本月订单金额(元)
-

1

+

{$month_order_amount}

- +
订单总金额(元)
-

1

+

{$total_amount}

- +
订单总数(笔)
-

1

-
-
-
- -
退款订单总额(元)
-
- -

1

-
-
-
- -
退款订单总数(笔)
-
- -

1

+

{$order_num}

@@ -95,76 +85,27 @@
- +
会员余额(元)
-

1

+

{$total_user_money}

- -
会员积分
+ +
会员可提现金额(元)
-

1

+

{$wait_earnings}

- -
会员可提现佣金(元)
+ +
会员已提现金额(元)
-

1

-
-
-
- -
会员已提现佣金(元)
-
- -

1

-
-
- - - -
-
-
分销概况
-
-
-
-
- -
本月分销佣金(元)
-
- -

1

-
-
-
- -
分销总佣金(元)
-
- -

1

-
-
-
- -
提现中佣金(元)
-
- -

1

-
-
-
- -
已提现佣金(元)
-
- -

1

+

{$have_withdraw_earnings}

diff --git a/application/admin/view/goods/add.html b/application/admin/view/goods/add.html index 34093ca..359a248 100755 --- a/application/admin/view/goods/add.html +++ b/application/admin/view/goods/add.html @@ -302,6 +302,23 @@ ul.albums li a.btn-fm_z{ +
+ +
+ +
+
+
diff --git a/application/admin/view/order/detail.html b/application/admin/view/order/detail.html index d35bbb3..66b6a39 100755 --- a/application/admin/view/order/detail.html +++ b/application/admin/view/order/detail.html @@ -150,7 +150,6 @@ -

商品金额:¥{$detail.goods_price}

应付金额:¥{$detail.order_amount}

diff --git a/application/admin/view/public/footer.html b/application/admin/view/public/footer.html index 9e634b4..0fbb980 100755 --- a/application/admin/view/public/footer.html +++ b/application/admin/view/public/footer.html @@ -4,7 +4,7 @@ - Copyright © 2020 {$admin.author|default='admin'}. All rights + Copyright © 2022 {$admin.author|default='admin'}. All rights reserved. {/if} \ No newline at end of file diff --git a/application/admin/view/shop_config/website.html b/application/admin/view/shop_config/website.html index b11548b..7028b6e 100755 --- a/application/admin/view/shop_config/website.html +++ b/application/admin/view/shop_config/website.html @@ -121,9 +121,9 @@ ul.albums li a.btn-fm_z{ 多个尺寸请用英文逗号分隔
-
+
-
    +
    @@ -140,7 +140,7 @@ ul.albums li a.btn-fm_z{ ,field:'image' ,multiple: true ,done: function(res){ - $(".albums img").attr('src',res.data.avatar_logo); + $("#albums_size_img img").attr('src',res.data.avatar_logo); $("#size_img").val(res.data.avatar_logo); } ,error: function(){ @@ -150,6 +150,64 @@ ul.albums li a.btn-fm_z{ }); }); +
    + +
      +
    • + +
    +
    + +
    + +
      +
    • + +
    +
    +
-
- -
- -
-
@@ -121,10 +110,6 @@
用户信息
- - -
收款账户信息
-
提现金额信息
提现状态
审核备注
@@ -149,19 +134,6 @@
- -
-
-

提现方式:{$item.type_text}

-

提现姓名:{$item.real_name}

-

提现手机:{$item.real_tel}

-

提现账户:{$item.account}

- {if $item.type eq 3} -

提现开户:{$item.subbank}

- {/if} -
-
-
diff --git a/application/api/common.php b/application/api/common.php index 34f7d31..596cc7f 100755 --- a/application/api/common.php +++ b/application/api/common.php @@ -199,3 +199,34 @@ if(!function_exists('getSubs')){ return $subs; } } + +/** + * 获取图片的Base64编码(不支持url) + * @param $img_file 传入本地图片地址 + * @return string + */ +function imgToBase64($img_file) { + $img_base64 = ''; + if (file_exists($img_file)) { + $app_img_file = $img_file; // 图片路径 + $img_info = getimagesize($app_img_file); // 取得图片的大小,类型等 + //echo '
' . print_r($img_info, true) . '

'; + $fp = fopen($app_img_file, "r"); // 图片是否可读权限 + if ($fp) { + $filesize = filesize($app_img_file); + $content = fread($fp, $filesize); + $file_content = chunk_split(base64_encode($content)); // base64编码 + switch ($img_info[2]) { //判读图片类型 + case 1: $img_type = "gif"; + break; + case 2: $img_type = "jpg"; + break; + case 3: $img_type = "png"; + break; + } + $img_base64 = 'data:image/' . $img_type . ';base64,' . $file_content;//合成图片的base64编码 + } + fclose($fp); + } + return $img_base64; //返回图片的base64 +} diff --git a/application/api/controller/AuthController.php b/application/api/controller/AuthController.php index 14c60a0..727c699 100755 --- a/application/api/controller/AuthController.php +++ b/application/api/controller/AuthController.php @@ -4,6 +4,7 @@ namespace app\api\controller; use app\common\model\User; +use app\common\model\Cart; use app\common\model\ShopConfig; use Exception; use think\Request; @@ -24,13 +25,13 @@ class AuthController extends Controller * @param UserValidate $validate * @return Json|void */ - public function login(Request $request,User $fumodel) + public function login(Request $request,User $fumodel,Cart $cmodel) { $param = $request->param(); $avatar =$param['avatar']??''; $nickname =$param['nickname']??''; $code =$param['code']??''; - $distribution_code =$param['distribution_code']??''; + //$distribution_code =$param['distribution_code']??''; $encryptedData =$param['encryptedData']??''; $iv =$param['iv']??''; if(!$avatar || !$nickname || !$code){ @@ -42,6 +43,10 @@ class AuthController extends Controller } $where['mobile'] = array('EQ',$user_info['tel']); $userinfo = $fumodel->field('id,avatar,nickname,openid')->where($where)->find(); + $cart_num=0; + if($userinfo){ + $cart_num=$cmodel->where(array('user_id'=>$userinfo['id']))->count(); + } if($userinfo && !$userinfo['openid']){ $data_login['login_ip']=$request->ip(); $data_login['login_time']=time(); @@ -49,21 +54,21 @@ class AuthController extends Controller $fumodel->where('id', $userinfo['id'])->update($data_login); $token = $this->getToken($userinfo['id']); $uid=Crypt::encrypt($userinfo['id']); - return success(['token' => $token,'uid'=>$uid], '登录成功'); + return success(['token' => $token,'uid'=>$uid,'cart_num'=>$cart_num], '登录成功'); }else if($userinfo && $userinfo['openid']){ $data_login['login_ip']=$request->ip(); $data_login['login_time']=time(); $fumodel->where('id', $userinfo['id'])->update($data_login); $token = $this->getToken($userinfo['id']); $uid=Crypt::encrypt($userinfo['id']); - return success(['token' => $token,'uid'=>$uid], '登录成功'); + return success(['token' => $token,'uid'=>$uid,'cart_num'=>$cart_num], '登录成功'); } //登录逻辑 // 启动事务 $fumodel->startTrans(); try { $res['sn'] =create_user_sn(); - $res['distribution_code'] =generate_invite_code(); + //$res['distribution_code'] =generate_invite_code(); $res['nickname']=$nickname; $res['username'] = '用户'.$res['sn']; $res['avatar'] = $avatar; @@ -74,10 +79,6 @@ class AuthController extends Controller $res['login_time']=time(); $fumodel::create($res); $uid=$fumodel->getLastInsID(); - //分销 - if($distribution_code){ - $fumodel->code($distribution_code,$uid); - } $fumodel->commit(); } catch (Exception $e) { $fumodel->rollback(); @@ -86,7 +87,7 @@ class AuthController extends Controller $uid=Crypt::encrypt($uid); $token = $this->getToken($uid); //返回数据 - return success(['token' => $token,'uid'=>$uid], '注册成功'); + return success(['token' => $token,'uid'=>$uid,'cart_num'=>$cart_num], '注册成功'); } //获取用户临时code 用来去获取openid diff --git a/application/api/controller/CartController.php b/application/api/controller/CartController.php index e5b4d1d..fa47fb4 100755 --- a/application/api/controller/CartController.php +++ b/application/api/controller/CartController.php @@ -44,7 +44,7 @@ class CartController extends Controller ]; $info = Cart::where($where)->find(); - $cart_num = $param['goods_num'] + (isset($info) ? $info['goods_num'] : 0); + $cart_num =1; //$param['goods_num'] + (isset($info) ? $info['goods_num'] : 0); if ($cmodel->checkStock($item_value, $cart_num,$goods_id)) { return client_error('很抱歉,商品库存不足'); @@ -52,7 +52,7 @@ class CartController extends Controller if ($info) { //购物车内已有该商品 $update_data = [ - 'goods_num' => $goods_num + $info['goods_num'], + 'goods_num' =>1, //$goods_num + $info['goods_num'], 'update_time' => $time, ]; $res =$cmodel @@ -63,13 +63,14 @@ class CartController extends Controller $data = [ 'user_id' => $user_id, 'goods_id' => $goods_id, - 'goods_num' => $goods_num, + 'goods_num' => 1,//$goods_num, 'item_value' => $item_value, 'create_time' => $time, ]; $res = $cmodel->insert($data); } - return $res ? success('','添加成功') : client_error('添加失败'); + $cart_num=$cmodel->where(array('user_id'=>$user_id))->count(); + return $res ? success($cart_num,'添加成功') : client_error('添加失败'); } //删除购物车 @@ -80,12 +81,21 @@ class CartController extends Controller if(!$user_id){ return unauthorized('请先授权'); } - $cart_id= $param['cart_id']?Crypt::decrypt($param['cart_id']):'0'; + $cart_id= $param['cart_id']?$param['cart_id']:'0'; if($cart_id=='0'){ return client_error('该购物车商品不存在'); } - $res = $cmodel->whereIn('id',$cart_id)->delete(); - return $res ? success('','删除成功') : client_error('删除失败'); + $cart_id_list=explode(',',$cart_id); + $cart_ids=array(); + foreach ($cart_id_list as $k1 => $v1) { + $cart_ids[] = Crypt::decrypt($v1); + } + if(count($cart_ids)==0){ + return client_error('该购物车商品不存在'); + } + $res = $cmodel->whereIn('id',$cart_ids)->delete(); + $cart_num=$cmodel->where(array('user_id'=>$user_id))->count(); + return $res ? success($cart_num,'删除成功') : client_error('删除失败'); } //变动购物车数量 @@ -113,7 +123,8 @@ class CartController extends Controller 'goods_num' => $goods_num, ]; $res = $cmodel->where(['id' => $cart_id])->update($update); - return $res ? success('','更新成功') : client_error('更新失败'); + $cart_num=$cmodel->where(array('user_id'=>$user_id))->count(); + return $res ? success($cart_num,'更新成功') : client_error('更新失败'); } //购物车选中状态 @@ -130,7 +141,8 @@ class CartController extends Controller } $res = $cmodel->where(['id' => $cart_id, 'user_id' => $user_id]) ->update(['selected' => $param['selected'], 'update_time' => time()]); - return $res ? success('','更新成功') : client_error('更新失败'); + $cart_num=$cmodel->where(array('user_id'=>$user_id))->count(); + return $res ? success($cart_num,'更新成功') : client_error('更新失败'); } //列表 diff --git a/application/api/controller/Controller.php b/application/api/controller/Controller.php index 440bf57..7b9dea1 100755 --- a/application/api/controller/Controller.php +++ b/application/api/controller/Controller.php @@ -54,7 +54,7 @@ class Controller //初始化基本数据 $this->param = $request->param(); $this->page = $this->param['page'] ?? 1; - $this->limit = $this->param['limit'] ?? 10; + $this->limit = $this->param['limit'] ?? 9; $this->id = $this->param['id'] ?? 0; $this->img_url=ShopConfig::get('website', 'img_url'); diff --git a/application/api/controller/GoodsController.php b/application/api/controller/GoodsController.php index f172040..a0c4d4f 100755 --- a/application/api/controller/GoodsController.php +++ b/application/api/controller/GoodsController.php @@ -14,20 +14,22 @@ use app\common\model\MallImage; use app\common\model\ShopConfig; use app\common\model\PhaseConfig; use app\common\model\GoodsCollect; +use app\common\model\DevRegion; use tools\Crypt; use think\Request; +use think\facade\Cache; class GoodsController extends Controller { protected $authExcept = [ - 'goods_info','goods_list','category_list' + 'goods_info','goods_list','category_list','region_list' ]; //商品列表 public function goods_list(Request $request,Goods $model) { $param = $request->param(); - $size=$param['size']>0?$param['size']:12; + $size=$param['size']>0?$param['size']:9; $page_l=$param['page']>1?$param['page']:1; $page=$size * ($page_l - 1); $where[]=array('status','=',1); @@ -113,12 +115,17 @@ class GoodsController extends Controller $goods_info['collocation_goods'][$k1]['img'] =$this->img_url.$v1['img']; $goods_info['collocation_goods'][$k1]['goods_id'] = Crypt::encrypt($v1['goods_id']); } - $goods_info['goods_size']=explode("\r\n",$goods_info['goods_size']); - - $img_list=$mimodel->field('thumb_image,ori_image')->where(array('union_id'=>$gid,'type'=>1))->select(); + if($goods_info['goods_size']){ + $goods_info['goods_size']=explode("\r\n",$goods_info['goods_size']); + } + $goods_fm_img=''; + $img_list=$mimodel->field('thumb_image,ori_image,is_cover')->where(array('union_id'=>$gid,'type'=>1))->select(); foreach ($img_list as $key => $value) { $img_list[$key]['thumb_image'] =$this->img_url.$value['thumb_image']; $img_list[$key]['ori_image'] =$this->img_url.$value['ori_image']; + if($value['is_cover']==1){ + $goods_fm_img=$value['thumb_image']; + } } //尺寸图片 $size_img=$this->img_url.ShopConfig::get('website', 'size_img'); @@ -135,16 +142,17 @@ class GoodsController extends Controller $category_goods =$model ->alias('g') - ->field("mi.thumb_image as img, g.name,g.price,g.id as goods_id,gb.name as brand_name") - ->join('goods_brand gb', 'gb.id= g.brand_id') + ->field("mi.thumb_image as img,g.id as goods_id") ->join('mall_image mi', 'mi.union_id= g.id and is_cover=1 and mi.type=1', 'LEFT') ->where(array('g.goods_category_id'=>$goods_info['goods_category_id'],'g.status'=>1)) ->select(); + $category_goods_list[]=array('img'=>$goods_fm_img,'goods_id'=>$goods_info['goods_id']); foreach ($category_goods as $k1 => $v1) { - $category_goods[$k1]['img'] =$this->img_url.$v1['img']; - $category_goods[$k1]['goods_id'] = Crypt::encrypt($v1['goods_id']); + $v1['img'] =$this->img_url.$v1['img']; + $v1['goods_id'] = Crypt::encrypt($v1['goods_id']); + $category_goods_list[]=$v1; } - return success(array('info'=>$goods_info,'img_list'=>$img_list,'size_img'=>$size_img,'goodsitem_list'=>$goodsitem_list,'phaseconfig_list'=>$phaseconfig_list,'category_goods'=>$category_goods)); + return success(array('info'=>$goods_info,'img_list'=>$img_list,'size_img'=>$size_img,'goodsitem_list'=>$goodsitem_list,'phaseconfig_list'=>$phaseconfig_list,'category_goods'=>$category_goods_list)); } //商品筛选 @@ -165,6 +173,18 @@ class GoodsController extends Controller ); return success($data); } + + //省市区 + public function region_list(Request $request,DevRegion $drmodel) + { + $region=Cache::get('region_list'); + if(!$region){ + $region_list=$drmodel->field('name,id as cid,parent_id')->select(); + $region=getSubs($region_list,100000); + Cache::set('region_list',$region); + } + return success($region); + } //愿望清单列表 @@ -221,11 +241,12 @@ class GoodsController extends Controller if(!$user_id){ return unauthorized('请先授权'); } - $goods_id = $param['goods_id']?Crypt::decrypt($param['goods_id']):''; + $goods_id = $param['goods_id']?$param['goods_id']:''; if(!$goods_id){ return client_error('该商品不存在'); } if($param['is_collect']==1){ + $goods_id = Crypt::decrypt($param['goods_id']); $where = [ 'user_id' => $user_id, 'goods_id' => $goods_id @@ -242,7 +263,14 @@ class GoodsController extends Controller return success('','操作成功'); } }else{ - $res =$gcmodel->where(['goods_id'=>$goods_id,'user_id'=>$user_id])->delete(); + $goods_ids=array(); + foreach ($goods_id as $k1 => $v1) { + $goods_ids[] = Crypt::decrypt($v1); + } + if(count($goods_ids)==0){ + return client_error('该商品不存在'); + } + $res =$gcmodel->whereIn('goods_id',$goods_ids)->where(['user_id'=>$user_id])->delete(); } return $res ? success('','操作成功') : client_error('操作失败'); } diff --git a/application/api/controller/IndexController.php b/application/api/controller/IndexController.php index 67450f9..660156b 100755 --- a/application/api/controller/IndexController.php +++ b/application/api/controller/IndexController.php @@ -77,7 +77,7 @@ class IndexController extends Controller $sort=$param['sort']??'asc'; $order=$param['order']??'g.sort_number'; - $size=$param['size']>0?$param['size']:12; + $size=$param['size']>0?$param['size']:9; $page_l=$param['page']>1?$param['page']:1; $page=$size * ($page_l - 1); $goods_count = $model diff --git a/application/api/controller/OrderController.php b/application/api/controller/OrderController.php index 6ef3a10..ec213d3 100755 --- a/application/api/controller/OrderController.php +++ b/application/api/controller/OrderController.php @@ -358,7 +358,7 @@ class OrderController extends Controller if(!$takeparts_time){ return client_error('请选择取件时间'); } - $goods_id=json_decode($goods_id,true); + //$goods_id=json_decode($goods_id,true); //寄卖数量限制 $jmnum =ShopConfig::get('website', 'jmnum'); if($jmnum>count($goods_id)){ diff --git a/application/api/controller/PaymentController.php b/application/api/controller/PaymentController.php index cc9fee5..c1d5dd3 100755 --- a/application/api/controller/PaymentController.php +++ b/application/api/controller/PaymentController.php @@ -53,12 +53,12 @@ class PaymentController extends Controller $notify_url=ShopConfig::get('website', 'notify_url'); $WxxiaopayApi = new WxxiaopayApi($APPID,$MCHID,$WXPAYKEY,$notify_url); $log_ip=$request->ip(); - $wxData =$WxxiaopayApi->prePay($order_sn,$order_wechatsn,$order_sn,$order['openid'],$log_ip); + $wxData =$WxxiaopayApi->prePay($order_sn,$order_wechatsn,'0.01',$order['openid'],$log_ip); return success($wxData); } //微信小程序回调 - public function wxnotify(Request $request,FrontMemberLog $fmlmodel,FrontUserMember $fummodel) + public function wxnotify(Request $request,Order $omodel) { $xml = file_get_contents('php://input', 'r'); $data = $this->toArray($xml); @@ -67,25 +67,12 @@ class PaymentController extends Controller $order_sn = mb_substr($data['out_trade_no'],0,18); $parameter['transaction_id']= $data['transaction_id']; //支付宝交易号 $parameter['pay_time'] =time(); - $parameter['is_pay'] =1; - $order_info = $fmlmodel - ->alias('fml') - ->field('fml.*,fm.days as days') + $parameter['order_status'] =1; + $order_info = $omodel ->where(array('order_sn'=>$order_sn)) - ->join('front_member fm', 'fm.id = fml.member_id') ->find(); if($order_info){ - $fummodel_info=$fummodel->where(array('user_id'=>$order_info['user_id'],'cid'=>$order_info['cid']))->find(); - $days_num=(60*60*24)*$order_info['days']; - $data_info['end_time']=time()+$days_num; - if($fummodel_info){ - $fummodel->where(array('id'=>$fummodel_info['id']))->update($data_info); - }else{ - $data_info['user_id']=$order_info['user_id']; - $data_info['cid']=$order_info['cid']; - $fummodel::create($data_info); - } - $fmlmodel->where(array('order_sn'=>$order_sn))->update($parameter); + $omodel->where(array('id'=>$order_info['id']))->update($parameter); exit('success'); } } diff --git a/application/api/controller/UserController.php b/application/api/controller/UserController.php index b472ca2..82d4ea7 100755 --- a/application/api/controller/UserController.php +++ b/application/api/controller/UserController.php @@ -19,7 +19,9 @@ use tools\Crypt; class UserController extends Controller { - + protected $authExcept = [ + 'center_config' + ]; //个人中心 public function center(Request $request,GoodsCollect $gcmodel){ $param = $request->param(); @@ -29,7 +31,7 @@ class UserController extends Controller } $user = User::where('id',$user_id)->field('avatar,nickname,user_money')->find(); //消息数量 - $user->notice_num = Notice::unRead($user_id) ? 1 : 0; + $user->notice_num = Notice::unRead($user_id) ? 1 : 1; $goods_list=$gcmodel ->alias('gc') ->field("mi.thumb_image as img, g.name,g.price,g.id as goods_id,gb.name as brand_name") @@ -45,14 +47,25 @@ class UserController extends Controller $goods_list[$k1]['goods_id'] = Crypt::encrypt($v1['goods_id']); } $user->collect =$goods_list; + return success($user); + } + + //个人中心参数 + public function center_config(Request $request){ + $param = $request->param(); + $user=array(); //联系我们 - $user->contactus =ShopConfig::get('policy', 'contactus'); + $user['contactus'] =ShopConfig::get('policy', 'contactus'); //社群与交流 - $user->community =ShopConfig::get('policy', 'community'); + $user['community'] =ShopConfig::get('policy', 'community'); //隐私政策 - $user->privacy =ShopConfig::get('policy', 'privacy'); + $user['privacy'] =ShopConfig::get('policy', 'privacy'); //条款与条件 - $user->clause =ShopConfig::get('policy', 'clause'); + $user['clause'] =ShopConfig::get('policy', 'clause'); + //分享图片 + $user['share_img'] =$this->img_url.ShopConfig::get('website', 'share_img'); + //小程序太阳码 + $user['wxqrcode'] =$this->img_url.ShopConfig::get('website', 'wxqrcode'); return success($user); } @@ -510,6 +523,7 @@ class UserController extends Controller $result = $wamodel->whereIn('id', $param['id'])->delete(); return $result ? success('','删除成功') : client_error('删除失败'); } + //提现操作 public function wthdrawal(Request $request,WithdrawAccount $wamodel,WithdrawApply $waymodel,AccountLog $almodel,User $umodel) { @@ -519,32 +533,32 @@ class UserController extends Controller return unauthorized('请先授权'); } //提现积分 - $integral = $param['integral']??'0'; - //提现账户 - $account_id = $param['account_id']?Crypt::decrypt($param['account_id']):''; - if(!$account_id){ - return client_error('请选择提现账户'); - } - $account_info=$wamodel->where(array('id'=>$account_id))->find(); - if(!$account_info){ - return client_error('请选择提现账户'); - } - $umodel_info=$umodel->field('integral')->where(array('id'=>$uid))->find(); - if($umodel_info['integral']<$integral){ - return client_error('积分不足,无法提现'); + $money = $param['money']??'0'; + // //提现账户 + // $account_id = $param['account_id']?Crypt::decrypt($param['account_id']):''; + // if(!$account_id){ + // return client_error('请选择提现账户'); + // } + // $account_info=$wamodel->where(array('id'=>$account_id))->find(); + // if(!$account_info){ + // return client_error('请选择提现账户'); + // } + $umodel_info=$umodel->field('user_money')->where(array('id'=>$uid))->find(); + if($umodel_info['user_money']<$money){ + return client_error('金额不足,无法提现'); } $min_withdraw =ShopConfig::get('withdraw', 'min_withdraw');//最低提现 $max_withdraw =ShopConfig::get('withdraw', 'max_withdraw');//最高提现积分 $poundage_type =ShopConfig::get('withdraw', 'poundage_type');//手续费类型 1固定 2比例 $poundage =ShopConfig::get('withdraw', 'poundage');//手续费 - if($integral<$min_withdraw){ - return client_error('最少提现积分数'.$min_withdraw.',无法提现'); + if($money<$min_withdraw){ + return client_error('最少提现金额'.$min_withdraw.',无法提现'); } - if($integral>$max_withdraw){ - return client_error('最多提现积分数'.$max_withdraw.',无法提现'); + if($money>$max_withdraw){ + return client_error('最多提现金额'.$max_withdraw.',无法提现'); } if($poundage_type==2){ - $poundage=$integral*($poundage/100); + $poundage=$money*($poundage/100); } // 启动事务 $waymodel->startTrans(); @@ -553,14 +567,14 @@ class UserController extends Controller $data = [ 'sn' => createSn('withdraw_apply', 'sn'), 'user_id' => $uid, - 'type' => $account_info['type'], - 'account' => $account_info['account'] ?? '', - 'real_name' => $account_info['real_name'] ?? '', - 'real_tel' => $account_info['real_tel'] ?? '', - 'money' => $integral, - 'left_money' => $integral - $poundage, + //'type' => $account_info['type'], + //'account' => $account_info['account'] ?? '', + //'real_name' => $account_info['real_name'] ?? '', + //'real_tel' => $account_info['real_tel'] ?? '', + 'money' => $money, + 'left_money' => $money - $poundage, 'money_qr_code' => '', - 'subbank' => $account_info['subbank'] ?? '', + //'subbank' => $account_info['subbank'] ?? '', 'poundage' => $poundage, 'status' => 1, // 待提现 'create_time' => time(), @@ -568,19 +582,21 @@ class UserController extends Controller $withdraw_id = $waymodel->insertGetId($data); //提交申请后,扣减用户的积分 $user = User::get($uid); - $user->integral = ['dec', $integral]; + $user->user_money = ['dec', $money]; $user->save(); //增加佣金变动记录 $almodel->AccountRecord( $uid, - $integral, + $money, 2, - 140, + 120, '', $withdraw_id, $data['sn'] ); + $money_sum=$umodel_info['user_money']-$money; + $money_sum=sprintf("%.2f",$money_sum); // 提交事务 $waymodel->commit(); }catch(\Exception $e){ @@ -588,6 +604,6 @@ class UserController extends Controller $waymodel->rollback(); return client_error($e->getMessage()); } - return success('','提交提现申请成功,等待审核打款'); + return success($money_sum,'提交提现申请成功,等待审核打款'); } } diff --git a/application/common/model/Order.php b/application/common/model/Order.php index f6ef089..2865ca4 100755 --- a/application/common/model/Order.php +++ b/application/common/model/Order.php @@ -7,6 +7,7 @@ namespace app\common\model; use think\model\concern\SoftDelete; use think\db; +use app\common\model\ShopConfig; class Order extends Model { use SoftDelete; @@ -123,14 +124,18 @@ class Order extends Model $goods_lists = array(); $total_num = 0;//商品总数量 $total_goods_price = 0;//商品总金额 + $img_url=ShopConfig::get('website', 'img_url'); foreach ($goods as $good) { $good['sub_price'] = round($good['goods_price'] * $good['goods_num'], 2); + $good['goods_img'] = $good['goods_img']; + $good['goods_img_url'] = $img_url.$good['goods_img']; $goods_item=Db::name('goods_item')->where(array('spec_value'=>$good['item_value'],'goods_id'=>$good['goods_id']))->find(); $good['stock'] =$goods_item['stock']; $goods_lists[] = $good; //订单汇总信息 $total_num += $good['goods_num']; $total_goods_price += $good['goods_price'] * $good['goods_num']; + } if (empty($goods_lists)) { $data=[ diff --git a/application/common/model/UserAddress.php b/application/common/model/UserAddress.php index 512ed8e..688771e 100755 --- a/application/common/model/UserAddress.php +++ b/application/common/model/UserAddress.php @@ -21,7 +21,7 @@ class UserAddress extends Model public static function infoUserAddress($user_id){ $info = Db::name('user_address') ->where(['user_id'=>$user_id]) - ->field('id,contact,telephone,province_id,city_id,district_id,address,is_default') + ->field('id,contact,telephone,province_id,city_id,district_id,address,is_default,post_code') ->select(); foreach ($info as &$item) { $item['province'] = self::getAddress($item['province_id']); @@ -38,7 +38,7 @@ class UserAddress extends Model public static function getDefaultAddress($user_id){ $info = Db::name('user_address') ->where(['is_default'=>1,'user_id'=>$user_id]) - ->field('id,contact,telephone,province_id,city_id,district_id,address,is_default') + ->field('id,contact,telephone,province_id,city_id,district_id,address,is_default,post_code') ->find(); if (!$info){ return []; @@ -105,6 +105,7 @@ class UserAddress extends Model 'district_id' => $post['district_id'], 'address' => $post['address'], 'is_default' => $post['is_default'], + 'post_code' => $post['post_code'], 'create_time' => time() ]; $result = Db::name('user_address')->insert($data); @@ -138,6 +139,7 @@ class UserAddress extends Model 'district_id' => $post['district_id'], 'address' => $post['address'], 'is_default' => $post['is_default'], + 'post_code' => $post['post_code'], 'update_time' => time() ]; $result = Db::name('user_address') @@ -170,7 +172,7 @@ class UserAddress extends Model { $info = Db::name('user_address') ->where(['id' => $address, 'user_id' => $user_id]) - ->field('id,contact,telephone,province_id,city_id,district_id,address,is_default') + ->field('id,contact,telephone,province_id,city_id,district_id,address,is_default,post_code') ->find(); if (!$info) { diff --git a/application/common/model/WithdrawApply.php b/application/common/model/WithdrawApply.php index 127aeb6..db85cc7 100755 --- a/application/common/model/WithdrawApply.php +++ b/application/common/model/WithdrawApply.php @@ -18,7 +18,7 @@ class WithdrawApply extends Model //withdraw public $WITHDRAW_TYPE = [ '1' =>'支付宝', - '2' =>'微信', + '0' =>'微信零钱', '3' =>'银行卡', ]; diff --git a/config/cache.php b/config/cache.php index 985dbb1..d1c7e27 100755 --- a/config/cache.php +++ b/config/cache.php @@ -22,4 +22,5 @@ return [ 'prefix' => '', // 缓存有效期 0表示永久缓存 'expire' => 0, + 'path' => app()->getRootPath().'runtime/cache/', ]; diff --git a/route/route.php b/route/route.php index 442f1fc..2c4b77f 100755 --- a/route/route.php +++ b/route/route.php @@ -31,7 +31,8 @@ Route::domain('dgg-jimai-api', function () { //操作愿望清单 Route::rule('handlecollectgoods','api/goods/handlecollectgoods'); - + //获取省市区 + Route::rule('region_list','api/goods/region_list'); //添加购物车 Route::rule('caet-add','api/cart/add'); @@ -87,22 +88,23 @@ Route::domain('dgg-jimai-api', function () { Route::rule('u-ordercancel','api/user/ordercancel'); //我的订单确认收货 Route::rule('u-orderconfirm','api/user/orderconfirm'); + //我的用户中心参数 + Route::rule('u-center_config','api/user/center_config'); //我的地址列表 - Route::rule('u-addresslists','api/useraddress/lists'); + Route::rule('u-addresslists','api/user_address/lists'); //我的地址默认 - Route::rule('u-addresssetdefault','api/useraddress/setdefault'); + Route::rule('u-addresssetdefault','api/user_address/setdefault'); //我的地址添加 - Route::rule('u-addressadd','api/useraddress/add'); + Route::rule('u-addressadd','api/user_address/add'); //我的地址编辑 - Route::rule('u-addressedit','api/useraddress/update'); + Route::rule('u-addressedit','api/user_address/update'); //我的地址删除 - Route::rule('u-addressdel','api/useraddress/del'); + Route::rule('u-addressdel','api/user_address/del'); + //提现申请 + Route::rule('u-wthdrawal','api/user/wthdrawal'); - - - //收益统计 Route::rule('u-profit_census','api/user/profit_census'); //提现记录 @@ -119,10 +121,6 @@ Route::domain('dgg-jimai-api', function () { Route::rule('u-account_add','api/user/account_add'); //删除账户 Route::rule('u-account_dal','api/user/account_dal'); - //提现申请 - Route::rule('u-wthdrawal','api/user/wthdrawal'); - //领取体验设备 - Route::rule('u-experience','api/user/experience'); //miss路由 Route::miss(function (){ diff --git a/runtime/temp/0a321b07c8fc33ed33a6e11c516520e3.php b/runtime/temp/0a321b07c8fc33ed33a6e11c516520e3.php index af19d61..0a1d2a3 100755 --- a/runtime/temp/0a321b07c8fc33ed33a6e11c516520e3.php +++ b/runtime/temp/0a321b07c8fc33ed33a6e11c516520e3.php @@ -1,4 +1,4 @@ - + @@ -235,7 +235,7 @@ - Copyright © 2020 . All rights + Copyright © 2022 . All rights reserved. diff --git a/runtime/temp/23a9125deeac5660389513769a7f67ff.php b/runtime/temp/23a9125deeac5660389513769a7f67ff.php index 8b25fc1..f993802 100755 --- a/runtime/temp/23a9125deeac5660389513769a7f67ff.php +++ b/runtime/temp/23a9125deeac5660389513769a7f67ff.php @@ -1,4 +1,4 @@ - + @@ -374,7 +374,7 @@ - Copyright © 2020 . All rights + Copyright © 2022 . All rights reserved. diff --git a/runtime/temp/43b0bbc24aac33245d5c697d3b42eb57.php b/runtime/temp/43b0bbc24aac33245d5c697d3b42eb57.php index 7353549..4fd2b88 100755 --- a/runtime/temp/43b0bbc24aac33245d5c697d3b42eb57.php +++ b/runtime/temp/43b0bbc24aac33245d5c697d3b42eb57.php @@ -1,4 +1,4 @@ - + diff --git a/runtime/temp/6c85cabfeb55988c16eebdf9d16fb180.php b/runtime/temp/6c85cabfeb55988c16eebdf9d16fb180.php index 53165d4..3a5f7e2 100755 --- a/runtime/temp/6c85cabfeb55988c16eebdf9d16fb180.php +++ b/runtime/temp/6c85cabfeb55988c16eebdf9d16fb180.php @@ -1,4 +1,4 @@ - + diff --git a/runtime/temp/98b3c4ff4fb93242dabc9398a0775641.php b/runtime/temp/98b3c4ff4fb93242dabc9398a0775641.php index 0407887..29c3744 100755 --- a/runtime/temp/98b3c4ff4fb93242dabc9398a0775641.php +++ b/runtime/temp/98b3c4ff4fb93242dabc9398a0775641.php @@ -1,4 +1,4 @@ - + @@ -112,7 +112,7 @@
- + diff --git a/runtime/temp/ce8ecc9e12adf5d8127ce76862c569c1.php b/runtime/temp/ce8ecc9e12adf5d8127ce76862c569c1.php index fb2a11b..a6864c8 100755 --- a/runtime/temp/ce8ecc9e12adf5d8127ce76862c569c1.php +++ b/runtime/temp/ce8ecc9e12adf5d8127ce76862c569c1.php @@ -1,4 +1,4 @@ - + @@ -147,7 +147,7 @@
- + diff --git a/runtime/temp/d41b160c460be4dd3ee8660ea187db57.php b/runtime/temp/d41b160c460be4dd3ee8660ea187db57.php index ec971ac..9e620e7 100755 --- a/runtime/temp/d41b160c460be4dd3ee8660ea187db57.php +++ b/runtime/temp/d41b160c460be4dd3ee8660ea187db57.php @@ -1,4 +1,4 @@ - + diff --git a/runtime/temp/e36eb1afe42271d845632f25a7797fdb.php b/runtime/temp/e36eb1afe42271d845632f25a7797fdb.php index be799ce..5bbd5f9 100755 --- a/runtime/temp/e36eb1afe42271d845632f25a7797fdb.php +++ b/runtime/temp/e36eb1afe42271d845632f25a7797fdb.php @@ -1,4 +1,4 @@ - + @@ -334,9 +334,9 @@ ul.albums li a.btn-fm_z{ 多个尺寸请用英文逗号分隔 -
+
-
    +
    @@ -353,7 +353,7 @@ ul.albums li a.btn-fm_z{ ,field:'image' ,multiple: true ,done: function(res){ - $(".albums img").attr('src',res.data.avatar_logo); + $("#albums_size_img img").attr('src',res.data.avatar_logo); $("#size_img").val(res.data.avatar_logo); } ,error: function(){ @@ -363,6 +363,64 @@ ul.albums li a.btn-fm_z{ }); }); +
    + +
      +
    • + +
    +
    + +
    + +
      +
    • + +
    +
    +