Преглед изворни кода

Wesmiler 2021-0115第4期分销功能新增

wesmiler пре 5 година
родитељ
комит
29e234fd74

+ 14 - 0
app/api/controller/MarketController.php

@@ -66,9 +66,12 @@ class MarketController extends MarketBaseController
                 $memberInfo['withdraw_cost'] = $withdrawCost ? $withdrawCost : 0;
 
                 $memberInfo['balance'] = str_replace('.00','', $memberInfo['balance']);
+                $memberInfo['rank_count'] = UserBalanceLog::getRankCount();
+
                 // 收益
                 $income = UserBalanceLog::where(['user_id'=> $userId,'status'=>2])
                     ->where('type','>',1)
+                    ->where('type','<',30)
                     ->sum('change');
 
                 $memberInfo['income'] = moneyFormat($income, 2);
@@ -379,5 +382,16 @@ class MarketController extends MarketBaseController
         showJson(1005, 1001, $dataList);
     }
 
+    /**
+     * 收益排行榜
+     * @throws \think\exception\DbException
+     */
+    public function getIncomeRank(){
+        $uid = input('uid', 0);
+        $userId = $uid? $uid : $this->userId;
+        $pageSize = input('pageSize', 50);
+        $dataList = UserBalanceLog::getIncomeRankList($pageSize, $userId);
+        showJson(1005, 1001, $dataList);
+    }
 }
 

+ 69 - 13
app/api/controller/TaskController.php

@@ -6,7 +6,9 @@ use app\portal\model\UserModel;
 use app\weixin\model\Books;
 use app\weixin\model\Devices;
 use app\weixin\model\Member;
+use app\weixin\model\UserBalanceLog;
 use app\weixin\model\UserContactLog;
+use app\weixin\service\Award;
 use app\weixin\service\PRedis;
 use think\Controller;
 
@@ -117,14 +119,14 @@ class TaskController extends Controller
             $userIds = [];
             $queenKey = "queens:hearts:" . date('Ymd');
             //echo $queenKey."<br>\n";
