123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- /**
- * 前台书籍控制器
- */
- namespace app\clientweb\controller;
- use app\common\controller\ClientWeb;
- use app\main\constants\ClientWebConstants;
- use app\main\constants\PayConstants;
- use app\main\service\AdminService;
- use app\main\service\FinancialService;
- use app\main\service\WebUserService;
- use think\Config;
- use think\Url;
- class Recharge extends ClientWeb
- {
- public function pay(){
- if(!$this->isLogin){
- $this->redirect('Bindphone/register',['action'=>ClientWebConstants::REDIRECT_ACTION_RECHARGE]);
- }
- $this->userInfo = WebUserService::instance()->getUserInfo();
- $uid = $this->userInfo->id;
- $kandian = FinancialService::instance()->getTotalKandianAndFreeKandian($uid)->data;
- $is_test = AdminService::instance()->checkIsTestChannel($this->userInfo->agent_id,$this->userInfo->channel_id);
- $list = model('Goods')->getGoodsList(PayConstants::BUSINESS_APP, PayConstants::GOODS_CATEGORY_RECHARGE, null, $is_test, $this->userInfo->is_pay);
- $pay_list = model('Wxpay')->getListByBusiness(PayConstants::BUSINESS_APP);
- if ($this->request->has('book_id')) {
- $book_id = $this->request->get('book_id');
- $bookInfo = model('Book')->BookInfo($book_id);
- if ($bookInfo) {
- if ($bookInfo['billing_type'] == 2 && $bookInfo['price'] > 0) { //按本收费
- $this->assign('bookBillingTip', '本书是VIP书籍(' . $bookInfo['price'] . '书币/本)');
- } elseif ($bookInfo['price'] > 0) { //按章收费,且自定义了价格
- $this->assign('bookBillingTip', '本章是VIP章节(' . $bookInfo['price'] . '书币/章)');
- } else { //按章收费,默认价格
- $this->assign('bookBillingTip', '本章是VIP章节(' . Config::get('site.book_chapter_price') . '书币/章)');
- }
- }
- }
- $this->assign('select_goods_id', $this->request->param('goods_id')??0);
- $this->assign('list', $list);
- $this->assign('business_line', PayConstants::BUSINESS_APP);
- $this->assign('user', $this->userInfo->toArray());
- $this->assign('kandian', $kandian);
- $this->assign('channel_id', $this->userInfo->channel_id);
- $this->assign('recent_url', Url::build('/index/user/recent', null, true));
- $this->assign('pay_list', $pay_list);
- return $this->view->fetch();
- }
- }
|