From 99b15134b0babc17abe27919841fd995c44d1081 Mon Sep 17 00:00:00 2001 From: lcc Date: Thu, 1 Aug 2024 09:43:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E9=A2=98=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../market/Market_sytopic_enroll_model.php | 15 +- .../market/Market_sytopic_module_model.php | 10 +- home/controllers/h5/market/sylive2/Biz.php | 14 +- home/controllers/h5/market/sylive2/User.php | 60 ++++++++ .../controllers/h5/market/sytopic/Welcome.php | 11 +- .../views/h5/market/sylive2/biz/app_lists.php | 19 +-- home/views/h5/market/sylive2/biz/index.php | 32 ++++- home/views/h5/market/sylive2/user/enroll.php | 131 ++++++++---------- home/views/h5/market/sylive2/user/index.php | 6 +- home/views/h5/market/sytopic/index.php | 86 +++++++++--- market/controllers/api/sytopic/Module.php | 12 +- market/controllers/api/sytopic/Topic.php | 50 +++++-- www/home/css/h5/market/sytopic/h5.css | 2 +- 13 files changed, 313 insertions(+), 135 deletions(-) diff --git a/common/models/market/Market_sytopic_enroll_model.php b/common/models/market/Market_sytopic_enroll_model.php index 8a469c6c..7cd50c73 100644 --- a/common/models/market/Market_sytopic_enroll_model.php +++ b/common/models/market/Market_sytopic_enroll_model.php @@ -19,8 +19,8 @@ class Market_sytopic_enroll_model extends HD_Model $topicUser = $this->topic_user_model->get(['id' => $topicUserId]); $row = $this->get(['status' => 0, 'moduleOptionId' => $id, 'userId' => $topicUser['userId']]); if ($row) { - $this->update(['name' => $name, 'mobile' => $mobile], ['id' => $row['id']]); - return ['code' => 1, 'msg' => '保存成功']; +// $this->update(['name' => $name, 'mobile' => $mobile], ['id' => $row['id']]); + return ['code' => 0, 'msg' => '您的信息已收到,无需重复操作']; } $data = [ 'topicUserId' => $topicUserId, @@ -28,6 +28,7 @@ class Market_sytopic_enroll_model extends HD_Model 'channelId' => $topicUser['channelId'], 'name' => $name, 'mobile' => $mobile, + 'enTime' => date('Y-m-d H:i:s'), 'createTime' => date('Y-m-d H:i:s'), ]; $optionRow['id'] && $data['moduleOptionId'] = $optionRow['id']; @@ -39,4 +40,14 @@ class Market_sytopic_enroll_model extends HD_Model } return ['code' => 1, 'msg' => '保存成功']; } + + public function statusCn() + { + $statusArray = [ + 0 => '待确认', + 1 => '已确认', + 2 => '无效单' + ]; + return $statusArray; + } } \ No newline at end of file diff --git a/common/models/market/Market_sytopic_module_model.php b/common/models/market/Market_sytopic_module_model.php index 47952ea8..a4218696 100644 --- a/common/models/market/Market_sytopic_module_model.php +++ b/common/models/market/Market_sytopic_module_model.php @@ -5,7 +5,7 @@ class Market_sytopic_module_model extends HD_Model { private $table_name = 'lc_market_sytopic_module'; - const TYPE_BANNER = 1; //banner图 +// const TYPE_BANNER = 1; //banner图 const TYPE_DISCOUNT = 2; //特惠报名 const TYPE_SWIPER_BANNER = 3; //广告轮播图 const TYPE_GRID = 4; //网格排列表 @@ -13,12 +13,12 @@ class Market_sytopic_module_model extends HD_Model const TYPE_ARTICLE = 6; // 文章 const TYPE_ARRAY = [ - self::TYPE_BANNER => 'banner图', - self::TYPE_DISCOUNT => '特惠报名', - self::TYPE_SWIPER_BANNER => '轮播图', +// self::TYPE_BANNER => '主图', + self::TYPE_DISCOUNT => '轮播报名', self::TYPE_GRID => '网格报名', self::TYPE_HORIZONTAL => '横排报名', - self::TYPE_ARTICLE => '文章', + self::TYPE_SWIPER_BANNER => '轮播图', + self::TYPE_ARTICLE => '富文本', ]; public function __construct() diff --git a/home/controllers/h5/market/sylive2/Biz.php b/home/controllers/h5/market/sylive2/Biz.php index fd69dbc2..53887749 100644 --- a/home/controllers/h5/market/sylive2/Biz.php +++ b/home/controllers/h5/market/sylive2/Biz.php @@ -8,6 +8,7 @@ class Biz extends Admin public function __construct() { parent::__construct(); + $this->load->model('market/Market_sytopic_enroll_model', 'sytopic_enroll_model'); } //活动列表 @@ -17,8 +18,10 @@ class Biz extends Admin $this->data['multi_org'] = $_SESSION[self::SESSION_KEY]['multi_org'] ? 1 : 0; $this->data['isBiz'] = $user['bizId'] == $user['organizationId'] ? 1 : 0; //微信分享 + $type = $this->input->get('type'); $wx_info = $this->share_info(); $this->data['sign_package'] = $wx_info['sign_package']; + $this->data['type'] = $type; $this->show_view('h5/market/sylive2/biz/index'); } @@ -100,11 +103,20 @@ class Biz extends Admin $rows = $this->topic_model->select($where, 'id desc', $page, $size); foreach ($rows as $item) { $banner = $item['banner'] ? build_qiniu_image_url($item['banner']) : ''; + //浏览数 + $userCount = $this->topic_user_model->count(['topicId' => $item['id'], 'bizId' => $user['bizId']]); + if ($userCount > 10000) { + $userCount = sprintf("%.2f", $userCount / 10000) . 'W'; + } + //留资数 + $lzCount = $this->sytopic_enroll_model->count(['topicId' => $item['id'], 'bizId' => $user['bizId'], 'status <> -1' => null]); $lists[] = [ 'title' => $item['title'], 'img' => $banner, 'time' => date('Y-m-d H:i', strtotime($item['timeStart'])) . '-' . date('Y-m-d H:i', strtotime($item['timeEnd'])), - 'url' => "/h5/market/sytopic?skey=".$this->myencryption->base64url_encode(Common::SIGN_TOP_KEY.'='.$item['id']) + 'url' => "/h5/market/sytopic?skey=" . $this->myencryption->base64url_encode(Common::SIGN_TOP_KEY . '=' . $item['id']), + 'userCount' => $userCount, + 'lzCount' => $lzCount, ]; } } diff --git a/home/controllers/h5/market/sylive2/User.php b/home/controllers/h5/market/sylive2/User.php index c97d87d5..81171ffd 100644 --- a/home/controllers/h5/market/sylive2/User.php +++ b/home/controllers/h5/market/sylive2/User.php @@ -9,6 +9,7 @@ class User extends Admin { parent::__construct(); $this->load->model('market/Market_sylive_organization_model', 'mdSyliveOrganization'); + $this->load->model('market/Market_sytopic_enroll_model', 'sytopic_enroll_model'); $this->load->library('market/sylive_entity'); $this->user = $this->user_model->get(['userId' => $this->uid], 'bizId,topOrgId'); $this->biz_id = $this->user['bizId']; @@ -20,6 +21,8 @@ class User extends Admin $row = $this->market_sylive_organization_model->get(['organizationId' => $this->user['topOrgId']]); $biz_row = $this->market_sylive_organization_model->get(['organizationId' => $this->biz_id]); $headimg = $row['logo'] ? build_qiniu_image_url($row['logo']) : Sylive_entity::HD_IMG; + $type = $this->input->get('type'); + $this->data['type'] = $type; $this->data['headimg'] = $headimg; $this->data['biz_name'] = $biz_row['organizationName']; $this->data['biz_id'] = $this->biz_id; @@ -219,4 +222,61 @@ class User extends Admin $this->data['_title'] = '我的推广'; $this->show_view('h5/market/sylive2/user/enroll'); } + + public function enLists() + { + $page = intval($this->input->get('page')); + $status = $this->input->get('status'); + !$page && $page = 1; + $size = 20; + $user = $this->user_model->get(['userId' => $this->session['userId']]); + $where = [ + 'status<>' => -1, + ]; + if ($user['bizId'] == $user['organizationId']) { //店长 + $where['bizId'] = $user['bizId']; + } else { + $where['channelId'] = $this->session['userId']; + } + if (strlen($status)) { + $where['status'] = intval($status); + } + $total = $this->sytopic_enroll_model->count($where); + $lists = []; + if ($total) { + $res = $this->sytopic_enroll_model->select($where, 'id desc', $page, $size); + $status_array = [ + 0 => ['name' => '待确认', 'class' => 'bg-f8e26a'], + 1 => ['name' => '已确认', 'class' => 'bg-2fdc53'], + 2 => ['name' => '无效单', 'class' => 'bg-f7'] + ]; + $topicIds = array_column($res, 'topicId'); + $topicIdsStr = implode(',', $topicIds); + $topicMap = []; + $topicIdsStr && $topicMap = $this->topic_model->map('id', 'title', ["id in ({$topicIdsStr})" => null], '', '', '', 'id,title'); + $channelUserIds = array_column($res, 'channelId'); + $channelUserIdsStr = implode(',', array_unique($channelUserIds)); + $channelUserMap = []; + $channelUserIdsStr && $channelUserMap = $this->user_model->map('userId', 'uname', ["userId in ({$channelUserIdsStr})" => null], '', '', '', 'userId,uname'); + foreach ($res as $val) { + $topicTitle = $topicMap[$val['topicId']]; + $channelName = $channelUserMap[$val['channelId']]; + $temp = [ + 'name' => $val['name'], + 'phone' => mobile_asterisk($val['mobile']), + 'time' => date('Y-m-d H:i', strtotime($val['enTime'])), + 'source' => [ + ['name' => $topicTitle, 'class' => 'bg-f8e26a'], + ['name' => '团队带客·' . $channelName, 'class' => 'bg-f7'], +// ['name' => '自然客', 'class' => 'bg-2fdc53'] + ], + 'status' => $status_array[$val['status']], + ]; + $lists[] = $temp; + } + } + $data['list'] = $lists; + $data['total'] = $total; + $this->show_json($data, 200); + } } \ No newline at end of file diff --git a/home/controllers/h5/market/sytopic/Welcome.php b/home/controllers/h5/market/sytopic/Welcome.php index 831299ea..2d76ca6b 100644 --- a/home/controllers/h5/market/sytopic/Welcome.php +++ b/home/controllers/h5/market/sytopic/Welcome.php @@ -32,11 +32,14 @@ class Welcome extends Wx } $channelRow = []; $actUser['channelId'] && $channelRow = $this->user_model->get(['userId' => $actUser['channelId']]); + $jsonData = json_decode($row['jsondata'], true); $info = [ 'title' => $row['title'], 'isAdmin' => $this->user_model->checkTopicIsAdmin($this->uid, $this->a_id), 'channelName' => $channelRow ? $channelRow['uname'] : '', - 'channelHeadImg' => $channelRow ? $channelRow['headimg'] : '', + 'channelHeadImg' => $channelRow['headimg'] ?: 'https://img.liche.cn/liche/market/202407/p_e1065373f27937f69142c28ce975a398.png', + 'banner' => $jsonData['banner'] ? build_qiniu_image_url($jsonData['banner']) : '', + 'bgColor' => $jsonData['bg_color'] ?: '', ]; $moduleLists = $this->module_option_model->getTopicModelOptionsList($this->a_id); $this->data['modules'] = array_values($moduleLists); @@ -60,9 +63,9 @@ class Welcome extends Wx $this->show_json('', 400, '请输入姓名'); } $key = self::ENROLL_SIGN_KEY . $mobile; -// if (!$code || $code != $redis->get($key)) { -// $this->show_json('', 400, '请输入正确的验证码'); -// } + if (!$code || $code != $redis->get($key)) { + $this->show_json('', 400, '请输入正确的验证码'); + } $result = $this->sytopic_enroll_model->enroll($optionId, $this->act_uid, $name, $mobile); if (!$result['code']) { $this->show_json('', 400, $result['msg']); diff --git a/home/views/h5/market/sylive2/biz/app_lists.php b/home/views/h5/market/sylive2/biz/app_lists.php index b8962cc9..9757d5d4 100644 --- a/home/views/h5/market/sylive2/biz/app_lists.php +++ b/home/views/h5/market/sylive2/biz/app_lists.php @@ -6,10 +6,11 @@
退出
- + 切换机构 +
-
-

欢迎来到好店云

-

好店云私域活动系统

+

欢迎使用

+

好店云私域营销系统

diff --git a/home/views/h5/market/sylive2/biz/index.php b/home/views/h5/market/sylive2/biz/index.php index 97d446ec..107c251f 100644 --- a/home/views/h5/market/sylive2/biz/index.php +++ b/home/views/h5/market/sylive2/biz/index.php @@ -7,22 +7,42 @@ -