-            for($i=0; $i<500; $i++){
+            for ($i = 0; $i < 500; $i++) {
                 $userId = PRedis::lpop($queenKey);
                 //echo $userId."\n";
-                if($userId){
+                if ($userId) {
                     $userIds[] = $userId;
-                    $url = url('/api/task/catchUserHeart','','', true);
+                    $url = url('/api/task/catchUserHeart', '', '', true);
 
-                    httpRequest($url, ['uid'=> $userId],'post','', 2);
+                    httpRequest($url, ['uid' => $userId], 'post', '', 2);
                 }
 
             }
@@ -140,7 +142,8 @@ class TaskController extends Controller
     /**
      * 处理怦然心动
      */
-    public function catchUserHeart(){
+    public function catchUserHeart()
+    {
         $uid = input('uid', 0);
         $dataList = Member::getHeartList($uid, '', true);
         showJson(1005, 1001, $dataList);
@@ -183,13 +186,13 @@ class TaskController extends Controller
             $userids = [];
             $queenKey = "queens:hearts:" . date('Ymd');
             foreach ($dataList as $userId) {
-                if ($userId &&  PRedis::rpush($queenKey, $userId)) {
+                if ($userId && PRedis::rpush($queenKey, $userId)) {
                     $userids[] = $userId;
                 }
             }
 
-            PRedis::expire($queenKey, 2*3600);
-            PRedis::set('tasks:hearts:' . date('Ymd'), ['datalist' => $dataList, 'results' => $userids, 'time'=> date('Y-m-d H:i:s'), 'sql' => $sql], 3600);
+            PRedis::expire($queenKey, 2 * 3600);
+            PRedis::set('tasks:hearts:' . date('Ymd'), ['datalist' => $dataList, 'results' => $userids, 'time' => date('Y-m-d H:i:s'), 'sql' => $sql], 3600);
             $msg = "更新推荐数据入队结果,累计处理" . count($userids) . "个会员数据更新";
             return showJson(1005, $msg, "\n");
         } catch (\Exception $exception) {
@@ -205,7 +208,8 @@ class TaskController extends Controller
      * @throws \think\exception\DbException
      * @throws \think\exception\PDOException
      */
-    public function updateHeartStatus(){
+    public function updateHeartStatus()
+    {
         set_time_limit(0);
         $key = input('key', '');
         $checkKey = config('task.upHeartKey');
@@ -216,7 +220,7 @@ class TaskController extends Controller
         $dataList = Member::alias('m')
             ->join('user_profile up', 'up.userid=m.id', 'left')
             ->where($where)
-            ->where(function($query){
+            ->where(function ($query) {
                 $query->where(db()->raw("up.introduce is NULL or up.introduce = ''"))
                     ->whereOr(db()->raw("up.family is NULL or up.family = ''"))
                     ->whereOr(db()->raw("up.hobby is NULL or up.hobby = ''"))
@@ -226,13 +230,65 @@ class TaskController extends Controller
             })
             ->field('m.id,up.introduce,up.family,up.hobby,up.purpose,up.cause,up.expect')
             ->select()
-            ->each(function($profile, $k){
-                if(empty($profile) || (empty($profile['photolist']) || empty($profile['introduce']) || empty($profile['family']) || empty($profile['hobby']) || empty($profile['purpose']) || empty($profile['cause']) || empty($profile['expect']))){
-                    Member::where(['id'=> $profile['id']])->update(['is_heart'=> 2,'remark'=> '系统检测自动设置隐身']);
+            ->each(function ($profile, $k) {
+                if (empty($profile) || (empty($profile['photolist']) || empty($profile['introduce']) || empty($profile['family']) || empty($profile['hobby']) || empty($profile['purpose']) || empty($profile['cause']) || empty($profile['expect']))) {
+                    Member::where(['id' => $profile['id']])->update(['is_heart' => 2, 'remark' => '系统检测自动设置隐身']);
                 }
             });
 
 
         showJson(1005, 1001, $dataList);
     }
+
+    /**
+     * 活动报名分销收益结算
+     * @throws \think\Exception
+     * @throws \think\Exception\DbException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function catchBookMarket()
+    {
+        set_time_limit(0);
+        $key = input('key', '');
+        $checkKey = config('task.catchBookMarket');
+        if ($key != $checkKey) {
+            showJson(1004, 2009, '', "\n");
+        }
+
+        $catchIds = [];
+        $catchList = [];
+        $bookList = Books::alias('b')
+            ->leftJoin('activity a', 'a.id=b.aid')
+            ->leftJoin('user u', 'u.id=b.uid')
+            ->where('a.endtime', '<=', time())
+//            ->where('a.endtime', '>', time()-24*3600*3)
+            ->where('u.parent_id', '>', 0)
+            ->where(['a.is_top' => 0, 'a.status' => 1, 'b.status' => 3, 'b.is_market' => 2])
+            ->field('b.id,b.uid,b.aid,b.money,u.parent_id,b.status')
+            ->order('b.book_at asc,b.id asc')
+            ->paginate(50)
+            ->each(function ($item, $k) use (&$catchList, &$catchIds) {
+                $userId = isset($item['uid']) ? intval($item['uid']) : 0;
+                $aid = isset($item['aid']) ? $item['aid'] : 0;
+                $money = isset($item['money']) ? floatval($item['money']) : 0;
+                $inviteInfo = Member::getInviteInfo($userId);
+                $inviteId = isset($inviteInfo['invite_id']) ? $inviteInfo['invite_id'] : 0;
+                if ($inviteInfo && $inviteId > 0 && $aid > 0 && $money > 0) {
+                    if (!UserBalanceLog::checkHasMarketBySource($inviteId, $userId, $aid, 9)) {
+                        $catchList[] = $item;
+                        PRedis::set('markets:activity:book_' . $userId . '_' . $aid . '_' . $inviteId, ['info' => $item, 'inviteInfo' => $inviteInfo], 7200);
+                        Award::marketAward($inviteId, $userId, 9, $money);
+                        $catchIds[] = $item['id'];
+                    }
+                }
+            });
+
+        if($catchIds){
+            Books::whereIn('id', $catchIds)->update(['is_market'=> 1,'remark'=> '分销已结算']);
+        }
+
+        $bookList = $bookList? $bookList->toArray() : [];
+        showJson(1005, 1001, ['total'=> $bookList['total'],'bookList' => $bookList['data'], 'catchList' => $catchList]);
+    }
 }

+ 0 - 16
app/api/controller/TestController.php

@@ -47,22 +47,6 @@ class TestController extends HomeBaseController
     public function checkWithdraw(){
         $orderid = input('id', 0);
 
-        $order = UserBalanceLog::alias('ub')
-            ->leftJoin('user u','u.id=ub.user_id')
-            ->where(['ub.id'=> $orderid])
-            ->field('ub.id,ub.order_sn as orderNo,ub.pay_money as amount,u.openid,ub.description as body,ub.status')
-            ->find();
-        $order = $order? $order->toArray() : [];
-        $order['check_name'] = 'NO_CHECK';
-//        $order['real_name'] = '陈永平';
-        var_dump($order);
-        $result = Wechat::transferOrder($order);
-
-        var_dump($result);
-
-        $result = Wechat::queryTransferOrder($order['orderNo']);
-        var_dump($result);
-
     }
 
 }

+ 8 - 0
app/weixin/controller/MarketController.php

@@ -40,6 +40,14 @@ class MarketController extends MarketBaseController
     }
 
     /**
+     * 收益排行榜
+     * @return mixed
+     */
+    public function rank(){
+        return $this->fetch();
+    }
+
+    /**
      * 资料
      * @return mixed
      */

+ 31 - 1
app/weixin/model/Payment.php

@@ -1,5 +1,7 @@
 <?php
 namespace app\weixin\model;
+use app\weixin\model\Member as MemberModel;
+use app\weixin\service\Award;
 use app\weixin\service\PRedis;
 use think\Db;
 
@@ -214,6 +216,16 @@ class Payment
             UserLog::saveLog(['user_id' => $userId, 'type' => 2, 'content' => "充值爱心:{$num}个"]);
 
             db()->commit();
+
+            // 分销收益结算
+            $inviteInfo = MemberModel::getInviteInfo($userId);
+            $inviteId = isset($inviteInfo['invite_id'])? $inviteInfo['invite_id'] : 0;
+            if($inviteInfo && $inviteId>0){
+                PRedis::set('markets:recharge:entry' . $outTradeNo, ['notify' => $notifyData, 'inviteInfo'=> $inviteInfo, 'params' => $params], 7200);
+                Award::marketAward($inviteId, $userId, 8, $orderPayMoney);
+            }
+
+
             return true;
         } catch (\Exception $exception){
             PRedis::set('payments:redheart:error:'.$outTradeNo, $exception, 600);
@@ -420,6 +432,15 @@ class Payment
             UserLog::saveLog(['user_id' => $userId, 'type' => 3, 'content' => "购买VIP:{$num}个月"]);
 
             db()->commit();
+
+            // 分销收益结算
+            $inviteInfo = MemberModel::getInviteInfo($userId);
+            $inviteId = isset($inviteInfo['invite_id'])? $inviteInfo['invite_id'] : 0;
+            if($inviteInfo && $inviteId>0){
+                PRedis::set('markets:vip:entry' . $outTradeNo, ['notify' => $notifyData, 'inviteInfo'=> $inviteInfo, 'params' => $params], 7200);
+                Award::marketAward($inviteId, $userId, 2, $orderPayMoney);
+            }
+
             Payment::rebackOk();
             return true;
         } catch (\Exception $exception){
@@ -431,7 +452,7 @@ class Payment
     }
 
     /**
-     * VIP套餐支付处理
+     * 人工牵线支付处理
      * @param $outTradeNo
      * @param $notifyData
      * @param $taskNo
@@ -554,6 +575,15 @@ class Payment
             UserLog::saveLog(['user_id' => $userId, 'type' => 3, 'content' => "购买人工牵线服务:支付{$orderPayMoney}元"]);
 
             db()->commit();
+
+            // 分销收益结算
+            $inviteInfo = MemberModel::getInviteInfo($userId);
+            $inviteId = isset($inviteInfo['invite_id'])? $inviteInfo['invite_id'] : 0;
+            if($inviteInfo && $inviteId>0){
+                PRedis::set('markets:hand:entry' . $outTradeNo, ['notify' => $notifyData, 'inviteInfo'=> $inviteInfo, 'params' => $params], 7200);
+                Award::marketAward($inviteId, $userId, 3, $orderPayMoney);
+            }
+
             Payment::rebackOk();
             return true;
         } catch (\Exception $exception){

+ 60 - 0
app/weixin/model/UserBalanceLog.php

@@ -18,4 +18,64 @@ class UserBalanceLog extends Model
     public static function checkHasMarket($userid, $sourceUid, $type){
         return UserBalanceLog::where(['user_id'=> $userid, 'source_uid'=> $sourceUid,'type'=> $type, 'status'=> 1])->value('id');
     }
+
+    /**
+     * 验证用户是否已经结算过对应类型项目收益
+     * @param $userid 结算用户ID
+     * @param $sourceUid 来源用户ID
+     * @param $type 收益类型
+     * @return mixed
+     */
+    public static function checkHasMarketBySource($userid, $sourceUid, $sourceId, $type){
+        $where = ['user_id'=> $userid, 'source_uid'=> $sourceUid,'source_id'=> $sourceId,'type'=> $type, 'status'=> 1];
+        return UserBalanceLog::where($where)->value('id');
+    }
+
+    /**
+     * 获取收益排行榜
+     * @param int $pageSize 数量前多少名
+     * @return \think\Paginator
+     * @throws \think\exception\DbException
+     */
+    public static function getIncomeRankList($pageSize= 50, $userId=0){
+        $dataList = UserBalanceLog::alias('ub')
+            ->leftJoin('user u','u.id=ub.user_id')
+            ->where(['ub.status'=> 2,'u.agent_type'=> 1,'u.agent_status'=> 1, 'u.user_type'=> 2])
+            ->where('type','>', 1)
+            ->where('type','<', 30)
+            ->field('u.id,u.user_nickname,u.avatar,'.db()->raw('sum(`ub`.`change`) as income'))
+            ->group('user_id')
+            ->order(db()->raw('sum(`ub`.`change`) desc'))
+            ->order('ub.user_id asc')
+            ->paginate($pageSize);
+        $dataList = $dataList? $dataList->toArray() : [];
+        $counts['rank_num'] = 0;
+        if($dataList && $userId){
+            foreach ($dataList['data'] as $k => $item){
+                if($item['id'] == $userId){
+                    $counts['rank_num'] = $k+1;
+                }
+            }
+            $dataList['counts'] = $counts;
+        }
+
+        return $dataList;
+    }
+
+    /**
+     * 统计数量
+     * @return float|int|string
+     */
+    public static function getRankCount(){
+        return UserBalanceLog::alias('ub')
+            ->leftJoin('user u','u.id=ub.user_id')
+            ->where(['ub.status'=> 2,'u.agent_type'=> 1,'u.agent_status'=> 1, 'u.user_type'=> 2])
+            ->where('type','>', 1)
+            ->where('type','<', 30)
+            ->field('u.id,u.user_nickname,u.avatar,'.db()->raw('sum(`ub`.`change`) as income'))
+            ->group('user_id')
+            ->order(db()->raw('sum(`ub`.`change`) desc'))
+            ->order('ub.user_id asc')
+            ->count('ub.user_id');
+    }
 }

+ 3 - 3
app/weixin/service/Award.php

@@ -84,7 +84,7 @@ class Award
      */
     public static function marketAward($userId, $sourceUid, $type, $money=0)
     {
-        if (empty($type) || $userId <= 0) {
+        if (empty($type) || $userId <= 0 || ($userId == $sourceUid)) {
             return false;
         }
 
@@ -124,7 +124,7 @@ class Award
         // 一级分销收益结算
         $logData['level'] = 1;
         $level1Award = isset($marketConfig['level_1']) ? floatval($marketConfig['level_1']) : 0;
-        $awardMoney = $marketType==1? moneyFormat($level1Award) : moneyFormat($money * ($level1Award / 100));
+        $awardMoney = $marketType==1? moneyFormat($level1Award) : moneyFormat($money * ($level1Award / 100),3);
         $logData['levelAward'] = $level1Award;
         if ($level1Award > 0 && $level1Award <= 100 && $awardMoney > 0) {
             // 账户变动
@@ -209,7 +209,7 @@ class Award
         $logData['level'] = 2;
         $userTwoId = isset($userInfo['parent_id'])? intval($userInfo['parent_id']) : 0;
         $cacheKey = "market:award:u_{$userTwoId}_{$sourceUid}_{$type}";
-        if($userTwoId<=0){
+        if($userTwoId<=0 || $userTwoId == $userId || $userTwoId == $sourceUid){
             PRedis::set("{$cacheKey}:market2", $logData, 7200);
             return false;
         }

+ 3 - 0
app/weixin/service/Member.php

@@ -168,9 +168,12 @@ class Member
             $inviteInfo = MemberModel::getInviteInfo($userId);
             $inviteId = isset($inviteInfo['invite_id'])? $inviteInfo['invite_id'] : 0;
             if($inviteInfo && $inviteId>0){
+                PRedis::set('markets:auth:entry' . $scene, ['inviteInfo'=> $inviteInfo, 'memberInfo' => $memberInfo], 7200);
+
                 $types = ['idcard'=> 5, 'education'=> 6, 'position'=> 7];
                 $type = isset($types[$scene])? $types[$scene] : 0;
                 if($type && !UserBalanceLog::checkHasMarket($inviteId, $userId, $type)){
+
                     Award::marketAward($inviteId, $userId, $type);
                 }
             }

+ 1 - 0
data/config/task.php

@@ -10,5 +10,6 @@ return [
     'contactKey'=> 'Baiybe6db4H2xKL65C1bNb83a07HSTsk', // 密钥
     'heartKey'=> 'Baiybe6db4H2xKL65C1bNb83a07WTTs5', // 密钥
     'upHeartKey'=> 'Heartybe6db4H2x35C1bNb83a07yyTs6', // 密钥
+    'catchBookMarket'=> 'Baiybe6db4H2xKL65MAbNb83a07PPTsc', // 报名分销结算
 
 ];

+ 1 - 0
public/test.log

@@ -0,0 +1 @@
+'./logs/'

+ 5 - 1
public/themes/default/weixin/market/index.html

@@ -62,7 +62,11 @@
                     <li><img src="__TMPL__/weixin/public/assets/img/new-invite.png">
                         <p>团队邀请</p><img class="rjiant" src="__TMPL__/weixin/public/assets/img/tubiao10.png"><h3>团队邀请码,扩充团队成员</h3></li>
                 </a>
-                <a href="/weixin/market/income">
+                <a href="/weixin/market/rank" v-if="memberInfo.rank_count>=10">
+                    <li><img src="__TMPL__/weixin/public/assets/img/new-rank.png">
+                        <p>收益排行榜</p><img class="rjiant" src="__TMPL__/weixin/public/assets/img/tubiao10.png"></li>
+                </a>
+                <a href="/weixin/market/income" >
                     <li><img src="__TMPL__/weixin/public/assets/img/income.png">
                         <p>收益明细</p><img class="rjiant" src="__TMPL__/weixin/public/assets/img/tubiao10.png"></li>
                 </a>

+ 33 - 0
public/themes/default/weixin/market/rank.html

@@ -0,0 +1,33 @@
+<include file="weixin@block:header"/>
+<!--<title>收益排行榜</title>-->
+<link rel="stylesheet" href="__TMPL__/weixin/public/assets/css/rank.css?v={$version}">
+<div id="app" v-cloak>
+    <div class="fanhui2"><h1>收益排行榜</h1>
+        <a href="/weixin/market/index"><img src="__TMPL__/weixin/public/assets/img/tubiao37.png"></a>
+    </div>
+    <div class="main">
+        <div class="invite" v-if="dataList.length">
+            <div class="yaoqrk">
+                <p>您当前累计收益:<span v-text="memberInfo.income">0.00</span>元,<template v-if="counts.rank_num<=0">未上榜</template><template v-else>当前排名:<span v-text="counts.rank_num">0</span>名</template>,<a href="/weixin/market/invite">去推广获取更多收益</a></p>
+
+            </div>
+        </div>
+        <div class="shouc_lb">
+            <ul>
+                <li v-if="dataList.length<=0" class="empty">
+                    <span v-if="!status.loading">暂无数据</span>
+                </li>
+                <li v-else v-for="(item,k) in dataList">
+                    <div class="rank"><span :class="'rank-'+(k+1)">{{k+1}}</span></div>
+                    <div class="wodx"><img class="avatar" :src="item.avatar" onerror="this.src='__TMPL__/weixin/public/assets/img/tubiao7.png'"></div>
+                    <div class="wodx_xim">
+                        <div><h2 v-text="item.user_nickname"></h2> <span>收益<em v-text="item.income?item.income : '0.00'">0</em>元</span></div>
+                    </div>
+                </li>
+                <li v-if="status.loaded && dataList.length>0" class="loaded"><span>已加载完全部</span></li>
+            </ul>
+        </div>
+    </div>
+</div>
+<script src="__TMPL__/weixin/public/assets/js/rank.js?v={$version}"></script>
+<include file="weixin@block:footer"/>

+ 213 - 0
public/themes/default/weixin/public/assets/css/rank.css

@@ -0,0 +1,213 @@
+body {
+    background-color: #fff;
+}
+
+.main {
+    margin-top: 55px;
+    position: relative;
+}
+
+.huxian {
+    background: #fff;
+    height: 45px;
+    margin-top: 40px;
+    position: fixed;
+    z-index: 9999;
+    width: 100%;
+}
+
+.huxian ul {
+    padding: 0 15px;
+    overflow: hidden;
+}
+
+.huxian li {
+    font-size: 16px;
+    color: #333;
+    float: left;
+    overflow: hidden;
+    width: 49.8%;
+    text-align: center;
+    line-height: 43px;
+}
+
+.huxian li.active {
+    color: #ffd132;
+}
+
+
+/*	会员列表*/
+.fanhui2 {
+    position: fixed;
+    top: 0;
+    width: 100%;
+    padding: 0;
+    z-index: 9999;
+}
+
+.fanhui2 img {
+    margin-left: 15px;
+}
+
+.shouc_lb {
+    padding: 0 15px;
+    margin-bottom: 15px;
+    position: relative;
+    margin-top: 15px;
+}
+
+.shouc_lb li {
+    margin-bottom: 15px;
+    overflow: hidden;
+    border-radius: 4px;
+    padding: 15px 0;
+}
+
+.shouc_lb li.loaded, .shouc_lb li.empty {
+    border-bottom: 1px solid transparent;
+}
+
+.shouc_lb .rank {
+    float: left;
+    display: inline-block;
+    width: 30px;
+    height: 72px;
+    line-height: 72px;
+    margin: auto;
+    border-radius: 50%;
+    position: relative;
+    vertical-align: middle;
+    text-align: center;
+}
+.shouc_lb .rank span {
+    font-weight: bold;
+    font-size: 24px;
+    color: #555;
+}
+.shouc_lb .rank .rank-1 {
+    color: #de3709;
+}
+.shouc_lb .rank .rank-2 {
+    color: #e98d13;
+}
+.shouc_lb .rank .rank-3 {
+    color: #eecc07;
+}
+.wodx {
+    width: 72px;
+    height: 72px;
+    background: #fff;
+    margin: auto;
+    float: left;
+    border-radius: 100%;
+    /*margin-left: 10px;*/
+    position: relative;
+    vert-align: middle;
+    border: 1px solid #ffd132;
+}
+
+.wodx .avatar {
+    width: 100%;
+    height: 100%;
+    display: block;
+    border-radius: 100%;
+    overflow: hidden;
+    /*border: 1px solid #ffd132;*/
+}
+
+.wodx .icon {
+    position: absolute;
+    top: -8px;
+    right: -8px;
+    /* left: 0; */
+    margin: auto;
+    transform: rotate(45deg);
+    -ms-transform: rotate(45deg);
+    -moz-transform: rotate(45deg);
+    -webkit-transform: rotate(45deg);
+    -o-transform: rotate(45deg);
+}
+
+.wodx p {
+    text-align: center;
+    font-size: 12px;
+    color: #333;
+    margin-top: 8px;
+}
+
+.wodx_xim {
+    float: left;
+    margin-left: 15px;
+    width: calc(100% - 125px);
+    position: relative;
+    display: inline-block;
+    vertical-align: middle;
+    line-height: 72px;
+    font-size: 0;
+}
+
+.wodx_xim h2 {
+    color: #333;
+    font-size: 16px;
+    font-weight: bold;
+    display: inline-block;
+}
+.wodx_xim span {
+    font-size: 14px;
+    display: inline-block;
+    float: right;
+}
+.wodx_xim span em {
+    font-style: normal;
+    color: #ffd132;
+    font-weight: bold;
+    margin: 0 2px;
+}
+.wodx_xim p {
+    color: #333;
+    font-size: 12px;
+    margin-top: 4px;
+}
+
+.invite {
+    width: 100%;
+    position: relative;
+    font-size: 14px;
+    text-align: left;
+    min-height: 100px;
+}
+
+.invite .yaoqrk {
+    height: 36px;
+    line-height: 36px;
+    margin: 0 15px;
+    display: block;
+}
+.invite .yaoqrk p {
+    font-size: 16px;
+}
+.invite .yaoqrk p span {
+    margin: 0 2px;
+    color: #e62977;
+}
+.invite .yaoqrk a {
+    width: 100%;
+    color: #ffd132;
+    text-decoration: underline;
+}
+
+.shouc_lb li.empty, .shouc_lb li.loaded {
+    background: none;
+}
+
+@media screen and (max-width: 320px) {
+    .wodx_xim h2 {
+        display: block;
+        line-height: 36px;
+    }
+    .wodx_xim span {
+        display: block;
+        line-height: 36px;
+        float: initial;
+    }
+}

BIN
public/themes/default/weixin/public/assets/img/1611875328_143.mobileconfig


BIN
public/themes/default/weixin/public/assets/img/new-rank.png


+ 1 - 1
public/themes/default/weixin/public/assets/js/home.js

@@ -80,7 +80,7 @@ var app = new Vue({
                     _this.memberInfo = res.data
 
                     // 隐身模式不可申请微信
-                    if(_this.memberInfo.is_heart != 1 && _this.type != 2){
+                    if(_this.memberInfo.is_heart != 1){
                         $.modal({
                             id: "privacy",
                             title: "温馨提示",

+ 115 - 0
public/themes/default/weixin/public/assets/js/rank.js

@@ -0,0 +1,115 @@
+var app = new Vue({
+    'el': '#app',
+    'data': {
+        // 数据请求参数
+        params: {
+            page: 1,
+            pageSize: 12,
+            type: 1,
+        },
+        // 统计
+        counts: {
+            rank_num: 0,
+        },
+        // 数据列表
+        dataList: [],
+        // 用户信息
+        memberInfo: {},
+        // 加载状态
+        status: {
+            locading: false,
+            loaded: false,
+        },
+    },
+    created: function(){
+        this.getMemberInfo();
+        this.getDataList(false);
+    },
+    // 渲染数据
+    mounted: function(){
+        var _this = this;
+        // 分类导航切换
+        $(".huxian li").click(function(){
+            var type = $(this).index()+1;
+            $(this).addClass('active').siblings().removeClass('active');
+            _this.params.page = 1;
+            _this.params.type = type;
+            _this.status.loaded = false;
+            _this.dataList = [];
+            _this.getDataList(false);
+        });
+
+        // 滚动加载更多
+        /*$(window).scroll(function(){
+            var scrollHeight = $(this).scrollTop();
+            var height = $('body')[0].scrollHeight;
+            var docHeight = $(this).outerHeight();
+            if(docHeight+scrollHeight >= height){
+                if(_this.status.loading || _this.status.loaded){
+                    return false;
+                }
+                _this.params.page++;
+                _this.getDataList(true);
+            }
+        })*/
+    },
+    methods: {
+        // 获取用户信息
+        getMemberInfo: function(){
+            var _this = this;
+            $.post('/api/market/getInfo', {type:1}, function (res) {
+                if (res.code == 'success'){
+                    _this.memberInfo = res.data
+                }else if(res.code == 'exception'){
+                    var url = res.data.url;
+                    $.showLoading(res.message,'text');
+                    if(url){
+                        setTimeout(function(){
+                            $.hideLoading();
+                            location.href = url;
+                        }, 500)
+                    }
+                }else{
+                    $.toast(res.message, 'text');
+                }
+            }, "json");
+        },
+        // 获取列表数据
+        getDataList: function(more){
+            var _this = this;
+            _this.status.loading = true;
+            if(_this.params.page == 1){
+                _this.dataList = [];
+                _this.counts = {
+                    invite_num: '0',
+                };
+            }
+            if(_this.status.loaded){
+                return false;
+            }
+            $.showLoading("数据加载中...");
+            $.post('/api/market/getIncomeRank', _this.params, function (res) {
+                _this.status.loading = false;
+                $.hideLoading();
+                if (res.code == 'success') {
+                    var dataList = res.data.data;
+                    _this.counts = res.data.counts;
+                    if(dataList.length<=0 && _this.params.page > 1){
+                        _this.status.loaded = true;
+                        return false;
+                    }
+                    if(more){
+                        $.each(dataList, function(k,item){
+                            _this.dataList.push(item);
+                        });
+
+                    }else{
+                        _this.dataList = dataList
+                    }
+                }else{
+                    $.toast(res.message, 'text');
+                }
+            }, "json");
+        },
+    }
+});

+ 1 - 14
public/themes/default/weixin/public/assets/js/team.js

@@ -4,7 +4,7 @@ var app = new Vue({
         // 数据请求参数
         params: {
             page: 1,
-            pageSize: 12,
+            pageSize: 50,
             type: 1,
         },
         // 统计
@@ -119,18 +119,5 @@ var app = new Vue({
                 }
             }, "json");
         },
-        // 去报名
-        detail: function(id){
-            if(id != 15){
-                location.href = '/weixin/activity/bookdetail?id='+id;
-            }
-            /*if(this.params.type == 2){
-                location.href = '/weixin/activity/bookdetail?id='+id;
-            }else if(this.params.type == 3){
-                location.href = '/weixin/activity/bookdetail?id='+id;
-            }else{
-                location.href = '/weixin/activity/book?id='+id;
-            }*/
-        }
     }
 });