123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?php
-
-
- namespace app\user\controller;
-
- use think\Db;
- use think\Config;
- use think\Page;
-
- class Level extends Base
- {
-
- public function _initialize() {
- parent::_initialize();
-
- $this->users_money_db = Db::name('users_money');
-
- $this->users_type_manage_db = Db::name('users_type_manage');
-
-
- $this->pay_wechat_config = '';
- $where = [
- 'pay_id' => 1,
- 'pay_mark' => 'wechat'
- ];
- $PayInfo = Db::name('pay_api_config')->where($where)->getField('pay_info');
- if (!empty($PayInfo)) $this->pay_wechat_config = unserialize($PayInfo);
-
-
- $this->pay_alipay_config = '';
- $where = [
- 'pay_id' => 2,
- 'pay_mark' => 'alipay'
- ];
- $PayInfo = Db::name('pay_api_config')->where($where)->getField('pay_info');
- if (!empty($PayInfo)) $this->pay_alipay_config = unserialize($PayInfo);
-
-
- if (version_compare(PHP_VERSION,'5.5.0','<')) {
- $this->php_version = 1;
- }else{
- $this->php_version = 0;
- }
-
-
- $redirect_url = '';
- $pay_open = getUsersConfigData('pay.pay_open');
- $web_users_switch = tpCache('web.web_users_switch');
- if (empty($pay_open)) {
-
- $redirect_url = url('user/Users/index');
- $msg = '支付功能尚未开启!';
- } else if (empty($web_users_switch)) {
-
- $redirect_url = ROOT_DIR.'/';
- $msg = '会员中心尚未开启!';
- }
- if (!empty($redirect_url)) {
- Db::name('users_menu')->where([
- 'mca' => 'user/Shop/shop_centre',
- 'lang' => $this->home_lang,
- ])->update([
- 'status' => 0,
- 'update_time' => getTime(),
- ]);
- $this->error($msg, $redirect_url);
- }
-
- }
-
-
- public function level_centre()
- {
-
- $users_type = $this->users_type_manage_db->order('sort_order asc')->select();
- $this->assign('users_type', $users_type);
-
-
- $member_limit_arr = Config::get('global.admin_member_limit_arr');
- foreach($member_limit_arr as $key => $value) {
-
- $member_limit_arr[$key] = $value['limit_name'];
- }
- $this->assign('member_limit_arr', $member_limit_arr);
-
-
- $where_1 = [
- 'users_id' => $this->users_id,
- 'cause_type' => 0,
- 'status' => 1,
- 'lang' => $this->home_lang,
- ];
- $OrderNumber = $this->users_money_db->where($where_1)->getField('order_number');
- $this->assign('OrderNumber', $OrderNumber);
-
-
- $is_open_wechat = 1;
- if (!empty($this->pay_wechat_config)) {
- $is_open_wechat = !empty($this->pay_wechat_config['is_open_wechat']) ? $this->pay_wechat_config['is_open_wechat'] : 0;
- } else {
- $where = [
- 'pay_id' => 1,
- 'pay_mark' => 'wechat'
- ];
- $PayInfo = Db::name('pay_api_config')->where($where)->getField('pay_info');
- if (!empty($PayInfo)) {
- $wechat = unserialize($PayInfo);
- $is_open_wechat = !empty($wechat['is_open_wechat']) ? $wechat['is_open_wechat'] : 0;
- }
- }
- $this->assign('is_open_wechat', $is_open_wechat);
-
-
- $is_open_alipay = 1;
- if (!empty($this->pay_alipay_config)) {
- $is_open_alipay = !empty($this->pay_alipay_config['is_open_alipay']) ? $this->pay_alipay_config['is_open_alipay'] : 0;
- } else {
- $where = [
- 'pay_id' => 2,
- 'pay_mark' => 'alipay'
- ];
- $PayInfo = Db::name('pay_api_config')->where($where)->getField('pay_info');
- if (!empty($PayInfo)) {
- $alipay = unserialize($PayInfo);
- $is_open_alipay = !empty($alipay['is_open_wechat']) ? $alipay['is_open_wechat'] : 0;
- }
- }
- $this->assign('is_open_alipay', $is_open_alipay);
-
- $result = [];
-
- $result['title'] = Db::name('users_menu')->where([
- 'mca' => 'user/Level/level_centre',
- 'lang' => $this->home_lang,
- ])->getField('title');
-
-
- $pay_balance_open = getUsersConfigData('pay.pay_balance_open');
- if (!is_numeric($pay_balance_open) && empty($pay_balance_open)) {
- $pay_balance_open = 1;
- }
- $result['pay_balance_open'] = $pay_balance_open;
-
-
- $eyou = array(
- 'field' => $result,
- );
- $this->assign('eyou', $eyou);
-
-
- $referurl = input('param.referurl/s', null, 'htmlspecialchars_decode,urldecode');
- if (empty($referurl)) {
- if (isset($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'], $this->request->host())) {
- $referurl = $_SERVER['HTTP_REFERER'];
- } else {
- $referurl = url("user/Users/centre");
- }
- }
- cookie('referurl', $referurl);
- $this->assign('referurl', $referurl);
-
- return $this->fetch('users/level_centre');
- }
-
- }
|