From 9e9d887061e156026f70e24ae8307c7f2e4efa49 Mon Sep 17 00:00:00 2001 From: dengbw Date: Thu, 2 Dec 2021 13:46:19 +0800 Subject: [PATCH] luckybag_1202 --- admin/controllers/app/liche/Luckybag.php | 161 ++++++++++++++ admin/controllers/app/liche/Main.php | 10 + admin/controllers/app/licheb/Channel.php | 74 ++++++- admin/views/app/liche/luckybag/lists.php | 122 +++++++++++ admin/views/app/liche/luckybag/lists_log.php | 28 +++ admin/views/app/licheb/channel/lists.php | 6 + admin/views/app/licheb/channel/lists_biz.php | 14 ++ api/controllers/wxapp/liche/Luckybag.php | 199 ++++++++++++++++++ .../liche/App_liche_luckybag_log_model.php | 17 ++ .../liche/App_liche_luckybag_users_model.php | 40 ++++ 10 files changed, 662 insertions(+), 9 deletions(-) create mode 100644 admin/controllers/app/liche/Luckybag.php create mode 100644 admin/views/app/liche/luckybag/lists.php create mode 100644 admin/views/app/liche/luckybag/lists_log.php create mode 100644 api/controllers/wxapp/liche/Luckybag.php create mode 100644 common/models/app/liche/App_liche_luckybag_log_model.php create mode 100644 common/models/app/liche/App_liche_luckybag_users_model.php diff --git a/admin/controllers/app/liche/Luckybag.php b/admin/controllers/app/liche/Luckybag.php new file mode 100644 index 00000000..1a0c28e0 --- /dev/null +++ b/admin/controllers/app/liche/Luckybag.php @@ -0,0 +1,161 @@ + '未领取', 1 => '已领取'); + + public function __construct() + { + parent::__construct(); + $this->load->model('app/liche/app_liche_luckybag_users_model', 'mdLuckyBagUsers'); + $this->load->model('app/liche/app_liche_luckybag_log_model', 'mdLuckyBagLog'); + $this->load->service("app/user_service", array("app_id" => 1)); + } + + public function index() + { + $this->lists(); + } + + public function lists() + { + $params = $this->input->get(); + $params['page'] = $params['page'] ? intval($params['page']) : 1; + $params['size'] = $params['size'] ? intval($params['size']) : 20; + $lists = $users = $where = []; + if ($params['name']) { + $where["uid in (select id from lc_app_liche_users where nickname like '%{$params['name']}%')"] = null; + } + if ($params['mobile']) { + $where["uid in (select id from lc_app_liche_users where mobile like '%{$params['mobile']}%')"] = null; + } + if (status_verify($params['lottery'])) { + $where['lottery'] = $params['lottery']; + } else { + $params['lottery'] = '-99'; + } + if (status_verify($params['gift_bag'])) { + $where['gift_bag'] = $params['gift_bag']; + } else { + $params['gift_bag'] = '-99'; + } + $count = $this->mdLuckyBagUsers->count($where); + if ($count) { + $res = $this->mdLuckyBagUsers->select($where, 'id desc', $params['page'], $params['size']); + $uids = array_column($res, 'uid'); + $res_u = $this->user_service->select(array('id in (' . implode(',', $uids) . ')' => null), 'id DESC', 0, 0, 'id,nickname,mobile'); + foreach ($res_u as $key => $value) { + $users[$value['id']] = array('nickname' => $value['nickname'], 'mobile' => $value['mobile']); + } + foreach ($res as $key => $value) { + $setValue = array(); + $user = $users[$value['uid']]; + $setValue['id'] = $value['id']; + $setValue['uid'] = $value['uid']; + $setValue['nickname'] = $user['nickname']; + $setValue['mobile'] = $user['mobile']; + $setValue['lottery'] = $value['lottery'] ? $this->mdLuckyBagUsers->get_gift($value['lottery'], 1)['title'] : '未中奖'; + $setValue['gift_bag'] = $value['gift_bag']; + $setValue['zhu_li_count'] = $this->mdLuckyBagLog->count(['uid' => $value['uid']]); + $setValue['c_time'] = date('Y-m-d H:i:s', $value['c_time']); + $lists[] = $setValue; + } + } + $lotterys = $this->mdLuckyBagUsers->count(['lottery>' => 0]); + $gift_bags = $this->mdLuckyBagUsers->count(['gift_bag' => 1]); + $menuAry = array(array('id' => 1, 'title' => "中奖", 'value' => $lotterys, 'tag' => '人'), + array('id' => 2, 'title' => "入门礼包", 'value' => $gift_bags, 'tag' => '人')); + $ary['menuAry'] = $menuAry; + $ary['lotteryAry'] = $this->mdLuckyBagUsers->get_gift(0, 1); + $ary['giftBagAry'] = $this->giftBagAry; + $this->data['ary'] = $ary; + $this->data['lists'] = $lists; + $this->data['params'] = $params; + $this->data['_title'] = '福袋活动用户'; + $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count); + return $this->show_view('/app/liche/luckybag/lists', true); + } + + public function lists_log() + { + $params = $this->input->get(); + $params['page'] = $params['page'] ? intval($params['page']) : 1; + $params['size'] = $params['size'] ? intval($params['size']) : 20; + $uid = intval($params['uid']); + $re_u = $this->user_service->get(array('id' => $uid)); + $nickname = $re_u['nickname'] ? $re_u['nickname'] : '未授权'; + $lists = $users = $where = []; + $where['uid'] = $uid; + $count = $this->mdLuckyBagLog->count($where); + if ($count) { + $res = $this->mdLuckyBagLog->select($where, 'id desc', $params['page'], $params['size']); + $uids = array_column($res, 'cf_uid'); + $res_u = $this->user_service->select(array('id in (' . implode(',', $uids) . ')' => null), 'id DESC', 0, 0, 'id,nickname,mobile'); + foreach ($res_u as $key => $value) { + $users[$value['id']] = array('nickname' => $value['nickname'], 'mobile' => $value['mobile']); + } + foreach ($res as $key => $value) { + $setValue = array(); + $user = $users[$value['cf_uid']]; + $setValue['nickname'] = $user['nickname']; + $setValue['mobile'] = $user['mobile']; + $setValue['c_time'] = date('Y-m-d H:i:s', $value['c_time']); + $lists[] = $setValue; + } + } + $this->data['lists'] = $lists; + $this->data['params'] = $params; + $this->data['_title'] = $nickname . '_助力用户'; + $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count); + return $this->show_view('/app/liche/luckybag/lists_log', true); + } + + public function get() + { + } + + public function add() + { + } + + public function edit() + { + } + + public function edit_gift_bag() + { + $params = $this->input->post(); + $uid = intval($params['uid']); + if (!$uid) { + return $this->show_json(SYS_CODE_FAIL, '非法参数!'); + } + $re_u = $this->mdLuckyBagUsers->get(['uid' => $uid]); + if (!$re_u) { + throw new Hd_exception('无此用户!', API_CODE_FAIL); + } + $jsondata = $re_u['jsondata'] ? json_decode($re_u['jsondata'], true) : []; + $jsondata['gift_bag_time'] = date('Y-m-d H:i:s'); + $this->mdLuckyBagUsers->update(['gift_bag' => 1, 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)], ['uid' => $uid]); + return $this->show_json(SYS_CODE_SUCCESS, '操作成功!'); + } + + public function del() + { + } + + public function batch() + { + + } + + public function export() + { + + } +} diff --git a/admin/controllers/app/liche/Main.php b/admin/controllers/app/liche/Main.php index a5a1785f..f73fd62b 100644 --- a/admin/controllers/app/liche/Main.php +++ b/admin/controllers/app/liche/Main.php @@ -20,6 +20,7 @@ class Main extends HD_Controller $this->load->model('Subjects_model', 'subM'); $this->load->model('bobing/bobing_user_model', 'mdBobingUser'); $this->load->model('app/user_accountlog_model'); + $this->load->model('app/liche/app_liche_luckybag_users_model', 'mdLuckyBagUsers'); } public function index() @@ -65,6 +66,15 @@ class Main extends HD_Controller ), ); + $value = $this->mdLuckyBagUsers->count(); + $list[] = array( + 'title' => '福袋活动(人)', + 'value' => $value, + 'btns' => array( + array('name' => '查看详情', 'url' => '/app/liche/luckybag'), + ), + ); + // $appConfig = $this->mdBobingUser->appConfig(); // $value = $this->mdBobingUser->count(array('act_key' => $appConfig['act_key'], 'app_id' => $appConfig['app_id'])); // $list[] = array( diff --git a/admin/controllers/app/licheb/Channel.php b/admin/controllers/app/licheb/Channel.php index dac26e88..9b66118d 100644 --- a/admin/controllers/app/licheb/Channel.php +++ b/admin/controllers/app/licheb/Channel.php @@ -68,10 +68,25 @@ class Channel extends HD_Controller } $params['page'] = $params['page'] ? intval($params['page']) : 1; $params['size'] = $params['size'] ? intval($params['size']) : 20; - $re = $this->mdUsers->get(array('id' => $params['uid'])); + $result = $this->dataSelect($params); + $count = $result['count']; + $this->data['lists'] = $result['lists']; + $this->data['params'] = $result['params']; + $this->data['_title'] = $result['_title']; + $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count); + return $this->show_view('/app/licheb/channel/lists_biz', true); + } + + private function dataSelect($params) + { $lists = []; - $where['lc_app_licheb_channel_biz.uid'] = $params['uid']; $where['lc_biz.status'] = 1; + $_title = '门店列表'; + if ($params['uid']) { + $where['lc_app_licheb_channel_biz.uid'] = $params['uid']; + $re = $this->mdUsers->get(array('id' => $params['uid'])); + $re['uname'] && $_title = $re['uname'] . '_门店列表'; + } !$params['city_id'] && $params['city_id'] = ''; !$params['county_id'] && $params['county_id'] = ''; if ($params['biz_name']) { @@ -96,6 +111,7 @@ class Channel extends HD_Controller $this->db->where($where); $this->db->order_by('lc_app_licheb_channel_biz.id Desc'); $this->db->limit($limit, $offset); + !$params['uid'] && $this->db->group_by('lc_app_licheb_channel_biz.biz_id'); $res = $this->db->get()->result_array(); $county_id_arr = array_unique(array_column($res, 'county_id')); $Areas = $this->mdArea->get_map_by_county_ids($county_id_arr, 'city_name,county_name,county_id', 'county_id'); @@ -110,14 +126,23 @@ class Channel extends HD_Controller $setValue['zbkhs'] = $this->mdCustomers->count(['biz_id' => $value['id'], 'status' => 3]); $setValue['orders'] = $this->mdOrders->count(['biz_id' => $value['id'], 'status>=' => 0, 'brand_id<>' => 3, 'biz_id<>' => 1]); $setValue['days'] = round((time() - $value['c_time']) / 3600 / 24) . '天'; + if (!$params['uid']) { + $this->db->from('lc_app_licheb_channel_biz'); + $this->db->join('lc_app_licheb_users', "lc_app_licheb_users.id = lc_app_licheb_channel_biz.uid", 'left'); + $this->db->select('lc_app_licheb_users.uname'); + $this->db->where(['lc_app_licheb_channel_biz.biz_id' => $value['id']]); + $res_u = $this->db->get()->result_array(); + $unames = $res_u ? implode(',', array_column($res_u, 'uname')) : ''; + $setValue['uname'] = $unames; + } $lists[] = $setValue; } } - $this->data['lists'] = $lists; - $this->data['params'] = $params; - $this->data['_title'] = $re['uname'] . '_门店列表'; - $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count); - return $this->show_view('/app/licheb/channel/lists_biz', true); + $data['lists'] = $lists; + $data['params'] = $params; + $data['count'] = $count; + $data['_title'] = $_title; + return $data; } //展示单条数据 @@ -150,6 +175,37 @@ class Channel extends HD_Controller //导出数据列表 public function export() { - + $params = $this->input->get(); + $params['page'] = 1; + $params['size'] = 10000; + $data = $indexs = array(); + $result = $this->dataSelect($params); + $fileName = $result['_title'] . '数据统计'; + foreach ($result['lists'] as $key => $value) { + $temp['biz_name'] = $value['biz_name']; + $temp['county_name'] = $value['county_name']; + $temp['wjkhs'] = $value['wjkhs']; + $temp['dtkhs'] = $value['dtkhs']; + $temp['ddkhs'] = $value['ddkhs']; + $temp['zbkhs'] = $value['zbkhs']; + $temp['orders'] = $value['orders']; + $temp['days'] = $value['days']; + !$params['uid'] && $temp['uname'] = $value['uname']; + $data[] = $temp; + } + $indexs = [ + 'biz_name' => '门店', + 'county_name' => '地区', + 'wjkhs' => '未见客户数', + 'dtkhs' => '到店客户数', + 'ddkhs' => '订单客户数', + "zbkhs" => "战败客户数", + "orders" => "订单数", + "days" => "创建时间", + ]; + !$params['uid'] && $indexs['uname'] = "渠道经理"; + array_unshift($data, $indexs); + $this->load->library('excel'); + $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); } -} +} \ No newline at end of file diff --git a/admin/views/app/liche/luckybag/lists.php b/admin/views/app/liche/luckybag/lists.php new file mode 100644 index 00000000..5056ff26 --- /dev/null +++ b/admin/views/app/liche/luckybag/lists.php @@ -0,0 +1,122 @@ +
+
+ $value) { ?> + +
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+ +
+
共有条数据
+ + + + + + + + + + + + + + + + + + + + + + + +
用户名称手机号码中奖入门礼包助力用户创建时间
+ + 已领取 + + 设为已领取 + + + +
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/admin/views/app/liche/luckybag/lists_log.php b/admin/views/app/liche/luckybag/lists_log.php new file mode 100644 index 00000000..bc5eb2d1 --- /dev/null +++ b/admin/views/app/liche/luckybag/lists_log.php @@ -0,0 +1,28 @@ +
+
+
共有条数据
+ + + + + + + + + + + + + + + + + +
用户名称手机号码助力时间
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/admin/views/app/licheb/channel/lists.php b/admin/views/app/licheb/channel/lists.php index 45fc0b12..edf53ab0 100644 --- a/admin/views/app/licheb/channel/lists.php +++ b/admin/views/app/licheb/channel/lists.php @@ -17,6 +17,9 @@
+
+ +
@@ -168,4 +171,7 @@ $('#dealer').change(function () { $('#vue-app').submit(); }); + $('#export').click(function () { + window.location.href = '/app/licheb/channel/export'; + }); diff --git a/admin/views/app/licheb/channel/lists_biz.php b/admin/views/app/licheb/channel/lists_biz.php index 6550b7b5..1a287ab0 100644 --- a/admin/views/app/licheb/channel/lists_biz.php +++ b/admin/views/app/licheb/channel/lists_biz.php @@ -27,6 +27,9 @@
+
+ +
@@ -133,4 +136,15 @@ $(function () { }); + $('#export').click(function () { + var count = ; + if (count > 10000) { + layer.msg('单次导出数据不能超过10000'); + return false; + } + var href = $.menu.parseUri(window.location.href); + var arr = href.split('?'); + href = '/app/licheb/channel/export?' + arr[1]; + window.location.href = href; + }); diff --git a/api/controllers/wxapp/liche/Luckybag.php b/api/controllers/wxapp/liche/Luckybag.php new file mode 100644 index 00000000..f04a5f39 --- /dev/null +++ b/api/controllers/wxapp/liche/Luckybag.php @@ -0,0 +1,199 @@ + '2021-11-01', 'e_time' => '2021-12-12', 'title' => '时间·2021-12-11/12']; + + function __construct($inputs, $app_key) + { + parent::__construct($inputs, $app_key); + $this->login_white = array();//登录白名单 + $this->check_status = array();//用户状态校验 + $this->check_mobile = array();//需要手机号 + $this->check_headimg = array();//授权微信信息 + $this->load->model('app/liche/app_liche_luckybag_users_model', 'mdLuckyBagUsers'); + $this->load->model('app/liche/app_liche_luckybag_log_model', 'mdLuckyBagLog'); + } + + protected function get() + { + $params = $this->input_param(); + $lucky_bag_btn = ['title' => '拆福袋', 'status' => 0]; + if ($params['cf_uid'] && ($params['cf_uid'] != $this->myuid)) {//帮别人助力 + $set_uid = $params['cf_uid']; + $user_btn = ['title' => '助力领领红包', 'status' => 1, 'type' => 1]; + $re_l = $this->mdLuckyBagLog->get(['uid' => $params['cf_uid'], 'cf_uid' => $this->myuid]); + if ($re_l) { + $user_btn['title'] = '已为TA助力过'; + $user_btn['status'] = 0; + } + $zhu_li_count = $this->mdLuckyBagLog->count(['uid' => $set_uid]); + } else { + $set_uid = $this->myuid; + $user_btn = ['title' => '邀请好友助力领福袋', 'status' => 1, 'type' => 0]; + $zhu_li_count = $this->mdLuckyBagLog->count(['uid' => $this->myuid]); + if ($this->myuid) { + $re_u = $this->mdLuckyBagUsers->get(['uid' => $this->myuid]); + if (!$re_u) { + $this->mdLuckyBagUsers->add(['uid' => $this->myuid, 'c_time' => time()]); + $re_u['lottery'] = 0; + } + if ($re_u['lottery'] > 0 || $zhu_li_count >= 3) { + $title_lottery = $re_u['lottery'] > 0 ? '已拆福袋' : '拆福袋'; + $lucky_bag_btn = ['title' => $title_lottery, 'status' => 1]; + } + } + } + $list = $this->mdLuckyBagLog->db->select('b.nickname,b.headimg') + ->from('lc_app_liche_luckybag_log as a') + ->join('lc_app_liche_users as b', "b.id=a.cf_uid", 'left') + ->where(['a.uid' => $set_uid]) + ->order_by('a.id Desc') + ->limit(3) + ->get()->result_array(); + $data = array( + 'title' => '哪吒汽车内购会', + "bg" => array('color' => '#f8c33f', 'img' => 'https://qs.haodian.cn/wechat_app/liche/ningDeFD/bag-theme.jpg'), + 'lucky_bag' => ['img' => 'https://qs.haodian.cn/wechat_app/liche/ningDeFD/luckybag.png', 'title' => '哪吒汽车宁德时代内购会' + , 'btn' => $lucky_bag_btn, 'time' => $this->activityTime['title']], + 'user' => ['btn' => $user_btn, 'zhu_li' => ['title' => "当前已有{$zhu_li_count}位好友帮忙", 'value' => $zhu_li_count, 'list' => $list]], + 'gift' => $this->mdLuckyBagUsers->get_gift(), + 'preferential' => ['https://qs.haodian.cn/wechat_app/liche/ningDeFD/policy.jpg'], + ); + return $data; + } + + /** + * Notes:领取礼包 + * Created on: 2021/11/26 11:05 + * Created by: dengbw + * @return mixed + * @throws Hd_exception + */ + protected function put() + { + $this->check_game_date(); + if (!$this->myuid) { + throw new Hd_exception('参数错误', API_CODE_FAIL); + } + $re_u = $this->mdLuckyBagUsers->get(['uid' => $this->myuid]); + if (!$re_u) { + throw new Hd_exception('无此用户,领取失败', API_CODE_FAIL); + } + $bag_title = '内购会入门礼包'; + if ($re_u['lottery'] > 0) { + $lottery = $re_u['lottery']; + $re_u['gift_bag'] && $bag_title = '内购会入门礼包(已领取)'; + } else { + $zhu_li_count = $this->mdLuckyBagLog->count(['uid' => $this->myuid]); + if ($zhu_li_count < 3) { + throw new Hd_exception('还未集齐3位好友拆福袋', API_CODE_FAIL); + } + $lottery = rand(1, 3); + $jsondata = $re_u['jsondata'] ? json_decode($re_u['jsondata'], true) : []; + $jsondata['lottery_time'] = date('Y-m-d H:i:s'); + $this->mdLuckyBagUsers->update(['lottery' => $lottery, 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)] + , ['uid' => $this->myuid]); + } + $gift_list[] = ['title' => $this->mdLuckyBagUsers->get_gift($lottery, 1)['tag'], 'img' => $this->mdLuckyBagUsers->get_gift($lottery, 0)['img']]; + $gift_list[] = ['title' => $bag_title, 'img' => 'https://qs.haodian.cn/wechat_app/liche/ningDeFD/gift-4.jpg']; + $data['title'] = '恭喜您,领取成功!'; + $data['gift'] = ['title' => '恭喜获得:', 'list' => $gift_list]; + $data['content'] = '注:订车后时展示该活动页面,销售会将抽中的礼品,写入合同备注中,提车时兑现。'; + $data['btn'] = ['title' => '给好友送福袋', 'url' => '/pages/ningDeFD/index']; + return $data; + } + + /** + * Notes:助力 + * Created on: 2021/11/26 11:05 + * Created by: dengbw + * @return mixed + * @throws Hd_exception + */ + protected function put_zhu_li() + { + $this->check_game_date(); + $params = $this->input_param(); + //$params['cf_uid'] = 2; + if (!$params['cf_uid'] || !$this->myuid) { + throw new Hd_exception('参数错误', API_CODE_FAIL); + } + if ($params['cf_uid'] == $this->myuid) { + throw new Hd_exception('不能自己助力', API_CODE_FAIL); + } + $user = $this->app_user_model->get(['id' => $params['cf_uid']]); + if (!$user) { + throw new Hd_exception('无此用户,助力失败', API_CODE_FAIL); + } + $re_l = $this->mdLuckyBagLog->get(['uid' => $params['cf_uid'], 'cf_uid' => $this->myuid]); + if ($re_l) { + throw new Hd_exception('您已助力过了', API_CODE_FAIL); + } + $id = $this->mdLuckyBagLog->add(['uid' => $params['cf_uid'], 'cf_uid' => $this->myuid, 'c_time' => time()]); + if (!$id) { + throw new Hd_exception('助力失败', API_CODE_FAIL); + } + $data['title'] = '助力成功'; + $data['content'] = '恭喜您获得一个宁德时代内部员工专属福袋,只要您或者身边有要买新能源汽车的成功下单即可获得豪华礼品。小手一点,免费获得'; + $data['btn'] = ['title' => '去领取红包', 'url' => '/pages/ningDeFD/index']; + return $data; + } + + /** + * Notes:助力用户 + * Created on: 2021/11/30 10:16 + * Created by: dengbw + * @return array + */ + protected function get_zhu_li() + { + $params = $this->input_param(); + $set_uid = $params['cf_uid'] ? intval($params['cf_uid']) : $this->myuid; + $params['page'] = $params['page'] ? intval($params['page']) : 1; + $params['size'] = $params['size'] ? intval($params['size']) : 10; + $list = []; + $where = ['a.uid' => $set_uid]; + $total = $this->mdLuckyBagLog->db->select('a.uid') + ->from('lc_app_liche_luckybag_log as a') + ->join('lc_app_liche_users as b', "b.id=a.cf_uid", 'left') + ->where($where) + ->count_all_results(); + if ($total) { + $offset = ($params['page'] - 1) * $params['size']; + $limit = $params['size']; + $list = $this->mdLuckyBagLog->db->select('b.nickname,b.headimg') + ->from('lc_app_liche_luckybag_log as a') + ->join('lc_app_liche_users as b', "b.id=a.cf_uid", 'left') + ->where($where) + ->order_by('a.id Desc') + ->limit($limit, $offset) + ->get()->result_array(); + } + return ['list' => $list, 'total' => $total]; + } + + protected function check_game_date() + { + $date = date('Y-m-d H:i'); + if ($this->activityTime['s_time'] . ' 00:00' > $date) { + throw new Hd_exception('活动未开始', API_CODE_FAIL); + } + if ($this->activityTime['e_time'] . ' 23:59' < $date) { + throw new Hd_exception('活动已结束', API_CODE_FAIL); + } + } + + protected function post() + { + return $this->put(); + } +} diff --git a/common/models/app/liche/App_liche_luckybag_log_model.php b/common/models/app/liche/App_liche_luckybag_log_model.php new file mode 100644 index 00000000..26bcc824 --- /dev/null +++ b/common/models/app/liche/App_liche_luckybag_log_model.php @@ -0,0 +1,17 @@ +table_name, 'default'); + } +} \ No newline at end of file diff --git a/common/models/app/liche/App_liche_luckybag_users_model.php b/common/models/app/liche/App_liche_luckybag_users_model.php new file mode 100644 index 00000000..58e1bf04 --- /dev/null +++ b/common/models/app/liche/App_liche_luckybag_users_model.php @@ -0,0 +1,40 @@ +table_name, 'default'); + } + + /** + * Notes:红包礼品 + * Created on: 2021/11/26 17:22 + * Created by: dengbw + * @param int $id + * @param int $type + * @return array|mixed + */ + public function get_gift($id = 0, $type = 0) + { + if ($type == 0) { + $content = '入场礼于活动期间抵达内购会现场即可领取内购礼提车时一同领取,权益可转让给亲友'; + $gift = [1 => ['title' => '内购礼:电视机+内购会入场礼包', 'content' => $content, 'img' => 'https://qs.haodian.cn/wechat_app/liche/ningDeFD/gift-1.jpg'] + , 2 => ['title' => '内购礼:电冰箱+内购会入场礼包', 'content' => $content, 'img' => 'https://qs.haodian.cn/wechat_app/liche/ningDeFD/gift-2.jpg'] + , 3 => ['title' => '内购礼:自行车+内购会入场礼包', 'content' => $content, 'img' => 'https://qs.haodian.cn/wechat_app/liche/ningDeFD/gift-3.jpg']]; + } else { + $gift = [1 => ['title' => '电视机', 'tag' => '电视机一台'], 2 => ['title' => '电冰箱', 'tag' => '电冰箱一台'] + , 3 => ['title' => '自行车', 'tag' => '自行车一辆']]; + } + return $id ? $gift[$id] : $gift; + } + +} \ No newline at end of file