syt_128
@@ -15,8 +15,10 @@ class Main extends HD_Controller
|
||||
$this->app_id = 2;
|
||||
parent::__construct();
|
||||
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
|
||||
$this->load->model('app/licheb/syt_activity_model', 'mdSytActivity');
|
||||
$this->load->model('app/material/Material_template_model', 'mdTemplate');
|
||||
$this->load->model('app/material/Material_biz_model', 'mdMaterialBiz');
|
||||
$this->load->model('topics/topics_model', 'mdTopics');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -61,6 +63,25 @@ class Main extends HD_Controller
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
$list = array();
|
||||
$value = $this->mdTopics->count(array('app_id' => $this->app_id));
|
||||
$list[] = array(
|
||||
'title' => '专题(个)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/topics/topics?app_id=' . $this->app_id),
|
||||
),
|
||||
);
|
||||
$value = $this->mdSytActivity->count(array('status>' => -1));
|
||||
$list[] = array(
|
||||
'title' => '私域通-活动(个)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/licheb/sytactivity'),
|
||||
),
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-user', 'list' => $list);
|
||||
|
||||
/*小程序设置 end*/
|
||||
|
||||
/*实时数据 end*/
|
||||
|
||||
@@ -0,0 +1,417 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:私域通-活动
|
||||
* Created on: 2021/11/19 13:38
|
||||
* Created by: dengbw
|
||||
*/
|
||||
|
||||
class Sytactivity extends HD_Controller
|
||||
{
|
||||
private $statusAry = array(-1 => '已删除', 0 => '待审核', 1 => '已通过', 2 => '未通过');
|
||||
private $app_id = 2;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/licheb/syt_activity_model', 'mdSytActivity');
|
||||
$this->load->model('app/licheb/syt_activity_kpidata_model', 'mdSytKpiData');
|
||||
$this->load->model('topics/topics_model', 'mdTopics');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $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 = array();
|
||||
$where = array('status>' => -1);
|
||||
$count = $this->mdSytActivity->count($where);
|
||||
if ($count) {
|
||||
$this->load->library('MyEncryption');
|
||||
$res = $this->mdSytActivity->select($where, 'id desc', $params['page'], $params['size']);
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['title'] = $value['title'];
|
||||
$z_title = '';
|
||||
if ($value['z_id']) {
|
||||
$re_t = $this->mdTopics->get(array('id' => $value['z_id']));
|
||||
$re_t['title'] && $z_title = $re_t['title'];
|
||||
}
|
||||
$setValue['z_id'] = $value['z_id'];
|
||||
$setValue['z_title'] = $z_title;
|
||||
$setValue['s_time'] = $value['s_time'];
|
||||
$setValue['e_time'] = $value['e_time'];
|
||||
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
|
||||
$setValue['status_name'] = $this->statusAry[$value['status']];
|
||||
|
||||
$url = http_host_com('home') . "/h5/syt/special?skey=" . $this->myencryption->base64url_encode("a_id=" . $value['id']);
|
||||
$setValue['url'] = urlencode($url);
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$this->data['_title'] = '私域通-活动列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
return $this->show_view('/app/licheb/syt/activity_lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$id = intval($params['id']);
|
||||
$status_list = $kpi_list = array();
|
||||
$posters = array('imgs_url' => array(), 'imgs' => array());
|
||||
$share_title = $remark = $rule = '';
|
||||
if ($id > 0) {
|
||||
$re = $this->mdSytActivity->get(array('id' => $id));
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '活动不存在!');
|
||||
}
|
||||
$_title = '编辑私域通活动';
|
||||
$dataInfo['editType'] = 0;
|
||||
$dataInfo['edit_url'] = '/app/licheb/sytactivity/edit';
|
||||
$dataInfo['brand_id'] = $re['brand_id'] ? explode(',', $re['brand_id']) : [];
|
||||
$dataInfo['status'] = $re['status'];
|
||||
$dataInfo['z_id'] = $re['z_id'];
|
||||
if ($re['jsondata']) {
|
||||
$jsondata = json_decode($re['jsondata'], true);
|
||||
$share_title = $jsondata['share_title'] ? $jsondata['share_title'] : '';
|
||||
$remark = $jsondata['remark'] ? $jsondata['remark'] : '';
|
||||
$rule = $jsondata['rule'] ? $jsondata['rule'] : '';
|
||||
if ($jsondata['posters']) {
|
||||
foreach ($jsondata['posters'] as $key => $value) {
|
||||
$posters['imgs_url'][] = array("value" => $value['url'], "src" => build_qiniu_image_url($value['url']));
|
||||
$posters['imgs'][] = array("value" => $value['url'], "src" => build_qiniu_image_url($value['url'])
|
||||
, "width" => $value['width'], "height" => $value['height']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($re['z_id']) {
|
||||
$re_t = $this->mdTopics->get(array('id' => $re['z_id']));
|
||||
$dataInfo['z_title'] = $re_t['title'] ? $re_t['title'] : '';
|
||||
}
|
||||
$dataInfo['title'] = $re['title'];
|
||||
$dataInfo['img'] = $re['img'] ? $re['img'] : '';
|
||||
$dataInfo['img_url'] = $re['img'] ? build_qiniu_image_url($re['img']) : '';
|
||||
$dataInfo['time'] = $re['s_time'] . " ~ " . $re['e_time'];
|
||||
$jsonkpi = $re['jsonkpi'] ? json_decode($re['jsonkpi'], true) : '';
|
||||
foreach ($this->mdSytKpiData->kpiAry() as $key => $value) {
|
||||
$kpi_list[$key] = array("num" => $jsonkpi[$key]['num'], "score" => $jsonkpi[$key]['score']
|
||||
, "title" => $value['title1'], "num_tag" => $value['num_tag'], "score_tag" => $value['score_tag']);
|
||||
}
|
||||
} else {
|
||||
$_title = '新增私域通活动';
|
||||
$dataInfo['editType'] = 2;
|
||||
$dataInfo['edit_url'] = '/app/licheb/sytactivity/add';
|
||||
$dataInfo['brand_id'] = [];
|
||||
$dataInfo['status'] = 0;
|
||||
$dataInfo['z_id'] = 0;
|
||||
foreach ($this->mdSytKpiData->kpiAry() as $key => $value) {
|
||||
$kpi_list[$key] = array("num" => 0, "score" => 0, "title" => $value['title1'], "num_tag" => $value['num_tag']
|
||||
, "score_tag" => $value['score_tag']);
|
||||
}
|
||||
}
|
||||
foreach ($this->statusAry as $key => $value) {
|
||||
$status_list[] = array("id" => $key, "name" => $value);
|
||||
}
|
||||
$dataInfo['kpi_list'] = $kpi_list;
|
||||
$dataInfo['id'] = $id;
|
||||
$dataInfo['share_title'] = $share_title;
|
||||
$dataInfo['remark'] = $remark;
|
||||
$dataInfo['rule'] = $rule;
|
||||
$this->data['info'] = $dataInfo;
|
||||
$this->data['status_list'] = $status_list;
|
||||
$this->data['posters'] = $posters;
|
||||
$this->data['_title'] = $_title;
|
||||
return $this->show_view('/app/licheb/syt/activity_edit', true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$checkData = $this->checkData($info);
|
||||
if (!$checkData['code']) {
|
||||
return $this->show_json($checkData['code'], $checkData['msg']);
|
||||
}
|
||||
$brand_id = $info['brand_id'] ? implode(',', $info['brand_id']) : 0;
|
||||
$re = $this->mdSytActivity->get(array("z_id" => $info['z_id'], "brand_id" => $brand_id));
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '该活动已存在!');
|
||||
}
|
||||
$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE);
|
||||
$json_data['share_title'] = $info['share_title'];
|
||||
$json_data['remark'] = $info['remark'];
|
||||
$json_data['rule'] = $info['rule'];
|
||||
//海报
|
||||
$posters = array();
|
||||
if ($info['posters']) {
|
||||
foreach ($info['posters'] as $key => $value) {
|
||||
$posters[] = array('url' => $value['value'], 'width' => $value['width'], 'height' => $value['height']);
|
||||
}
|
||||
}
|
||||
$json_data['posters'] = $posters;
|
||||
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$addData = array("brand_id" => $brand_id, "title" => $info['title'], "z_id" => $info['z_id'], "img" => $info['img']
|
||||
, "jsonkpi" => $jsonkpi, "jsondata" => $jsondata, "status" => $info['status'], "c_time" => time());
|
||||
if ($info['time']) {
|
||||
$time = explode(' ~ ', $info['time']);
|
||||
$addData['s_time'] = $time[0];
|
||||
$addData['e_time'] = $time[1];
|
||||
}
|
||||
$id = $this->mdSytActivity->add($addData);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '新增活动失败!');
|
||||
}
|
||||
$this->data['type'] = 'add';
|
||||
$this->data['id'] = $id;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '新增活动成功!');
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$checkData = $this->checkData($info);
|
||||
if (!$checkData['code']) {
|
||||
return $this->show_json($checkData['code'], $checkData['msg']);
|
||||
}
|
||||
if (!$info['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE);
|
||||
$json_data['share_title'] = $info['share_title'];
|
||||
$json_data['remark'] = $info['remark'];
|
||||
$json_data['rule'] = $info['rule'];
|
||||
//海报
|
||||
$posters = array();
|
||||
if ($info['posters']) {
|
||||
foreach ($info['posters'] as $key => $value) {
|
||||
$posters[] = array('url' => $value['value'], 'width' => $value['width'], 'height' => $value['height']);
|
||||
}
|
||||
}
|
||||
$json_data['posters'] = $posters;
|
||||
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$brand_id = $info['brand_id'] ? implode(',', $info['brand_id']) : 0;
|
||||
$updateData = array("brand_id" => $brand_id, "title" => $info['title'], "z_id" => $info['z_id'], "img" => $info['img']
|
||||
, "jsonkpi" => $jsonkpi, "jsondata" => $jsondata);
|
||||
if ($info['time']) {
|
||||
$time = explode(' ~ ', $info['time']);
|
||||
$updateData['s_time'] = $time[0];
|
||||
$updateData['e_time'] = $time[1];
|
||||
}
|
||||
$this->mdSytActivity->update($updateData, array('id' => $info['id']));
|
||||
$this->data['type'] = 'edit';
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改活动成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改商家状态
|
||||
* Created on: 2020/8/24 11:12
|
||||
* Created by: dengbw
|
||||
* @return bool|void
|
||||
*/
|
||||
public function edit_status()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
if (!$info['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$this->mdSytActivity->update(array("status" => intval($info['status'])), array('id' => $info['id']));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes:私域通-报名
|
||||
* Created on: 2020/12/23 14:54
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function get_enroll_lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
if (!$params['a_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$re = $this->mdSytActivity->get(array('id' => $params['a_id']));
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '活动不存在!');
|
||||
}
|
||||
$res = $this->enrollSelect($params);
|
||||
$lists = $res['lists'];
|
||||
$count = $res['count'];
|
||||
$params = $res['params'];
|
||||
$this->data['_title'] = '私域通-[' . $re['title'] . ']报名';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $res['params'];
|
||||
return $this->show_view('/app/hdy/syt/enroll_lists', true);
|
||||
}
|
||||
|
||||
public function enrollSelect($params)
|
||||
{
|
||||
$this->load->model('app/syt/syt_activity_enroll_model', 'mdSytActivityEnroll');
|
||||
$this->load->model('app/syt/syt_activity_team_model', 'mdSytActivityTeam');
|
||||
$this->load->model('app/hdy/app_hdy_users_model', 'mdHdyUsers');
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$params['a_id'] = intval($params['a_id']);
|
||||
$lists = array();
|
||||
$where = array('status' => 1, 'a_id' => $params['a_id']);
|
||||
if ($params['nickname']) {
|
||||
$where['nickname LIKE "%' . $params['nickname'] . '%"'] = null;
|
||||
}
|
||||
if ($params['mobile']) {
|
||||
$where['mobile LIKE "%' . $params['mobile'] . '%"'] = null;
|
||||
}
|
||||
$count = $this->mdSytActivityEnroll->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdSytActivityEnroll->select($where, 'id desc', $params['page'], $params['size']);
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['nickname'] = $value['nickname'];
|
||||
$setValue['mobile'] = $value['mobile'];
|
||||
$cf_name = '-';
|
||||
if ($value['cf_uid'] || $value['t_id']) {
|
||||
if ($value['cf_uid']) {
|
||||
$reUsers = $this->mdHdyUsers->get(array('id' => $value['cf_uid']));
|
||||
$reUsers['nickname'] && $cf_name = $reUsers['nickname'];
|
||||
} else {
|
||||
$re_t = $this->mdSytActivityTeam->get(array('id' => $value['t_id']));
|
||||
$re_t['name'] && $cf_name = $re_t['name'];
|
||||
}
|
||||
}
|
||||
$setValue['cf_name'] = $cf_name;
|
||||
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$data['lists'] = $lists;
|
||||
$data['count'] = $count;
|
||||
$data['params'] = $params;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:检查新增/修改数据
|
||||
* Created on: 2020/8/20 11:59
|
||||
* Created by: dengbw
|
||||
* @param $info
|
||||
* @return array
|
||||
*/
|
||||
private function checkData($info)
|
||||
{
|
||||
$msg = '';
|
||||
$code = SYS_CODE_FAIL;
|
||||
if (!$info) {
|
||||
$msg = '非法参数';
|
||||
} else if (!$info['brand_id']) {
|
||||
$msg = '请选择活动品牌';
|
||||
} else if (!$info['z_id']) {
|
||||
$msg = '请选择活动专题';
|
||||
} else if (!$info['title']) {
|
||||
$msg = '请输入活动标题';
|
||||
} else if (!$info['time']) {
|
||||
$msg = '请选择活动时间';
|
||||
} else {
|
||||
$code = SYS_CODE_SUCCESS;
|
||||
}
|
||||
return array('code' => $code, 'msg' => $msg);
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
// TODO: Implement batch() method.
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$data = $indexs = array();
|
||||
$res = $this->enrollSelect($params);
|
||||
$fileName = '私域通报名';
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$temp['nickname'] = $value['nickname'];
|
||||
$temp['mobile'] = $value['mobile'];
|
||||
$temp['cf_name'] = $value['cf_name'];
|
||||
$temp['c_time'] = $value['c_time'];
|
||||
$data[] = $temp;
|
||||
}
|
||||
$indexs = [
|
||||
'nickname' => '报名昵称',
|
||||
'mobile' => '手机号',
|
||||
'cf_name' => '来源',
|
||||
'c_time' => '创建时间'
|
||||
];
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
$this->excel->out($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
public function get_topics()
|
||||
{
|
||||
$page = $this->input->post('page') ? intval($this->input->post('page')) : 1;
|
||||
$size = $this->input->post('size') ? intval($this->input->post('size')) : 10;
|
||||
|
||||
$topicsList = array();
|
||||
$where = array('status >' => -1, 'app_id' => $this->app_id);
|
||||
$title = $this->input->post('title');
|
||||
$title && $where['title like "%' . $title . '%"'] = null;
|
||||
$count = $this->mdTopics->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdTopics->select($where, 'id desc', $page, $size);
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['title'] = $value['title'];
|
||||
$topicsList[] = $setValue;
|
||||
}
|
||||
}
|
||||
$this->data['topicsList'] = $topicsList;
|
||||
$hasNext = ceil($count / $size) > $page ? 1 : 0;
|
||||
$this->data['topicsPage'] = array('page' => $page, 'pageLimit' => $size, 'pageCount' => $count, 'hasNext' => $hasNext);
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
private function get_biz_name($info)
|
||||
{
|
||||
$biz_name = '';
|
||||
if ($info['biz_id']) {
|
||||
$reBiz = $this->mdBiz->get(array('id' => $info['biz_id']), 'biz_name');
|
||||
$biz_name = $reBiz['biz_name'];
|
||||
} else if ($info['brand_id']) {
|
||||
$reBrand = $this->mdBrand->get(array('id' => $info['brand_id']), 'brand_name');
|
||||
$biz_name = $reBrand['brand_name'];
|
||||
}
|
||||
return $biz_name;
|
||||
}
|
||||
|
||||
public function get_kpidata()
|
||||
{
|
||||
$this->load->model('app/syt/syt_activity_member_model', 'mdSytActivityMember');
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 10;
|
||||
$where = array('status' => 1);
|
||||
$res = $this->mdSytActivityMember->select($where, 'id asc', $params['page'], $params['size']);
|
||||
foreach ($res as $key => $value) {
|
||||
$this->mdSytKpiData->update(array("t_id" => $value['t_id']), array("a_id" => $value['a_id'], 'cf_uid' => $value['uid']));
|
||||
}
|
||||
print_r($res);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:私域通-门店
|
||||
* Created on: 2021/11/19 13:38
|
||||
* Created by: dengbw
|
||||
*/
|
||||
|
||||
class Sytbiz extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/licheb/syt_biz_score_model', 'mdSytBizScore');
|
||||
$this->load->model('app/licheb/syt_activity_model', 'mdSytActivity');
|
||||
$this->load->model('app/licheb/syt_activity_kpidata_model', 'mdSytActivityKpiData');
|
||||
$this->load->model("biz/biz_model", 'mdBiz');
|
||||
$this->load->model('app/app_weixin_users_model', 'mdWeixinUsers');
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$re_a = $this->mdSytActivity->get(array("id" => $params['a_id']));
|
||||
if (!$re_a) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "活动不存在");
|
||||
}
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$lists = array();
|
||||
$where = array('a_id' => $params['a_id']);
|
||||
if($params['biz_name']){
|
||||
$where['biz_id in (select id from lc_biz where biz_name like "%' . $params['biz_name'] . '%")'] = null;
|
||||
}
|
||||
$count = $this->mdSytBizScore->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdSytBizScore->select($where, 'score DESC,id ASC', $params['page'], $params['size'], 'biz_id,score,c_time');
|
||||
$str_biz_ids = implode(',', array_column($res, 'biz_id'));
|
||||
$map_biz = $this->mdBiz->map('id', 'biz_name', ["id in ({$str_biz_ids})" => null]);
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$enroll_count = $this->mdSytActivityKpiData->count(['kpi' => 'enroll', 'a_id' => $params['a_id'], 'biz_id' => $value['biz_id']]);
|
||||
$browse_count = $this->mdSytActivityKpiData->count(['kpi' => 'browse', 'a_id' => $params['a_id'], 'biz_id' => $value['biz_id']]);
|
||||
$share_count = $this->mdSytActivityKpiData->count(['kpi' => 'share', 'a_id' => $params['a_id'], 'biz_id' => $value['biz_id']]);
|
||||
$setValue['biz_id'] = $value['biz_id'];
|
||||
$setValue['biz_name'] = $map_biz[$value['biz_id']];
|
||||
$setValue['score'] = $value['score'];
|
||||
$setValue['enroll_count'] = $enroll_count;
|
||||
$setValue['browse_count'] = $browse_count;
|
||||
$setValue['share_count'] = $share_count;
|
||||
$setValue['c_time'] = date('Y-m-d H:i:s', $value['c_time']);
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$this->data['_title'] = $re_a['title'] . '-门店统计';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
return $this->show_view('/app/licheb/syt/activity_biz_lists', true);
|
||||
}
|
||||
|
||||
public function get_achievement()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$re_a = $this->mdSytActivity->get(array("id" => $params['a_id']));
|
||||
if (!$re_a) {
|
||||
return $this->show_json(SYS_CODE_FAIL, "活动不存在");
|
||||
}
|
||||
$_title = $re_a['title'].'_业绩报告';
|
||||
$where['a_id'] = $params['a_id'];
|
||||
$params['biz_id'] && $where['biz_id'] = $params['biz_id'];
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
$time[0] && $where["c_time >="] = strtotime($time[0] . ' 00:00:00');
|
||||
$time[1] && $where["c_time <="] = strtotime($time[1] . ' 23:59:59');
|
||||
}
|
||||
$menu_lists = $lists = array();
|
||||
foreach ($this->mdSytActivityKpiData->kpiAry() as $key => $value) {
|
||||
$count = $this->mdSytActivityKpiData->count(array_merge($where, array('kpi' => $key)));
|
||||
$menu_lists[] = array('title' => $value['title2'], 'value' => $count, 'num_tag' => $value['num_tag']);
|
||||
}
|
||||
$count = $this->mdSytActivityKpiData->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdSytActivityKpiData->select($where, 'id DESC', $params['page'], $params['size'], 'id,uid,cf_uid,kpi,c_time');
|
||||
$uids_arr = array_unique(array_column($res, 'uid'));
|
||||
$cf_uids_arr = array_unique(array_column($res, 'cf_uid'));
|
||||
$uids = $this->mdWeixinUsers->get_map_by_ids($uids_arr, 'id,nickname');
|
||||
$cf_uids = $this->mdLichebUsers->get_map_by_ids($cf_uids_arr, 'id,uname');
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['nickname'] = $cf_uids[$value['cf_uid']][0]['uname'] ? $cf_uids[$value['cf_uid']][0]['uname'] : '无昵称';
|
||||
$nickname = $uids[$value['uid']][0]['nickname'] ? $uids[$value['uid']][0]['nickname'] : '无昵称';
|
||||
$setValue['title'] = '新增' . $this->mdSytActivityKpiData->kpiAry($value['kpi'], 'title') . '用户' . $nickname;
|
||||
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$this->data['_title'] = $_title;
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['menu_lists'] = $menu_lists;
|
||||
$this->data['params'] = $params;
|
||||
return $this->show_view('/app/licheb/syt/achievement_lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,8 @@ Class Topics extends AppBase
|
||||
private $moduleAry = array(
|
||||
array('name' => '文本模块', 'tag' => 'text'),
|
||||
array('name' => '广告模块', 'tag' => 'ad'),
|
||||
array('name' => '报名模块', 'tag' => 'enroll')
|
||||
array('name' => '报名模块', 'tag' => 'enroll'),
|
||||
array("name" => "按钮模块", "tag" => "button")
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
@@ -26,6 +27,7 @@ Class Topics extends AppBase
|
||||
$this->load->model('topics/topic_module_ad_model', 'mdModuleAd');
|
||||
$this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll');
|
||||
$this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata');
|
||||
$this->load->model('topics/topic_module_button_model', 'mdModuleButton');
|
||||
$this->load->model('topics/topic_user_log_model', 'mdUserLog');
|
||||
$this->load->model("sys/sys_admin_model", 'mdSysAdmin');
|
||||
}
|
||||
@@ -67,11 +69,6 @@ Class Topics extends AppBase
|
||||
}
|
||||
$res = $this->mdTopics->select($where, "id desc", $params['page'], $size);
|
||||
$count = $this->mdTopics->count($where);
|
||||
|
||||
$view_where["c_time > UNIX_TIMESTAMP(DATE_SUB(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL 7 day))"] = null;
|
||||
$view_select = "tid, count(id) as doc_count, count(distinct app_uid) as doc_count_uid";
|
||||
|
||||
$user_log_arr = $this->mdUserLog->map_groupby('tid', '*', $view_where, $view_select, 'tid');
|
||||
if ($res) {
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
@@ -86,8 +83,6 @@ Class Topics extends AppBase
|
||||
}
|
||||
$setValue['status_name'] = $statusAry[$value['status']];
|
||||
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
|
||||
$setValue['count_view'] = $user_log_arr[$value['id']]['doc_count'] ?: 0;
|
||||
$setValue['count_view_uid'] = $user_log_arr[$value['id']]['doc_count_uid'] ?: 0;
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
@@ -459,6 +454,10 @@ Class Topics extends AppBase
|
||||
$mdModule = $this->mdModuleEnroll;
|
||||
$style = 'block';
|
||||
break;
|
||||
case "button":
|
||||
$title = '按钮模块';
|
||||
$mdModule = $this->mdModuleButton;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
if ($mdModule) {
|
||||
@@ -519,6 +518,10 @@ Class Topics extends AppBase
|
||||
$this->mdModuleAd->add($dataI);
|
||||
} else if ($add_sys_shop_module['tag'] == 'enroll') {
|
||||
$this->mdModuleEnroll->add($dataI);
|
||||
} elseif ($add_sys_shop_module['tag'] == 'button') {
|
||||
$this->mdModuleButton->add($dataI);
|
||||
} elseif ($add_sys_shop_module['tag'] == 'countdown') {
|
||||
$this->mdModuleCountdown->add($dataI);
|
||||
}
|
||||
//更新专题
|
||||
$module_ids = $module_ids ? $module_ids . ',' . $mid : $mid;
|
||||
@@ -920,6 +923,63 @@ Class Topics extends AppBase
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取按扭模块信息
|
||||
* Created on: 2020/10/20 12:48
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function get_button_setting()
|
||||
{
|
||||
$module_id = intval($this->input->get('module_id'));
|
||||
$re_btn = $this->mdModuleButton->get(array('module_id' => $module_id));
|
||||
$setting = $jsondata = array();
|
||||
$status = $module_type = 0;
|
||||
$module_title = $module_descrip = "";
|
||||
if ($re_btn) {
|
||||
$reM = $this->mdTopicModules->get(array('id' => $module_id));
|
||||
$status = intval($reM['status']);
|
||||
$module_title = $re_btn['title'];
|
||||
$module_type = intval($re_btn['type']);
|
||||
$module_descrip = $re_btn['descrip'];
|
||||
if ($re_btn['jsondata']) {
|
||||
$jsondata = json_decode($re_btn['jsondata'], true);
|
||||
$jsondata['img_url'] = $jsondata['img'] ? build_qiniu_image_url($jsondata['img']) : "";
|
||||
}
|
||||
}
|
||||
$setting['status'] = $status;
|
||||
$setting['module_title'] = $module_title;
|
||||
$setting['module_type'] = $module_type;
|
||||
$setting['module_descrip'] = $module_descrip;
|
||||
$setting['module_jsondata'] = $jsondata;
|
||||
$this->data['setting'] = $setting;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '获取成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:保存按扭模块
|
||||
* Created on: 2020/10/20 12:35
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function edit_save_button()
|
||||
{
|
||||
$save_data = $this->input->post('save_data');
|
||||
if (!$save_data['module_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
|
||||
}
|
||||
$dataI['title'] = $save_data['setting']['module_title'];
|
||||
$dataI['type'] = $save_data['setting']['module_type'];
|
||||
$dataI['descrip'] = $save_data['setting']['module_descrip'];
|
||||
$module_jsondata = $save_data['setting']['module_jsondata'];
|
||||
unset($module_jsondata['img_url']);
|
||||
$dataI['jsondata'] = json_encode($module_jsondata, JSON_UNESCAPED_UNICODE);
|
||||
$this->mdModuleButton->update($dataI, array('module_id' => $save_data['module_id']));
|
||||
$where = array('id' => $save_data['module_id']);
|
||||
$upd = array('status' => $save_data['setting']['status']);
|
||||
$this->mdTopicModules->update($upd, $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes:修改状态 0下架,1正常
|
||||
* Created on: 2019/12/3 15:48
|
||||
@@ -938,20 +998,17 @@ Class Topics extends AppBase
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
|
||||
}
|
||||
|
||||
public
|
||||
function del()
|
||||
public function del()
|
||||
{
|
||||
// TODO: Implement del() method.
|
||||
}
|
||||
|
||||
|
||||
public
|
||||
function batch()
|
||||
public function batch()
|
||||
{
|
||||
}
|
||||
|
||||
public
|
||||
function export()
|
||||
public function export()
|
||||
{
|
||||
// TODO: Implement export() method.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<div class="am-g">
|
||||
<div class="col-sm-12">
|
||||
<?php foreach ($menu_lists as $key => $value) { ?>
|
||||
<div class="col-sm-2">
|
||||
<div class="my-panel">
|
||||
<div class="text-center">
|
||||
<?= $value['title'] ?>
|
||||
</div>
|
||||
<div class="text-center" style="padding-top: 3px;">
|
||||
<span><?= $value['value'] ?></span> <?= $value['num_tag'] ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/licheb/sytbiz/get_achievement">
|
||||
<input type="hidden" name="a_id" value="<?= $params['a_id'] ?>">
|
||||
<input type="hidden" name="biz_id" value="<?= $params['biz_id'] ?>">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="order-lists-time" type="text" name="time" value="<?= $params['time'] ?>"
|
||||
placeholder="统计日期范围"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl mb10" style="margin-top: 5px">
|
||||
<div class="am-para-inline w300">
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="today">今天</a>
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);"
|
||||
data-date="yesterday">昨日</a>
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
|
||||
<a class="mr10 order-lists-time-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml30">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="50"><span>ID</span></th>
|
||||
<th width="6%"><span>用户</span></th>
|
||||
<th width="20%"><span>内容</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['nickname'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#order-lists-time', range: '~'
|
||||
});
|
||||
$('.order-lists-time-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', d_obj = new Date();
|
||||
switch (type) {
|
||||
case 'today':
|
||||
date = d_obj.Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case 'yesterday':
|
||||
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
|
||||
date = date + ' ~ ' + date;
|
||||
break;
|
||||
case '7day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
case '30day':
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
}
|
||||
$('#order-lists-time').val(date);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.my-panel {
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.tab-active {
|
||||
background-color: #5cb85c;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.my-panel span {
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,60 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/licheb/sytbiz/lists">
|
||||
<input type="hidden" name="a_id" value="<?= $params['a_id'] ?>">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">门店名称:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="biz_name" value="<?= $params['biz_name'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml100">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%"><span>门店ID</span></th>
|
||||
<th width="15%"><span>门店</span></th>
|
||||
<th width="10%"><span>分数</span></th>
|
||||
<th width="10%"><span>报名</span></th>
|
||||
<th width="10%"><span>浏览</span></th>
|
||||
<th width="10%"><span>分享</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="10%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['biz_id'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['score'] ?></td>
|
||||
<td><?= $v['enroll_count'] ?></td>
|
||||
<td><?= $v['browse_count'] ?></td>
|
||||
<td><?= $v['share_count'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td>
|
||||
<a data-open="/app/licheb/sytbiz/get_achievement?a_id=<?= $params['a_id'] ?>&biz_id=<?= $v['biz_id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">业绩报告</a></td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,543 @@
|
||||
<div class="am-form am-form-horizontal" style="width: 98%;padding-top: 10px">
|
||||
<div id="vue-edit">
|
||||
<div class="am-g">
|
||||
<div class="col-sm-12" style="margin-bottom: 20px;">
|
||||
<div class="col-sm-2">
|
||||
<div class="my-panel">
|
||||
<div class="text-center">
|
||||
状态
|
||||
</div>
|
||||
<div class="text-center" style="padding-top: 5px;">
|
||||
<select v-if="info.id==0" id="status" v-model="info.status">
|
||||
<template v-for="(v,i) in status_list">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
<select v-else id="status" disabled="disabled" v-model="info.status">
|
||||
<template v-for="(v,i) in status_list">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="info.id>0" class="am-form-inline"
|
||||
style="text-align:right;padding-right: 10px;padding-top: 35px;">
|
||||
<div class="am-form-group ml10">
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
|
||||
@click="editType(1)" v-if="info.editType==1">取消编辑</a>
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
|
||||
@click="editType(1)" v-else>编辑状态</a>
|
||||
</div>
|
||||
<div class="am-form-group ml10" v-if="info.editType==1">
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
|
||||
@click="saveStatus()">保存状态</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-u-lg-12">
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">活动信息</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
<a href="javascript:" @click="editType(2)"><i class="fa fa-edit"></i></a></span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">活动专题:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group" style="width: 30%">
|
||||
<input type="text" v-model="info.z_title" disabled="disabled">
|
||||
</div>
|
||||
<div class="am-form-group ml10">
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
|
||||
@click="topicsModal">选择</a>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<span class="f12 clr999 lh-default ml10">注:活动页面只能从现有的专题中选择</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">活动品牌:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-g" style="margin-left: 3px;">
|
||||
<label class="mr10" style="margin-top: 7px" v-for="(v,i) in auto_brands">
|
||||
<input type="checkbox" :value="v.id" v-model="info.brand_id"/> {{v.name}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">活动标题:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<input type="text" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">活动封面:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="cover"><i class="am-icon-cloud-upload"></i> 上传封面
|
||||
</button>
|
||||
<span class="f12 clr999 lh-default ml5">建议尺寸宽度690</span>
|
||||
<input type="hidden" name="cover" id="cover_id"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
value="<?= $info['img'] ?>" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
src="<?= $info['img_url'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">海报图片:</label>
|
||||
<div class="am-para-input">
|
||||
<p><a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="999" data-type="jpg,png,gif,png,jpeg" data-uptype="qiniu"
|
||||
data-mark="goods">上传图片</a></p>
|
||||
<div class="photo-upload">
|
||||
<div class="photo-upload-item" v-for="(v,i) in goods.imgs_url">
|
||||
<img :src="v.src" class="img-thumbnail" :data-value="v.value" data-tips-image
|
||||
style="width:100px;height:100px;">
|
||||
<span class="photo-upload-item-remove"><i class="fa fa-remove"
|
||||
@click="removeImgs(i);"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">分享描述:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<input type="text" v-model="info.share_title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">活动时间:</label>
|
||||
<div class="am-para-input" style="width: 50%">
|
||||
<input id="time_id" value="<?= $info['time'] ?>" type="text" placeholder="开始日期 ~ 结束日期"
|
||||
autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">备注:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<textarea rows="3" v-model="info.remark"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">规则:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<textarea rows="3" v-model="info.rule"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">配置KPI:</label>
|
||||
<div class="am-para-input">
|
||||
<div v-for="(v,i) in info.kpi_list" class="am-form-inline" style="padding-bottom: 10px;">
|
||||
<div class="am-form-group">{{v.title}}</div>
|
||||
<div class="am-form-group" style="width: 10%">
|
||||
<input type="text" v-model="v.num">
|
||||
</div>
|
||||
<div class="am-form-group">{{v.num_tag}}</div>
|
||||
<div class="am-form-group" style="width: 10%;margin-left: 15px;">
|
||||
<input type="text" v-model="v.score">
|
||||
</div>
|
||||
<div class="am-form-group">{{v.score_tag}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.editType==2">
|
||||
<label class="am-para-label"></label>
|
||||
<div class="am-para-input" style="width: 60%">
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
|
||||
@click="saveEdit()">保存活动信息</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="topics-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<div class="header">
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" v-model="topicsName" placeholder="专题名"/>
|
||||
<div class="input-group-btn">
|
||||
<a href="javascript:" class="btn btn-primary btn-stroke"
|
||||
@click="searchByTopicsName()">
|
||||
<i class="fa fa-search"></i></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div style="padding-top: 10px;">
|
||||
<div class="vuetable-body-wrapper">
|
||||
<table class="vuetable table table-middle table-hover fixed">
|
||||
<colgroup>
|
||||
<col class="vuetable-col-title" style="width: 50%;">
|
||||
<col class="vuetable-col-actions text-right">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="vuetable-th-slot-title" style="width: 50%;">专题名</th>
|
||||
<th class="vuetable-th-slot-actions text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot></tfoot>
|
||||
<tbody class="vuetable-body">
|
||||
<tr v-for="(v,i) in topicsList">
|
||||
<td class="vuetable-slot" style="width: 50%;">
|
||||
<div>
|
||||
{{v.title}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="vuetable-slot text-right">
|
||||
<button type='button' v-if="v.selected==0 || !v.selected"
|
||||
class="btn btn-sm btn-success"
|
||||
@click="addTopicsItem(v)">添加
|
||||
</button>
|
||||
<button type='button' v-if="v.selected==1" class="btn btn-sm btn-danger"
|
||||
@click="removeTopicsItem(v)">删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{topicsPage.page}}页(每页{{topicsPage.pageLimit}}条,共{{topicsPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeTopicsPage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="topicsPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterTopicsPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#time_id', range: '~', type: 'datetime'
|
||||
, done: function (value, date, endDate) {
|
||||
if (endDate.hours == "0" && endDate.minutes == "0" && endDate.seconds == "0") {
|
||||
// 改变结束时间默认值
|
||||
$(".layui-laydate-footer [lay-type='datetime'].laydate-btns-time").click();
|
||||
$(".laydate-main-list-1 .layui-laydate-content li ol li:last-child").click();
|
||||
$(".layui-laydate-footer [lay-type='date'].laydate-btns-time").click();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
var layer_open;
|
||||
var vue_obj;
|
||||
$(document).ready(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info: {},
|
||||
goods: {"imgs_url": [], "imgs": []},
|
||||
status_list: [],
|
||||
topicsName: '',
|
||||
topicsList: [],
|
||||
topicsPage: [],
|
||||
topicsThPage: 0,
|
||||
auto_brands: [],
|
||||
},
|
||||
mounted() {
|
||||
var that = this;
|
||||
that.info = <?=json_encode($info)?>;
|
||||
that.status_list = <?=json_encode($status_list)?>;
|
||||
that.goods = <?=json_encode($posters)?>;
|
||||
that.init_auto_brands();
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
},
|
||||
updated: function () {
|
||||
},
|
||||
methods: {
|
||||
init_auto_brands: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/auto/brand/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {status: 1},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
vm.auto_brands = data.data.list;
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
},
|
||||
removeImgs: function (index) {
|
||||
var vm = this;
|
||||
vm.goods.imgs_url.splice(index, 1);
|
||||
vm.goods.imgs.splice(index, 1);
|
||||
},
|
||||
editType: function (index) {
|
||||
var vm = this;
|
||||
if (index == 1) {
|
||||
if (vm.info.editType == 1) {
|
||||
$("#status").attr("disabled", "disabled");
|
||||
vm.info.editType = 0;
|
||||
} else {
|
||||
$("#status").removeAttr("disabled");
|
||||
vm.info.editType = 1;
|
||||
}
|
||||
} else if (index == 2) {
|
||||
if (vm.info.editType == 2) {
|
||||
vm.info.editType = 0;
|
||||
} else {
|
||||
vm.info.editType = 2;
|
||||
}
|
||||
} else {
|
||||
vm.info.editType = 0;
|
||||
}
|
||||
},
|
||||
//选择活动专题
|
||||
topicsModal: function () {
|
||||
var that = this;
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['45%', '80%'], //宽高
|
||||
content: $('#topics-modal'),
|
||||
title: '选择活动专题',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/app/licheb/sytactivity/get_topics',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: that.topicsThPage,
|
||||
title: that.topicsName,
|
||||
},
|
||||
success: function (json) {
|
||||
var topicsList = json.data.topicsList;
|
||||
that.topicsPage = json.data.topicsPage;
|
||||
topicsList.map(function (_item, _index) {
|
||||
if (that.info.z_id == _item.id) {
|
||||
topicsList[_index].selected = 1;
|
||||
} else {
|
||||
topicsList[_index].selected = 0;
|
||||
}
|
||||
})
|
||||
that.topicsList = topicsList;
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeTopicsPage: function () {
|
||||
var vm = this;
|
||||
if (vm.topicsThPage == 1) {
|
||||
alert('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.topicsThPage--;
|
||||
return this.topicsModal();
|
||||
},
|
||||
afterTopicsPage: function () {
|
||||
var vm = this;
|
||||
vm.topicsThPage++;
|
||||
return this.topicsModal();
|
||||
},
|
||||
addTopicsItem: function (item) {
|
||||
var vm = this;
|
||||
vm.info['z_id'] = item.id;
|
||||
vm.info['z_title'] = item.title;
|
||||
this.topicsList.map(function (_item, _index) {
|
||||
if (item.id == _item.id) {
|
||||
_item.selected = 1;
|
||||
} else {
|
||||
_item.selected = 0;
|
||||
}
|
||||
})
|
||||
},
|
||||
removeTopicsItem: function (item) {
|
||||
var vm = this;
|
||||
vm.info['z_id'] = 0;
|
||||
vm.info['z_title'] = '';
|
||||
this.topicsList.map(function (_item, _index) {
|
||||
if (item.id == _item.id) {
|
||||
vm.topicsList[_index].selected = 0;
|
||||
}
|
||||
})
|
||||
},
|
||||
saveEdit: function () {
|
||||
var vm = this;
|
||||
vm.info.time = $('#time_id').val();
|
||||
vm.info.img = $('#cover_id').val();
|
||||
vm.info.posters = vm.goods.imgs;
|
||||
$.ajax({
|
||||
url: vm.info.edit_url,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
if (data['data']['type'] == 'add') {
|
||||
window.location.href = "#/app/licheb/sytactivity/get?id=" + data['data']['id'] + "?spm=<?= $_GET['spm'] ?>";
|
||||
} else {
|
||||
$.form.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
},
|
||||
});
|
||||
},
|
||||
saveStatus: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/app/licheb/sytactivity/edit_status',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
|
||||
.label-width {
|
||||
width: 150px
|
||||
}
|
||||
|
||||
.my-ul ul li {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.my-panel {
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
.auto-content {
|
||||
width: min-content;
|
||||
min-width: 50%;
|
||||
}
|
||||
|
||||
.btn-group .disabled {
|
||||
background-color: #eee;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.photo-upload {
|
||||
position: relative;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.photo-upload:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.photo-upload-item {
|
||||
position: relative;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 12px; /*display:inline-block;width:120px;*/
|
||||
}
|
||||
|
||||
.photo-upload-item > img {
|
||||
}
|
||||
|
||||
.photo-upload-item-check,
|
||||
.photo-upload-item-remove {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -8px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
border: 1px solid #fff;
|
||||
background-color: #eee;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.photo-upload-item:hover .photo-upload-item-remove {
|
||||
opacity: 1;
|
||||
transition: all .4s ease
|
||||
}
|
||||
|
||||
.photo-upload-item-check {
|
||||
opacity: 1;
|
||||
background-color: #36f;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css?v=1581252500">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css?v=1581252500">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/hd.css?v=1581252500">
|
||||
@@ -0,0 +1,78 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/licheb/sytactivity">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">活动标题:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="title" value="<?= $params['title'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml100">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" data-open="/app/licheb/sytactivity/get"
|
||||
class="am-btn am-btn-success am-btn-sm w100">新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%"><span>ID</span></th>
|
||||
<th width="15%"><span>活动标题</span></th>
|
||||
<th width="15%"><span>专题</span></th>
|
||||
<th width="10%"><span>开始时间</span></th>
|
||||
<th width="10%"><span>结束时间</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td align="left"><?= $v['title'] ?></td>
|
||||
<td align="left"><a href="javascript:void(0);"
|
||||
data-open="/topics/topics/get?id=<?= $v['z_id'] ?>"><?= $v['z_title'] ?></a>
|
||||
</td>
|
||||
<td><?= $v['s_time'] ?></td>
|
||||
<td><?= $v['e_time'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="align-r">
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/receiver/customer?cfrom_id=35&t_id=<?= $v['id'] ?>">报名</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/app/licheb/sytbiz/lists?a_id=<?= $v['id'] ?>">门店</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/app/licheb/sytbiz/get_achievement?a_id=<?= $v['id'] ?>">业绩报告</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-modal="/common/share_qrcode?url=<?= $v['url'] ?>"
|
||||
data-title="分享二维码">分享二维码</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/app/licheb/sytactivity/get?id=<?= $v['id'] ?>">编辑</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,6 +83,8 @@
|
||||
:is_template="is_template" @ad-title="changeModuleName"></v-ad>
|
||||
<v-enroll ref="enroll" v-if="module.tag === 'enroll'" :module="module"
|
||||
:is_template="is_template" @enroll-title="changeModuleName"></v-enroll>
|
||||
<v-button ref="button" v-if="module.tag === 'button'" :module="module"
|
||||
:is_template="is_template" @enroll-title="changeModuleName"></v-button>
|
||||
</template>
|
||||
|
||||
<div v-else class="form-group">
|
||||
@@ -135,6 +137,8 @@
|
||||
<? load_view("/topics/module_ad") ?>
|
||||
<!-- v-enroll -->
|
||||
<? load_view("/topics/module_enroll") ?>
|
||||
<!-- v-button -->
|
||||
<? load_view("/topics/module_button") ?>
|
||||
<!--模块操作-->
|
||||
<script type="text/javascript">
|
||||
var content_html;
|
||||
@@ -257,6 +261,7 @@
|
||||
if (tag === 'text') return 'fa-file';
|
||||
if (tag === 'ad') return 'fa-photo';
|
||||
if (tag === 'enroll') return 'fa-sign-out';
|
||||
if (tag === 'button') return 'fa-toggle-down';
|
||||
},
|
||||
// 模块排序
|
||||
sort: function () {
|
||||
|
||||
@@ -52,10 +52,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"><span>ID</span></th>
|
||||
<th width="20%"><span>专题名称</span></th>
|
||||
<th width="25%"><span>专题名称</span></th>
|
||||
<th width="6%"><span>状态</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="15%"><span>七天内 访问次数/访问用户数</span></th>
|
||||
<th width="15%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -65,24 +65,13 @@
|
||||
<td>{{item.title}}</td>
|
||||
<td>{{item.status_name}}</td>
|
||||
<td>{{item.c_time}}</td>
|
||||
<td>{{item.count_view}}/{{item.count_view_uid}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" class="align-r">
|
||||
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
|
||||
<!-- :data-modal="'/common/share_link?id='+item.id+'&app_id=--><?//= $params['app_id'] ?><!--&pages=special'"-->
|
||||
<!-- data-title="分享连接">分享链接</a>-->
|
||||
<a class="am-btn am-btn-primary am-btn-xs" :data-open="'/topics/topics/lists_userc?id='+item.id"
|
||||
data-title="记录概况">记录概况</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
:data-open="'/topics/topics/lists_by_day?id='+item.id" data-title="按天统计">按天统计</a>
|
||||
<td>
|
||||
<input type="button" class="am-btn am-btn-xs am-btn-danger"
|
||||
data-ajax="post" data-action="/topics/topics/edit_status"
|
||||
:data-params-id="item.id" :data-params-status="item.che_status"
|
||||
:value="item.che_status_name"/>
|
||||
<a :data-open="'/topics/topics/get?id='+item.id"
|
||||
class="am-btn am-btn-primary am-btn-xs">编辑</a>
|
||||
</td>
|
||||
class="am-btn am-btn-primary am-btn-xs">编辑</a></td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
@@ -90,8 +79,6 @@
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
<label class="checkall">
|
||||
<input type="checkbox" data-check-target=".order-ids">全选</label>
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
<script>
|
||||
Vue.component('v-button', {
|
||||
props: ['module', 'is_template'],
|
||||
data: function () {
|
||||
return {
|
||||
params: {'module_jsondata': {}}
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.initData();
|
||||
},
|
||||
updated: function () {
|
||||
},
|
||||
methods: {
|
||||
initData: function () {
|
||||
var vm = this;
|
||||
if (vm.module.id) {
|
||||
$.ajax({
|
||||
url: '/topics/topics/get_button_setting',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
module_id: vm.module.id
|
||||
},
|
||||
success: function (re) {
|
||||
vm.params = re.data.setting;
|
||||
vm.params.app_id = <?= $info['app_id'] ?>;
|
||||
if (re.data.setting.module_jsondata.img) {
|
||||
$("#module_jsondata_img").val(re.data.setting.module_jsondata.img);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
save: function () {
|
||||
var vm = this;
|
||||
vm.params.module_jsondata.img = $("#module_jsondata_img").val();
|
||||
var save_data = {
|
||||
module_id: vm.module.id,
|
||||
setting: vm.params
|
||||
};
|
||||
$.ajax({
|
||||
url: '/topics/topics/edit_save_button',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
save_data: save_data
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (re) {
|
||||
if (re.code) {
|
||||
layer.msg(re.msg, {icon: 1});
|
||||
} else {
|
||||
layer.msg(re.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'module.id': function (newValue, oldValue) {
|
||||
console.log(newValue, oldValue);
|
||||
this.initData();
|
||||
},
|
||||
'params.module_title': function (newValue, oldValue) {
|
||||
if (!newValue) newValue = '按钮模块';
|
||||
var obj = {};
|
||||
obj.module_id = this.module.id;
|
||||
obj.module_name = newValue;
|
||||
this.$emit('button-title', obj);
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
template: '#v-button'
|
||||
})
|
||||
</script>
|
||||
<template id="v-button">
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">模块状态</label>
|
||||
<div class="col-sm-2">
|
||||
<div class="radio"><label><input type="radio" value="1" v-model="params.status"> 正常</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="radio"><label><input type="radio" value="0" v-model="params.status">
|
||||
下架</label></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">模块信息</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">标题</div>
|
||||
<input type="text" class="form-control" v-model="params.module_title" placeholder=""/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">简介</div>
|
||||
<input type="text" class="form-control" placeholder="" v-model="params.module_descrip"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">按钮类型</label>
|
||||
<div class="col-sm-2">
|
||||
<div class="radio"><label><input type="radio" value="0" v-model="params.module_type">普通按钮</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="radio"><label><input type="radio" value="1" v-model="params.module_type">图片按钮</label></div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="radio"><label><input type="radio" value="2" v-model="params.module_type">报名弹窗<span
|
||||
class="f12 clr999">(报名模块需设成弹窗展示)</span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label"></label>
|
||||
<template v-if="params.module_type==0 || params.module_type==2">
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">按钮文案</div>
|
||||
<input type="text" class="form-control" v-model="params.module_jsondata.title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">按钮颜色</div>
|
||||
<input type="text" class="form-control" v-model="params.module_jsondata.color"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="params.module_type==1">
|
||||
<div class="col-sm-3">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="module_jsondata_img"><i
|
||||
class="am-icon-cloud-upload"></i> 按钮图片<span
|
||||
style="color: blue">(700*125)</span>
|
||||
</button>
|
||||
<input type="hidden" name="module_jsondata_img" id="module_jsondata_img"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
value="" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
:src="params.module_jsondata.img_url"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<template v-if="params.module_type==0 || params.module_type==1">
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{{params.app_id==6 ? 'h5跳转链接': '跳转链接'}}</div>
|
||||
<input type="text" class="form-control" v-model="params.module_jsondata.url"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" v-if="params.app_id==6">
|
||||
<label for="" class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">小程序跳转链接</div>
|
||||
<input type="text" class="form-control" v-model="params.module_jsondata.url_mini"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -150,7 +150,7 @@
|
||||
<div class="col-sm-2">
|
||||
<div class="input-group">
|
||||
<button type="button"
|
||||
:data-open="'/topics/enroll/lists?module_id='+module.id"
|
||||
data-open="/receiver/customer?cfrom_id=35&t_id=<?= $info['id'] ?>"
|
||||
class="am-btn am-btn-default am-btn-sm">查看报名列表
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -124,6 +124,16 @@ class Aptinfo extends Wxapp{
|
||||
$lng = $this->input_param('lng');
|
||||
$recommend_id = intval($this->input_param('cf_uid')); //来源用户id
|
||||
$cms_id = intval($this->input_param('cms_id')); //cmsid
|
||||
$syt = intval($this->input_param('syt'));
|
||||
if ($syt && $this->myuid) {//私域通报名
|
||||
$this->load->library('entity/syt_entity');
|
||||
$syt_entity = new Syt_entity(array('app_id' => $this->app_id));
|
||||
$results = $syt_entity->kpi_enroll_log(['cf_platform' => 'wxapp', 'uid' => $this->myuid, 'nickname' => $this->session['nickname']
|
||||
, 'mobile' => $this->session['mobile']]);
|
||||
if ($results['code'] == 200) {
|
||||
throw new Hd_exception($results['msg'], $results['code']);
|
||||
}
|
||||
}
|
||||
|
||||
$city_id && $city_row = $this->sys_area_model->get(['county_id' => $city_id],'id,county_id,city_id');
|
||||
$cms_row = $this->cms_model->get(['id'=>$cms_id]);
|
||||
|
||||
@@ -120,7 +120,7 @@ class Customers extends Wxapp
|
||||
}
|
||||
$car_json = json_decode($row['car_json'], true);
|
||||
$update = [];
|
||||
if($row['cf_title']!='平台分配'){
|
||||
if ($row['cf_title'] != '平台分配') {
|
||||
if ($mobile) {
|
||||
if (!mobile_valid($mobile)) {
|
||||
throw new Exception('手机号格式错误', ERR_PARAMS_ERROR);
|
||||
@@ -314,7 +314,7 @@ class Customers extends Wxapp
|
||||
$log = $log ? $log . ',' . $msg : $msg;
|
||||
}
|
||||
$visit = $status == 2 ? 1 : 0;//变成订单客户,更新客户已回访
|
||||
$this->customers_entity->add_log_visit($id, $uid, $this->session['uname'], $log,0,$visit);
|
||||
$this->customers_entity->add_log_visit($id, $uid, $this->session['uname'], $log, 0, $visit);
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
@@ -388,6 +388,7 @@ class Customers extends Wxapp
|
||||
$cf_clues = $this->input_param('cf_clues');//线索来源
|
||||
$admin_id = $this->input_param('admin_id');
|
||||
$id = $this->input_param('cus_id');
|
||||
$a_id = intval($this->input_param('a_id'));//私域通活动id
|
||||
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
@@ -403,12 +404,16 @@ class Customers extends Wxapp
|
||||
$orderby = 'c_time desc';
|
||||
}
|
||||
}
|
||||
|
||||
$where = [
|
||||
'biz_id' => $biz_id,
|
||||
'status>=' => 0
|
||||
];
|
||||
|
||||
if ($a_id) {
|
||||
$where["cf_id"] = 35;
|
||||
$where["t_id"] = $a_id;
|
||||
}
|
||||
|
||||
if ($group_id == 1 || $ismy) {
|
||||
$where["admin_id"] = $uid;
|
||||
}
|
||||
@@ -697,7 +702,7 @@ class Customers extends Wxapp
|
||||
if ($ret) {
|
||||
$this->load->library('receiver/customers_entity');
|
||||
$visit = $update['status'] == 3 ? 1 : 0;
|
||||
$this->customers_entity->add_log_visit($id, $this->session['uid'], $this->session['uname'], $log,0,$visit);
|
||||
$this->customers_entity->add_log_visit($id, $this->session['uid'], $this->session['uname'], $log, 0, $visit);
|
||||
throw new Exception('操作成功', API_CODE_SUCCESS);
|
||||
}
|
||||
throw new Exception('操作失败', ERR_PARAMS_ERROR);
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
defined('WXAPP_APP') OR exit('No direct script access allowed');
|
||||
ini_set('display_errors', 'On');
|
||||
error_reporting(E_ERROR);
|
||||
|
||||
require_once APPPATH . 'controllers/wxapp/Wxapp.php';
|
||||
|
||||
/**
|
||||
* Notes:私域通-活动
|
||||
* Created on: 2022/1/14 20:16
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Sytactivity extends Wxapp
|
||||
{
|
||||
private $biz_id;//门店id
|
||||
private $cf_id = 35;//私域直播
|
||||
|
||||
function __construct($inputs, $app_key)
|
||||
{
|
||||
parent::__construct($inputs, $app_key);
|
||||
$this->login_white = array();//登录白名单
|
||||
$this->check_status = array();//用户状态校验
|
||||
$this->majia_white = array('get');//超级管理员披上马甲权限控制
|
||||
$this->load->model('app/licheb/syt_activity_model', 'mdSytActivity');
|
||||
$this->load->model('app/licheb/syt_activity_kpidata_model', 'mdSytActivityKpiData');
|
||||
$this->load->model('app/licheb/syt_biz_score_model', 'mdSytBizScore');
|
||||
$this->load->model('app/app_weixin_users_model', 'mdWeixinUsers');
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
$this->load->model("biz/biz_model", 'mdBiz');
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:顶部菜单
|
||||
* Created on: 2022/1/14 9:40
|
||||
* Created by: dengbw
|
||||
* @return mixed
|
||||
*/
|
||||
protected function get_tabs()
|
||||
{
|
||||
$data['title'] = '私域通';
|
||||
$bm_count = $this->mdSytActivityKpiData->count(['kpi' => 'enroll']);
|
||||
$dd_count = $this->mdCustomers->count(['status' => 1, 'cf_id' => $this->cf_id]);
|
||||
$xd_count = $this->mdCustomers->count(['status' => 2, 'cf_id' => $this->cf_id]);
|
||||
$data['bg_img'] = 'https://qs.haodian.cn/wechat_app/lichebao/siyutong/theme.jpg';
|
||||
$data['menus'] = array(array('title' => '报名', 'value' => $bm_count), array('title' => '到店', 'value' => $dd_count),
|
||||
array('title' => '下定', 'value' => $xd_count));
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:推广活动列表
|
||||
* Created on: 2022/1/14 9:40
|
||||
* Created by: dengbw
|
||||
* @return mixed
|
||||
*/
|
||||
protected function get_list()
|
||||
{
|
||||
$page = $this->input_param('page');
|
||||
$size = $this->input_param('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 3;
|
||||
$where['status'] = 1;
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$lists = array();
|
||||
$total = $this->mdSytActivity->count($where);
|
||||
if ($total) {
|
||||
$res = $this->mdSytActivity->select($where, 'id DESC', $page, $size, 'id,title,s_time,e_time');
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$setValue['id'] = intval($value['id']);
|
||||
$setValue['title'] = $value['title'];
|
||||
$type_name = $color = '';
|
||||
$type = 0;
|
||||
$s_time = $value['s_time'];
|
||||
$e_time = $value['e_time'];
|
||||
if ($s_time > $date) {
|
||||
$type = 1;
|
||||
$type_name = '未开始';
|
||||
$color = '#999';
|
||||
} else if ($s_time <= $date && $e_time >= $date) {
|
||||
$type = 2;
|
||||
$type_name = '进行中';
|
||||
$color = '#ff842d';
|
||||
} else if ($e_time < $date) {
|
||||
$type = 3;
|
||||
$type_name = '已结束';
|
||||
$color = '#996c6c';
|
||||
}
|
||||
$setValue['type'] = $type;
|
||||
$setValue['type_name'] = $type_name;
|
||||
$setValue['color'] = $color;
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$data['list'] = $lists;
|
||||
$data['total'] = $total;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:推广活动详情
|
||||
* Created on: 2020/9/28 16:01
|
||||
* Created by: dengbw
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
protected function get_detail()
|
||||
{
|
||||
$id = intval($this->input_param('id'));
|
||||
if (!$id) {
|
||||
throw new Hd_exception('参数错误!', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$re = $this->mdSytActivity->get(array("id" => $id, "status" => 1));
|
||||
if (!$re) {
|
||||
throw new Hd_exception('未找到活动!', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : '';
|
||||
$share_count = $this->mdSytActivityKpiData->count(['kpi' => 'share', 'a_id' => $id]);
|
||||
$browse_count = $this->mdSytActivityKpiData->count(['kpi' => 'browse', 'a_id' => $id]);
|
||||
$enroll_count = $this->mdSytActivityKpiData->count(['kpi' => 'enroll', 'a_id' => $id]);
|
||||
$ranking = 0;
|
||||
$re_biz_score = $this->mdSytBizScore->get(['a_id' => $id, 'biz_id' => $this->biz_id]);
|
||||
if ($re_biz_score && $re_biz_score['score']) {
|
||||
$ranking = $this->mdSytBizScore->count(['score >=' => $re_biz_score['score'], 'a_id' => $id]);
|
||||
}
|
||||
$data['id'] = intval($re['id']);
|
||||
$data['img'] = $re['img'] ? build_qiniu_image_url($re['img']) : '';
|
||||
$data['poster'] = $jsondata['posters'] ? build_qiniu_image_url($jsondata['posters'][0]['url']) : $data['img'];
|
||||
$data['remark'] = $jsondata['remark'] ? $jsondata['remark'] : '';
|
||||
$data['ranking'] = ['title' => '当前门店排名', 'value' => $ranking, 'url' => '/pages/siyutong/activityRanking/index?id=' . $id];
|
||||
$data['menus'] = [['title' => '分享', 'value' => $share_count], ['title' => '浏览', 'value' => $browse_count]
|
||||
, ['title' => '报名>', 'value' => $enroll_count, 'url' => '/pages/customer/filterList/index?a_id=' . $id]];
|
||||
//生成分享连接
|
||||
$this->load->library('MyEncryption');
|
||||
$skey = $this->myencryption->base64url_encode("a_id={$id}&cf_uid={$this->myuid}&biz_id={$this->biz_id}&cf_share={$this->myencryption->random_string(6)}");
|
||||
$myqrcode_url = http_host_com('home') . '/h5/syt/special?skey=' . $skey;
|
||||
$share_url = http_host_com('home') . '/h5/syt/myqrcode/get?url=' . $myqrcode_url;
|
||||
$data['btn'] = ['title' => '马上邀请', 'value' => 1, 'share_url' => $share_url];
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:实时战报
|
||||
* Created on: 2022/1/19 9:57
|
||||
* Created by: dengbw
|
||||
* @return mixed
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
protected function get_log()
|
||||
{
|
||||
$page = $this->input_param('page');
|
||||
$size = $this->input_param('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
$id = intval($this->input_param('id'));
|
||||
if (!$id) {
|
||||
throw new Hd_exception('参数错误!', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$lists = array();
|
||||
$where = array('a_id' => $id, 'kpi<>' => 'share');
|
||||
$total = $this->mdSytActivityKpiData->count($where);
|
||||
if ($total) {
|
||||
$res = $this->mdSytActivityKpiData->select($where, 'id DESC', $page, $size, 'uid,cf_uid,kpi,biz_id,c_time');
|
||||
$uids_arr = array_unique(array_column($res, 'uid'));
|
||||
$cf_uids_arr = array_unique(array_column($res, 'cf_uid'));
|
||||
$uids = $this->mdWeixinUsers->get_map_by_ids($uids_arr, 'id,nickname');
|
||||
$cf_uids = $this->mdLichebUsers->get_map_by_ids($cf_uids_arr, 'id,uname');
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
if ($value['kpi'] == 'enroll') {
|
||||
$content = "{$uids[$value['uid']][0]['nickname']}通过{$cf_uids[$value['cf_uid']][0]['uname']}报名了活动";
|
||||
} else {
|
||||
$content = "{$cf_uids[$value['cf_uid']][0]['uname']}邀请{$uids[$value['uid']][0]['nickname']}进入活动页";
|
||||
}
|
||||
$setValue['content'] = $content;
|
||||
$setValue['c_time'] = friendly_date($value['c_time'], 'mohu');
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$data['list'] = $lists;
|
||||
$data['total'] = $total;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:活动排名
|
||||
* Created on: 2022/1/19 14:25
|
||||
* Created by: dengbw
|
||||
* @return mixed
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
protected function get_ranking()
|
||||
{
|
||||
$id = intval($this->input_param('id'));
|
||||
if (!$id) {
|
||||
throw new Hd_exception('参数错误!', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$re = $this->mdSytActivity->get(array("id" => $id, "status" => 1));
|
||||
if (!$re) {
|
||||
throw new Hd_exception('未找到活动!', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$score = 0;
|
||||
$ranking = [];
|
||||
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : '';
|
||||
$re = $this->mdSytBizScore->get(array("biz_id" => $this->biz_id));
|
||||
$re['score'] && $score = $re['score'];
|
||||
$res = $this->mdSytBizScore->select(['a_id' => $id], 'score DESC,id ASC', 0, 7, 'biz_id,score');
|
||||
if ($res) {
|
||||
$str_biz_ids = implode(',', array_column($res, 'biz_id'));
|
||||
$map_biz = $this->mdBiz->map('id', 'biz_name', ["id in ({$str_biz_ids})" => null]);
|
||||
foreach ($res as $key => $value) {
|
||||
$num = $key + 1;
|
||||
$ranking[] = ['num' => $num, 'biz_name' => $map_biz[$value['biz_id']], 'score' => $value['score'] . '分'];
|
||||
}
|
||||
}
|
||||
$data['title'] = '活动排名';
|
||||
$data['biz'] = ['title' => '我的直营店', 'value' => $score . '分'];
|
||||
$data['ranking'] = $ranking;
|
||||
$data['rule'] = ['title' => '积分规则>', 'value' => $jsondata['rule'] ? $jsondata['rule'] : ''];
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -131,6 +131,16 @@ class Topic extends Wxapp
|
||||
$cf_id = 1;
|
||||
$brand_id = 0;
|
||||
$recommend_id && $cf_id = 8;
|
||||
$syt = intval($this->input_param('syt'));
|
||||
if ($syt && $this->myuid) {//私域通报名
|
||||
$this->load->library('entity/syt_entity');
|
||||
$syt_entity = new Syt_entity(array('app_id' => $this->app_id));
|
||||
$results = $syt_entity->kpi_enroll_log(['cf_platform' => 'wxapp', 'uid' => $this->myuid, 'nickname' => $this->session['nickname']
|
||||
, 'mobile' => $this->session['mobile']]);
|
||||
if ($results['code'] == 200) {
|
||||
throw new Hd_exception($results['msg'], $results['code']);
|
||||
}
|
||||
}
|
||||
$city_id && $city_row = $this->sys_area_model->get(['county_id' => $city_id], 'id,county_id,city_id');
|
||||
$re_t = $this->mdTemplate->get(['id' => $t_id]);
|
||||
if ($re_t && $re_t['brand_ids']) {
|
||||
|
||||
@@ -33,6 +33,66 @@ if (!function_exists('load_cache')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口加密
|
||||
* @param $string
|
||||
* @param string $operation
|
||||
* @param string $key
|
||||
* @param int $expiry
|
||||
* @return string
|
||||
*/
|
||||
if (!function_exists('liche_authcode')) {
|
||||
function liche_authcode($string, $operation = 'DECODE', $key = '123456', $expiry = 0)
|
||||
{
|
||||
$ckey_length = 4;
|
||||
$key = md5($key ? $key : self::KEY);
|
||||
$keya = md5(substr($key, 0, 16));
|
||||
$keyb = md5(substr($key, 16, 16));
|
||||
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : '';
|
||||
|
||||
$cryptkey = $keya . md5($keya . $keyc);
|
||||
$key_length = strlen($cryptkey);
|
||||
|
||||
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string;
|
||||
$string_length = strlen($string);
|
||||
|
||||
$result = '';
|
||||
$box = range(0, 255);
|
||||
|
||||
$rndkey = array();
|
||||
for ($i = 0; $i <= 255; $i++) {
|
||||
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
|
||||
}
|
||||
|
||||
for ($j = $i = 0; $i < 256; $i++) {
|
||||
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
|
||||
$tmp = $box[$i];
|
||||
$box[$i] = $box[$j];
|
||||
$box[$j] = $tmp;
|
||||
}
|
||||
|
||||
for ($a = $j = $i = 0; $i < $string_length; $i++) {
|
||||
$a = ($a + 1) % 256;
|
||||
$j = ($j + $box[$a]) % 256;
|
||||
$tmp = $box[$a];
|
||||
$box[$a] = $box[$j];
|
||||
$box[$j] = $tmp;
|
||||
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
|
||||
}
|
||||
|
||||
if ($operation == 'DECODE') {
|
||||
if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
|
||||
return substr($result, 26);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return $keyc . str_replace('=', '', base64_encode($result));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sql日志
|
||||
* @param $string
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Notes:私域通
|
||||
* Created on: 2021/1/13 14:44
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Syt_entity
|
||||
{
|
||||
private $ci;
|
||||
private $app_id;
|
||||
private $app_config;
|
||||
private $log_file;//日志文件
|
||||
|
||||
public function __construct($params = array())
|
||||
{
|
||||
$this->ci = &get_instance();
|
||||
$this->init($params);
|
||||
$class_name = lcfirst(get_class($this));//调用类的名称,子类或者当前类名称
|
||||
$this->log_file = "libraris_{$class_name}.log";
|
||||
$this->load->model('app/licheb/syt_activity_model', 'mdSytActivity');
|
||||
$this->load->model('app/licheb/syt_activity_kpidata_model', 'mdSytActivityKpiData');
|
||||
$this->load->model('app/licheb/syt_biz_score_model', 'mdSytBizScore');
|
||||
}
|
||||
|
||||
public function init($params)
|
||||
{
|
||||
if ($params['app_id']) {
|
||||
$this->app_id = $params['app_id'];
|
||||
$this->load->model('app/App_model', 'mdApp');
|
||||
$this->app_config = $this->ci->mdApp->appConfig()[$this->app_id];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:报名记录
|
||||
* Created on: 2022/1/24 10:57
|
||||
* Created by: dengbw
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
public function kpi_enroll_log($params)
|
||||
{
|
||||
if ($params['cf_platform'] == 'wxapp') {
|
||||
if (!$params['uid']) {
|
||||
return array('code' => 400, 'msg' => '无狸车用户uid');
|
||||
}
|
||||
$this->load->model('app/liche/app_liche_users_model', 'mdLicheUsers');
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
$this->load->model('app/app_weixin_users_model', 'mdWeixinUsers');
|
||||
$re_lu = $this->ci->mdLicheUsers->get(array("id" => $params['uid']));
|
||||
if (!$re_lu['unionid']) {
|
||||
return array('code' => 400, 'msg' => '无狸车用户unionid');
|
||||
}
|
||||
$re_lw = $this->ci->mdWeixinUsers->get(array("unionid" => $re_lu['unionid']));
|
||||
if (!$re_lw['unionid']) {
|
||||
return array('code' => 400, 'msg' => '无狸车公众号unionid');
|
||||
}
|
||||
$jsondata = $re_lw['jsondata'] ? json_decode($re_lw['jsondata'], true) : '';
|
||||
if (!$jsondata['syt']) {
|
||||
return array('code' => 400, 'msg' => '无狸车公众号syt');
|
||||
}
|
||||
$syt = $jsondata['syt'];
|
||||
$syt['nickname'] = $params['nickname'];
|
||||
$syt['mobile'] = $params['mobile'];
|
||||
$syt['uid'] = $re_lw['id'];
|
||||
$syt['cf_id'] = 35;
|
||||
$syt['if_driver'] = 1;
|
||||
$params = $syt;
|
||||
}
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->load->model("biz/biz_model", 'mdBiz');
|
||||
$re_a = $this->ci->mdSytActivity->get(array("id" => $params['a_id'], "status" => 1));
|
||||
if (!$re_a) {
|
||||
return array('code' => 400, 'msg' => '活动不存在');
|
||||
}
|
||||
$nickname = $params['nickname'];
|
||||
$mobile = $params['mobile'];
|
||||
$cf_id = intval($params['cf_id']);
|
||||
$uid = intval($params['uid']);
|
||||
$biz_id = intval($params['biz_id']);
|
||||
$if_driver = intval($params['if_driver']);
|
||||
if ($biz_id) {
|
||||
$re_enroll = $this->ci->mdCustomers->get(array('cf_id' => $cf_id, 't_id' => $params['a_id'], 'mobile' => $mobile));
|
||||
if ($re_enroll) {
|
||||
return array('code' => 400, 'msg' => '你已经报名过啦,我们会在24时内与您取得联系,请耐心等待!');
|
||||
}
|
||||
}
|
||||
$brand_id = 0;
|
||||
if ($re_a['brand_id']) {
|
||||
$brand_ids = implode(',', $re_a['brand_id']);
|
||||
$brand_id = count($brand_ids) > 0 ? $brand_ids[0] : $re_a['brand_id'];
|
||||
}
|
||||
$c_id = 0;
|
||||
$type = 'customers';
|
||||
if ($biz_id) {//加入门店客户
|
||||
$re_biz = $this->ci->mdBiz->get(['id' => $biz_id, 'status' => 1]);
|
||||
if ($re_biz) {
|
||||
$add_data = [
|
||||
'name' => $nickname,
|
||||
'mobile' => $mobile,
|
||||
'biz_id' => $biz_id,
|
||||
'brand_id' => $brand_id,
|
||||
'city_id' => $re_biz['city_id'],
|
||||
'county_id' => $re_biz['county_id'],
|
||||
'cf_title' => '私域活动',
|
||||
'cf_id' => $cf_id,
|
||||
't_id' => $params['a_id'],
|
||||
'p_time' => date('Y-m-d H:i:s'),
|
||||
'c_time' => time()
|
||||
];
|
||||
$c_id = $this->ci->mdCustomers->add($add_data);
|
||||
if (!$c_id) {
|
||||
return array('code' => 400, 'msg' => '您报名该活动失败了');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$c_id) {//未加到门店,加到线索池里
|
||||
$this->load->model('receiver/receiver_clues_model', 'clues_model');
|
||||
$this->load->library('receiver/clues_entity');
|
||||
$row = $this->ci->clues_model->get(['mobile' => $mobile]);
|
||||
if ($row) {
|
||||
$update = ['en_time' => date('Y-m-d H:i:s')];
|
||||
$this->ci->clues_model->update($update, ['id' => $row['id']]);
|
||||
//增加日志
|
||||
$cf_title = $this->ci->clues_entity->cf_title($cf_id);
|
||||
$log_msg = '用户报名';
|
||||
$cf_title && $log_msg = "用户通过【{$cf_title}】报名";
|
||||
$this->ci->clues_entity->add_log($row['id'], $uid, $nickname, $log_msg);
|
||||
return array('code' => 200, 'msg' => '报名成功了,我们会在24时内与您取得联系!');
|
||||
}
|
||||
$jsondata['info'] = ['biz_id' => $biz_id ? $biz_id : ''];
|
||||
$params['a_id'] && $jsondata['info']['t_id'] = $params['a_id'];
|
||||
$add_data = [
|
||||
'name' => $nickname,
|
||||
'mobile' => $mobile,
|
||||
'brand_id' => $brand_id,
|
||||
'cf_uid' => $uid,
|
||||
'cf_id' => $cf_id,
|
||||
'app_id' => $this->app_id,
|
||||
'if_driver' => $if_driver,
|
||||
'cf_platform' => $params['cf_platform'],
|
||||
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
|
||||
'en_time' => date('Y-m-d H:i:s'),
|
||||
'c_time' => time()
|
||||
];
|
||||
$c_id = $this->ci->clues_model->add($add_data);
|
||||
if (!$c_id) {
|
||||
return array('code' => 400, 'msg' => '您报名该活动失败了');
|
||||
}
|
||||
$type = 'clues';
|
||||
$cf_title = $this->ci->clues_entity->cf_title($cf_id);
|
||||
$log_msg = '用户报名';
|
||||
$cf_title && $log_msg = "用户通过【{$cf_title}】报名";
|
||||
$this->ci->clues_entity->add_log($c_id, $uid, $nickname, $log_msg);
|
||||
}
|
||||
//增加报名分数
|
||||
$this->kpi_log(array('a_id' => $params['a_id'], 'cf_uid' => $params['cf_uid'], 'biz_id' => $params['biz_id']
|
||||
, 'kpi' => 'enroll', 'c_id' => $c_id, 'type' => $type, 'uid' => $uid));
|
||||
return array('code' => 200, 'msg' => '报名成功,我们会在24时内与您取得联系!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:添加kpi记录
|
||||
* Created on: 2021/1/13 11:20
|
||||
* Created by: dengbw
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
public function kpi_log($params)
|
||||
{
|
||||
if ($params['a_id'] && $params['uid'] && ($params['cf_uid'] || $params['biz_id'])) {
|
||||
$re_a = $this->ci->mdSytActivity->get(array("id" => $params['a_id'], "status" => 1));
|
||||
$now_time = time();
|
||||
if (!$re_a || $now_time < strtotime($re_a['s_time']) || $now_time > strtotime($re_a['e_time'])) {
|
||||
return array('code' => 0, 'msg' => '无活动或未在活动时间内');
|
||||
}
|
||||
if ($params['kpi'] == 'share' && $params['cf_share']) {//检测分享码是否已使用
|
||||
$where_share = array("a_id" => $params['a_id'], 'kpi' => $params['kpi'], "cf_share" => $params['cf_share']);
|
||||
if ($params['cf_uid']) {
|
||||
$where_share['cf_uid'] = $params['cf_uid'];
|
||||
} else {
|
||||
$where_share['biz_id'] = $params['biz_id'];
|
||||
}
|
||||
$re_share = $this->ci->mdSytActivityKpiData->get($where_share);
|
||||
if ($re_share) {
|
||||
return array('code' => 0, 'msg' => '分享码已被使用');
|
||||
}
|
||||
}
|
||||
$re_kpi = $this->ci->mdSytActivityKpiData->get(array("a_id" => $params['a_id'], 'uid' => $params['uid'], 'kpi' => $params['kpi']));
|
||||
if ($re_kpi) {//已添加过活动kpi(访活动只记录一次用户kpi记录)
|
||||
return array('code' => 0, 'msg' => '已添加过' . $params['kpi'] . '记录');
|
||||
}
|
||||
$where_kpi = array("a_id" => $params['a_id'], "biz_id" => $params['biz_id'], 'kpi' => $params['kpi']);
|
||||
//增加记录
|
||||
$addData = array_merge($where_kpi, array('uid' => $params['uid'], 'cf_uid' => $params['cf_uid'], 'c_time' => time()));
|
||||
$jsondata = array();
|
||||
if ($params['kpi'] == 'enroll' && $params['c_id']) {//加报名id记录
|
||||
$jsondata['enroll_type'] = $params['type'];
|
||||
$jsondata['enroll_c_id'] = $params['c_id'];
|
||||
}
|
||||
if ($params['kpi'] == 'share' && $params['cf_share']) {//加分享码
|
||||
$addData['cf_share'] = $params['cf_share'];
|
||||
}
|
||||
$jsondata && $addData['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
$id = $this->ci->mdSytActivityKpiData->add($addData);
|
||||
if (!$id) {
|
||||
return array('code' => 0, 'msg' => '添加记录失败');
|
||||
}
|
||||
if (!$params['biz_id']) {
|
||||
return array('code' => 0, 'msg' => '无门店不加分数');
|
||||
}
|
||||
$jsonkpi = $re_a['jsonkpi'] ? json_decode($re_a['jsonkpi'], true) : array();
|
||||
$kpi_count = $this->ci->mdSytActivityKpiData->count(array_merge($where_kpi, array('status' => 0)));
|
||||
$kpi_num = intval($jsonkpi[$params['kpi']]['num']);
|
||||
$kpi_score = intval($jsonkpi[$params['kpi']]['score']);
|
||||
if ($kpi_num && $kpi_score && $kpi_count >= $kpi_num) {//大于等于次数加分
|
||||
$re_biz_score = $this->ci->mdSytBizScore->get(array('a_id' => $params['a_id'], 'biz_id' => $params['biz_id']));
|
||||
if (!$re_biz_score) {//未添加门店数据
|
||||
$re_biz_score['id'] = $this->ci->mdSytBizScore->add(['a_id' => $params['a_id'], 'biz_id' => $params['biz_id'], 'c_time' => time()]);
|
||||
if (!$re_biz_score['id']) {
|
||||
return array('code' => 0, 'msg' => '添加门店分数记录');
|
||||
}
|
||||
$re_biz_score['score'] = 0;
|
||||
}
|
||||
$score_ms = $kpi_score + intval($re_biz_score['score']);
|
||||
$this->ci->mdSytBizScore->update(array('score' => $score_ms), array('id' => $re_biz_score['id']));
|
||||
$res_kpi = $this->ci->mdSytActivityKpiData->select(array_merge($where_kpi, array('status' => 0)), 'id asc', 0, $kpi_num, 'id');
|
||||
if ($res_kpi) {
|
||||
$kpi_ids = implode(',', array_column($res_kpi, "id"));
|
||||
$this->ci->mdSytActivityKpiData->update(array('status' => 1), array("id in(" . $kpi_ids . ")" => null));//更新为已加分
|
||||
}
|
||||
return array('code' => 1, 'msg' => '添加记录成功');
|
||||
}
|
||||
} else {
|
||||
return array('code' => 0, 'msg' => '参数错误');
|
||||
}
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if ('_model' === substr($name, -6)) {
|
||||
return $this->ci->$name;
|
||||
} elseif ('load' == $name) {
|
||||
return $this->ci->load;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:狸车公众号用户表
|
||||
* Created on: 2021/11/24 14:13
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class App_weixin_users_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_app_weixin_users';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:根据id获取数据
|
||||
* Created on: 2022/1/17 11:06
|
||||
* Created by: dengbw
|
||||
* @param $ids
|
||||
* @param string $fileds
|
||||
* @return array
|
||||
*/
|
||||
public function get_map_by_ids($ids, $fileds = '')
|
||||
{
|
||||
$rows = [];
|
||||
$ids = array_filter($ids);
|
||||
if ($ids) {
|
||||
$cf_ids = implode(',', $ids);
|
||||
$where = [
|
||||
"id in ($cf_ids)" => null
|
||||
];
|
||||
$rows = $this->map('id', '', $where, '', '', '', $fileds);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:私域通-活动kpi数据
|
||||
* Created on: 2021/11/19 17:11
|
||||
* Created by: dengbw
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Syt_activity_kpidata_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_syt_activity_kpidata';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function kpiAry($kpi = '', $title = '')
|
||||
{
|
||||
$url = 'https://qs.haodian.cn/wechat_app/haodianyun/siyutong';
|
||||
$data['share'] = array('img' => $url . '/kpi2-1.png', 'title' => '分享', 'title1' => '分享次数', 'title2' => '分享次数', 'title3' => '分享人数'
|
||||
, 'num_tag' => '次', 'score_tag' => '分数');
|
||||
$data['browse'] = array('img' => $url . '/kpi2-2.png', 'title' => '浏览', 'title1' => '浏览用户', 'title2' => '浏览次数', 'title3' => '浏览人数'
|
||||
, 'num_tag' => '人', 'score_tag' => '分数');
|
||||
$data['enroll'] = array('img' => $url . '/kpi2-3.png', 'title' => '报名', 'title1' => '报名用户', 'title2' => '报名用户', 'title3' => '报名用户'
|
||||
, 'num_tag' => '人', 'score_tag' => '分数');
|
||||
if ($kpi) {
|
||||
return $data[$kpi][$title];
|
||||
} else {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:私域通-活动
|
||||
* Created on: 2021/11/19 17:11
|
||||
* Created by: dengbw
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Syt_activity_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_syt_activity';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:私域通-门店分数记录
|
||||
* Created on: 2022/1/13 17:11
|
||||
* Created by: dengbw
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Syt_biz_score_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_syt_biz_score';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class Receiver_customers_model extends HD_Model
|
||||
|
||||
private $status_arr = [-1 => '删除', 0 => '未见客户', 1 => '到店客户', 2 => '订单客户', 3 => '战败客户'];
|
||||
private $level = ['H', 'A', 'B', 'C', 'D'];
|
||||
private $cfrom_arr = ['自有资源', '平台分配', '素材推广'];
|
||||
private $cfrom_arr = ['自有资源', '平台分配', '素材推广', '私域活动'];
|
||||
private $cfrom_clues_arr = ['自然进店', '外展', 'DM', '转介绍', '其它','网站','外展外拓','垂直媒体','自媒体'];
|
||||
private $buy_time = [3, 7, 15, 30];
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:专题模块-按钮表
|
||||
* Created on: 2020/10/20 13:46
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Topic_module_button_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_topic_module_button';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: linfan
|
||||
* Date: 2018-12-04
|
||||
* Time: 15:51
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$config = array(
|
||||
);
|
||||
@@ -7,12 +7,6 @@
|
||||
*/
|
||||
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
//好店云-订阅号
|
||||
$config['default']['appid'] = 'wx27c91c638ebafbda';
|
||||
$config['default']['appSecret'] = '8e9ea53783bee447d2e6b449e3e43752';
|
||||
|
||||
$config['xsf']['appid'] = 'wx2222b94b21406c62';
|
||||
$config['xsf']['appSecret'] = '09e369a457be4b79ecd4e5e2b98fdd71';
|
||||
|
||||
$config['hdy']['appid'] = 'wxbdec8558931efffd';
|
||||
$config['hdy']['appSecret'] = '583b3cd0d8e145009eda61ece003ca14';
|
||||
//狸车-服务号
|
||||
$config['liche']['appid'] = 'wxe66f905683582780';
|
||||
$config['liche']['appSecret'] = '9546cd4de877be13ce203f3e6140633f';
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
defined('APPPATH') OR exit('No direct script access allowed');
|
||||
ini_set('display_errors','On');
|
||||
error_reporting(E_ERROR);
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: xuxb
|
||||
* Date: 2020/3/10
|
||||
* Time: 17:13
|
||||
*/
|
||||
abstract class Wxapp extends CI_Controller{
|
||||
protected $log_file;//日志文件
|
||||
protected $log_dir;
|
||||
protected $app_id;//应用id,hd_app.id
|
||||
protected $request;
|
||||
protected $lc_redis;
|
||||
protected $env;//网络环境 d开发, t测试, p生产
|
||||
protected $host;
|
||||
protected $api_host;
|
||||
protected $redis_mcode;//手机验证码
|
||||
protected $white_mobile;//手机验证白名单
|
||||
protected $white_appid;//appid校验白名单
|
||||
|
||||
private $inputs;
|
||||
|
||||
function __construct($set_app_id = 0){
|
||||
parent::__construct();
|
||||
//加载输入参数
|
||||
$this->input_param();
|
||||
|
||||
//app_id是必需的
|
||||
$this->app_id = $app_id = $set_app_id ? $set_app_id : $this->input_param('app_id');
|
||||
$this->data['app_id'] = $app_id;
|
||||
|
||||
$this->get_env();
|
||||
|
||||
$r = &load_cache('redis');
|
||||
$this->lc_redis = $r;
|
||||
|
||||
//日志文件
|
||||
$class_name = lcfirst(get_class($this));//调用类的名称,子类或者当前类名称
|
||||
|
||||
$this->log_file = "h5_wxapp{$app_id}_{$class_name}.log";
|
||||
$this->log_dir = "h5_wxapp{$app_id}_{$class_name}";
|
||||
$this->redis_mcode = "wxapp_{$app_id}_mcode_";
|
||||
$this->white_mobile = array('18063762579');
|
||||
|
||||
$this->load->helper('cookie');
|
||||
|
||||
//根据app_id重载model
|
||||
$this->load->rebuild_model($this->app_id);
|
||||
|
||||
$this->load->library('hd_exception');
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有方法请求入口
|
||||
* @param $method
|
||||
* @return mixed
|
||||
*/
|
||||
function _remap($method){
|
||||
try{
|
||||
|
||||
if('index' == $method){
|
||||
$method = $this->request;
|
||||
} else {
|
||||
$method = $this->request.'_'. $method;
|
||||
}
|
||||
|
||||
if(!in_array($method, $this->white_appid) && !$this->app_id){
|
||||
debug_log("[error] ". __FUNCTION__ . "# not app_id", $this->log_file);
|
||||
throw new Hd_exception('请求超时', 403);
|
||||
}
|
||||
|
||||
$data = $this->$method();
|
||||
|
||||
if($data['view']){//返回视图
|
||||
$this->data = array_merge($this->data, $data);
|
||||
return $this->show_view($data['view'], $data['alone']);
|
||||
} else {//返回json数据
|
||||
return $this->show_json($data);
|
||||
}
|
||||
} catch(Hd_exception $e){//处理异常
|
||||
$code = $e->getCode();
|
||||
$msg = $e->getMessage();
|
||||
|
||||
if($this->input->is_ajax_request()){
|
||||
return $this->show_json(array(), $code, $msg);
|
||||
} else {
|
||||
$this->data = array('heading' => 'Warning', 'message' => $msg);
|
||||
return $this->show_view('errors/html/error_404');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数(只支持application/json格式)
|
||||
* @param string $key
|
||||
* @return array|mixed
|
||||
*/
|
||||
protected function input_param($key = ''){
|
||||
if($key){
|
||||
return $this->inputs[$key];
|
||||
}
|
||||
|
||||
$request = $this->input->method();
|
||||
|
||||
switch($request){
|
||||
case 'post':
|
||||
case 'put':
|
||||
case 'delete':
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
break;
|
||||
default:
|
||||
$input = $this->input->get();
|
||||
}
|
||||
|
||||
$this->request = $request;
|
||||
$this->inputs = $input;
|
||||
return $this->inputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $view
|
||||
* @param $alone "独立页面"
|
||||
*/
|
||||
protected function show_view($view, $alone = false){
|
||||
if($alone){
|
||||
$this->load->view($view, $this->data);
|
||||
} else{
|
||||
$this->load->view('h5/header',$this->data);
|
||||
$this->load->view($view);
|
||||
$this->load->view('h5/footer');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param int $code
|
||||
* @param string $msg
|
||||
* @param string $url
|
||||
*/
|
||||
protected function show_json($data, $code = 200, $msg = 'success', $url = '')
|
||||
{
|
||||
if(!isset($data['code'])){
|
||||
$data = array('data' => $data, 'code' => $code, 'msg' => $msg, 'url' => $url);
|
||||
}
|
||||
|
||||
exit(json_encode($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ukey
|
||||
* @return array|mixed
|
||||
*/
|
||||
protected function api_session($ukey){
|
||||
$redis = &load_cache('redis');
|
||||
|
||||
$app_key = "";
|
||||
switch($this->app_id){
|
||||
case 1:
|
||||
$app_key = "sbcard";
|
||||
break;
|
||||
case 2:
|
||||
$app_key= "xcard";
|
||||
}
|
||||
|
||||
if(!$app_key){
|
||||
return array();
|
||||
}
|
||||
|
||||
$redis_login = "wxapp_{$app_key}_login_";
|
||||
//data:{"uid":"用户ID", "session_key":"微信session_key"}
|
||||
$data = $redis->get($redis_login.$ukey);
|
||||
|
||||
$session = array();
|
||||
if($data){
|
||||
$session = json_decode($data, true);
|
||||
}
|
||||
|
||||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取环境
|
||||
*/
|
||||
private function get_env(){
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'dev')) { //dev 测试
|
||||
$this->env = 'd';
|
||||
$this->host = "https://hd-wxdev.xiaoyu.com";
|
||||
$this->api_host = "https://hd-api-dev.xiaoyu.com";
|
||||
} elseif (false !== strpos($_SERVER['HTTP_HOST'], 'test')) {//test 测试
|
||||
$this->env = 't';
|
||||
$this->host = "https://www-test.haodian.cn";
|
||||
$this->api_host = "https://api.test.haodian.cn";
|
||||
} else { // 正式
|
||||
$this->env = 'p';
|
||||
$this->host = "https://www.haodian.cn";
|
||||
$this->api_host = "https://api.haodian.cn";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
ini_set('display_errors', 'On');
|
||||
error_reporting(E_ERROR);
|
||||
|
||||
require_once COMMPATH . 'third_party/phpqrcode/phpqrcode.php';
|
||||
|
||||
/**
|
||||
* Notes:私或通专题页
|
||||
* Created on: 2020/10/13 14:13
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Myqrcode extends CI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes:
|
||||
* Created on: 2020/10/14 10:49
|
||||
* Created by: dengbw
|
||||
* https://liche-dev.xiaoyu.com/h5/syt/qrcode
|
||||
*/
|
||||
function get()
|
||||
{
|
||||
$url = $this->input->get('url');
|
||||
if ($url) {
|
||||
$errorCorrectionLevel = 'L'; //容错级别
|
||||
$matrixPointSize = 5; //生成图片大小
|
||||
//生成二维码图片
|
||||
QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
$basedir = '';
|
||||
$saveDir = '要保存的目录地址';
|
||||
if (!is_dir($saveDir)) {
|
||||
mkdir($basedir);
|
||||
chmod($basedir, 0777);
|
||||
}
|
||||
if (is_dir($saveDir)) {
|
||||
$filename = $saveDir . '/qrcode.png';
|
||||
$qrcode_content = 'hello qrcode';//二维码的内容
|
||||
ob_clean();
|
||||
QRcode::png($qrcode_content, $filename);
|
||||
echo $filename;
|
||||
} else {
|
||||
exit('目录创建失败');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,652 @@
|
||||
<?php
|
||||
ini_set('display_errors', 'On');
|
||||
error_reporting(E_ERROR);
|
||||
require_once APPPATH . 'controllers/h5/Wxapp.php';
|
||||
|
||||
class Special extends Wxapp
|
||||
{
|
||||
private $session;
|
||||
private $secret;
|
||||
private $uid = 0;
|
||||
private $cf_id = 35;//私域直播
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(2);
|
||||
$this->secret = "2021_syt_h5_1119";
|
||||
//$this->load->helper('cookie');
|
||||
$this->load->model('app/licheb/syt_activity_model', 'mdSytActivity');
|
||||
$this->load->model('app/licheb/syt_activity_kpidata_model', 'mdSytActivityKpiData');
|
||||
$this->load->model('app/app_weixin_users_model', 'mdWeixinUsers');
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->load->model("biz/biz_model", 'mdBiz');
|
||||
$ukey = get_cookie('ukey');
|
||||
if ($ukey) {
|
||||
$this->session = json_decode(liche_authcode($ukey, 'DECODE', $this->secret), true);
|
||||
$this->uid = $this->session['uid'];
|
||||
}
|
||||
//重置cookie
|
||||
$reset = $this->input_param('reset');
|
||||
if ($reset) {
|
||||
set_cookie("ukey", "", 86400 * 30);
|
||||
$this->session = array();
|
||||
$this->uid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:
|
||||
* https://liche-dev.xiaoyu.com/h5/syt/special
|
||||
* https://liche-dev.xiaoyu.com/h5/syt/special?skey=YV9pZD03JmNmX3VpZD0yMSZiaXpfaWQ9MiZjZl9zaGFyZT1SNU5JS1c
|
||||
* https://www.liche.cn/h5/syt/special
|
||||
* Created on: 2021/8/26 11:19
|
||||
* Created by: dengbw
|
||||
*/
|
||||
function get()
|
||||
{
|
||||
$skey = $this->input->get('skey');
|
||||
//$skey = "YV9pZD03JmNmX3VpZD0yMSZiaXpfaWQ9MiZjZl9zaGFyZT1SNU5JS1c";
|
||||
if (!$skey) {
|
||||
throw new Hd_exception("参数错误", 400);
|
||||
}
|
||||
$this->load->library('MyEncryption');
|
||||
$param = $this->myencryption->base64url_decode($skey);
|
||||
//$skey = "a_id=7&cf_uid=24&biz_id=2&cf_share=" . $this->myencryption->random_string(6);
|
||||
//echo $this->myencryption->base64url_encode($skey);
|
||||
//print_r($param);
|
||||
//exit;
|
||||
$a_id = intval($param['a_id']);//活动id
|
||||
$cf_uid = intval($param['cf_uid']);//来源用户id
|
||||
$biz_id = intval($param['biz_id']);//门店id
|
||||
$cf_share = $param['cf_share'];//分享
|
||||
$re_a = $this->mdSytActivity->get(array("id" => $a_id, "status" => 1));
|
||||
if (!$re_a) {
|
||||
throw new Hd_exception("活动不存在", 400);
|
||||
}
|
||||
$url = http_host_com('home') . "/h5/syt/special?skey={$skey}";
|
||||
$this->set_auth($url);
|
||||
$topic_ary = array('id' => $re_a['z_id'], 'a_id' => $a_id, '_title' => $re_a['title']);
|
||||
$topic = $this->get_topic($topic_ary);
|
||||
if (!$topic) {
|
||||
throw new Hd_exception("专题不存在", 400);
|
||||
}
|
||||
if ($this->uid) {
|
||||
$re_wu = $this->mdWeixinUsers->get(['id' => $this->uid]);
|
||||
if ($re_wu) {//更新参数
|
||||
$jsondata = $re_wu['jsondata'] ? json_decode($re_wu['jsondata'], true) : '';
|
||||
$jsondata['syt'] = $param;
|
||||
$this->mdWeixinUsers->update(['jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)], ['id' => $this->uid]);
|
||||
}
|
||||
}
|
||||
//一次性订阅
|
||||
// $re_s = $this->mdSytSubscribemsg->get(array('a_id' => $a_id, 'uid' => $this->uid));
|
||||
// if ($re_s) {
|
||||
// $subscribemsg = '已订阅直播';
|
||||
// } else {
|
||||
// $this->load->config('wechat');
|
||||
// $config = $this->config->item('liche');
|
||||
// $sub_redirect_url = urlencode(http_host_com('home') . '/h5/syt/special/subscribemsg?skey=' . $skey
|
||||
// . '&s_time=' . $topic['mCountdown']['b_s_time']);
|
||||
// $subscribemsg = "https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid={$config['appid']}&scene=0}&template_id=DO0B9IYYub1d0oNvy9czzGbe6_1EU8PQmnLEoDOcmXA&redirect_url={$sub_redirect_url}&reserved=test#wechat_redirect";
|
||||
// }
|
||||
// $topic['subscribemsg'] = $subscribemsg;
|
||||
$topic['subscribemsg'] = '';
|
||||
$a_img = $re_a['img'] ? build_qiniu_image_url($re_a['img']) : '';
|
||||
$a_title = $re_a['title'] ? $re_a['title'] : '';
|
||||
//微信分享
|
||||
$this->load->library('Jssdk');
|
||||
$jssdk = new Jssdk('liche');
|
||||
$sign_package = $jssdk->getSignPackage();
|
||||
$t_skey = $c_skey = '';
|
||||
if ($biz_id) {//门店
|
||||
$skey = "a_id=" . $a_id . "&cf_uid=" . $cf_uid . "&biz_id=" . $biz_id . "&cf_share=" . $this->myencryption->random_string(6);
|
||||
$c_skey = "a_id=" . $a_id . "&cf_uid=" . $cf_uid . '&biz_id=' . $biz_id;
|
||||
} else {
|
||||
$skey = "a_id=" . $a_id . "&cf_uid=" . $cf_uid . "&cf_share=" . $this->myencryption->random_string(6);
|
||||
$c_skey = "a_id=" . $a_id . '&cf_uid=' . $cf_uid;
|
||||
}
|
||||
//浏览
|
||||
$this->set_kpi_score(array('a_id' => $a_id, 'cf_uid' => $cf_uid, 'biz_id' => $biz_id, 'kpi' => 'browse'));
|
||||
//分享
|
||||
$cf_share && $this->set_kpi_score(array('a_id' => $a_id, 'cf_uid' => $cf_uid, 'biz_id' => $biz_id, 'cf_share' => $cf_share, 'kpi' => 'share'));
|
||||
$share_url = http_host_com('home') . "/h5/syt/special?skey=" . $this->myencryption->base64url_encode($skey);
|
||||
$jsondata = $re_a['jsondata'] ? json_decode($re_a['jsondata'], true) : '';
|
||||
$share_title = $jsondata['share_title'] ? $jsondata['share_title'] : '';
|
||||
$posters = $jsondata['posters'] ? $jsondata['posters'] : '';
|
||||
$share = array(
|
||||
'title' => $a_title,
|
||||
"img" => $a_img,
|
||||
"desc" => $share_title,
|
||||
"url" => $share_url
|
||||
);
|
||||
//渠道获取统计代码
|
||||
$stat_code = "";
|
||||
// if ($t_id) {
|
||||
// $where = array('id' => $t_id);
|
||||
// $row = $this->mdSytActivityTeam->get($where);
|
||||
// $row['declaration'] && $stat_code = $row['declaration'];
|
||||
// }
|
||||
$topic['a_skey'] = $this->myencryption->base64url_encode("a_id=" . $a_id);
|
||||
$topic['c_skey'] = $this->myencryption->base64url_encode($c_skey);
|
||||
$topic['t_skey'] = $t_skey;
|
||||
$topic['a_id'] = $a_id;
|
||||
$topic['cf_uid'] = $cf_uid;
|
||||
$topic['biz_id'] = $biz_id;
|
||||
$topic['uid'] = $this->uid;
|
||||
$topic['posters'] = $posters;
|
||||
$topic['stat_code'] = $stat_code;
|
||||
$data = array(
|
||||
'_title' => $a_title,
|
||||
'view' => 'h5/syt/special',
|
||||
'topic' => $topic,
|
||||
"sign_package" => $sign_package,
|
||||
"share" => $share,
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function get_topic($param = array())
|
||||
{
|
||||
$data = $list = $mButton = array();
|
||||
$mCountdown = array('b_e_time' => 0, 'b_s_time' => 0);
|
||||
$this->load->model('app/App_model', 'mdApp');
|
||||
$this->load->model('topics/topics_model', 'mdTopics');
|
||||
$this->load->model('topics/topic_modules_model', 'mdTopicModules');
|
||||
$this->load->model('topics/topic_module_text_model', 'mdModuleText');
|
||||
$this->load->model('topics/topic_module_ad_model', 'mdModuleAd');
|
||||
$this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll');
|
||||
$this->load->model('topics/topic_module_button_model', 'mdModuleButton');
|
||||
// $this->load->model('topics/topic_module_countdown_model', 'mdModuleCountdown');
|
||||
$re = $this->mdTopics->get(array('id' => $param['id'], 'app_id' => $this->app_id));
|
||||
if (!$re) {
|
||||
return $data;
|
||||
}
|
||||
$appConfig = array();
|
||||
$mp_app_id = $mp_app_name = '';
|
||||
$ebiz = 0;
|
||||
if ($re['jsondata']) {
|
||||
$topics_jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : array();
|
||||
if ($topics_jsondata['mp_app_id']) {
|
||||
$appConfig = $this->mdApp->appConfig()[$topics_jsondata['mp_app_id']];
|
||||
$mp_app_id = $topics_jsondata['mp_app_id'];
|
||||
$mp_app_name = $appConfig['wx_kzh']['appname'] ? $appConfig['wx_kzh']['appname'] : '星师傅';
|
||||
}
|
||||
$ebiz = intval($topics_jsondata['ebiz']);
|
||||
}
|
||||
$nickname = $mobile = $msgisReg = '';
|
||||
$module_ids = $re['module_ids'];
|
||||
if ($module_ids) {
|
||||
$where = is_numeric($module_ids) ? array('id' => $module_ids) : array("id in ({$module_ids})" => null);
|
||||
$where['status'] = 1;
|
||||
$total = $this->mdTopicModules->count($where);
|
||||
if ($total) {
|
||||
$select = 'id, type,jsondata';
|
||||
$rows = $this->mdTopicModules->select($where, 'sort DESC', 0, 0, $select);
|
||||
foreach ($rows as $row_topic) {
|
||||
$mid = $row_topic['id'];
|
||||
$type = $row_topic['type'];
|
||||
$json_topic = json_decode($row_topic['jsondata'], true);
|
||||
$title_img = "";
|
||||
$title_icon = "";
|
||||
if ($json_topic['title_img']) {
|
||||
$title_img = build_qiniu_image_url($json_topic['title_img']);
|
||||
} else {
|
||||
$title_icon = "https://qs.haodian.cn/wechat_app/xingxuanka/special/tt-tip2.png";
|
||||
}
|
||||
switch ($type) {
|
||||
case "countdown"://倒计时
|
||||
$module = $this->mdModuleCountdown->get(array('module_id' => $mid));
|
||||
$jsondata = $module['jsondata'] ? json_decode($module['jsondata'], true) : array();
|
||||
$b_s_time = $jsondata['time'] ? $jsondata['time'] : 0;
|
||||
$b_e_time = strtotime($b_s_time) - time();
|
||||
$b_e_time < 0 && $b_e_time = 0;
|
||||
$mCountdown = array(
|
||||
'title' => $module['title'] ? $module['title'] : '',
|
||||
'b_title' => $jsondata['title'] ? $jsondata['title'] : '',
|
||||
'b_mp_title' => $jsondata['mp_title'] ? $jsondata['mp_title'] : '',
|
||||
'b_ghid' => $appConfig['ghid'] ? $appConfig['ghid'] : '',
|
||||
'b_s_time' => $b_s_time,
|
||||
'b_e_time' => $b_e_time,
|
||||
);
|
||||
break;
|
||||
case "button"://按钮类型
|
||||
$module = $this->mdModuleButton->get(array('module_id' => $mid));
|
||||
$jsondata = $module['jsondata'] ? json_decode($module['jsondata'], true) : array();
|
||||
$ghid = $url = '';
|
||||
$url = $jsondata['url'] ? $jsondata['url'] : '';
|
||||
$url_mini = $jsondata['url_mini'] ? $jsondata['url_mini'] : '';//在小程序里连接
|
||||
if ($appConfig['ghid'] && (strstr($url, 'pages'))) {//跳转小程序
|
||||
$ghid = $appConfig['ghid'];
|
||||
}
|
||||
$mButton = array(
|
||||
'title' => $module['title'] ? $module['title'] : '',
|
||||
'type' => $module['type'],
|
||||
'b_url' => $url,
|
||||
'b_url_mini' => $url_mini,
|
||||
'b_title' => $jsondata['title'] ? $jsondata['title'] : '',
|
||||
'b_img' => $jsondata['img'] ? build_qiniu_image_url($jsondata['img']) : '',
|
||||
'b_color' => $jsondata['color'] ? $jsondata['color'] : '',
|
||||
'b_ghid' => $ghid,
|
||||
);
|
||||
break;
|
||||
case "text"://文本类型
|
||||
$module = $this->mdModuleText->get(array('module_id' => $mid));
|
||||
$list[] = array(
|
||||
"type" => "text",
|
||||
'id' => $mid,
|
||||
'title' => $module['title'] ? $module['title'] : '',
|
||||
"title_img" => $title_img,
|
||||
"title_icon" => $title_icon,
|
||||
"title_color" => $json_topic["title_color"] ? $json_topic["title_color"] : "#fff",//背景色,
|
||||
"title_bgcolor" => $json_topic["title_bgcolor"] ? $json_topic["title_bgcolor"] : "#ee5b15",//背景色
|
||||
'bg_img' => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
|
||||
'bg_color' => $json_topic["bg_color"] ? $json_topic["bg_color"] : '#ff0',
|
||||
"border_color" => strval($json_topic['border_color']),
|
||||
'descrip' => $module['descrip'] ? $module['descrip'] : '',
|
||||
'content' => $module['content'] ? $module['content'] : '',
|
||||
'style' => 0,
|
||||
'ads' => array(),
|
||||
);
|
||||
break;
|
||||
case 'ad'://广告
|
||||
$module = $this->mdModuleAd->get(array('module_id' => $mid));
|
||||
$module_json = $module['img_json'] ? json_decode($module['img_json'], true) : array();
|
||||
$ads = array();
|
||||
foreach ($module_json as $ad) {
|
||||
$url = strval($ad['link']);
|
||||
$miniProgram = '';
|
||||
$img = $ad['img'] ? build_qiniu_image_url($ad['img']) : '';
|
||||
if ($appConfig['ghid'] && strstr($url, 'pages')) {//跳转小程序
|
||||
$img_class = $module['style'] == 2 ? 'wp100 block bds-f3' : 'wp100 block';
|
||||
$miniProgram = '<div class="relative">
|
||||
<div class="absolute top-0 left-0 right-0 bottom-0 opacity-0 overflowhidden">
|
||||
<wx-open-launch-weapp username="' . $appConfig['ghid'] . '" path="' . $url . '">
|
||||
<template><button style="width:655px;height:681px;opacity:0"></button></template>
|
||||
</wx-open-launch-weapp></div><img class="' . $img_class . '" src="' . $img . '" /></div>';
|
||||
}
|
||||
$is_item = false;
|
||||
if (strpos($url, "wxapp/syt/item") !== false) {
|
||||
$url .= "&__skey=" . $this->input_param('skey');
|
||||
$is_item = true;
|
||||
}
|
||||
$ads[] = array(
|
||||
'type' => 'ad',
|
||||
'img' => $img,
|
||||
'url' => $url ? $url : '',
|
||||
'miniProgram' => $miniProgram,
|
||||
'jump_type' => intval($ad['jump_type']),
|
||||
'is_item' => $is_item,
|
||||
'title' => $ad['title']
|
||||
);
|
||||
}
|
||||
$title_img = "";
|
||||
$title_icon = "";
|
||||
if ($json_topic['title_img']) {
|
||||
$title_img = build_qiniu_image_url($json_topic['title_img']);
|
||||
} else {
|
||||
$title_icon = "https://qs.haodian.cn/wechat_app/xingxuanka/special/tt-tip2.png";
|
||||
}
|
||||
$list[] = array(
|
||||
"type" => "ad",
|
||||
'id' => $mid,
|
||||
'title' => $module['title'] ? $module['title'] : '',
|
||||
"title_img" => $title_img,
|
||||
"title_icon" => $title_icon,
|
||||
"title_color" => $json_topic["title_color"] ? $json_topic["title_color"] : "#fff",//背景色,
|
||||
"title_bgcolor" => $json_topic["title_bgcolor"] ? $json_topic["title_bgcolor"] : "#fe7c35",//背景色
|
||||
'bg_img' => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
|
||||
'bg_color' => $json_topic["bg_color"] ? $json_topic["bg_color"] : (2 == $module['style'] ? '#FFF' : ''),
|
||||
"border_color" => strval($json_topic['border_color']),
|
||||
'descrip' => $module['descrip'] ? $module['descrip'] : '',
|
||||
'content' => '',
|
||||
'style' => $module['style'],
|
||||
'ads' => $ads,
|
||||
);
|
||||
break;
|
||||
case 'enroll'://报名活动
|
||||
$module = $this->mdModuleEnroll->get(array('module_id' => $mid));
|
||||
//处理状态字段
|
||||
$status = array("title" => "我要报名", "value" => 0);
|
||||
//是否开始
|
||||
if (1 == $module['type']) {
|
||||
$s_time = strtotime($module['as_time']);
|
||||
$e_time = strtotime($module['ae_time']);
|
||||
} else {
|
||||
$s_time = strtotime($module['es_time']);
|
||||
$e_time = strtotime($module['ee_time']);
|
||||
}
|
||||
if ($s_time > time()) {
|
||||
$status = array("title" => "报名尚未开始", "value" => 2);
|
||||
} elseif ($e_time < time()) {
|
||||
$status = array("title" => "报名已截止", "value" => -2);
|
||||
}
|
||||
//判断是否还能参加报名
|
||||
if (0 == $status['value'] && $module['limit_num'] > 0) {
|
||||
$where = array('a_id' => $param['a_id']);
|
||||
$count = $this->mdSytActivityEnroll->count($where);
|
||||
if ($count >= $module['limit_num']) {
|
||||
$status = array("title" => "报名人数已满", "value" => 3);
|
||||
}
|
||||
}
|
||||
if ($this->uid) {//是否报名
|
||||
$re_enroll = [];
|
||||
$this->session['mobile'] && $re_enroll = $this->mdCustomers->get(array('cf_id' => $this->cf_id, 't_id' => $param['a_id'], 'mobile' => $this->session['mobile']));
|
||||
if ($re_enroll) {
|
||||
$status = array("title" => "已报名", "value" => 1);
|
||||
} else {
|
||||
$reUsers = $this->mdWeixinUsers->get(array('id' => $this->uid));
|
||||
$nickname = $reUsers['nickname'] ? $reUsers['nickname'] : '';
|
||||
$mobile = $reUsers['mobile'] ? $reUsers['mobile'] : '';
|
||||
}
|
||||
}
|
||||
$jsondata = $module['jsondata'] ? json_decode($module['jsondata'], true) : array();
|
||||
$if_code = intval($jsondata['if_code']);//是否验证手机
|
||||
if ($jsondata["show_type"] == 1) {
|
||||
$msgisReg = array(
|
||||
'title' => $module['title'] ? $module['title'] : '报名',
|
||||
'if_code' => $if_code,
|
||||
'status' => $status);
|
||||
break;
|
||||
}
|
||||
|
||||
$info = array(
|
||||
// array("title" => "姓名", "field" => "input", "key" => "uname"),
|
||||
// array("title" => "手机号", "field" => "mobile", "key" => "mobile"),
|
||||
// array("title" => "备注", "field" => "input", "key" => "remark"),
|
||||
);
|
||||
$record = array();
|
||||
$date_arr = array(
|
||||
date('Y.m.d'),
|
||||
date('Y.m.d', strtotime("-1 day")),
|
||||
date('Y.m.d', strtotime("-2 day")),
|
||||
date('Y.m.d', strtotime("-3 day"))
|
||||
);
|
||||
$num = 10;
|
||||
$res = $this->mdCustomers->select(array('cf_id' => $this->cf_id, 't_id' => $param['a_id']), 'c_time desc', 1, $num);
|
||||
if ($res) {
|
||||
foreach ($res as $key2 => $val2) {
|
||||
$nick_name = $val2['nickname'];
|
||||
$len = mb_strlen($nick_name, 'UTF-8');
|
||||
if ($len >= 3) {
|
||||
$nick_name = mb_substr($nick_name, 0, 1, 'UTF-8') . '*' . mb_substr($nick_name, -1, 1, 'UTF-8');
|
||||
} else {
|
||||
$nick_name = mb_substr($nick_name, 0, 1, 'UTF-8') . '*';
|
||||
}
|
||||
$record[] = date('Y.m.d', $val2['c_time']) . ' ' . $nick_name . ' 报名了 ' . $param['_title'];
|
||||
}
|
||||
}
|
||||
$num = $num - count($record);
|
||||
if ($num) {
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$record[] = $date_arr[array_rand($date_arr)] . ' ' . rand_name() . ' 报名了 ' . $param['_title'];
|
||||
}
|
||||
}
|
||||
$list[] = array(
|
||||
"type" => "enroll",
|
||||
'id' => $mid,
|
||||
'title' => $module['title'] ? $module['title'] : '',
|
||||
"title_img" => $title_img,
|
||||
"title_icon" => $title_icon,
|
||||
"title_color" => $json_topic["title_color"] ? $json_topic["title_color"] : "#fff",//背景色,
|
||||
"title_bgcolor" => $json_topic["title_bgcolor"] ? $json_topic["title_bgcolor"] : "#ee5b15",//背景色
|
||||
'bg_img' => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
|
||||
'bg_color' => $json_topic["bg_color"] ? $json_topic["bg_color"] : '#fff',
|
||||
"border_color" => strval($json_topic['border_color']),
|
||||
'descrip' => $module['descrip'] ? $module['descrip'] : '',
|
||||
'content' => $module['content'] ? $module['content'] : '',
|
||||
'style' => 0,
|
||||
'if_code' => $if_code,
|
||||
'ads' => array(),
|
||||
'status' => $status,
|
||||
'info' => $info,
|
||||
'record' => $record
|
||||
);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'id' => $param['id'],
|
||||
'title' => $re['title'],
|
||||
'bg_img' => build_qiniu_image_url($re['bg_img']),
|
||||
'bg_color' => $re['bg_color'],
|
||||
'ebiz' => $ebiz,
|
||||
'list' => $list,
|
||||
'name' => $nickname,
|
||||
'telPhone' => $mobile,
|
||||
'vCode' => '',
|
||||
'codeState' => true,
|
||||
'codeTx' => '获取验证码',
|
||||
'isSubmiting' => false,
|
||||
'mButton' => $mButton,
|
||||
'mCountdown' => $mCountdown,
|
||||
"bundleIntervalEvent" => '',
|
||||
'msgisShowCode' => false,
|
||||
'msgisRegShow' => false,
|
||||
"qrcode" => '',
|
||||
"logintelPhone" => '',
|
||||
"loginvCode" => '',
|
||||
"logincodeState" => true,
|
||||
"logincodeTx" => '获取验证码',
|
||||
"loginBundleIntervalEvent" => '',
|
||||
'loginBackurl' => '',
|
||||
"msgisLoginShowCode" => false,
|
||||
"needLogin" => $reUsers['mobile'] ? false : true,
|
||||
'mp_app_id' => $mp_app_id,
|
||||
'mp_app_name' => $mp_app_name,
|
||||
'msgisReg' => $msgisReg,
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:生成海报
|
||||
* Created on: 2022/1/20 16:35
|
||||
* Created by: dengbw
|
||||
* @return array
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
protected function get_poster()
|
||||
{
|
||||
$skey = $this->input_param('skey');
|
||||
if (!$skey) {
|
||||
throw new Hd_exception("参数错误", 400);
|
||||
}
|
||||
$this->load->library('MyEncryption');
|
||||
$param = $this->myencryption->base64url_decode($skey);
|
||||
$a_id = intval($param['a_id']);//活动id
|
||||
$cf_uid = intval($param['cf_uid']);
|
||||
$biz_id = intval($param['biz_id']);//门店id
|
||||
$re_a = $this->mdSytActivity->get(array("id" => $a_id, "status" => 1));
|
||||
if (!$re_a) {
|
||||
throw new Hd_exception("活动不存在", 400);
|
||||
}
|
||||
$url = http_host_com('home') . "/h5/wxapp/syt/special/poster?skey={$skey}";
|
||||
$this->set_auth($url);
|
||||
if ($biz_id) {//门店
|
||||
$skey = "a_id=" . $a_id . "&cf_uid=" . $cf_uid . "&biz_id=" . $biz_id . "&cf_share=" . $this->myencryption->random_string(6);
|
||||
} else {
|
||||
$skey = "a_id=" . $a_id . "&cf_uid=" . $cf_uid . "&cf_share=" . $this->myencryption->random_string(6);
|
||||
}
|
||||
$share_url = http_host_com('home') . "/h5/syt/special?skey=" . $this->myencryption->base64url_encode($skey);
|
||||
$qr_cod = '/h5/syt/myqrcode/get?url=' . $share_url;
|
||||
$posters = array();
|
||||
if ($re_a['jsondata']) {
|
||||
$jsondata = json_decode($re_a['jsondata'], true);
|
||||
if ($jsondata['posters']) {//海报
|
||||
foreach ($jsondata['posters'] as $key => $value) {
|
||||
$posters[] = array("img" => build_qiniu_image_url($value['url']), "code" => $qr_cod,
|
||||
"width" => $value['width'], "height" => $value['height']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->load->library('Jssdk');
|
||||
$jssdk = new Jssdk('liche');
|
||||
$sign_package = $jssdk->getSignPackage();
|
||||
$data = array(
|
||||
'_title' => '生成海报',
|
||||
'posters' => $posters,
|
||||
'sign_package' => $sign_package,
|
||||
'view' => 'h5/syt/special_poster',
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:活动报名
|
||||
* Created on: 2020/11/3 14:36
|
||||
* Created by: dengbw
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
function post_enroll()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
$mobile = $params['mobile'];
|
||||
$code = $params['code'];
|
||||
$nickname = $params['nickname'];
|
||||
$if_code = $params['if_code'];
|
||||
if (!$nickname) {
|
||||
throw new Hd_exception('请输入昵称', 400);
|
||||
}
|
||||
if (!mobile_valid($mobile)) {
|
||||
throw new Hd_exception('手机号码不正确', 400);
|
||||
}
|
||||
$key = '';
|
||||
if (!$if_code) {//0开启,1关闭
|
||||
if (!$code) {
|
||||
throw new Hd_exception('请输入验证码', 400);
|
||||
}
|
||||
$key = $this->redis_mcode . $mobile;
|
||||
if (!in_array($mobile, $this->white_mobile)) {//校验手机号
|
||||
$code_check = $this->lc_redis->get($key);
|
||||
if (!$code || $code != $code_check) {
|
||||
throw new Hd_exception("验证码不正确", 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
$params['cf_platform'] = 'h5';
|
||||
$params['mobile'] = $mobile;
|
||||
$params['nickname'] = $nickname;
|
||||
$params['uid'] = $this->uid;
|
||||
$params['cf_id'] = $this->cf_id;
|
||||
$this->load->library('entity/syt_entity');
|
||||
$syt_entity = new Syt_entity(array('app_id' => $this->app_id));
|
||||
$results = $syt_entity->kpi_enroll_log($params);
|
||||
if ($results['code'] == 400) {
|
||||
throw new Hd_exception($results['msg'], $results['code']);
|
||||
}
|
||||
$key && $this->lc_redis->delete($key);
|
||||
throw new Hd_exception($results['msg'], $results['code']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取短信验证码
|
||||
* Created on: 2020/10/14 22:10
|
||||
* Created by: dengbw
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
protected function get_mcode()
|
||||
{
|
||||
$mobile = $this->input_param('mobile');
|
||||
$title = $this->input_param('title');
|
||||
if (!mobile_valid($mobile)) {
|
||||
throw new Hd_exception('手机号码不正确', 400);
|
||||
}
|
||||
$key = $this->redis_mcode . $mobile;
|
||||
$code = $this->lc_redis->get($key);
|
||||
if (!$code) {
|
||||
$this->load->helper('string');
|
||||
$code = random_string('numeric', 6);
|
||||
$this->lc_redis->save($key, $code, 600);
|
||||
}
|
||||
$content = "【狸车】您正在参与{$title}报名,验证码 {$code}";
|
||||
b2m_send_sms($mobile, $content);
|
||||
throw new Hd_exception('发送成功', 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:设置kpi加分
|
||||
* Created on: 2020/10/15 10:09
|
||||
* Created by: dengbw
|
||||
* @param array $param
|
||||
*/
|
||||
private function set_kpi_score($param = array())
|
||||
{
|
||||
$param['uid'] = $this->uid;
|
||||
if ($param['a_id'] && $param['uid'] && ($param['cf_uid'] || $param['biz_id'])) {
|
||||
$this->load->library('entity/syt_entity');
|
||||
$syt_entity = new Syt_entity(array('app_id' => $this->app_id));
|
||||
$syt_entity->kpi_log($param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:未登录授权登录
|
||||
* Created on: 2020/10/28 21:07
|
||||
* Created by: dengbw
|
||||
* @param $url
|
||||
*/
|
||||
protected function set_auth($url)
|
||||
{
|
||||
if ("wx" == checkua() && !$this->uid) {
|
||||
$this->load->helper('url');
|
||||
$config['appid'] = 'wxe66f905683582780';//小红榜授权
|
||||
$config['appSecret'] = '9546cd4de877be13ce203f3e6140633f';
|
||||
$this->load->config('wechat');
|
||||
$config = $this->config->item('liche');
|
||||
$code = $this->input->get('code');
|
||||
$auth = 1;//是否信息授权
|
||||
$auth && $url .= "&auth={$auth}";
|
||||
if ($code) {//授权码获取微信信息
|
||||
$auth_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$config['appid']}&secret={$config['appSecret']}&code={$code}&grant_type=authorization_code";
|
||||
$res = file_get_contents($auth_url);
|
||||
$ret = json_decode($res, true);
|
||||
$openid = $ret['openid'];
|
||||
$unionid = $ret['unionid'];
|
||||
$mobile = '';
|
||||
if ($openid) {
|
||||
$row_wechat = $this->mdWeixinUsers->get(array('openid' => $openid));
|
||||
if (!$row_wechat) {//用户授权信息未记录到wechat
|
||||
$info_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$ret['access_token']}&openid={$openid}&lang=zh_CN";
|
||||
$res = file_get_contents($info_url);
|
||||
$ret = json_decode($res, true);
|
||||
$unionid = $ret['unionid'];
|
||||
$add = array(
|
||||
'nickname' => strval($ret['nickname']),
|
||||
"headimg" => strval($ret['headimgurl']),
|
||||
"unionid" => $unionid,
|
||||
"openid" => $openid,
|
||||
"app_id" => $this->app_id,
|
||||
"c_time" => time()
|
||||
);
|
||||
$this->uid = $this->mdWeixinUsers->add($add);
|
||||
if (!$this->uid) {
|
||||
debug_log("[error]# " . $this->mdWeixinUsers->db->last_query(), __FUNCTION__, $this->log_dir);
|
||||
}
|
||||
} else {
|
||||
!$unionid && $unionid = $row_wechat['unionid'];
|
||||
$this->uid = $row_wechat['id'];
|
||||
$mobile = $row_wechat['mobile'];
|
||||
}
|
||||
}
|
||||
if ($this->uid) {
|
||||
$session = array('uid' => $this->uid, "unionid" => $unionid, "mobile" => $mobile);
|
||||
$ukey = liche_authcode(json_encode($session, JSON_UNESCAPED_UNICODE), 'ENCODE', $this->secret);
|
||||
set_cookie("ukey", $ukey, 86400 * 30);
|
||||
}
|
||||
} elseif ($auth) {//信息授权获取用户微信昵称/头像
|
||||
$redirect_uri = urlencode($url);
|
||||
$auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$config['appid']}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
|
||||
redirect($auth_url);
|
||||
} elseif (!$this->session) {//静默授权获取用户openid
|
||||
$redirect_uri = urlencode($url);
|
||||
$auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$config['appid']}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
|
||||
redirect($auth_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: xuxb
|
||||
* Date: 2019/7/25
|
||||
* Time: 16:40
|
||||
*/
|
||||
class Hdwechat{
|
||||
private $log_file = "wechat.log";
|
||||
|
||||
public $appid = '';
|
||||
public $secret = '';
|
||||
public $token_url = '';//第三方地址获取token
|
||||
private $access_token = '';
|
||||
|
||||
|
||||
/**
|
||||
* Hdwechat constructor.
|
||||
* @param array $config {'appid':'', 'secret':'', 'token_url':'第三方方式获取token'}
|
||||
*/
|
||||
function __construct($config = array()){
|
||||
$config && $this->init($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $config ('appid', 'secret')
|
||||
*/
|
||||
function init($config){
|
||||
$this->appid = $config['appid'];
|
||||
$this->secret = $config['secret'];
|
||||
$this->token_url = $config['token_url'];
|
||||
|
||||
$CI = & get_instance();
|
||||
$CI->load->library("hd_wechat", $config);
|
||||
/*这里用new的方式,因为load如果对象已经存在,会去取旧的,不会生成新配置的对象*/
|
||||
$this->hd_wechat = new Hd_wechat($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取或者重置access_token
|
||||
* @param $reset (是否重置)
|
||||
* @return mixed
|
||||
*/
|
||||
function access_token($reset = false){
|
||||
|
||||
$this->access_token = $this->hd_wechat->access_token($reset);
|
||||
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
* @param $filename (文件名称)
|
||||
* @param $scene (最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式)
|
||||
* @param $page (必须是已经发布的小程序存在的页面(否则报错),例如 pages/index/index, 根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面)
|
||||
* @param $width (二维码的宽度,单位 px,最小 280px,最大 1280px,默认430px)
|
||||
* @return array {'file':'文件路径', 'url':'访问相对路径'}
|
||||
*/
|
||||
function wxacode($filename, $scene, $page, $width){
|
||||
$file = APPPATH . '../www/home/wx/wxacode/' . $filename . '.png';
|
||||
$dir = substr($file, 0, strrpos($file, '/'));
|
||||
if(!is_dir($dir)){
|
||||
$ret = mkdir($dir, 0777, true);// 如果文件夹不存在,将以递归方式创建该文件夹
|
||||
if(!$ret){
|
||||
debug_log("[error] ". __FUNCTION__ . ": mkdir {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exists($file)){
|
||||
return array('file' => $file, 'url' => 'wx/wxacode/' . $filename . '.png');
|
||||
}
|
||||
|
||||
$pre_url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=';
|
||||
$url = $pre_url . $this->access_token();
|
||||
$data = array(
|
||||
'scene' => $scene,
|
||||
'page' => $page,
|
||||
'width' => $width ? $width : 430,
|
||||
);
|
||||
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if(isset($ret['errcode'])){
|
||||
debug_log("[error] ". __FUNCTION__ . ": httpcode:{$code}, response:{$res}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$ret = file_put_contents($file, $res);
|
||||
if(false === $ret){
|
||||
debug_log("[error] ". __FUNCTION__ . ": file_put_contents {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
return array('file' => $file, 'url' => 'wx/' . $filename . '.png');
|
||||
}
|
||||
|
||||
function qrcode($filename, $scene, $type = 0, $expire = 0){
|
||||
$file = APPPATH . '../www/home/wx/qrcode/' . $filename . '.png';
|
||||
$file_url = 'wx/qrcode/' . $filename . '.png';
|
||||
$dir = substr($file, 0, strrpos($file, '/'));
|
||||
if(!is_dir($dir)){
|
||||
$ret = mkdir($dir, 0777, true);// 如果文件夹不存在,将以递归方式创建该文件夹
|
||||
if(!$ret){
|
||||
debug_log("[error] ". __FUNCTION__ . ": mkdir {$ret}, filename:{$filename}, scene:{$scene}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exists($file)){
|
||||
return array('file' => $file, 'url' => $file_url);
|
||||
}
|
||||
|
||||
if(is_numeric($scene)){
|
||||
$action_info = array(
|
||||
'scene' => array('scene_id' => $scene)
|
||||
);
|
||||
$action_name = $type ? 'QR_LIMIT_SCENE' : 'QR_SCENE';
|
||||
} else {
|
||||
$action_info = array(
|
||||
'scene' => array('scene_str' => $scene)
|
||||
);
|
||||
$action_name = $type ? 'QR_LIMIT_STR_SCENE' : 'QR_STR_SCENE';
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'action_name' => $action_name,
|
||||
'action_info' => $action_info
|
||||
);
|
||||
$expire && $data['expire_seconds'] = $expire;
|
||||
|
||||
$qr_url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=';
|
||||
$url = $qr_url . $this->access_token();
|
||||
|
||||
//请求获取二维码的ticket
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $qr_url . $this->access_token(true);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
|
||||
if(isset($ret['errcode'])){
|
||||
debug_log("[error] ". __FUNCTION__ . ": httpcode:{$code}, response:{$res}, filename:{$filename}, scene:{$scene}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
if(!$ret['ticket']){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not ticket, filename:{$filename}, scene:{$scene}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
//根据ticket获取
|
||||
$ticket_url='https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='.$ret['ticket'];
|
||||
|
||||
debug_log("[info] ". __FUNCTION__ . ": ticket_url=$ticket_url", $this->log_file);
|
||||
|
||||
$ret = file_put_contents($file, $this->url_get($ticket_url));
|
||||
if(false === $ret){
|
||||
debug_log("[error] ". __FUNCTION__ . ": file_put_contents {$ret}, filename:{$filename}, scene:{$scene}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
return array('file' => $file, 'url' => $file_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
private function curl_post($url, $data){
|
||||
debug_log("[info] ". __FUNCTION__ . ":url={$url}, data=".json_encode($data), $this->log_file);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
||||
$res = curl_exec($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
$size = strlen($res);
|
||||
if($size > 5000){
|
||||
debug_log("[info] ". __FUNCTION__ . ":httpcode={$code}, response is big only show size={$size}", $this->log_file);
|
||||
} else {
|
||||
debug_log("[info] ". __FUNCTION__ . ":httpcode={$code}, response={$res}", $this->log_file);
|
||||
}
|
||||
|
||||
return array($code, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @return string
|
||||
*/
|
||||
private function url_get($url){
|
||||
$res = file_get_contents($url);
|
||||
debug_log("[info] ". __FUNCTION__ . ":url={$url}, res={$res}", $this->log_file);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: 0fun
|
||||
* Date: 2018/5/10
|
||||
* Time: 17:16
|
||||
*/
|
||||
|
||||
class Jssdk
|
||||
{
|
||||
private $appId;
|
||||
private $appSecret;
|
||||
private $redis;
|
||||
|
||||
public function __construct($group = 'default')
|
||||
{
|
||||
$CI = & get_instance();
|
||||
if(is_array($group)){
|
||||
$this->appId = $group['appid'];
|
||||
$this->appSecret = $group['appSecret'];
|
||||
} else {
|
||||
$CI->load->config('wechat');
|
||||
$config =$CI->config->item($group);
|
||||
|
||||
$this->appId = $config['appid'];
|
||||
$this->appSecret = $config['appSecret'];
|
||||
}
|
||||
|
||||
$r = &load_cache('redis');
|
||||
$this->redis = $r->redis();
|
||||
|
||||
$param = array('appid' => $this->appId, "secret" => $this->appSecret);
|
||||
$CI->load->library("hd_wechat", $param);
|
||||
$this->hd_wechat = $CI->hd_wechat;
|
||||
$this->hd_wechat->init($param);
|
||||
}
|
||||
|
||||
public function getSignPackage()
|
||||
{
|
||||
$jsapiTicket = $this->getJsApiTicket();
|
||||
$url = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
|
||||
if($_SERVER['QUERY_STRING'])
|
||||
{
|
||||
//$url .= '?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
|
||||
$timestamp = time();
|
||||
$nonceStr = $this->createNonceStr();
|
||||
|
||||
// 这里参数的顺序要按照 key 值 ASCII 码升序排序
|
||||
$string = "jsapi_ticket=$jsapiTicket&noncestr=$nonceStr×tamp=$timestamp&url=$url";
|
||||
$signature = sha1($string);
|
||||
|
||||
$signPackage = array(
|
||||
"appId" => $this->appId,
|
||||
"nonceStr" => $nonceStr,
|
||||
"timestamp" => $timestamp,
|
||||
"url" => $url,
|
||||
"signature" => $signature,
|
||||
"rawString" => $string,
|
||||
'jsapi_ticket' => $jsapiTicket
|
||||
);
|
||||
|
||||
return $signPackage;
|
||||
}
|
||||
|
||||
private function createNonceStr($length = 16)
|
||||
{
|
||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
$str = "";
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
{
|
||||
$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
private function getJsApiTicket()
|
||||
{
|
||||
$ticket = $this->hd_wechat->api_ticket();
|
||||
return $ticket;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title><?=isset($_title)?$_title:''?></title>
|
||||
<script src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
|
||||
<script src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
|
||||
<script src="https://qs.haodian.cn/web/javascript/axios.min.js"></script>
|
||||
<meta name="format-detection" content="telephone=yes" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -0,0 +1,825 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cmn-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title><?= $_title ?></title>
|
||||
<link rel="stylesheet" href="/css/h5/syt/special.css?v=20210416">
|
||||
<link rel="stylesheet" href="https://qs.haodian.cn/web/javascript/swiper/css/swiper.min.css">
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/axios.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/swiper/js/swiper.min.js"></script>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/qs.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue-mugen-scroll.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/mDialog.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/LArea/js/LAreaData1.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/LArea/js/LAreaData2.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/LArea/js/LArea.js"></script>
|
||||
<? if ($topic['a_id'] == 17) { ?>
|
||||
<!-- Bytedance Tracking -->
|
||||
<script>
|
||||
(function (r, d, s, l) {
|
||||
var meteor = r.meteor = r.meteor || [];
|
||||
meteor.methods = ["track", "off", "on"];
|
||||
meteor.factory = function (method) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(method);
|
||||
meteor.push(args);
|
||||
return meteor
|
||||
}
|
||||
};
|
||||
for (var i = 0; i < meteor.methods.length; i++) {
|
||||
var key = meteor.methods[i];
|
||||
meteor[key] = meteor.factory(key)
|
||||
}
|
||||
meteor.load = function () {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
js = d.createElement(s);
|
||||
js.src = "https://analytics.snssdk.com/meteor.js/v1/" + l + "/sdk";
|
||||
fjs.parentNode.insertBefore(js, fjs)
|
||||
};
|
||||
meteor.load();
|
||||
if (meteor.invoked) {
|
||||
return
|
||||
}
|
||||
meteor.invoked = true;
|
||||
meteor.track("pageview")
|
||||
})(window, document, "script", "1698357717847053");
|
||||
</script>
|
||||
<!-- End Bytedance Tracking -->
|
||||
<? } elseif ($topic['a_id'] == 18) { ?>
|
||||
<script type="text/javascript" src="https://ocpc.insintek.com/push.js"></script>
|
||||
<? } ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div class="index" :style="'background-color:'+bg_color">
|
||||
<div class="relative">
|
||||
<img class="wp100 block" :src="bg_img"/>
|
||||
</div>
|
||||
|
||||
<div v-if="list.length > 0" class="pl30 pr30 container">
|
||||
<block v-for="(specialist,modIndex) in list">
|
||||
<div class="fn-flex fn-flex-wrap mb30" v-if="specialist.style == 4 && specialist.ads.length > 0">
|
||||
<a v-for="ads in specialist.ads"
|
||||
:class="specialist.ads.length>3?'wp33 pt15 pb15 text-center font-26 index-nav-item':'wp33 mt30 text-center font-26 index-nav-item fn-flex-item'"
|
||||
:href="ads.url">
|
||||
<img class='img-140x140 ulib-r20' :src='ads.img'/>
|
||||
<div class="mt10 text-nowrap font-28 color-fff">{{ads.title}}</div>
|
||||
</a>
|
||||
</div>
|
||||
<div :class="[modIndex==list.length-1 ?'':'mb30','relative ']"
|
||||
:style="'background:'+[specialist.bg_color !=''?specialist.bg_color:'']+';'">
|
||||
<div v-if="specialist.title_img !=''">
|
||||
<img class="wp100 block" :src="specialist.title_img"/>
|
||||
</div>
|
||||
<div :class="[specialist.bg_color !=''?'inner30 pt0':'']">
|
||||
|
||||
<!--富文本-->
|
||||
<div v-if="specialist.bg_color !=''">
|
||||
<div class="mt20 font-28 color-666 line-height-17" v-if="specialist.descrip != ''"
|
||||
v-html="specialist.descrip"></div>
|
||||
<div class="mt20 font-28 color-666 line-height-17" v-if="specialist.content != ''"
|
||||
v-html="specialist.content"></div>
|
||||
</div>
|
||||
|
||||
<!--图片-->
|
||||
<div v-if="specialist.ads.length > 0">
|
||||
|
||||
<!--单图-->
|
||||
<div v-if="specialist.style==0">
|
||||
<div v-for="ads in specialist.ads">
|
||||
<div v-if="ads.miniProgram != ''" v-html='ads.miniProgram'></div>
|
||||
<div v-else-if="ads.jump_type==1" @click="showReg">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</div>
|
||||
<a v-else @click="ImgHref(ads)">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--左右两张图-->
|
||||
<div class="fn-flex mb-20" v-if="specialist.style==1">
|
||||
<div class="fn-flex-item pr10">
|
||||
<div v-for="(ads,adsIndex) in specialist.ads" v-if="adsIndex%2 == 0">
|
||||
<div v-if="ads.miniProgram != ''" v-html='ads.miniProgram'></div>
|
||||
<div v-else-if="ads.jump_type==1" @click="showReg">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</div>
|
||||
<a v-else @click="ImgHref(ads)">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fn-flex-item pl10">
|
||||
<div v-for="(ads,adsIndex) in specialist.ads" v-if="adsIndex%2 != 0">
|
||||
<div v-if="ads.miniProgram != ''" v-html='ads.miniProgram'></div>
|
||||
<div v-else-if="ads.jump_type==1" @click="showReg">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</div>
|
||||
<a v-else @click="ImgHref(ads)">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--三张LOGO图-->
|
||||
<div class="fn-flex pt10 pb10" v-if="specialist.style==2">
|
||||
<div class="fn-flex-item pl5 pr5">
|
||||
<div class="mt10" v-for="(ads,adsIndex) in specialist.ads" v-if="adsIndex%3 == 0">
|
||||
<div v-if="ads.miniProgram != ''" v-html='ads.miniProgram'></div>
|
||||
<div v-else-if="ads.jump_type==1" @click="showReg">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</div>
|
||||
<a v-else :href="ads.url">
|
||||
<img class="wp100 block bds-f3" :src="ads.img"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fn-flex-item pl5 pr5">
|
||||
<div class="mt10" v-for="(ads,adsIndex) in specialist.ads" v-if="adsIndex%3 == 1">
|
||||
<div v-if="ads.miniProgram != ''" v-html='ads.miniProgram'></div>
|
||||
<div v-else-if="ads.jump_type==1" @click="showReg">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</div>
|
||||
<a v-else :href="ads.url">
|
||||
<img class="wp100 block bds-f3" :src="ads.img"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fn-flex-item pl5 pr5">
|
||||
<div class="mt10" v-for="(ads,adsIndex) in specialist.ads" v-if="adsIndex%3 == 2">
|
||||
<div v-if="ads.miniProgram != ''" v-html='ads.miniProgram'></div>
|
||||
<div v-else-if="ads.jump_type==1" @click="showReg">
|
||||
<img class="wp100 block" :src="ads.img"/>
|
||||
</div>
|
||||
<a v-else :href="ads.url">
|
||||
<img class="wp100 block bds-f3" :src="ads.img"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--报名-->
|
||||
<div v-if="specialist.type == 'enroll'">
|
||||
|
||||
<div class="bg-f5e5e5 mt20 pt15 pb15 ulib-r10" v-if="specialist.record.length>0">
|
||||
<div class="relative j-swiper">
|
||||
<div class="swiper-container left-0 top-0">
|
||||
<div class="swiper-wrapper">
|
||||
<div class="swiper-slide bg-f5e5e5 pl30 pr30"
|
||||
v-for="item in specialist.record">
|
||||
<div class="text-center font-24 color-980002 text-nowrap"
|
||||
:style="'color:'+bg_color">{{item}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pl160 bbs-eee relative">
|
||||
<div class="absolute left-0 box-middle font-30">报名昵称</div>
|
||||
<div><input class="wp100 inp-reg pt30 pb30 font-30" type="text" v-model="name"
|
||||
placeholder="请输入报名昵称"/></div>
|
||||
</div>
|
||||
<div class="pl160 bbs-eee relative pr200">
|
||||
<div class="absolute left-0 box-middle font-30">手机号码</div>
|
||||
<div><input class="wp100 inp-reg pt30 pb30 font-30" type="tel" v-model="telPhone"
|
||||
placeholder="请输入手机号"/></div>
|
||||
<button v-if="specialist.if_code==0"
|
||||
:class="[codeState ?'color-980002':'color-999','absolute right-0 bg-none border-none box-middle font-30']"
|
||||
:style="codeState?'color:'+mButton.b_color:''"
|
||||
:disabled="!codeState" @click="getcode(specialist.status.value)">{{codeTx}}
|
||||
</button>
|
||||
</div>
|
||||
<div class="pl160 bbs-eee relative" v-if="specialist.if_code==0">
|
||||
<div class="absolute left-0 box-middle font-30">验证码</div>
|
||||
<div><input class="wp100 inp-reg pt30 pb30 font-30" type="number" v-model="vCode"
|
||||
placeholder="请输入验证码"/></div>
|
||||
</div>
|
||||
|
||||
<div class="pt40 text-center">
|
||||
<button class="wp100 bg-9d0002 border-none pt20 pb20 font-32 color-fff ulib-r10"
|
||||
:style="'background-color:'+mButton.b_color"
|
||||
@click="submit(modIndex)">{{specialist.status.title}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</block>
|
||||
</div>
|
||||
<? if ($topic['a_id'] == 17 || $topic['a_id'] == 18) { ?>
|
||||
<? } else { ?>
|
||||
<div class="text-center pt40 pb40 font-22 color-bbb">
|
||||
<span class="pl5 pr5 text-middle">Powered by</span>
|
||||
<img class='inline-block img-30x21 text-middle'
|
||||
src='https://qs.haodian.cn/wechat_app/common/hdy-logo-gray.png'/>
|
||||
<span class="pl5 pr5 text-middle">好店云</span>
|
||||
</div>
|
||||
<? } ?>
|
||||
|
||||
<div class="fixed top-0 right-0 mt110 z-index-4">
|
||||
<a v-if="mCountdown.b_s_time" class="relative viewlive ulib-rl10" @click="showCode" href="javascript:">
|
||||
<div class="absolute left-0 pl15 pb5 box-middle"><img class='inline-block img-52x52 text-middle'
|
||||
src='/img/h5/syt/icon-live.gif'/></div>
|
||||
<div class="absolute right-0 pt5 pr10 box-middle font-18 color-fff">
|
||||
<div>订阅</div>
|
||||
<div>直播</div>
|
||||
</div>
|
||||
</a>
|
||||
<a v-if="posters" class="relative mt10 viewlive ulib-rl10"
|
||||
:href="'/h5/syt/special/poster?skey='+c_skey">
|
||||
<div class="absolute left-0 pl15 pb5 box-middle"><img class='inline-block img-52x52 text-middle'
|
||||
src='/img/h5/syt/icon-poster.gif'/></div>
|
||||
<div class="absolute right-0 pt5 pr10 box-middle font-18 color-fff">
|
||||
<div>分享</div>
|
||||
<div>海报</div>
|
||||
</div>
|
||||
</a>
|
||||
<a v-if="t_skey!= ''" class="relative mt10 viewlive ulib-rl10"
|
||||
:href="'/h5/syt/team/mine?skey='+t_skey">
|
||||
<div class="absolute left-0 pl15 pb5 box-middle"><img class='inline-block img-52x52 text-middle'
|
||||
src='/img/h5/syt/icon-team.png'/></div>
|
||||
<div class="absolute right-0 pt5 pr10 box-middle font-18 color-fff">
|
||||
<div>我的</div>
|
||||
<div>团队</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a v-if="uid && !mp_app_id && ebiz" class="fixed icon-mine img-cover z-index-4"
|
||||
style="background-image:url(/img/h5/syt/icon-mine.png);" @click="showLoginCode"
|
||||
href="javascript:"></a>
|
||||
</div>
|
||||
|
||||
<div v-if="mCountdown.b_e_time > 0 || mButton.b_title">
|
||||
<div style="height:70px;"></div>
|
||||
<div class="fixed left-0 bottom-0 right-0 bg-000-op80 pl30 pr30 text-center z-index-4"
|
||||
style="height:65px;padding-top:10px;">
|
||||
<div v-if="mButton.type == 2"
|
||||
style="width:100%;height:45px;background-color:#f55537;-webkit-border-radius:750px;border-radius:750px;">
|
||||
<button @click="showReg"
|
||||
style="width:100%;height:45px;background-color:<?= $topic['mButton']['b_color'] ?>;border:none;line-height:45px;font-size:16px;color:#fff;-webkit-border-radius:750px;border-radius:750px;">
|
||||
{{mButton.b_title}}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else-if="mCountdown.b_e_time > 0"
|
||||
class="absolute left-0 right-0 box-middle text-center font-24 color-fff">
|
||||
<span class="text-middle" v-html="showTime"></span>
|
||||
<a class="inline-block ml10 pt15 pb15 pl20 pr20 text-middle color-fff ulib-r750"
|
||||
:style="'background-color:'+mButton.b_color" @click="showCode" href="javascript:">
|
||||
<img class='inline-block img-30x30 text-middle' src='/img/h5/syt/icon-live2.png'/>
|
||||
<span class="text-middle">订阅直播</span>
|
||||
</a>
|
||||
</div>
|
||||
<div v-else
|
||||
style="width:100%;height:45px;background-color:#f55537;-webkit-border-radius:750px;border-radius:750px;">
|
||||
<div v-if="mButton.b_ghid">
|
||||
<wx-open-launch-weapp @error="handleErrorFn" @launch="handleLaunchFn" id="launch-btn"
|
||||
:username="mButton.b_ghid"
|
||||
:path="mButton.b_url">
|
||||
<script type="text/wxtag-template" v-if="mButton.type == 0">
|
||||
<button style="min-width:250px;width:100%;height:45px;background-color:<?= $topic['mButton']['b_color'] ?>;border:none;line-height:45px;font-size:16px;color:#fff;-webkit-border-radius:750px;border-radius:750px;">
|
||||
{{mButton.b_title}}
|
||||
</button>
|
||||
</script>
|
||||
<script type="text/wxtag-template" v-else>
|
||||
<img src="<?= $topic['mButton']['b_img'] ?>" style="width:100%;height:45px;">
|
||||
</script>
|
||||
</wx-open-launch-weapp>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button v-if="mButton.type == 0" @click="watch(mButton.b_url,mButton.b_url_mini)"
|
||||
style="width:100%;height:45px;background-color:<?= $topic['mButton']['b_color'] ?>;border:none;line-height:45px;font-size:16px;color:#fff;-webkit-border-radius:750px;border-radius:750px;">
|
||||
{{mButton.b_title}}
|
||||
</button>
|
||||
<img @click="watch(mButton.b_url,mButton.b_url_mini)" v-else :src="mButton.b_img"
|
||||
style="width:100%;height:60px;">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="msg fn-hide" :style="msgisShowCode?'display:block':'display:none'" v-if="msgisShowCode">
|
||||
<div class="msgBg" @click="closeCode"></div>
|
||||
<div class="msgMain">
|
||||
<div class="content">
|
||||
<div class="word">
|
||||
<div class="pt10 text-center">
|
||||
<img v-if="qrcode" class='inline-block img-220x220' :src='qrcode'/>
|
||||
</div>
|
||||
<div class="pt30 pb20 pl20 pr20 font-24 color-666 line-height-15"><img
|
||||
class='inline-block mr5 text-middle img-50x50' src='/img/h5/syt/icon-finger.png'/>长按识别二维码,关注{{mp_app_name}}服务号。即可接收直播提醒,还有更多福利不定期放送哦~
|
||||
</div>
|
||||
</div>
|
||||
<div class="opt pl40 pr40">
|
||||
<a class="block pt25 pb25 text-center font-32 color-fff ulib-r750" style="background-color:#f55537;"
|
||||
@click="closeCode" href="javascript:">知道了</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msg fn-hide" :style="msgisLoginShowCode?'display:block':'display:none'" v-if="msgisLoginShowCode">
|
||||
<div class="msgBg" @click="closeLoginCode"></div>
|
||||
<div class="msgMain">
|
||||
<div class="content">
|
||||
<div class="word">
|
||||
<div class="font-36 text-center">绑定手机号</div>
|
||||
<div class="mt30 relative bg-f6 ulib-r10">
|
||||
<input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="tel"
|
||||
v-model="logintelPhone" placeholder="请输入常用手机号码"/>
|
||||
</div>
|
||||
<div class="mt30 relative bg-f6 ulib-r10 pr200">
|
||||
<div><input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="number"
|
||||
v-model="loginvCode" placeholder="请输入验证码"/></div>
|
||||
<button :class="[logincodeState ?'color-980002':'color-999','absolute right-0 bg-none border-none box-middle font-30']"
|
||||
:style="codeState?'color:'+mButton.b_color:''"
|
||||
:disabled="!logincodeState" @click="getlogincode()">{{logincodeTx}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt20 opt pl40 pr40">
|
||||
<a class="block pt25 pb25 text-center font-32 color-fff ulib-r750"
|
||||
:style="'background-color:'+mButton.b_color"
|
||||
@click="loginsubmit()" href="javascript:">确定</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msg fn-hide" :style="msgisRegShow?'display:block':'display:none'" v-if="msgisRegShow && msgisReg">
|
||||
<div class="msgBg" @click="closeReg"></div>
|
||||
<div class="msgMain">
|
||||
<div class="content">
|
||||
<div class="word">
|
||||
<div class="font-36 text-center">{{msgisReg.title}}</div>
|
||||
|
||||
<div class="mt30 relative bg-f6 ulib-r10">
|
||||
<input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="text" v-model="name"
|
||||
placeholder="请输入报名昵称"/>
|
||||
</div>
|
||||
|
||||
<div class="mt30 relative bg-f6 ulib-r10">
|
||||
<input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="tel" v-model="telPhone"
|
||||
placeholder="请输入手机号"/>
|
||||
</div>
|
||||
<div class="mt30 relative bg-f6 ulib-r10 pr200" v-if="msgisReg.if_code==0">
|
||||
<div><input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="number"
|
||||
v-model="vCode" placeholder="请输入验证码"/></div>
|
||||
<button :class="[codeState ?'color-980002':'color-999','absolute right-0 bg-none border-none box-middle font-30']"
|
||||
:style="codeState?'color:'+mButton.b_color:''"
|
||||
:disabled="!codeState" @click="getcode(msgisReg.status.value)">{{codeTx}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt20 opt pl40 pr40">
|
||||
<a class="block pt25 pb25 text-center font-32 color-fff ulib-r750"
|
||||
:style="'background-color:'+mButton.b_color" @click="submit(0)">{{msgisReg.status.title}}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<? if ($topic['stat_code']) { ?>
|
||||
<div style="display: none">
|
||||
<?= $topic['stat_code'] ?>
|
||||
</div>
|
||||
<? } ?>
|
||||
<script type="text/javascript">
|
||||
var loading = 0;
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: <?=json_encode($topic)?>,
|
||||
computed: {
|
||||
//用计算属性显示结果
|
||||
showTime() {
|
||||
if (this.mCountdown.b_e_time <= 0) {//剩余秒数<=0
|
||||
return "已结束";
|
||||
} else { // 剩余秒数>0
|
||||
let day = Math.floor(this.mCountdown.b_e_time / 86400);
|
||||
let hour = Math.floor((this.mCountdown.b_e_time % 86400) / 3600);
|
||||
let min = Math.floor(((this.mCountdown.b_e_time % 86400) % 3600) / 60);
|
||||
let sec = Math.floor(((this.mCountdown.b_e_time % 86400) % 3600) % 60);
|
||||
return ("<span class='text-middle'><?= $topic['mCountdown']['b_title'] ?>:</span><em class='time-pin ulib-r5' style='background-color:#fe506a'>" + day + "</em><em class='text-middle'>天</em><em class='time-pin ulib-r5' style='background-color:#fe506a'>" + (hour < 10 ? "0" : "") + hour + "</em><em class='text-middle'>时</em><em class='time-pin ulib-r5' style='background-color:#fe506a'>" + (min < 10 ? "0" : "") + min + "</em><em class='text-middle'>分</em><em class='time-pin ulib-r5' style='background-color:#fe506a'>" + (sec <
|
||||
10 ? "0" : "") + sec + "</em><em class='text-middle'>秒</em>");
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
var Timer;
|
||||
var swiper = new Swiper('.j-swiper .swiper-container', {
|
||||
loop: true,
|
||||
direction: 'vertical',
|
||||
autoplay: {
|
||||
delay: 3000,
|
||||
stopOnLastSlide: false,
|
||||
disableOnInteraction: true,
|
||||
}
|
||||
});
|
||||
this.bundleIntervalEvent = setInterval(this.intervalEvent, 1000);
|
||||
let that = this;
|
||||
// $.ajax({
|
||||
// url: '/h5/syt/special/ckbind',
|
||||
// type: 'post',
|
||||
// dataType: 'json',
|
||||
// success: function (data) {
|
||||
// if (data.code == 200) {
|
||||
// that.needLogin = data.data.needLogin;
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.bundleIntervalEvent);
|
||||
},
|
||||
methods: {
|
||||
ImgHref: function (value) {
|
||||
if (value.url) {
|
||||
if (value.is_item && this.needLogin) {
|
||||
this.loginBackurl = value.url;
|
||||
this.showLoginCode();
|
||||
} else {
|
||||
window.location.href = value.url;
|
||||
}
|
||||
}
|
||||
},
|
||||
showReg: function () {
|
||||
this.msgisRegShow = true
|
||||
},
|
||||
closeReg: function () {
|
||||
this.msgisRegShow = false
|
||||
},
|
||||
showCode: function () {
|
||||
let that = this;
|
||||
if (that.subscribemsg == '已订阅直播') {
|
||||
mDialog.msg({content: that.subscribemsg});
|
||||
return;
|
||||
}
|
||||
if (!that.mp_app_id) {
|
||||
window.location.href = "" + that.subscribemsg;
|
||||
return;
|
||||
}
|
||||
that.msgisShowCode = true;
|
||||
$.ajax({
|
||||
url: '/h5/syt/special/qrcode',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
a_id: that.a_id,
|
||||
cf_uid: that.cf_uid,
|
||||
biz_id: that.biz_id,
|
||||
skey: that.a_skey,
|
||||
mp_app_id: that.mp_app_id
|
||||
},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
that.qrcode = data.qrcode;
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
},
|
||||
showLoginCode: function () {
|
||||
if (this.needLogin) {
|
||||
this.msgisLoginShowCode = true
|
||||
} else {
|
||||
window.location.href = "/h5/syt/ucenter?__skey=" + this.a_skey;
|
||||
}
|
||||
},
|
||||
closeLoginCode: function () {
|
||||
this.msgisLoginShowCode = false
|
||||
},
|
||||
|
||||
/**
|
||||
* 登录生成倒计时
|
||||
*/
|
||||
loginIntervalEvent() {
|
||||
if (this.e_time > 0) {
|
||||
this.e_time--;
|
||||
} else {
|
||||
clearInterval(this.loginBundleIntervalEvent);
|
||||
}
|
||||
},
|
||||
|
||||
loginCountDownTime(time) {
|
||||
let that = this;
|
||||
if (time > 1) {
|
||||
time--;
|
||||
this.logincodeState = false;
|
||||
this.logincodeTx = time + "s后重新获取";
|
||||
loginTimer = setTimeout(function () {
|
||||
that.loginCountDownTime(time);
|
||||
}, 1000)
|
||||
} else {
|
||||
clearTimeout(loginTimer);
|
||||
that.logincodeState = true;
|
||||
that.logincodeTx = "获取验证码";
|
||||
}
|
||||
},
|
||||
|
||||
getlogincode() {
|
||||
if (!/^1[3456789]\d{9}$/.test(this.logintelPhone)) {
|
||||
mDialog.msg({content: "请输入正确手机号"});
|
||||
} else {
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url: '/h5/syt/special/mcode',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {mobile: this.logintelPhone, type: 'login'},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
mDialog.msg({content: data.msg});
|
||||
if (200 == data['code']) {
|
||||
//按钮倒计时
|
||||
that.loginCountDownTime(30)
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
loginsubmit() {
|
||||
if (this.isSubmiting) return;
|
||||
|
||||
if (!/^1[3456789]\d{9}$/.test(this.logintelPhone)) {
|
||||
mDialog.msg({content: "请输入正确手机号"});
|
||||
} else if (!this.loginvCode) {
|
||||
mDialog.msg({content: "请输入验证码"});
|
||||
} else {
|
||||
var that = this
|
||||
this.isSubmiting = true
|
||||
var loading = mDialog.load({
|
||||
shade: false,
|
||||
text: "",
|
||||
});
|
||||
$.ajax({
|
||||
url: '/h5/syt/special/bind',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
mobile: this.logintelPhone, code: this.loginvCode
|
||||
},
|
||||
success: function (data) {
|
||||
loading && mDialog.close(loading); //关闭加载
|
||||
mDialog.msg({content: data.msg, pause: 8000});
|
||||
if (200 == data['code']) {
|
||||
if (that.loginBackurl) {
|
||||
window.location.href = that.loginBackurl;
|
||||
} else {
|
||||
window.location.href = "/h5/syt/ucenter?__skey=" + that.a_skey;
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
that.isSubmiting = false;
|
||||
}
|
||||
});
|
||||
//mDialog.close(loading); //关闭加载
|
||||
|
||||
//this.closeLoginCode() //关闭弹框
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
closeCode: function () {
|
||||
this.msgisShowCode = false
|
||||
window.location.href = "" + this.subscribemsg;//跳转一次性订阅
|
||||
},
|
||||
/**
|
||||
* 生成倒计时
|
||||
*/
|
||||
intervalEvent() {
|
||||
if (this.mCountdown.b_e_time > 0) {
|
||||
this.mCountdown.b_e_time--;
|
||||
} else {
|
||||
clearInterval(this.bundleIntervalEvent);
|
||||
}
|
||||
},
|
||||
handleErrorFn(e) {
|
||||
mDialog.msg({content: e.detail});
|
||||
},
|
||||
handleLaunchFn(e) {
|
||||
this.watch('', '');
|
||||
},
|
||||
watch(url, url_mini) {
|
||||
let that = this;
|
||||
$.ajax({
|
||||
url: '/h5/syt/special/watch',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {a_id: that.a_id, cf_uid: that.cf_uid, biz_id: that.biz_id},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
},
|
||||
complete: function () {
|
||||
if (url) {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.match(/MicroMessenger/i) == "micromessenger") {//ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
|
||||
wx.miniProgram.getEnv(function (res) {
|
||||
if (res.miniprogram && url_mini) {
|
||||
wx.miniProgram.navigateTo({
|
||||
url: url_mini,//跳转回小程序的页面
|
||||
success: function () {
|
||||
console.log('success');
|
||||
},
|
||||
fail: function () {
|
||||
console.log('fail');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
location.href = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
countDownTime(time) {
|
||||
let that = this;
|
||||
if (time > 1) {
|
||||
time--;
|
||||
this.codeState = false;
|
||||
this.codeTx = time + "s后重新获取";
|
||||
Timer = setTimeout(function () {
|
||||
that.countDownTime(time);
|
||||
}, 1000)
|
||||
} else {
|
||||
clearTimeout(Timer);
|
||||
that.codeState = true;
|
||||
that.codeTx = "获取验证码";
|
||||
}
|
||||
},
|
||||
|
||||
getcode(status) {
|
||||
if (status != 0) return;
|
||||
let that = this;
|
||||
var mobile = that.telPhone;
|
||||
if (!/^1\d{10}$/.test(mobile)) {
|
||||
mDialog.msg({content: "请输入正确手机号"})
|
||||
} else {
|
||||
$.ajax({
|
||||
url: '/h5/syt/special/mcode',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {mobile: mobile, title: "<?= $_title ?>"},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
mDialog.msg({content: data.msg});
|
||||
if (200 == data['code']) {
|
||||
that.countDownTime(30); //按钮倒计时
|
||||
}
|
||||
loading && mDialog.close(loading); //关闭加载
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
submit(index) {
|
||||
let that = this;
|
||||
var status = 1;
|
||||
var if_code = 0;
|
||||
if (index) {
|
||||
status = that.list[index].status.value;
|
||||
if_code = that.list[index].if_code;
|
||||
} else {
|
||||
status = that.msgisReg.status.value;
|
||||
if_code = that.msgisReg.if_code;
|
||||
}
|
||||
if (that.isSubmiting || status != 0) return;
|
||||
var mobile = that.telPhone;
|
||||
if (!that.name) {
|
||||
mDialog.msg({content: "请输入昵称"})
|
||||
} else if (!/^1\d{10}$/.test(mobile)) {
|
||||
mDialog.msg({content: "请输入正确手机号"})
|
||||
} else if (!that.vCode && !if_code) {
|
||||
mDialog.msg({content: "请输入验证码"})
|
||||
} else {
|
||||
that.isSubmiting = true;
|
||||
loading = mDialog.load({shade: false, text: "",});
|
||||
$.ajax({
|
||||
url: '/h5/syt/special/enroll',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
mobile: mobile,
|
||||
code: that.vCode,
|
||||
nickname: that.name,
|
||||
a_id: that.a_id,
|
||||
cf_uid: that.cf_uid,
|
||||
biz_id: that.biz_id,
|
||||
uid: that.uid,
|
||||
if_code: if_code,
|
||||
},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
mDialog.msg({content: data.msg});
|
||||
if (200 == data['code']) {
|
||||
if (index) {
|
||||
that.list[index].status.title = "已报名";
|
||||
that.list[index].status.value = 1;
|
||||
} else {
|
||||
that.msgisReg.status.title = "已报名";
|
||||
that.msgisReg.status.value = 1;
|
||||
that.closeReg();
|
||||
}
|
||||
if (that.a_id == 17) {//统计
|
||||
meteor.track('form', {convert_id: 1699532670201934});
|
||||
}else if (that.a_id == 18) {
|
||||
formSuccess();
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
that.isSubmiting = false;
|
||||
loading && mDialog.close(loading); //关闭加载
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
wx.config({
|
||||
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印
|
||||
appId: "<?=$sign_package['appId']?>", // 必填,公众号的唯一标识
|
||||
timestamp: "<?=$sign_package['timestamp']?>", // 必填,生成签名的时间戳
|
||||
nonceStr: "<?=$sign_package['nonceStr']?>", // 必填,生成签名的随机串
|
||||
signature: "<?=$sign_package['signature']?>",// 必填,签名
|
||||
jsApiList: ["openLocation", "updateAppMessageShareData", "updateTimelineShareData"], // 必填,需要使用的JS接口列表
|
||||
openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
|
||||
});
|
||||
wx.ready(function () {
|
||||
//自定义“分享到朋友圈”及“分享到QQ空间”按钮的分享内容
|
||||
wx.updateTimelineShareData({
|
||||
title: '<?=$share['title']?>', // 分享标题
|
||||
link: '<?=$share['url']?>', // 分享链接
|
||||
imgUrl: '<?=$share['img']?>', // 分享图标
|
||||
desc: '<?=$share['desc']?>', // 分享描述
|
||||
success: function () {
|
||||
// 用户成功分享后执行的回调函数
|
||||
alert(option.title);
|
||||
option.success()
|
||||
},
|
||||
cancel: function () {
|
||||
// 用户取消分享后执行的回调函数
|
||||
option.error()
|
||||
}
|
||||
});
|
||||
//自定义“分享给朋友”及“分享到QQ”按钮的分享内容
|
||||
wx.updateAppMessageShareData({
|
||||
title: '<?=$share['title']?>', // 分享标题
|
||||
desc: '<?=$share['desc']?>', // 分享描述
|
||||
link: '<?=$share['url']?>', // 分享链接
|
||||
imgUrl: '<?=$share['img']?>', // 分享图标
|
||||
success: function () {
|
||||
// 用户成功分享后执行的回调函数
|
||||
alert(option.title);
|
||||
option.success()
|
||||
},
|
||||
cancel: function () {
|
||||
// 用户取消分享后执行的回调函数
|
||||
option.error()
|
||||
}
|
||||
});
|
||||
});
|
||||
wx.error(function (res) {
|
||||
console.log('res', res);
|
||||
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,158 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cmn-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title><?= $_title ?></title>
|
||||
<link rel="stylesheet" href="/css/h5/syt/special.css?v=20210416">
|
||||
<link rel="stylesheet" href="https://qs.haodian.cn/web/javascript/swiper/css/swiper.min.css">
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/axios.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/swiper/js/swiper.min.js"></script>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/qs.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue-mugen-scroll.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/mDialog.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div class="poster">
|
||||
<div class="detail-banner relative p-swiper">
|
||||
<div class="swiper-container left-0 top-0">
|
||||
<div class="swiper-wrapper">
|
||||
<div class="swiper-slide img-cover" v-for="item in list">
|
||||
<div class="relative">
|
||||
<img class="wp100 block" :src="item.img" style="pointer-events:none;" />
|
||||
<img class="absolute left-0 bottom-0 ml60 mb80 img-130x130" :src="item.code"
|
||||
style="pointer-events:none;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="swiper-pagination ulib-rl750"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div @click="showPoster">
|
||||
<div style="height:70px;"></div>
|
||||
<div class="fixed left-0 bottom-0 right-0 bg-000-op80 pl30 pr30 text-center z-index-4"
|
||||
style="height:65px;padding-top:10px;">
|
||||
<div style="width:100%;height:45px;background-color:#f55537;-webkit-border-radius:750px;border-radius:750px;">
|
||||
<button style="width:100%;height:45px;background-color:#f55537;border:none;line-height:45px;font-size:16px;color:#fff;-webkit-border-radius:750px;border-radius:750px;">
|
||||
生成海报
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msg fn-hide" :style="msgisShowPoster?'display:block':'display:none'">
|
||||
<div class="msgBgPoster" @click="closePoster"></div>
|
||||
<div class="msgMain">
|
||||
<i @click="closePoster" class="posterClose" v-if="posterSrc"><span></span></i>
|
||||
<div class="msgPoster">
|
||||
<div class="postercon overflowhidden ulib-r20">
|
||||
<div style="display:none;">
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
<div v-if="posterSrc"><img class="wp100 ulib-r20" :src='posterSrc' alt=""/></div>
|
||||
</div>
|
||||
<div class="pt30 pb10 text-center text-center font-30 color-fff" v-if="posterSrc">
|
||||
<img class="inline-block img-42x42 text-middle" src="/img/h5/syt/icon-finger.png" alt=""/>
|
||||
<span class="ml10 text-middle">长按图片保存到手机发送给好友</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
list: <?=json_encode($posters)?>,
|
||||
msgisShowPoster: false,
|
||||
canW: 750,
|
||||
canH: 0,
|
||||
activeIndex: 0,
|
||||
posterSrc: '',
|
||||
},
|
||||
mounted() {
|
||||
let that = this
|
||||
var swiper = new Swiper('.p-swiper .swiper-container', {
|
||||
//loop: true,
|
||||
//autoHeight: true,
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
type: 'fraction',
|
||||
},
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
on: {
|
||||
slideChangeTransitionEnd: function () {
|
||||
that.activeIndex = this.activeIndex
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
showPoster: function () {
|
||||
this.msgisShowPoster = true
|
||||
this.posterSrc = ''
|
||||
this.draw()
|
||||
},
|
||||
closePoster: function () {
|
||||
this.msgisShowPoster = false
|
||||
},
|
||||
|
||||
//海报生成
|
||||
draw() {
|
||||
let that = this
|
||||
that.canH = that.list[that.activeIndex].height / that.list[that.activeIndex].width * that.canW
|
||||
$("#canvas").attr({
|
||||
'width': that.canW,
|
||||
'height': that.canH,
|
||||
});
|
||||
let canvas = document.getElementById('canvas');
|
||||
let ctx = canvas.getContext("2d");
|
||||
let imgBg = new Image();
|
||||
imgBg.setAttribute("crossOrigin", 'Anonymous')//如果二维码图片域名跨域,则保留此代码
|
||||
imgBg.src = that.list[that.activeIndex].img
|
||||
imgBg.onload = function () {
|
||||
ctx.drawImage(imgBg, 0, 0, that.list[that.activeIndex].width, that.list[that.activeIndex].height, 0, 0, that.canW, that.canH)
|
||||
let codeimg = new Image();
|
||||
codeimg.setAttribute("crossOrigin", 'Anonymous')//如果二维码图片域名跨域,则保留此代码
|
||||
codeimg.src = that.list[that.activeIndex].code
|
||||
codeimg.onload = function () {
|
||||
ctx.drawImage(codeimg, 60, that.canH - 210, 130, 130)
|
||||
that.posterSrc = canvas.toDataURL("image/jpg");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
wx.config({
|
||||
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印
|
||||
appId: "<?=$sign_package['appId']?>", // 必填,公众号的唯一标识
|
||||
timestamp: "<?=$sign_package['timestamp']?>", // 必填,生成签名的时间戳
|
||||
nonceStr: "<?=$sign_package['nonceStr']?>", // 必填,生成签名的随机串
|
||||
signature: "<?=$sign_package['signature']?>",// 必填,签名
|
||||
jsApiList: ["hideAllNonBaseMenuItem"], // 必填,需要使用的JS接口列表
|
||||
openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
|
||||
});
|
||||
wx.ready(function () {
|
||||
wx.hideAllNonBaseMenuItem();
|
||||
});
|
||||
wx.error(function (res) {
|
||||
console.log('res', res);
|
||||
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
6KCtCFAFCutAcUIU
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |