Browse Source

取消跟踪 .env
把敏感信息放进 .env 访问
把之前临时用在 config 里的配置转移到后台配置,可以方便运营调整

joe 3 years ago
parent
commit
e86a31f818

+ 0 - 1
.env

@@ -1 +0,0 @@
-APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
HOSTPORT = 3306
USERNAME = twong
PASSWORD = 'twong'
DATABASE = twong
PREFIX = eb_
CHARSET = utf8
DEBUG = true

[LANG]
default_lang = zh-cn

+ 43 - 1
.example.env

@@ -1 +1,43 @@
-APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = test
USERNAME = username
PASSWORD = password
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
PREFIX = eb_

[LANG]
default_lang = zh-cn
+APP_DEBUG = true
+
+[APP]
+DEFAULT_TIMEZONE = Asia/Shanghai
+HOST = ''
+QY_WECHAT_ROBOT_KEY = 'a17b9d56-b566-404b-904e-8864534534'
+SERVER_IP = '127.0.0.1'
+
+[DATABASE]
+TYPE = mysql
+DRIVER = mysql
+HOSTNAME = 127.0.0.1
+HOSTPORT = 3306
+USERNAME = root
+PASSWORD = root
+DATABASE = twong
+PREFIX = eb_
+CHARSET = utf8
+DEBUG = true
+
+[REDIS]
+HOSTNAME = '127.0.0.1'
+HOSTPORT = 6379
+PASSWORD = 'sdjfsdf'
+DATABASE = 1
+TIMEOUT = 5000
+PREFIX = 'cc:'
+
+[BEANSTALK]
+HOSTNAME = '127.0.0.1'
+HOSTPORT = 11300
+
+[CACHE]
+DRIVER = 'redis'
+
+[FILESYSTEM]
+DRIVER = 'public'
+
+[LOG]
+CHANNEL='file'
+
+[LANG]
+DEFAULT_LANG = zh-cn

+ 1 - 0
.gitignore

@@ -6,5 +6,6 @@ public/install/install.lock
 *.xlsx
 *.xls
 *.pid
+.env
 docs/api_admin
 docs/api_front

+ 66 - 1
CHANGELOG

@@ -8,4 +8,69 @@ ALTER TABLE eb_user ADD channel INT(8) DEFAULT 0 NOT NULL COMMENT '渠道编号'
 CREATE INDEX eb_user_channel_IDX USING BTREE ON eb_user (channel);
 INSERT INTO eb_dict_coin (symbol,name,icon,price,min_withdrawal,mine_per_sec,status) VALUES
 	 ('PIG','PIGTOKEN','http://twongpic.shotshock.shop/logos/icon-pigg.png',0.00000120,10000.00000000,0.00000000,0),
