diff --git a/addon/futures/api/controller/Futures.php b/addon/futures/api/controller/Futures.php index 30299271..e7a8295a 100644 --- a/addon/futures/api/controller/Futures.php +++ b/addon/futures/api/controller/Futures.php @@ -89,6 +89,7 @@ class Futures extends BaseApi{ if($search_text != ''){ $condition[] = ['o.order_no','like','%'.$search_text.'%']; } +// $this->member_id=108; //(1=库存,2=已上架,3=已售出,4=提货中,5=提货完成,6=待支付,7=捡漏,8=拆单) switch($status){ case 6: //买家未付款 @@ -130,7 +131,7 @@ class Futures extends BaseApi{ $field = [ 'seller.username as seller_username', 'seller.nickname as seller_nickname', - 'seller.headimg as seller_headimg', + 'seller.headimg as seller_headimg', 'g.goods_name', 'g.goods_image', 'g.market_price', @@ -148,6 +149,7 @@ class Futures extends BaseApi{ 'o.adjust_money', 'o.pay_money', 'o.order_id', + 'o.name as buyer_name', ]; // 表关联 $join = [ @@ -174,20 +176,22 @@ class Futures extends BaseApi{ $id = input('id', 0); $price = input('price', 0); $agree_split_order = input('agree_split_order', 0); - $date = model('futures')->getInfo([['id', '=', $id],['seller_uid', '=', $this->member_id]]); if(empty($date)){ return $this->response($this->error('','发布失败')); } - $futuresModel = new FuturesModel; $basicsConfig = $futuresModel->getBasicsConfig($this->site_id)['data']['value']; - if(!($price > sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['min'] / 100)) && $price <= sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['max'] / 100)))){// 后台配置范围 - return $this->response($this->error('','发布失败,价格不在允许范围内'.sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['min'] / 100)).'-'.sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['max'] / 100)))); + + +// if(!($price > sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['min'] / 100)) && $price <= sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['max'] / 100)))){// 后台配置范围 +// return $this->response($this->error('','发布失败,价格不在允许范围内'.sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['min'] / 100)).'-'.sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['max'] / 100)))); +// } + + if(!($price <= sprintf('%.2f',$date['unit_price'] * (1 + $basicsConfig['price_range']['max'] / 100)))){// 后台配置范围 + return $this->response($this->error('','发布失败,价格不得高于市场价格')); } - // 限制发布时间 - return $this->response($futuresModel->release($id, $price, $agree_split_order)); } @@ -198,17 +202,15 @@ class Futures extends BaseApi{ public function stock(){ $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); - $id = input('id', 0); - $date = model('futures')->getInfo([['id', '=', $id],['seller_uid', '=', $this->member_id]]); if(empty($date)){ return $this->response($this->error('','下架失败')); } - $futuresModel = new FuturesModel; return $this->response($futuresModel->stock($id)); } + /** * 提货 * @return false|string @@ -217,28 +219,23 @@ class Futures extends BaseApi{ public function pickUp(){ $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); - $id = input('id', 0); - $date = model('futures')->getInfo([['id', '=', $id],['seller_uid', '=', $this->member_id]]); if(empty($date)){ return $this->response($this->error('','提货失败')); } - $futuresModel = new FuturesModel; return $this->response($futuresModel->pickUp($id)); } + /** * 详情 * @return false|string */ public function detail(){ - $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); - $id = input('id', 0); - $futuresModel = new FuturesModel; $detail = $futuresModel->detail($id, $this->site_id); $times = $futuresModel->checkTimes($this->site_id, $this->member_id, $detail['data']['status']); @@ -260,20 +257,20 @@ class Futures extends BaseApi{ $res = [ 'price_range' => $basicsConfig['price_range'], 'service_price' => $basicsConfig['service_price'], + 'proposed_range' => $basicsConfig['proposed_range'], + 'technical_range' => $basicsConfig['technical_range'], ]; return $this->response($this->success($res)); } + /** * 详情 * @return false|string */ public function myDetail(){ - $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); - $id = input('id', 0); - $futuresModel = new FuturesModel; $detail = $futuresModel->detail($id, $this->site_id); if($detail['code'] < 0 || empty($detail['data']) || !($detail['data']['seller_uid'] == $this->member_id || $detail['data']['member_id'] == $this->member_id)){ @@ -292,7 +289,4 @@ class Futures extends BaseApi{ return $this->response($info); } - // public function testBuyBack(){ - // return $this->response(event('BuyBack')); - // } } \ No newline at end of file diff --git a/addon/futures/api/controller/Ordercreate.php b/addon/futures/api/controller/Ordercreate.php index ebb0f9b1..553b7dae 100644 --- a/addon/futures/api/controller/Ordercreate.php +++ b/addon/futures/api/controller/Ordercreate.php @@ -14,12 +14,9 @@ namespace addon\futures\api\controller; use app\api\controller\BaseApi; use addon\futures\model\order\FuturesOrderCreate as OrderCreateModel; -use app\model\system\Pay; - /** * 订单创建 * @author Administrator - * */ class Ordercreate extends BaseApi { @@ -45,8 +42,10 @@ class Ordercreate extends BaseApi 'latitude' => $this->params[ 'latitude' ] ?? '', 'longitude' => $this->params[ 'longitude' ] ?? '', - 'is_invoice' => $this->params[ 'is_invoice' ] ?? 0, + + 'pay_password' => $this->params[ 'payPassword' ] ?? '', + 'invoice_type' => $this->params[ 'invoice_type' ] ?? 0, 'invoice_title' => $this->params[ 'invoice_title' ] ?? '', 'taxpayer_number' => $this->params[ 'taxpayer_number' ] ?? '', @@ -60,13 +59,9 @@ class Ordercreate extends BaseApi 'goods_sku_list' => !empty($this->params['goods_sku_list']) ? json_decode($this->params['goods_sku_list'], true) : [], 'sku_id' => isset($this->params['sku_id']) ? $this->params['sku_id'] : '', ]; - var_dump($data);die; - if ($data[ 'futures_id' ] == 0) { - return $this->response($this->error('', '缺少必填参数商品数据')); - } - $pay = new Pay(); - $out_trade_no = $pay->createOutTradeNo($data[ 'member_id' ]); - return $this->success($out_trade_no); + if ($data[ 'futures_id' ] == 0) { + return $this->response($this->error('', '缺少必填参数商品数据')); + } $res = $order_create->create($data); return $this->response($res); } @@ -139,7 +134,6 @@ class Ordercreate extends BaseApi if ($data[ 'futures_id' ] == 0) { return $this->response($this->error('', '缺少必填参数商品数据')); } - $res = $order_create->orderPayment($data); return $this->response($res); } diff --git a/addon/futures/api/controller/User.php b/addon/futures/api/controller/User.php index 2ab3003e..48387f03 100644 --- a/addon/futures/api/controller/User.php +++ b/addon/futures/api/controller/User.php @@ -1,15 +1,12 @@ checkToken(); if ($token['code'] < 0) return $this->response($token); - $info = model('futures_user')->getInfo([['member_id', '=', $this->member_id]]); - if(empty($info)){ $data['member_id'] = $this->member_id; $data['site_id'] = $this->site_id; @@ -17,7 +14,6 @@ class User extends BaseApi{ model('futures_user')->add($data); $info = model('futures_user')->getInfo([['member_id', '=', $this->member_id]]); } - return $this->response($this->success($info)); } } \ No newline at end of file diff --git a/addon/futures/config/menu_shop.php b/addon/futures/config/menu_shop.php index 21b9492f..90fe9c18 100644 --- a/addon/futures/config/menu_shop.php +++ b/addon/futures/config/menu_shop.php @@ -7,7 +7,7 @@ return [ 'name' => 'TRADING_MARKET', 'title' => '交易市场', 'url' => 'futures://shop/futures/index', - 'parent' => 'CHANNEL_ROOT', + 'parent' => 'PROMOTION_CENTER', 'is_show' => 1, 'sort' => 1, 'picture' => 'addon/futures/shop/view/public/img/futures_new.png', // 图标 @@ -15,7 +15,7 @@ return [ 'child_list' => [ [ 'name' => 'TRADING_MARKET_HOME', - 'title' => '交易市场', + 'title' => '交易订单', 'url' => 'futures://shop/futures/index', 'is_show' => 1, 'sort' => 1, @@ -33,12 +33,7 @@ return [ 'url' => 'futures://shop/config/basics', 'is_show' => 1, 'sort' => 2, - ], - - - - - + ] ] ], ]; diff --git a/addon/futures/event/MemberRegister.php b/addon/futures/event/MemberRegister.php index 28367a15..eb2da59d 100644 --- a/addon/futures/event/MemberRegister.php +++ b/addon/futures/event/MemberRegister.php @@ -8,29 +8,32 @@ * ========================================================= */ - namespace addon\futures\event; - +use addon\futures\model\Futures as FuturesModel; +use app\model\member\MemberAccount; use think\facade\Db; - class MemberRegister { - // 会员注册 public function handle($param){ // 获取用户id $memberId = $param['member_id'] ?? 0; if($memberId > 0){ + $futuresModel = new FuturesModel; $memberInfo = Db::name('member') ->field('member_id,site_id') ->where('member_id',$memberId) ->find(); + $basics = $futuresModel->getBasicsConfig($memberInfo['site_id'])['data']['value']; + if($basics['newuser_points']){ + $member_account = new MemberAccount(); + $member_account->addMemberAccount($memberInfo['site_id'], $memberInfo['member_id'], 'diamond', $basics['newuser_points'], 'diamond', '赠送猕猴桃', '新用户注册赠送猕猴桃'); + } $data = [ 'site_id' => $memberInfo['site_id'], 'member_id' => $memberInfo['member_id'], 'created_time' => time() ]; - Db::name('futures_user')->insert($data); } } diff --git a/addon/futures/event/OrderPay.php b/addon/futures/event/OrderPay.php index 1bee8009..276fceed 100644 --- a/addon/futures/event/OrderPay.php +++ b/addon/futures/event/OrderPay.php @@ -20,8 +20,8 @@ class OrderPay public function handle($param){ if($param['promotion_type'] == 'futures'){ $futures_model = new Futures(); -// $result = $futures_model->orderComplete($param['promotion_id'],$param['order_id']); - (new Forder())->calculate($param); + $result = $futures_model->orderComplete($param['promotion_id'],$param['order_id']); + (new Forder())->calculate($param); //计算订单佣金 }else{ $goods_ids = model("order_goods")->getList([[ 'order_id', '=', $param[ 'order_id' ] ] ], 'goods_id'); $diamond = model("goods")->getSum([['goods_id', 'in', array_column($goods_ids,'goods_id')]], 'give_diamond'); @@ -29,7 +29,7 @@ class OrderPay $site_id=$param['site_id']; $member_id=$param['member_id']; $member_account = new MemberAccount(); - $member_account->addMemberAccount($site_id, $member_id, 'diamond', $diamond, 'diamond', '赠送钻石', '会员购物赠送钻石',$param[ 'order_id' ]); + $member_account->addMemberAccount($site_id, $member_id, 'diamond', $diamond, 'diamond', '赠送猕猴桃', '会员购物赠送猕猴桃',$param[ 'order_id' ]); } } return success(); diff --git a/addon/futures/model/Futures.php b/addon/futures/model/Futures.php index 903d5c57..7f781276 100644 --- a/addon/futures/model/Futures.php +++ b/addon/futures/model/Futures.php @@ -2,6 +2,7 @@ namespace addon\futures\model; use addon\fenxiao\model\FenxiaoAccount; +use addon\futures\model\Futures as FuturesModel; use addon\message\model\Message; use app\model\member\MemberAccount; use app\model\system\Config as ConfigModel; @@ -93,6 +94,7 @@ class Futures extends BaseModel{ Cache::store('redis_concurrent')->set('addon_futures_stock_'.$id,'1'); return $this->success($id); } + /** * 发布 * @param $id @@ -141,14 +143,22 @@ class Futures extends BaseModel{ } } $service_price = $price * $basics['service_price'] / 100; + $technical_range=$service_price*$basics['technical_range']/100; + if(model('member')->getValue(['member_id'=>$date['seller_uid']],'balance_money')<$service_price){ + return error(-800, '您余额不足!'); + } model('futures')->update([ 'status' => $futuresInfo['status'], 'release_time' => time() + $basics['release_wait'] * 24 * 60 * 60,// 配置上线延迟时间 'price' => $price, 'total' => $futuresInfo['total'], 'service_price' => $service_price, - 'real_income' => $price - $service_price, + 'real_income' => $price, ],[['id','=',$id]]); + //扣除服务费 + $memberAccountModel = new MemberAccount(); + $memberAccountModel->addMemberAccount($date['site_id'], $date['seller_uid'], 'balance_money', -$technical_range, 'service_price', $date['id'], '服务费', $date['id']); + $memberAccountModel->addMemberAccount($date['site_id'], $date['seller_uid'], 'balance_money', -$service_price-$technical_range, 'service_price', $date['id'], '商家分账', $date['id']); model('futures')->commit(); Cache::store('redis_concurrent')->set('addon_futures_'.$id,'1'); return $this->success(); @@ -174,6 +184,10 @@ class Futures extends BaseModel{ model('futures')->update([ 'status' => 1, ], [['id', '=', $id]]); + //扣除服务费 + $memberAccountModel = new MemberAccount(); + $memberAccountModel->addMemberAccount($date['site_id'], $date['seller_uid'], 'balance_money', $date['service_price'], 'service_price', $date['id'], '退回服务费与商家分账', $date['id']); + Cache::store('redis_concurrent')->set('addon_futures_stock_'.$id,'1'); return $this->success(); } /** @@ -193,13 +207,12 @@ class Futures extends BaseModel{ model('futures')->update([ 'status' => 5, ], [['id', '=', $id]]); - $basics = $this->getBasicsConfig($date['site_id'])[ 'data' ][ 'value' ]; // 提货用来减少用户买入限制 Db::name('futures_user') - ->where('member_id',$date['member_id']) + ->where('member_id', $date['member_id']) ->update([ - 'business_num' => Db::raw('business_num-'.$basics['order_restrictions_num']), + 'business_num' => Db::raw('business_num-' . $basics['order_restrictions_num']), ]); return $this->success(); } @@ -209,26 +222,28 @@ class Futures extends BaseModel{ * @return array */ public function orderCreate($id, $order_id, $member_id){ + $date = model('futures')->getInfo([['id', '=', $id]]); if(empty($date) || ($date['status'] !== 2 && $date['status'] !== 7)){ return $this->error($date,'下单失败-1001'); } - if(!Cache::store('redis_concurrent')->delete('addon_futures_'.$id)){ - return $this->error('','下单失败-1002'); - } - model('futures')->update([ +// if(!Cache::store('redis_concurrent')->delete('addon_futures_'.$id)){ +// return $this->error('','下单失败-1002'); +// } + model('futures')->update( + [ 'status' => 6, 'created_time' => time(), 'member_id' => $member_id, 'order_id' => $order_id, - ], [['id', '=', $id]]); - + ], + [['id', '=', $id]]); // 增加用户已下单次数 - Db::name('futures_user') - ->where('member_id',$date['member_id']) + $res=Db::name('futures_user') + ->where('member_id',$member_id) ->update([ - 'business_num' => Db::raw('business_num+1'), - 'total_business_num' => Db::raw('total_business_num+1'), + 'business_num' => Db::raw('business_num +1'), + 'total_business_num' => Db::raw('total_business_num +1'), ]); (new Message())->addMessage($date['site_id'],'订单创建',1,$member_id,$id); Cache::store('redis_concurrent')->set('addon_futures_pay_'.$id,'1'); @@ -270,9 +285,16 @@ class Futures extends BaseModel{ // 给用户增加余额 $memberAccountModel = new MemberAccount(); $memberAccountModel->addMemberAccount($date['site_id'], $date['seller_uid'], 'balance_money', $date['price'], 'sell', $date['id'], '售卖产品', $date['id']); - $memberAccountModel->addMemberAccount($date['site_id'], $date['seller_uid'], 'balance_money', -$date['service_price'], 'service_price', $date['id'], '服务费', $date['id']); + $futuresModel = new FuturesModel; + $basics = $futuresModel->getBasicsConfig($date['site_id'])['data']['value']; + if ($basics['give_integral'] > 0) { //首单赠送积分 + if (model('futures')->getCount(['seller_uid'=>$date['member_id']])==1) { + $memberAccountModel->addMemberAccount($date['site_id'], $date['member_id'], 'point', $basics['give_integral'], 'sell', $date['id'], '秒杀首单赠送积分', $date['id']); + } + } + $point=$date['price']*$basics['order_give_points_ratio']/100; //赠送积分 - $memberAccountModel->addMemberAccount($date['site_id'], $date['member_id'], 'point', $date['price'], 'sell', $date['id'], '秒杀赠送积分', $date['id']); + $memberAccountModel->addMemberAccount($date['site_id'], $date['member_id'], 'point', intval($point), 'sell', $date['id'], '秒杀赠送积分', $date['id']); return $this->success(); } diff --git a/addon/futures/model/order/FuturesOrderCreate.php b/addon/futures/model/order/FuturesOrderCreate.php index 29d54ff2..0742b9fa 100644 --- a/addon/futures/model/order/FuturesOrderCreate.php +++ b/addon/futures/model/order/FuturesOrderCreate.php @@ -13,12 +13,14 @@ namespace addon\futures\model\order; use addon\fenxiao\model\FenxiaoAccount; use addon\futures\model\Futures; use addon\futures\model\Futures as FuturesModel; +use addon\member\model\Member; use app\model\member\MemberAccount; use app\model\order\Config; use app\model\order\OrderCreate; use app\model\goods\GoodsStock; use app\model\store\Store; use app\model\express\Express; +use app\model\system\Cron; use app\model\system\Pay; use app\model\express\Config as ExpressConfig; use app\model\express\Local; @@ -95,6 +97,8 @@ class FuturesOrderCreate extends OrderCreate $order_type = $this->orderType($shop_goods_list, $calculate_data); $order_no = $this->createOrderNo($shop_goods_list[ 'site_id' ], $data[ 'member_id' ]); $member_address = $calculate_data[ 'member_address' ]; + $member_info= $calculate_data[ 'member_account' ]; + $times= $calculate_data[ 'times' ]['original']; $data_order = [ 'order_no' => $order_no, 'site_id' => $site_id, @@ -119,6 +123,7 @@ class FuturesOrderCreate extends OrderCreate 'longitude' => $member_address[ 'longitude' ] ?? '', 'latitude' => $member_address[ 'latitude' ] ?? '', 'buyer_ip' => request()->ip(), + 'buyer_nickname' => $member_info['nickname'], 'goods_money' => $shop_goods_list[ 'goods_money' ], 'delivery_money' => $shop_goods_list[ 'delivery_money' ], 'coupon_id' => $shop_goods_list[ 'coupon_id' ] ?? 0, @@ -160,7 +165,6 @@ class FuturesOrderCreate extends OrderCreate $order_id = model('order')->add($data_order); $pay_money += $shop_goods_list[ 'pay_money' ]; //订单项目表 - foreach ($shop_goods_list[ 'goods_list' ] as $k_order_goods => $order_goods) { $data_order_goods = array ( 'order_id' => $order_id, @@ -192,18 +196,19 @@ class FuturesOrderCreate extends OrderCreate $order_goods_id = model('order_goods')->add($data_order_goods); $calculate_data[ 'shop_goods_list' ][ 'goods_list' ][ $k_order_goods ][ 'order_goods_id' ] = $order_goods_id; } - $futures_model = new Futures; $futures_info = $futures_model->orderCreate($data['futures_id'],$order_id,$data['member_id']); if ($futures_info[ 'code' ] != 0) { model('order')->rollback(); return $futures_info; } + // 提前秒杀扣除钻石 if($calculate_data['times']['is_early']){ $member_account = new MemberAccount(); - $member_account->addMemberAccount($site_id, $data['member_id'], 'balance', -1, 'diamond', '秒杀抵扣钻石', '会员抢购抵扣钻石',$order_id); + $member_account->addMemberAccount($site_id, $data['member_id'], 'diamond', -1, 'diamond', '秒杀抵扣猕猴桃', '会员抢购抵猕猴桃',$order_id); } + $result_list = event('OrderCreate', [ 'order_id' => $order_id, 'site_id' => $shop_goods_list[ 'site_id' ],'create_data' => $calculate_data ]); if (!empty($result_list)) { foreach ($result_list as $k => $v) { @@ -214,8 +219,15 @@ class FuturesOrderCreate extends OrderCreate } } //生成整体支付单据 - $pay->addPay($shop_goods_list[ 'site_id' ], $out_trade_no, $this->pay_type, $this->order_name, $this->order_name, $this->pay_money, '', 'OrderPayNotify', '/pages_rush/futures/order?status=stock');//'/pages_rush/order/detail?order_id=' . $order_id - $this->addOrderCronClose($order_id, $shop_goods_list[ 'site_id' ]);//增加关闭订单自动事件 +// $pay->addPay($shop_goods_list[ 'site_id' ], $out_trade_no, $this->pay_type, $this->order_name, $this->order_name, $this->pay_money, '', 'OrderPayNotify', '/pages_rush/futures/order?status=stock');//'/pages_rush/order/detail?order_id=' . $order_id + $execute_time = $times['miaosha_end_time'] ?? ''; + if ($execute_time) { + $cron_model = new Cron(); + $execute_time +=strtotime(date('Ymd')); + $cron_model->addCron(1, 0, "订单自动关闭", "CronOrderClose", $execute_time, $order_id); + } else { + $this->addOrderCronClose($order_id, $shop_goods_list['site_id']);//增加关闭订单自动事件 + } model('order')->commit(); return $this->success($out_trade_no); } catch (\Exception $e) { @@ -236,6 +248,11 @@ class FuturesOrderCreate extends OrderCreate if ($data[ 'is_balance' ] > 0) { $this->member_balance_money = $data[ 'member_account' ][ 'balance_total' ] ?? 0; } + $member_model = new Member(); + $result = $member_model->checkPayPassword($data["member_id"], $data["pay_password"]); + if ($result["code"] < 0) { + return error(-1,'支付密码不正确'); + } $member_id = $data['member_id']; $futures_id = $data['futures_id']; $site_id = $data['site_id']; @@ -245,23 +262,24 @@ class FuturesOrderCreate extends OrderCreate ['status', 'in', [2,7]], ['release_time', '<', time()], ); + $futures_info = model('futures')->getInfo($condition) ?? []; if(empty($futures_info)) return $this->error([], '该秒杀不存在!'); - $futuresModel = new FuturesModel; $data['times'] = $futuresModel->checkTimes($site_id, $member_id, $futures_info['status']); if($data['times']['code'] != 0){ return $data['times']; } $data['times'] = $data['times']['data']; - $data['fenxiao_info'] = model('fenxiao')->getInfo([['member_id','=',$data['member_id']]]); +// $data['fenxiao_info'] = model('fenxiao')->getInfo([['member_id','=',$data['member_id']]]); $basics = $futuresModel->getBasicsConfig($site_id)['data']['value']; $data['futures_user_info'] = model('futures_user')->getInfo([['member_id','=',$data['member_id']]]); + //检查钻石数量 if($data['times']['is_early'] && $data['futures_user_info']['is_special'] == 0){ - if($data['fenxiao_info']['diamond'] <= 0){ + if($data['member_account']['diamond'] <= 0){ return error(-1,'钻石不足,不可提前秒杀'); } } diff --git a/addon/futures/shop/view/config/basics.html b/addon/futures/shop/view/config/basics.html index 11dd6c4d..75a0f9fc 100644 --- a/addon/futures/shop/view/config/basics.html +++ b/addon/futures/shop/view/config/basics.html @@ -56,12 +56,10 @@ -
-
@@ -126,6 +124,42 @@
达到订单数限制后,进行提货恢复限制数
+
+
+ +
+
+ +
+
+
用户抢购首单送积分
+
+
+
+
+ +
+
+ +
+
+
新用户赠送积分
+
+
+
+
+ +
+
+ +
+
%
+
+
下单赠送积分,得消费额百分比,系统自动取整
+
+
+ +
@@ -139,6 +173,14 @@
%
+
+ +
+ +
+
%
+
+
建议出售价格比例
@@ -149,6 +191,15 @@
%
+
商家出售商品担保交易费用,包含计算服务费商家佣金
+
+ +
+ +
+
%
+
+
服务费拆分,用于区分服务费费用名目
diff --git a/addon/member/model/Member.php b/addon/member/model/Member.php index 5f50b34f..5e62383a 100644 --- a/addon/member/model/Member.php +++ b/addon/member/model/Member.php @@ -285,7 +285,7 @@ class Member extends BaseModel */ public function getMemberDetail($member_id, $site_id) { - $field = 'member_id,source_member,username,nickname,mobile,email,status,headimg,member_level,member_level_name,member_label,member_label_name,qq,realname,sex,location,birthday,reg_time,point,balance,growth,balance_money,account5,pay_password,member_level_type'; + $field = 'member_id,source_member,username,nickname,mobile,email,status,headimg,member_level,member_level_name,member_label,member_label_name,qq,realname,sex,location,birthday,reg_time,point,balance,diamond,growth,balance_money,account5,pay_password,member_level_type'; $member_info = model('member')->getInfo([ [ 'member_id', '=', $member_id ], [ 'site_id', '=', $site_id ] ], $field); if (!empty($member_info)) { $member_info[ 'balance_total' ] = $member_info[ 'balance' ] + $member_info[ 'balance_money' ]; diff --git a/addon/memberrecharge/api/controller/Memberrecharge.php b/addon/memberrecharge/api/controller/Memberrecharge.php index 7e7fbaa4..25be6d51 100644 --- a/addon/memberrecharge/api/controller/Memberrecharge.php +++ b/addon/memberrecharge/api/controller/Memberrecharge.php @@ -54,6 +54,8 @@ class Memberrecharge extends BaseApi $field = 'recharge_id,recharge_name,cover_img,face_value,buy_price,point,growth,coupon_id,sale_num'; $member_recharge_model = new MemberRechargeModel(); $list = $member_recharge_model->getMemberRechargePageList([ [ 'status', '=', 1 ], [ 'site_id', '=', $this->site_id ] ], $page, $page_size, 'create_time desc', $field); + + $list['explain']='充值任意金额后,会存到您的账户余额中'; return $this->response($list); } } \ No newline at end of file diff --git a/addon/memberrecharge/model/MemberrechargeOrderCreate.php b/addon/memberrecharge/model/MemberrechargeOrderCreate.php index bda93906..e5a33374 100644 --- a/addon/memberrecharge/model/MemberrechargeOrderCreate.php +++ b/addon/memberrecharge/model/MemberrechargeOrderCreate.php @@ -38,7 +38,6 @@ class MemberrechargeOrderCreate extends OrderCreate $member_info = $member['data']; //获取套餐信息 $recharge_model = new Memberrecharge(); - if ($data['recharge_id'] > 0) { //套餐字段 $field = 'recharge_id,recharge_name,cover_img,face_value,buy_price,point,growth,coupon_id'; @@ -59,12 +58,10 @@ class MemberrechargeOrderCreate extends OrderCreate "coupon_id" => 0, ); } - //创建或加入 $pay = new Pay(); $out_trade_no = $pay->createOutTradeNo($data['member_id']); $order_no = $this->createOrderNo($data['site_id'], $data['member_id']); - $order_data = [ 'recharge_id' => $data['recharge_id'], 'order_no' => $order_no, @@ -90,15 +87,12 @@ class MemberrechargeOrderCreate extends OrderCreate 'relate_id' => $data['relate_id'] ?? 0, 'relate_type' => $data['relate_type'] ?? '', ]; - model("member_recharge_order")->startTrans(); //循环生成多个订单 try { - $order_id = model("member_recharge_order")->add($order_data); //生成整体支付单据 $pay->addPay($data['site_id'], $out_trade_no, "", "会员充值套餐,面额:" . $recharge_info['face_value'], "会员充值套餐,面额:" . $recharge_info['face_value'], $recharge_info['buy_price'], '', 'MemberrechargeOrderPayNotify', ''); - //计算订单自动关闭时间 $config_model = new Config(); $order_config_result = $config_model->getOrderEventTimeConfig($data['site_id']); @@ -111,16 +105,12 @@ class MemberrechargeOrderCreate extends OrderCreate } $cron_model = new Cron(); $cron_model->addCron(1, 0, "订单自动关闭", "MemberrechargeOrderClose", $execute_time, $order_id); - event("MemberRechargeOrderCreate", ['order_id' => $order_id]); model("member_recharge_order")->commit(); return $this->success($out_trade_no); - } catch (\Exception $e) { model("member_recharge_order")->rollback(); return $this->error('', $e->getMessage()); } - } - } \ No newline at end of file diff --git a/addon/memberrecharge/shop/controller/Memberrecharge.php b/addon/memberrecharge/shop/controller/Memberrecharge.php index b6c0bd80..29c8df10 100644 --- a/addon/memberrecharge/shop/controller/Memberrecharge.php +++ b/addon/memberrecharge/shop/controller/Memberrecharge.php @@ -31,13 +31,10 @@ class Memberrecharge extends BaseShop } //套餐字段 protected $field = 'recharge_id,recharge_name,cover_img,face_value,buy_price,point,growth,coupon_id,sale_num,create_time,status'; - //开卡字段 protected $card_field = 'card_id,recharge_id,card_account,cover_img,face_value,point,growth,coupon_id,buy_price,member_img,nickname,order_id,order_no,from_type,use_status,create_time,use_time'; - //订单字段 protected $order_field = 'order_id,recharge_name,recharge_id,order_no,out_trade_no,member_id,cover_img,face_value,buy_price,point,growth,coupon_id,price,pay_type,pay_type_name,status,create_time,pay_time,member_img,nickname,order_from_name,order_from'; - //优惠券字段 protected $coupon_field = 'coupon_type_id,coupon_name,money,count,lead_count,max_fetch,at_least,end_time,image,validity_type,fixed_term'; @@ -81,7 +78,6 @@ class Memberrecharge extends BaseShop public function add() { if (request()->isAjax()) { - $data = [ 'site_id' => $this->site_id, 'recharge_name' => input('recharge_name', ''),//套餐名称 @@ -92,10 +88,8 @@ class Memberrecharge extends BaseShop 'growth' => input('growth', ''),//赠送成长值 'coupon_id' => input('coupon_id', '')//优惠券id ]; - $model = new MemberRechargeModel(); return $model->addMemberRecharge($data); - } else { return $this->fetch('memberrecharge/add'); } @@ -108,10 +102,8 @@ class Memberrecharge extends BaseShop public function edit() { $rechargeModel = new MemberRechargeModel(); - $recharge_id = input('recharge_id', ''); if (request()->isAjax()) { - $data = [ 'recharge_name' => input('recharge_name', ''),//套餐名称 'cover_img' => input('cover_img', ''),//封面 @@ -121,7 +113,6 @@ class Memberrecharge extends BaseShop 'growth' => input('growth', ''),//赠送成长值 'coupon_id' => input('coupon_id', '')//优惠券id ]; - return $rechargeModel->editMemberRecharge( [ [ 'recharge_id', '=', $recharge_id ], @@ -129,7 +120,6 @@ class Memberrecharge extends BaseShop ] , $data ); - } else { //获取套餐详情 $recharge = $rechargeModel->getMemberRechargeInfo( @@ -143,7 +133,6 @@ class Memberrecharge extends BaseShop $this->assign('recharge', $recharge); return $this->fetch('memberrecharge/edit'); } - } /** @@ -153,9 +142,7 @@ class Memberrecharge extends BaseShop public function detail() { $recharge_model = new MemberRechargeModel(); - $recharge_id = input('recharge_id', ''); - //获取套餐详情 $info = $recharge_model->getMemberRechargeInfo( [ @@ -166,7 +153,6 @@ class Memberrecharge extends BaseShop )[ 'data' ] ?? []; if (empty($info)) $this->error('未获取到套餐数据', addon_url('memberrecharge://shop/memberrecharge/lists')); $this->assign('info', $info); - return $this->fetch('memberrecharge/detail'); } @@ -177,12 +163,9 @@ class Memberrecharge extends BaseShop public function invalid() { $model = new MemberRechargeModel(); - $recharge_id = input('recharge_id', ''); - $data = [ 'status' => 2 ]; $condition = [ [ 'recharge_id', '=', $recharge_id ] ]; - $res = $model->editMemberRecharge($condition, $data); return $res; } @@ -194,12 +177,9 @@ class Memberrecharge extends BaseShop public function open() { $model = new MemberRechargeModel(); - $recharge_id = input('recharge_id', ''); - $data = [ 'status' => 1 ]; $condition = [ [ 'recharge_id', '=', $recharge_id ] ]; - $res = $model->editMemberRecharge($condition, $data); return $res; } @@ -211,9 +191,7 @@ class Memberrecharge extends BaseShop public function delete() { $model = new MemberRechargeModel(); - $recharge_id = input('recharge_id', ''); - return $model->deleteMemberRecharge([ [ 'recharge_id', '=', $recharge_id ] ]); } @@ -225,7 +203,6 @@ class Memberrecharge extends BaseShop { $recharge_id = input('recharge_id', ''); $page_size = input('page_size', PAGE_LIST_ROWS); - $model = new MemberRechargeCardModel(); $condition[] = [ 'site_id', '=', $this->site_id ]; $condition[] = [ 'recharge_id', '=', $recharge_id ]; @@ -235,21 +212,16 @@ class Memberrecharge extends BaseShop if ($status) { $condition[] = [ 'use_status', '=', $status ]; } - $page = input('page', 1); $list = $model->getMemberRechargeCardPageList($condition, $page, $page_size, 'card_id desc', $this->card_field); return $list; } else { - $page_size = input('page_size', PAGE_LIST_ROWS); - $list = $model->getMemberRechargeCardPageList($condition, 1, $page_size, 'card_id desc', $this->card_field); $this->assign('list', $list); - $this->assign('recharge_id', $recharge_id); return $this->fetch('memberrecharge/card_lists'); } - } /** @@ -259,16 +231,13 @@ class Memberrecharge extends BaseShop public function cardDetail() { $model = new MemberRechargeCardModel(); - $card_id = input('card_id', ''); - //获取详情 $info = $model->getMemberRechargeCardInfo( [ [ 'card_id', '=', $card_id ] ], $this->card_field )[ 'data' ] ?? []; $this->assign('info', $info); - return $this->fetch('memberrecharge/card_detail'); } diff --git a/app/api/controller/Memberbankaccount.php b/app/api/controller/Memberbankaccount.php index 47c71829..68bfbd73 100644 --- a/app/api/controller/Memberbankaccount.php +++ b/app/api/controller/Memberbankaccount.php @@ -36,6 +36,7 @@ class Memberbankaccount extends BaseApi $withdraw_type = isset($this->params[ 'withdraw_type' ]) ? $this->params[ 'withdraw_type' ] : '';// '账户类型 alipay 支付宝 bank 银行卡 $branch_bank_name = isset($this->params[ 'branch_bank_name' ]) ? $this->params[ 'branch_bank_name' ] : '';// 银行支行信息 $bank_account = isset($this->params[ 'bank_account' ]) ? $this->params[ 'bank_account' ] : '';// 银行账号 + $bank_address = isset($this->params[ 'bank_address' ]) ? $this->params[ 'bank_address' ] : '';// 银行地址 if (empty($realname)) { return $this->response($this->error('', 'REQUEST_REAL_NAME')); } @@ -62,6 +63,7 @@ class Memberbankaccount extends BaseApi 'withdraw_type' => $withdraw_type, 'branch_bank_name' => $branch_bank_name, 'bank_account' => $bank_account, + 'bank_address' => $bank_address, 'is_default' => 1 ]; $res = $member_bank_account_model->addMemberBankAccount($data); @@ -76,13 +78,13 @@ class Memberbankaccount extends BaseApi { $token = $this->checkToken(); if ($token[ 'code' ] < 0) return $this->response($token); - $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : 0; $realname = isset($this->params[ 'realname' ]) ? $this->params[ 'realname' ] : ''; $mobile = isset($this->params[ 'mobile' ]) ? $this->params[ 'mobile' ] : ''; $withdraw_type = isset($this->params[ 'withdraw_type' ]) ? $this->params[ 'withdraw_type' ] : '';// '账户类型 alipay 支付宝 bank 银行卡 $branch_bank_name = isset($this->params[ 'branch_bank_name' ]) ? $this->params[ 'branch_bank_name' ] : '';// 银行支行信息 $bank_account = isset($this->params[ 'bank_account' ]) ? $this->params[ 'bank_account' ] : '';// 银行账号 + $bank_address = isset($this->params[ 'bank_address' ]) ? $this->params[ 'bank_address' ] : '';// 银行地址 if (empty($id)) { return $this->response($this->error('', 'REQUEST_ID')); } @@ -113,6 +115,7 @@ class Memberbankaccount extends BaseApi 'withdraw_type' => $withdraw_type, 'branch_bank_name' => $branch_bank_name, 'bank_account' => $bank_account, + 'bank_address' => $bank_address, 'is_default' => 1 ]; $res = $member_bank_account_model->editMemberBankAccount($data); @@ -166,7 +169,7 @@ class Memberbankaccount extends BaseApi return $this->response($this->error('', 'REQUEST_ID')); } $member_bank_account_model = new MemberBankAccountModel(); - $info = $member_bank_account_model->getMemberBankAccountInfo([ [ 'member_id', '=', $this->member_id ], [ 'id', '=', $id ] ], 'id,member_id,realname,mobile,withdraw_type,branch_bank_name,bank_account,is_default'); + $info = $member_bank_account_model->getMemberBankAccountInfo([ [ 'member_id', '=', $this->member_id ], [ 'id', '=', $id ] ], 'id,member_id,realname,mobile,withdraw_type,branch_bank_name,bank_account,is_default,bank_address'); if (!empty($info[ 'data' ])) { $info[ 'data' ][ 'withdraw_type_name' ] = $member_bank_account_model->getWithdrawType()[ $info[ 'data' ][ 'withdraw_type' ] ]; } diff --git a/app/api/controller/Memberwithdraw.php b/app/api/controller/Memberwithdraw.php index e969d165..b7d760bf 100644 --- a/app/api/controller/Memberwithdraw.php +++ b/app/api/controller/Memberwithdraw.php @@ -96,6 +96,7 @@ class Memberwithdraw extends BaseApi "account_number" => $account_number, "apply_money" => $apply_money, "mobile" => $mobile, + "identity" => $mobile, "app_type" => $app_type ); $result = $withdraw_model->apply($data, $member_info[ 'data' ][ 'site_id' ], 'shop'); diff --git a/app/model/member/MemberAccount.php b/app/model/member/MemberAccount.php index becbec8d..a73ef92c 100644 --- a/app/model/member/MemberAccount.php +++ b/app/model/member/MemberAccount.php @@ -132,8 +132,8 @@ class MemberAccount extends BaseModel $from_type[ 'balance' ][ 'transfer' ] = [ 'type_name' => '转账', 'type_url' => '' ]; - $from_type[ 'diamond' ]['diamond'] = [ 'type_name' => '赠送钻石', 'type_url' => '' ]; - $from_type[ 'balance' ]['diamond'] = [ 'type_name' => '赠送钻石', 'type_url' => '' ]; + $from_type[ 'diamond' ]['diamond'] = [ 'type_name' => '赠送猕猴桃', 'type_url' => '' ]; + $from_type[ 'balance' ]['diamond'] = [ 'type_name' => '赠送猕猴桃', 'type_url' => '' ]; $this->from_type = $from_type; } diff --git a/app/model/member/MemberBankAccount.php b/app/model/member/MemberBankAccount.php index e0339203..88aafcff 100644 --- a/app/model/member/MemberBankAccount.php +++ b/app/model/member/MemberBankAccount.php @@ -92,9 +92,7 @@ class MemberBankAccount extends BaseModel $config_model = new Withdraw(); $config_result = $config_model->getConfig(1, 'shop'); $config = $config_result['data']['value']; - if (!empty($config)) { - //提现方式为微信的时候 判断用户是否已关注公众号 if ($data['withdraw_type'] == 'wechatpay') { //获取会员信息 @@ -103,26 +101,20 @@ class MemberBankAccount extends BaseModel return $this->error('', '请先绑定微信'); } } - model('member_bank_account')->startTrans(); try { - if ($data['is_default'] == 1) { model('member_bank_account')->update(['is_default' => 0], ['member_id' => $data['member_id']]); } $data['modify_time'] = time(); $res = model('member_bank_account')->update($data, ['id' => $data['id']]); Cache::tag("member_bank_account_" . $data['member_id'])->clear(); - model('member_bank_account')->commit(); return $this->success($res); - } catch (\Exception $e) { - model('member_bank_account')->rollback(); return $this->error('', $e->getMessage()); } - } else { return $this->error('', '平台未开启会员提现'); } diff --git a/app/model/member/Withdraw.php b/app/model/member/Withdraw.php index bb950e1c..dbbdadae 100644 --- a/app/model/member/Withdraw.php +++ b/app/model/member/Withdraw.php @@ -101,7 +101,7 @@ class Withdraw extends BaseModel return $this->error([], "提现金额为{$config["money_multiple"]}倍数"); } $member_id = $data["member_id"]; - $identity = $data["identity"]; + $identity = $data["identity"]??''; $member_model = new Member(); $member_info_result = $member_model->getMemberInfo([["member_id", "=", $member_id]], "balance_money,headimg,wx_openid,username,mobile,weapp_openid,nickname"); $member_info = $member_info_result["data"]; @@ -169,7 +169,7 @@ class Withdraw extends BaseModel "realname" => $data["realname"], "bank_name" => $bank_name, "account_number" => $account_number, - "identity" => $identity, +// "identity" => $identity, "mobile" => $data["mobile"], "applet_type" => $applet_type ); diff --git a/app/pay/controller/Test.php b/app/pay/controller/Test.php index 5051719a..13b90588 100644 --- a/app/pay/controller/Test.php +++ b/app/pay/controller/Test.php @@ -29,9 +29,11 @@ class Test extends Controller } public function s(){ - $paydata='{"item_code":"AM010201000000117823","charset":"UTF-8","notify_time":"2023-02-02 10:41:48","commodity_order_id":"202302020000000008847076","quantity":"1","total_price":"0.00","method":"alipay.open.servicemarket.order.notify","sign":"PrqlBU8y1sIIS962JrLmAuggPH89kSTy1cPLur9z0ynHI0YurAVVahaxxt9iWErUMOQGNKehyilyMtCeZdRh84hSdHKktSTHpDvy423sX9xVLYvPBii05joMBJUZ3PM4y7BbizyPamie3yPqdomDuGQ539AYTA\/9YtmwUoh62zjloIoq4UefDOihwuESGFmB5B3HYbw6HpSiVbe8lHEGNSKOGBTCi2OowaSk1sGaT9\/5dQgBCARDGb+amg4pKGMkw105ERlD2EEW9qoGQNwQVP7o9R5UP+7KqgOhg+X95kW5qcIjltjF6rRPa2cH\/j1WQ1RSeTfTuuRBOMLAOr3xuw==","order_time":"2023-02-02 10:38:00","title":"客单豹","specifications":"客单豹","version":"1.0","notify_id":"2023020200222103800094771410174673","merchant_pid":"2088402283167085","package_count":"0","notify_type":"servicemarket_order_notify","period_day":"-1","phone":"18980669271","name":"*敏","order_item_num":"1","contactor":"柏鸿凯","app_id":"2021003167617037","sign_type":"RSA2","timestamp":"2023-02-02 10:41:48"}'; - $res= event('AliAuthNotify',json_decode($paydata,true)); - var_dump($res); + + var_dump(329*1/100); +// $paydata='{"item_code":"AM010201000000117823","charset":"UTF-8","notify_time":"2023-02-02 10:41:48","commodity_order_id":"202302020000000008847076","quantity":"1","total_price":"0.00","method":"alipay.open.servicemarket.order.notify","sign":"PrqlBU8y1sIIS962JrLmAuggPH89kSTy1cPLur9z0ynHI0YurAVVahaxxt9iWErUMOQGNKehyilyMtCeZdRh84hSdHKktSTHpDvy423sX9xVLYvPBii05joMBJUZ3PM4y7BbizyPamie3yPqdomDuGQ539AYTA\/9YtmwUoh62zjloIoq4UefDOihwuESGFmB5B3HYbw6HpSiVbe8lHEGNSKOGBTCi2OowaSk1sGaT9\/5dQgBCARDGb+amg4pKGMkw105ERlD2EEW9qoGQNwQVP7o9R5UP+7KqgOhg+X95kW5qcIjltjF6rRPa2cH\/j1WQ1RSeTfTuuRBOMLAOr3xuw==","order_time":"2023-02-02 10:38:00","title":"客单豹","specifications":"客单豹","version":"1.0","notify_id":"2023020200222103800094771410174673","merchant_pid":"2088402283167085","package_count":"0","notify_type":"servicemarket_order_notify","period_day":"-1","phone":"18980669271","name":"*敏","order_item_num":"1","contactor":"柏鸿凯","app_id":"2021003167617037","sign_type":"RSA2","timestamp":"2023-02-02 10:41:48"}'; +// $res= event('AliAuthNotify',json_decode($paydata,true)); +// var_dump($res); } // public function e(){ diff --git a/app/shop/view/index/index.html b/app/shop/view/index/index.html index 7541c64a..8923e938 100644 --- a/app/shop/view/index/index.html +++ b/app/shop/view/index/index.html @@ -2,10 +2,7 @@ {block name="resources"} {/block} - {block name="main"} - - {if !$guide_close}
@@ -117,7 +114,6 @@
{/if} -
实时概况
@@ -164,7 +160,6 @@
-
待办事项
@@ -220,7 +215,6 @@ {/if}
-
@@ -239,7 +233,6 @@
-
常用功能
@@ -281,7 +274,6 @@ {/if}
-
@@ -336,16 +328,12 @@ {block name="script"}