From af135f5064a855f4aabc8357633714d5bbb9df99 Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Sat, 23 Nov 2024 14:35:13 +0800 Subject: [PATCH] tijiao --- addons/wanlshop/config.php | 16 +++++ addons/wanlshop/library/WanlPay/WanlPay.php | 8 ++- .../admin/view/wanlshop/client/config.html | 62 ++++++++++++++++++- .../api/controller/wanlshop/Active.php | 4 ++ application/api/controller/wanlshop/Pay.php | 1 + .../api/controller/wanlshop/Product.php | 22 ++++++- 6 files changed, 107 insertions(+), 6 deletions(-) diff --git a/addons/wanlshop/config.php b/addons/wanlshop/config.php index 5fb2f0d..8da9e21 100644 --- a/addons/wanlshop/config.php +++ b/addons/wanlshop/config.php @@ -523,6 +523,22 @@ return [ 'tip' => '观看公益课堂比例配置', 'ok' => '', 'extend' => '', + + ], + [ + 'name' => 'vippayconfig', + 'title' => '观看公益课堂比例配置', + 'type' => 'array', + 'value' => [ + 'money' => 0.01, + 'givered' => 1, + ], + 'rule' => '', + 'msg' => '', + 'tip' => '观看公益课堂比例配置', + 'ok' => '', + 'extend' => '', + ], [ 'name' => '__tips__', diff --git a/addons/wanlshop/library/WanlPay/WanlPay.php b/addons/wanlshop/library/WanlPay/WanlPay.php index ee39b1b..d8e5552 100644 --- a/addons/wanlshop/library/WanlPay/WanlPay.php +++ b/addons/wanlshop/library/WanlPay/WanlPay.php @@ -311,7 +311,13 @@ class WanlPay } catch (\Exception $e) { return ['code' => 10006 ,'msg' => $this->type.':'.$e->getMessage()]; } - } else { + } else if($this->type == 'dinpay'){ + try{ + + } catch (\Exception $e) { + return ['code' => 10006 ,'msg' => $this->type.':'.$e->getMessage()]; + } + } else { return ['code' => 10010 ,'msg' => '未找到任何有效支付']; } } diff --git a/application/admin/view/wanlshop/client/config.html b/application/admin/view/wanlshop/client/config.html index d8a6dcc..4dd874c 100644 --- a/application/admin/view/wanlshop/client/config.html +++ b/application/admin/view/wanlshop/client/config.html @@ -20,7 +20,7 @@
  • 推广活动配置
  • 发票兑换比例
  • 观看公益课堂比例配置
  • - +
  • 会员卡金额设置
  • @@ -1977,7 +1977,65 @@
    - +
    +
    +
    + {:token()} + + + + + + + + + + + + + + + + + + + + + + + +
    配置项参数
    观看公益课堂比例配置 +
    +
    + {:Form::text('row[vippayconfig][money]', $wanlshop.vippayconfig.money, ['data-tip'=>'请填写会员卡价格','placeholder'=>'请填写会员卡价格'])} + +
    +
    +
    +
    办理会员赠送红包数量 +
    +
    + {:Form::text('row[vippayconfig][givered]', $wanlshop.vippayconfig.givered, ['data-tip'=>'请填写办理会员赠送红包数量','placeholder'=>'请填写办理会员赠送红包数量'])} + +
    +
    +
    +
    + + +
    +
    +
    +
    diff --git a/application/api/controller/wanlshop/Active.php b/application/api/controller/wanlshop/Active.php index 38e8dc6..4a35b83 100644 --- a/application/api/controller/wanlshop/Active.php +++ b/application/api/controller/wanlshop/Active.php @@ -19,4 +19,8 @@ class Active extends Api $list = $this->model->select(); return $this->success('ok',$list); } + public function getVipConfig(){ + $config = get_addon_config('wanlshop'); + $this->success("获取成功",$config['vippayconfig']); + } } \ No newline at end of file diff --git a/application/api/controller/wanlshop/Pay.php b/application/api/controller/wanlshop/Pay.php index 7de8f52..2114517 100644 --- a/application/api/controller/wanlshop/Pay.php +++ b/application/api/controller/wanlshop/Pay.php @@ -3,6 +3,7 @@ namespace app\api\controller\wanlshop; use addons\wanlshop\library\WanlPay\WanlPay; use addons\wanlshop\library\WanlSdk\Common; +use addons\wanlshop\library\ZhiPay; use app\common\controller\Api; use think\Cache; use think\Db; diff --git a/application/api/controller/wanlshop/Product.php b/application/api/controller/wanlshop/Product.php index 991abcb..897de68 100644 --- a/application/api/controller/wanlshop/Product.php +++ b/application/api/controller/wanlshop/Product.php @@ -13,7 +13,7 @@ use think\Db; */ class Product extends Api { - protected $noNeedLogin = ['lists', 'goods', 'drawer', 'comment', 'likes', 'stock','activelists']; + protected $noNeedLogin = ['lists', 'goods', 'drawer', 'comment', 'likes', 'stock','activelists','getbrand']; protected $noNeedRight = ['*']; protected $excludeFields = ""; @@ -104,7 +104,7 @@ class Product extends Api //记录去除红包之后的价格 $priceinfo['price'] = round($price*(100-$bili)/100,2); //计算红包数量 - $priceinfo['redpocket'] = ($price-$priceinfo['price'])/$config['moneyRedpocket']['money']*$config['moneyRedpocket']['redpocket']; + $priceinfo['redpocket'] = round(($price-$priceinfo['price'])/$config['moneyRedpocket']['money']*$config['moneyRedpocket']['redpocket'],2); return $priceinfo; } public function getbili($uid=0){ @@ -178,7 +178,14 @@ class Product extends Api ->select() ]); } - + public function getbrand(){ + $brandModel = model('app\api\model\wanlshop\Brand'); + $brandInfo = $brandModel + ->where('status','normal') + ->field('id,name,image') + ->select(); + $this->success('返回成功',$brandInfo); + } /** * 猜你喜欢 * @@ -293,7 +300,16 @@ class Product extends Api ->field('id,category_id,shop_category_id,brand_id,freight_id,shop_id,title,image,images,flag,content,category_attribute,activity_type,price,sales,payment,comment,praise,moderate,negative,like,views,status') ->find(); // 浏览+1 & 报错 + $config = get_addon_config('wanlshop'); + $vipbili = $config['vipbili']['vipuser']; + $freebili = $config['vipbili']['freeuser']; if($goods && $goods['status'] == 'normal'){ + //免费会员商品价格+红包 + $priceinfo = $this->pricejisuan($goods['price'],$freebili,0); + $goods['freepriceInfo'] = $priceinfo; + //vip会员价格+红包 + $priceinfo = $this->pricejisuan($goods['price'],$vipbili,0); + $goods['vippriceInfo'] = $priceinfo; // 查询类目 $goods->category->visible(['id','pid','name']); // 查询优惠券