-	 ('RMB','RMB','http://twongpic.shotshock.shop/logos/rmb.png',1.00000000,1.00000000,0.00000000,0);
+	 ('RMB','RMB','http://twongpic.shotshock.shop/logos/rmb.png',1.00000000,1.00000000,0.00000000,0);
+
+2022-07-29:
+
+-- 注意一下表名前缀需要根据实际情况更改 
+INSERT INTO eb_system_config_tab
+(pid, title, eng_title, status, info, icon, `type`, sort)
+VALUES(0, '活动配置', 'activity_config', 1, 0, 'cutlery', 0, 0);
+INSERT INTO eb_system_config_tab
+(pid, title, eng_title, status, info, icon, `type`, sort)
+VALUES(0, '排行榜配置', 'leaderboard', 1, 0, 'cny', 0, 0);
+
+
+-- 注意 config_tab_id 值为上面两条实际生成的 ID
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('off_days_before', 'text', 'number', 5, '', NULL, 'require:true', 100, NULL, '"60"', '自动下架天数', '上架时间超过此天数的商品自动下架,避免上游缺货,0表示不自动下架', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('server_ip', 'text', 'input', 1, '', NULL, 'require:true', 100, NULL, '0.0.0.0', '网站IP', '主服务器IP,用于微信支付双向校验', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('show_benefit', 'radio', 'number', 5, '0=>不显示
+1=>显示', NULL, NULL, NULL, NULL, '"1"', '是否显示赔付金额', '前端商品列表中是否显示赔付多少钱', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('notice_sender', 'text', 'input', 5, '', NULL, 'required:true', 100, NULL, '"\\u8fd0\\u8425\\u4e2d\\u5fc3"', '消息发送者名称', '客户端用户收到系统消息的发送者', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('notice_max', 'text', 'number', 5, '', NULL, 'required:true', 100, NULL, '"30"', '消息最大条数', '客户端消息最多显示多少条', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('extract_weixin_enabled', 'radio', 'number', 5, '1=>开启
+0=>关闭', NULL, NULL, NULL, NULL, '"1"', '微信提现', '是否开启微信提现', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('extract_weixin_bank_enabled', 'radio', 'number', 5, '1=>开启
+0=>关闭', NULL, NULL, NULL, NULL, '"1"', '微信支付银行卡提现', '是否开启微信平台的银行卡提现', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('extract_alipay_enabled', 'radio', 'number', 5, '1=>开启
+0=>关闭', NULL, NULL, NULL, NULL, '"0"', '支付宝提现', '是否开启支付宝提现', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('extract_alipay_bank_enabled', 'radio', 'number', 5, '1=>开启
+0=>关闭', NULL, NULL, NULL, NULL, '"0"', '支付宝银行卡提现', '是否开启支付宝平台的银行卡提现', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('bank_extract_free', 'radio', 'number', 24, '1=>开启
+0=>关闭', NULL, NULL, NULL, NULL, '"0"', '提现免手续费', '支付平台银行卡提现有手续费,免手续费指官方垫付手续费', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('register_money', 'text', 'number', 24, '', NULL, '', 100, NULL, '0.0', '注册送钱(元)', '注册即送多少钱', 0, 1);
+
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('leader_board_banner', 'upload', 'input', 25, '', 1, NULL, NULL, NULL, NULL, '顶部图片', '客户端排行榜页面顶部图片(750x161)', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('leader_max_num', 'text', 'number', 25, '', NULL, '', 100, NULL, '30', '最大人数', '排行榜只显示前多少名', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('leader_robot_earn_min', 'text', 'number', 25, '', NULL, NULL, 100, NULL, '"0"', '机器人最少返利(元)', '机器人定时下订单并获得返利,最少返利和最多返利定义了机器人单次返利范围', 0, 1);
+INSERT INTO eb_system_config
+(menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
+VALUES('leader_robot_earn_max', 'text', 'number', 25, '', NULL, NULL, 100, NULL, '"50"', '机器人最多返利(元)', '机器人定时下订单并获得返利,最少返利和最多返利定义了机器人单次返利范围', 0, 1);

+ 7 - 7
app/admin/controller/user/UserNotice.php

@@ -42,17 +42,17 @@ class UserNotice extends AuthController
      */
     public function create()
     {
-        $sender = Config::get('app.notice_sender');
+        $sender = sys_config('notice_sender', '运营中心');
         $f = array();
         $f[] = Form::input('user', '发送人', $sender);
         $f[] = Form::frameImageOne('icon', '图标', Url::buildUrl('admin/widget.images/index', array('fodder' => 'icon')))->icon('image')->width('100%')->height('500px');
         $f[] = Form::input('title', '通知标题');
         $f[] = Form::input('content', '通知内容')->type('textarea')->rows(10);
         $f[] = Form::radio('type', '消息类型', 1)->options([
-            ['label' => '系统通知', 'value' => 0], 
+            ['label' => '系统通知', 'value' => 0],
             // ['label' => '分组通知', 'value' => 1],
             ['label' => '用户通知', 'value' => 2],
-            ]);
+        ]);
         $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('save'));
         $this->assign(compact('form'));
         return $this->fetch('public/form-builder');
@@ -93,10 +93,10 @@ class UserNotice extends AuthController
         $f[] = Form::input('title', '通知标题', $notice["title"]);
         $f[] = Form::input('content', '通知内容', $notice["content"])->type('textarea')->rows(10);
         $f[] = Form::radio('type', '消息类型', $notice["type"])->options([
-            ['label' => '系统通知', 'value' => 0], 
+            ['label' => '系统通知', 'value' => 0],
             // ['label' => '分组通知', 'value' => 1],
             ['label' => '用户通知', 'value' => 2],
-            ]);
+        ]);
         $form = Form::make_post_form('编辑通知', $f, Url::buildUrl('update', ["id" => $id]), 2);
         $this->assign(compact('form'));
         return $this->fetch('public/form-builder');
@@ -166,7 +166,7 @@ class UserNotice extends AuthController
                 $model = $model->where("A.uid", $notice['uid']);
             }
             $model->order('A.uid desc');
-        } else if($notice['type'] == 2) {
+        } else if ($notice['type'] == 2) {
             $model = $model->join('UserNoticeSee B', 'A.uid = B.uid', 'RIGHT');
             $model = $model->where("B.nid", $notice['id']);
             $model->order('B.add_time desc');
@@ -313,4 +313,4 @@ class UserNotice extends AuthController
         UserNoticeModel::edit(array("send_time" => time(), 'uid' => $uid), $id);
         return Json::successful('发送成功!');
     }
