浏览代码

供货商

shish 5 年之前
父节点
当前提交
c652fb6b1c

+ 1 - 1
app-ghs/controllers/GhsController.php

@@ -15,7 +15,7 @@ class GhsController extends BaseController
     {
         $get = Yii::$app->request->get();
         $name = isset($get['name']) ? $get['name'] : '';
-        $where = ['shopId' => $this->shopId];
+        $where = ['sjId' => $this->sjId];
         if (!empty($name)) {
             if (stringUtil::isLetter($name)) {
                 $where['py'] = ['like', $name];

+ 17 - 6
app-hd/controllers/ConsoleController.php

@@ -29,12 +29,23 @@ class ConsoleController extends BaseController
         $current = time();
         $remain = strtotime($deadline) - $current;
         if ($remain <= 1296000) {
-            $title = '您的试用期已到,点击免费续期1年';
-            if ($remain > 0) {
-                $num = ceil($remain / 86400);
-                $title = "您的试用期还有{$num}天,点击免费续期";
+
+            $parentId = $sj['parentId'] ?? 0;
+            if (!empty($parentId)) {
+                $title = '您的试用期已到,点击免费续期1年';
+                if ($remain > 0) {
+                    $num = ceil($remain / 86400);
+                    $title = "您的试用期还有{$num}天,点击免费续期";
+                }
+                $notice = array_merge($notice, [['title' => $title, 'action' => '查看', 'page' => '/admin/recharge/renew']]);
+            } else {
+                $title = '您的试用期已到,请及时续费';
+                if ($remain > 0) {
+                    $num = ceil($remain / 86400);
+                    $title = "您的试用期还有{$num}天,请及时续费";
+                }
+                $notice = array_merge($notice, [['title' => $title, 'action' => '续期', 'page' => '/pagesClient/official/index']]);
             }
-            $notice = array_merge($notice, [['title' => $title, 'action' => '查看', 'page' => '/admin/recharge/renew']]);
         }
 
         //今天访客数
@@ -52,7 +63,7 @@ class ConsoleController extends BaseController
         $todayData = ['visit' => $todayVisit, 'fans' => $todayFansNum, 'user' => $todayUserNum, 'income' => $todayIncome, 'order' => $todayOrder];
 
         $incomeStat = [];
-        if(httpUtil::isMiniProgram() == false){
+        if (httpUtil::isMiniProgram() == false) {
             //当月的收入
             $currentMonthIncome = StatIncomeMonthService::getCurrentMonthIncome($this->shopId);
             //上个月收入

+ 163 - 164
app-hd/controllers/RechargeController.php

@@ -13,168 +13,167 @@ use Yii;
 
 class RechargeController extends BaseController
 {
-	
-	//充值记录 ssh 2021.2.21
-	public function actionList()
-	{
-		$where = ['shopId' => $this->shopId, 'payStatus' => RechargeClass::PAY_STATUS_HAS_PAY];
-		$list = RechargeClass::getRechargeList($where);
-		util::success($list);
-	}
-	
-	//免费续期活动 ssh 2021.2.21
-	public function actionRenew()
-	{
-		$prefix = imgUtil::getPrefix();
-		$data = [
-			'renew' => 3980,
-			'recharge' => 5980,
-			'shopName' => '纯彩花艺',
-			'userNum' => 150,
-			'userAvatar' => [
-				$prefix . '/hhb_small.png',
-				$prefix . '/hhb_small.png',
-			],
-		];
-		util::success($data);
-	}
-	
-	//续期充值付款 ssh 2021.2.21
-	public function actionRenewPay()
-	{
-		ini_set('date.timezone', 'Asia/Shanghai');
-		$wxPay = dict::getConfig('payWay', 'wxPay');
-		$data = [
-			'amount' => 5980,
-			'payWay' => $wxPay,
-			'sjId' => $this->sjId,
-			'sjStyle' => SjClass::STYLE_RETAIL,
-			'shopId' => $this->shopId,
-			'modPrice' => 0,
-			'remark' => '免费续期充值',
-		];
-		$order = RechargeClass::addOrder($data);
-		$orderSn = $order['orderSn'];
-		$name = $order['orderName'] ?? '充值';
-		$totalFee = $order['amount'];
-		
-		//强制使用小程序的miniOpenId
-		$openId = $this->admin['miniOpenId'];
-		
-		$capitalTypeData = dict::getConfig('capitalType');
-		$capitalType = $capitalTypeData['xhRecharge']['id'];
-		//流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
-		$wxPayType = 0;
-		if (httpUtil::isMiniProgram()) {
-			$wxPayType = 1;
-		}
-		$attach = "couponId=0&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
-		//订单30分钟后过期
-		$now = time();
-		$expireTime = $now + 1800;
-		
-		$wx = Yii::getAlias("@vendor/weixin");
-		require_once($wx . '/lib/WxPay.Api.php');
-		require_once($wx . '/example/WxPay.JsApiPay.php');
-		$input = new \WxPayUnifiedOrder();
-		$input->SetBody($name);
-		$input->SetOut_trade_no($orderSn);
-		$input->SetTotal_fee($totalFee * 100);
-		$input->SetTime_start(date("YmdHis", $now));
-		$input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
-		$input->SetTime_expire(date("YmdHis", $expireTime));
-		$input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
-		$input->SetTrade_type("JSAPI");
-		
-		$merchantExtend = WxOpenClass::getWxInfo();
-		if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
-			$input->SetSub_openid($openId);
-		} else {
-			$input->SetOpenid($openId);
-		}
-		
-		//强制使用小程序的AppId
-		$merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
-		
-		$wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
-		$tools = new \JsApiPay();
-		$jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
-		$newParams = json_decode($jsApiParameters, true);
-		util::success($newParams);
-	}
-	
-	//充值余额 ssh 2021.2.21
-	public function actionBalance()
-	{
-		ini_set('date.timezone', 'Asia/Shanghai');
-		$get = Yii::$app->request->get();
-		$amount = $get['amount'] ?? 500;
-		$wxPay = dict::getConfig('payWay', 'wxPay');
-		$data = [
-			'amount' => $amount,
-			'payWay' => $wxPay,
-			'sjId' => $this->sjId,
-			'sjStyle' => SjClass::STYLE_RETAIL,
-			'shopId' => $this->shopId,
-			'modPrice' => 0,
-			'remark' => '',
-		];
-		$order = RechargeClass::addOrder($data);
-		$orderSn = $order['orderSn'];
-		$name = $order['orderName'] ?? '充值';
-		$totalFee = $order['amount'];
-		
-		//强制使用小程序的miniOpenId
-		$openId = $this->admin['miniOpenId'];
-		
-		$capitalTypeData = dict::getConfig('capitalType');
-		$capitalType = $capitalTypeData['xhRecharge']['id'];
-		//流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
-		$wxPayType = 0;
-		if (httpUtil::isMiniProgram()) {
-			$wxPayType = 1;
-		}
-		$attach = "couponId=0&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
-		//订单30分钟后过期
-		$now = time();
-		$expireTime = $now + 1800;
-		
-		$wx = Yii::getAlias("@vendor/weixin");
-		require_once($wx . '/lib/WxPay.Api.php');
-		require_once($wx . '/example/WxPay.JsApiPay.php');
-		$input = new \WxPayUnifiedOrder();
-		$input->SetBody($name);
-		$input->SetOut_trade_no($orderSn);
-		$input->SetTotal_fee($totalFee * 100);
-		$input->SetTime_start(date("YmdHis", $now));
-		$input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
-		$input->SetTime_expire(date("YmdHis", $expireTime));
-		$input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
-		$input->SetTrade_type("JSAPI");
-		
-		$merchantExtend = WxOpenClass::getWxInfo();
-		if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
-			$input->SetSub_openid($openId);
-		} else {
-			$input->SetOpenid($openId);
-		}
-		
-		//强制使用小程序的AppId
-		$merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
-		
-		$wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
-		$tools = new \JsApiPay();
-		$jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
-		$newParams = json_decode($jsApiParameters, true);
-		util::success($newParams);
-	}
-	
-	//续期成功 ssh 2021.2.21
-	public function actionRenewSuccess()
-	{
-		$sj = $this->sj;
-		$deadline = date("Y-m-d H:i", strtotime($sj['deadline']));
-		util::success(['deadline' => $deadline]);
-	}
-	
+
+    //充值记录 ssh 2021.2.21
+    public function actionList()
+    {
+        $where = ['shopId' => $this->shopId, 'payStatus' => RechargeClass::PAY_STATUS_HAS_PAY];
+        $list = RechargeClass::getRechargeList($where);
+        util::success($list);
+    }
+
+    //免费续期活动 ssh 2021.2.21
+    public function actionRenew()
+    {
+        $sj = $this->sj;
+        $parentId = $sj['parentId'] ?? 0;
+        $parentSj = SjClass::getById($parentId);
+        $sjName = $parentSj['name'] ?? '';
+        $data = [
+            'renew' => getenv('RENEW_PRICE'),
+            'recharge' => getenv('RECHARGE_PRICE'),
+            'shopName' => $sjName,
+            'userNum' => 150
+        ];
+        util::success($data);
+    }
+
+    //续期充值付款 ssh 2021.2.21
+    public function actionRenewPay()
+    {
+        ini_set('date.timezone', 'Asia/Shanghai');
+        $wxPay = dict::getConfig('payWay', 'wxPay');
+        $data = [
+            'amount' => 5980,
+            'payWay' => $wxPay,
+            'sjId' => $this->sjId,
+            'sjStyle' => SjClass::STYLE_RETAIL,
+            'shopId' => $this->shopId,
+            'modPrice' => 0,
+            'remark' => '免费续期充值',
+        ];
+        $order = RechargeClass::addOrder($data);
+        $orderSn = $order['orderSn'];
+        $name = $order['orderName'] ?? '充值';
+        $totalFee = $order['amount'];
+
+        //强制使用小程序的miniOpenId
+        $openId = $this->admin['miniOpenId'];
+
+        $capitalTypeData = dict::getConfig('capitalType');
+        $capitalType = $capitalTypeData['xhRecharge']['id'];
+        //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
+        $wxPayType = 0;
+        if (httpUtil::isMiniProgram()) {
+            $wxPayType = 1;
+        }
+        $attach = "couponId=0&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
+        //订单30分钟后过期
+        $now = time();
+        $expireTime = $now + 1800;
+
+        $wx = Yii::getAlias("@vendor/weixin");
+        require_once($wx . '/lib/WxPay.Api.php');
+        require_once($wx . '/example/WxPay.JsApiPay.php');
+        $input = new \WxPayUnifiedOrder();
+        $input->SetBody($name);
+        $input->SetOut_trade_no($orderSn);
+        $input->SetTotal_fee($totalFee * 100);
+        $input->SetTime_start(date("YmdHis", $now));
+        $input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
+        $input->SetTime_expire(date("YmdHis", $expireTime));
+        $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
+        $input->SetTrade_type("JSAPI");
+
+        $merchantExtend = WxOpenClass::getWxInfo();
+        if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
+            $input->SetSub_openid($openId);
+        } else {
+            $input->SetOpenid($openId);
+        }
+
+        //强制使用小程序的AppId
+        $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
+
+        $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
+        $tools = new \JsApiPay();
+        $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
+        $newParams = json_decode($jsApiParameters, true);
+        util::success($newParams);
+    }
+
+    //充值余额 ssh 2021.2.21
+    public function actionBalance()
+    {
+        ini_set('date.timezone', 'Asia/Shanghai');
+        $get = Yii::$app->request->get();
+        $amount = $get['amount'] ?? 500;
+        $wxPay = dict::getConfig('payWay', 'wxPay');
+        $data = [
+            'amount' => $amount,
+            'payWay' => $wxPay,
+            'sjId' => $this->sjId,
+            'sjStyle' => SjClass::STYLE_RETAIL,
+            'shopId' => $this->shopId,
+            'modPrice' => 0,
+            'remark' => '',
+        ];
+        $order = RechargeClass::addOrder($data);
+        $orderSn = $order['orderSn'];
+        $name = $order['orderName'] ?? '充值';
+        $totalFee = $order['amount'];
+
+        //强制使用小程序的miniOpenId
+        $openId = $this->admin['miniOpenId'];
+
+        $capitalTypeData = dict::getConfig('capitalType');
+        $capitalType = $capitalTypeData['xhRecharge']['id'];
+        //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
+        $wxPayType = 0;
+        if (httpUtil::isMiniProgram()) {
+            $wxPayType = 1;
+        }
+        $attach = "couponId=0&capitalType=" . $capitalType . '&wxPayType=' . $wxPayType;
+        //订单30分钟后过期
+        $now = time();
+        $expireTime = $now + 1800;
+
+        $wx = Yii::getAlias("@vendor/weixin");
+        require_once($wx . '/lib/WxPay.Api.php');
+        require_once($wx . '/example/WxPay.JsApiPay.php');
+        $input = new \WxPayUnifiedOrder();
+        $input->SetBody($name);
+        $input->SetOut_trade_no($orderSn);
+        $input->SetTotal_fee($totalFee * 100);
+        $input->SetTime_start(date("YmdHis", $now));
+        $input->SetAttach($attach);//将流水类型、代金劵等传给微信再回传
+        $input->SetTime_expire(date("YmdHis", $expireTime));
+        $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
+        $input->SetTrade_type("JSAPI");
+
+        $merchantExtend = WxOpenClass::getWxInfo();
+        if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
+            $input->SetSub_openid($openId);
+        } else {
+            $input->SetOpenid($openId);
+        }
+
+        //强制使用小程序的AppId
+        $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
+
+        $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
+        $tools = new \JsApiPay();
+        $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
+        $newParams = json_decode($jsApiParameters, true);
+        util::success($newParams);
+    }
+
+    //续期成功 ssh 2021.2.21
+    public function actionRenewSuccess()
+    {
+        $sj = $this->sj;
+        $deadline = date("Y-m-d H:i", strtotime($sj['deadline']));
+        util::success(['deadline' => $deadline]);
+    }
+
 }

+ 2 - 0
common/components/stringUtil.php

@@ -137,6 +137,8 @@ class stringUtil
 			return '';
 		}
 		$string = str_replace('圳', 'z', $string);
+        $string = str_replace('未', 'w', $string);
+        $string = str_replace('石', 's', $string);
 		$ret = "";
 		$s1 = iconv("UTF-8", "gb2312", $string);
 		$s2 = iconv("gb2312", "UTF-8", $s1);