-}
+}

+ 1 - 1
app/api/controller/PublicController.php

@@ -41,7 +41,7 @@ class PublicController
     public function index(Request $request)
     {
         $filing_info = sys_config('filing_info') ?? '';
-        $show_benefit = Config::get('app.show_benefit', false);
+        $show_benefit = sys_config_int('show_benefit');
         $banner = sys_data('routine_home_banner') ?: []; //TODO 首页banner图
         $menus = sys_data('routine_home_menus') ?: []; //TODO 首页按钮
         $roll = SystemCarousel::getFirst(20); // sys_data('routine_home_roll_news') ?: [];//TODO 首页滚动新闻 update to carousel

+ 6 - 6
app/api/controller/board/UserBoardController.php

@@ -5,7 +5,6 @@ namespace app\api\controller\board;
 use crmeb\services\UtilService;
 use app\models\board\UserBoard;
 use \think\facade\Config;
-use tw\command\console;
 use tw\lib\robot\Robots;
 use tw\redis\BoardRds;
 
@@ -59,17 +58,17 @@ class UserBoardController
     /**
      * 讀取数据库中每日榜单的今日榜单
      */
-    protected function daily_win_money()
+    protected function daily_win_money($max = 30)
     {
         $board = new UserBoard();
-        $res = $board->getDailyWinMoney();
+        $res = $board->getDailyWinMoney($max);
         foreach ($res as &$row) {
             $row['value'] = floatval($row['value']);
             $row['border'] = 0;
             $row['vip'] = 0;
         }
         return [
-            'banner' => Config::get('app.leader_board_banner'),
+            'banner' => sys_config('leader_board_banner'),
             'name' => "日榜",
             'board' => $res,
         ];
@@ -80,8 +79,9 @@ class UserBoardController
      */
     public function cache_board()
     {
-        $real_board = $this->daily_win_money();
-        $robot_board = Robots::first_n_by_value(30);
+        $max = sys_config('leader_max_num');
+        $real_board = $this->daily_win_money($max);
+        $robot_board = Robots::first_n_by_value($max);
 
         $board = array_merge($robot_board, $real_board['board']);
         // 过滤掉 value == 0 的记录

+ 6 - 6
app/api/controller/coin/UserCoinController.php

@@ -62,7 +62,7 @@ class UserCoinController
     public function status(Request $request)
     {
         // 是否开启挖矿
-        $symbol = Config::get('app.mining_symbo');
+        $symbol = Config::get('activity.mining_symbo');
         //
         $coinInfo = Cache::get($symbol);
         if (!$coinInfo) {
@@ -200,8 +200,8 @@ class UserCoinController
 
     public static function get_step(): float
     {
-        $secs_unit = Config::get('app.mining_sec_unit');
-        $reward_unit = Config::get('app.mining_num_per_unit');
+        $secs_unit = Config::get('activity.mining_sec_unit');
+        $reward_unit = Config::get('activity.mining_num_per_unit');
         return twdiv($reward_unit, $secs_unit, 8);
     }
 
@@ -221,7 +221,7 @@ class UserCoinController
         }
 
         // 是否开启活动
-        $symbol = Config::get('app.mining_symbo');
+        $symbol = Config::get('activity.mining_symbo');
         if (!$symbol) {
             return app('json')->fail('本活动未开启');
         }
@@ -256,9 +256,9 @@ class UserCoinController
         // 已挖总额
         $balance = UserCoin::where('uid', $uid)->where('symbol', $symbol)->value('balance') ?? 0.0;
         // 单次活动时长
-        $hours = Config::get('app.mining_time');
+        $hours = Config::get('activity.mining_time');
         if (count($hours) != 2 || $hours[0] > $hours[1]) {
-            warnlog('app.mining_time config error.');
+            warnlog('activity.mining_time config error.');
             return app('json')->fail('启动失败,请联系客服');;
         }
         $hour = random_int($hours[0], $hours[1]);

+ 14 - 0
app/common.php

@@ -235,6 +235,20 @@ if (!function_exists('sys_config')) {
     }
 }
 
+if (!function_exists('sys_config_int')) {
+    function sys_config_int(string $name, $default = 0)
+    {
+        return intval(sys_config($name, strval($default)));
+    }
+}
+
+if (!function_exists('sys_config_float')) {
+    function sys_config_float(string $name, $default = 0.0)
+    {
+        return floatval(sys_config($name, strval($default)));
+    }
+}
+
 if (!function_exists('sys_data')) {
     /**
      * 获取系统单个配置

+ 2 - 2
app/models/board/UserBoard.php

@@ -24,7 +24,7 @@ class UserBoard extends BaseModel
     order by value desc, u.uid asc limit 10
 
      */
-    public function getDailyWinMoney()
+    public function getDailyWinMoney(int $max=30)
     {
         $start = ts_of_day();
         $prefix = Env::get('database.prefix', 'eb_');
@@ -37,7 +37,7 @@ class UserBoard extends BaseModel
             where activity is not null and tso.pay_time > %d and reparation > 0
             group by oid 
             order by value desc, u.uid asc limit %d
-        ", $tcart_info, $torder, $tuser, $start, 30);
+        ", $tcart_info, $torder, $tuser, $start, $max);
         return Db::query($sql);
     }
 }

+ 3 - 3
app/models/store/StoreProduct.php

@@ -64,7 +64,7 @@ class StoreProduct extends BaseModel
         if ($product) {
             $product = $product->toArray();
 
-            if (Config::get('app.show_benefit')) {
+            if (sys_config_int('show_benefit')) {
                 $rate = getRate($product['cate_id']);
                 $product['reputation'] = '赔付' . getReputation($product, $rate);
             }
@@ -100,7 +100,7 @@ class StoreProduct extends BaseModel
      */
     // protected static function search_by_keywords($keywords, $uid)
     // {
-    //     $show_benefit = Config::get('app.show_benefit', false);
+    //     $show_benefit = sys_config_int('show_benefit');
 
     //     $ml = new Client(config('meilisearch.addr', '127.0.0.1'), config('meilisearch.key'));
     //     $idx = $ml->index('products');
@@ -162,7 +162,7 @@ class StoreProduct extends BaseModel
             $baseOrder .= ', ';
         }
         $model->order($baseOrder . 'sort DESC, add_time DESC');
-        $show_benefit = Config::get('app.show_benefit', false);
+        $show_benefit = sys_config_int('show_benefit');
         $fields = 'id,store_name,cate_id,image,IFNULL(sales,0) + IFNULL(ficti,0) as sales,price,stock,spec_type';
         if ($show_benefit) {
             $fields .= ',cost';

+ 1 - 1
app/models/user/User.php

@@ -211,7 +211,7 @@ class User extends BaseModel
         if ($spread_uid) {
             $res1 = self::where('uid', $spread_uid)->inc('spread_count', 1)->update();
         }
-        $register_money = floatval(Config::get('activity.register_money', 0.0));
+        $register_money = sys_config_float('register_money');
 
         //        $storeBrokerageStatu = sys_config('store_brokerage_statu') ? : 1;//获取后台分销类型
         $res2 = self::create([

+ 3 - 3
app/models/user/UserExtract.php

@@ -95,7 +95,7 @@ class UserExtract extends BaseModel
             $insertData['wechat'] = $userInfo['nickname'];
         }
         if ($data['extract_type'] == 'alipay') {
-            $enabled = Config::get('app.extract_alipay_enabled', false);
+            $enabled = sys_config_int('extract_alipay_enabled');
             if (!$enabled) {
                 return self::setErrorInfo('支付宝提现已关闭');
             }
@@ -106,7 +106,7 @@ class UserExtract extends BaseModel
             $insertData['alipay_code'] = $data['alipay_code'];
             $mark = '使用支付宝提现' . $insertData['extract_price'] . '元';
         } else if ($data['extract_type'] == 'bank') {
-            $enabled = Config::get('app.extract_bank_enabled', false);
+            $enabled = sys_config_int('extract_weixin_bank_enabled');
             if (!$enabled) {
                 return self::setErrorInfo('银行卡提现已关闭');
             }
@@ -120,7 +120,7 @@ class UserExtract extends BaseModel
 
             $mark = '使用银联卡' . $insertData['bank_code'] . '提现' . $insertData['extract_price'] . '元';
         } else if ($data['extract_type'] == 'weixin') {
-            $enabled = Config::get('app.extract_weixin_enabled', false);
+            $enabled = sys_config_int('extract_weixin_enabled');
             if (!$enabled) {
                 return self::setErrorInfo('微信提现已关闭');
             }

+ 4 - 4
app/models/user/UserNotice.php

@@ -27,7 +27,7 @@ class UserNotice extends BaseModel
     public static function publishSystemNotice($title, $content, $sender = null, $icon = '')
     {
         if (!$sender) {
-            $sender = Config::get('app.notice_sender', '运营中心');
+            $sender = sys_config('notice_sender', '运营中心');
         }
         self::sendNotice($title, $content, 0, 0, $sender, $icon);
     }
@@ -41,7 +41,7 @@ class UserNotice extends BaseModel
      */
     public static function sendNoticeTo($uid, $title, $content, $icon = '')
     {
-        $sender = Config::get('app.notice_sender', '运营中心');
+        $sender = sys_config('notice_sender', '运营中心');
         self::sendNotice($title, $content, $uid, 2, $sender, $icon);
     }
 
@@ -70,7 +70,7 @@ class UserNotice extends BaseModel
         ", $tnotice, $tnotice_see, $uid, $uid);
         $row = Db::query($sql);
         $num = intval($row[0]['unread']);
-        $max = Config::get('app.notice_max', 30);
+        $max = sys_config_int('notice_max', 60);
         return $num > $max ? $max : $num;
     }
 
@@ -80,7 +80,7 @@ class UserNotice extends BaseModel
      */
     public static function getNoticeList($uid, $page, $limit = 20)
     {
-        $max = Config::get('app.notice_max', 30);
+        $max = sys_config_int('notice_max', 60);
         $limit = $max;
         $prefix = Env::get('database.prefix', 'eb_');
         $tnotice = $prefix . 'user_notice';

+ 7 - 4
config/activity.php

@@ -8,6 +8,13 @@ return [
     'mining_stopped' => false,   // 停止挖矿,启用但停止,可以让当前挖矿未结束的用户结束挖矿,进而关闭活动或更换矿种
     'mining_display_name' => '黑洞星球',
     'mining_display_pic' => 'http://x.png',
+    /// 挖矿配置, 每次更新币种后需要重新配置
+    // 单次挖矿时长
+    'mining_symbo' => 'RMB',
+    'mining_time' => [20, 24],    // 两个值 [min, max] 之间随机, 单位 h
+    // 每 @mining_sec_unit 挖币 @mining_num_per_unit
+    'mining_sec_unit' => 1,
+    'mining_num_per_unit' => 0.000024,
     // 挖矿活动ID
     'mining_cate_id' => 199,
 
@@ -33,8 +40,4 @@ return [
     'luck_b_rate' => 0.5,
     // 幸运活动开奖时间表
     'lucky_daily_opens' => [],
-    // 注册送钱
-    'register_money' => 5.0,
-    // 免费提现
-    'bank_extract_free' => false, 
 ];

+ 3 - 25
config/app.php

@@ -35,7 +35,7 @@ return [
     // 默认应用
     'default_app'      => 'wap',
     // 默认时区
-    'default_timezone' => 'Asia/Shanghai',
+    'default_timezone' => Env::get('app.default_timezone', 'Asia/Shanghai'),
     // 异常页面的模板文件
     'exception_tmpl'   => app()->getRootPath() . 'public/static/exception.tpl',
     // 错误显示信息,非调试模式有效
@@ -43,37 +43,15 @@ return [
     // 显示错误信息
     'show_error_msg'   => false,
 
-    // 前端是否顯示商品賠付盈利
-    'show_benefit' => true,
-    'off_days_before'  => 90,   // 超過(n)天數下架
-    // 部署的云服务器或 VPS IP 地址
-    'server_ip'        => '81.70.81.74',
-    // 微信提现开关
-    'extract_weixin_enabled'  => true,
-    'extract_bank_enabled'    => true,
-    'extract_alipay_enabled'  => false,
-
     /// 企业微信机器人
     // redis key @deprecated.
     'redis_robot_msg_key'   => 'qywechatpush',
     'beanstalk_tube'        => 'twong',
     // 亚里士多得
-    'qy_weixin_robot_aristotle' => 'a17b9d56-b566-404b-904e-4476b95dc8d7',
-
-    /// 自动发消息的消息发送者
-    'notice_sender' => '运营中心',
-    'notice_max' => 30, // 每次最多支持的消息数量
-
-    /// 挖矿配置, 每次更新币种后需要重新配置
-    // 单次挖矿时长
-    'mining_symbo' => 'RMB',
-    'mining_time' => [20, 24],    // 两个值 [min, max] 之间随机, 单位 h
-    // 每 @mining_sec_unit 挖币 @mining_num_per_unit
-    'mining_sec_unit' => 1,
-    'mining_num_per_unit' => 0.000024,
+    'qy_weixin_robot_aristotle' => Env::get('app.qy_wechat_robot_key', ''),
 
     // 排行榜 banner 750 x 142 首页 banner 750x375 精品推荐滚动图 750x282
-    'leader_board_banner' => 'http://twongstatic.shotshock.shop/banner_rank_750x142.jpg',
+    // 'leader_board_banner' => 'http://twongstatic.shotshock.shop/banner_rank_750x142.jpg',
 
     'header_cs_1' => 'http://twongstatic.shotshock.shop/headers/customer_service_1.jpg',
     'header_cs_2' => 'http://twongstatic.shotshock.shop/headers/customer_service_2.jpg',

+ 5 - 3
config/beanstalk.php

@@ -1,6 +1,8 @@
 <?php
 
+use think\facade\Env;
+
 return [
-    'addr' => '127.0.0.1',
-    'port' => 11300,
-];
+    'addr' => Env::get('beanstalk.hostname', '127.0.0.1'),
+    'port' => intval(Env::get('beanstalk.hostport', '11300')),
+];

+ 4 - 4
config/cache.php

@@ -37,11 +37,11 @@ return [
         // 更多的缓存连接
         'redis' => [
             'type' => 'redis',
-            'host' => '127.0.0.1',
-            'port' => '6379',
-            'password' => '123456',
+            'host' => Env::get('redis.hostname', '127.0.0.1'),
+            'port' => Env::get('redis.hostport', '6379'),
+            'password' => Env::get('redis.password', ''),
             'select' => 1,
-            'prefix' => 'cc:',
+            'prefix' => Env::get('redis.prefix', ''),
         ],
     ],
 ];

+ 6 - 1
tw/command/Maintain.php

@@ -265,7 +265,12 @@ class Maintain extends Command
     protected function prod()
     {
         $now = time();
-        $days = Config::get('app.off_days_before', 30);
+        $days = sys_config_int('off_days_before');
+        if ($days <= 0) {
+            warnlog("maintain prod quit. off_days_before=$days");
+            return;
+        }
+
         $days_ago = $now - $days * SECONDS_OF_ONEDAY;
         // 找到过期商品
         $products = StoreProduct::where([

+ 8 - 1
tw/lib/robot/Robots.php

@@ -207,12 +207,19 @@ class Robots
         // 下单人数
         $robot_num = tw_rand(0, count(self::$robots) / 2);
 
+        $min = sys_config_int('leader_robot_earn_min');
+        $max = sys_config_int('leader_robot_earn_max');
+        if ($min > $max) { // swap
+            $t = $min;
+            $min = $max;
+            $max = $t;
+        }
         for ($i = 0; $i < $robot_num; $i++) {
             // 下单人UID
             $index = tw_rand(0, count(self::$robots));
             $uid = self::$ROBOT_BASE_ID + $index;
             // 获利金额
-            $value = tw_divf(tw_rand(500, 5000), 100.0, 2);
+            $value = tw_divf(tw_rand($min * 100, $max * 100), 100.0, 2);
 
             // get - update - set
             $srobot = (new RobotsInfoRds)->hget(false, $uid);

+ 2 - 2
tw/services/payment/MachantPay.php

@@ -91,7 +91,7 @@ class MachantPay
     public static function toWeixin($openid, $trade_no, $amount, $desc = '', $realname = '')
     {
         try {
-            $caller_ip = Config::get('app.server_ip', '127.0.0.1');
+            $caller_ip = sys_config('server_ip', '127.0.0.1');
             $params = self::getWeixinParams();
             $sdk = new SDK($params);
             $req = new Request();
@@ -144,7 +144,7 @@ class MachantPay
             $fee = $max;
         }
         // 是否免手续费
-        $free = Config::get('activity.bank_extract_free', false);
+        $free = sys_config_int('bank_extract_free');
         if ($free) {
             $fee = 0;
         }