修改私域活动

This commit is contained in:
chenrx
2024-06-14 17:48:08 +08:00
parent 939f6460e0
commit c4bfe08efe
6 changed files with 348 additions and 279 deletions
+2 -2
View File
@@ -950,11 +950,11 @@ if (!function_exists('http_host_com')) {
} else if ($type == 'admin') {
$url = "http://liche-admin.dev.xiaoyu.com";
}
} elseif (false !== strpos($_SERVER['HTTP_HOST'], 'test')) {//test 测试
} elseif (false !== strpos($_SERVER['HTTP_HOST'], 'lc')) {//test 测试
if ($type == 'api') {
$url = 'api.lc.haodian.cn';
} else if ($type == 'home') {
$url = "https://www-test.liche.cn";
$url = "http://www.lc.haodian.cn";
} else if ($type == 'admin') {
$url = "https://admin.test.liche.cn";
}
+217 -196
View File
@@ -1,22 +1,24 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');
require_once 'Common.php';
require_once COMMPATH . 'third_party/phpqrcode/phpqrcode.php';
class Act extends Wx {
class Act extends Wx
{
private $item_banner = ['https://qs.haodian.cn/web/images/project/H5-ShiYu/goods.jpg'];
private $template_id = 'DO0B9IYYub1d0oNvy9czzGbe6_1EU8PQmnLEoDOcmXA';
private $a_id,$skey;
private $a_id, $skey;
public function __construct(){
public function __construct()
{
//echo "<h1>大家都太热情了,先稍等片刻再访问吧~</h1>";exit;
parent::__construct();
$this->load->model('market/market_sylive_organization_model');
$this->load->model('market/market_sylive_activity_model');
$this->load->model('market/market_sylive_activity_biz_model','mdSytActivityBiz');
$this->load->model('market/market_sylive_subscribemsg_model','mdSytSubscribemsg');
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
$this->load->model('market/market_sylive_activity_biz_model', 'mdSytActivityBiz');
$this->load->model('market/market_sylive_subscribemsg_model', 'mdSytSubscribemsg');
$this->load->model('market/market_sylive_activity_kpidata_model', 'mdSytActivityKpiData');
$this->load->model('market/market_sylive_order_model');
$this->load->model('market/market_sylive_customer_model');
$this->load->model('market/market_sylive_items_model');
@@ -28,29 +30,34 @@ class Act extends Wx {
$this->a_id = intval($param['a_id']);//活动id
}
public function index(){
public function index()
{
$alert_code = $this->input->get('alert_code');
$apt = $this->input->get('apt');
if (!$this->a_id) {
throw new Hd_exception("参数错误", 400);
}
$row = $this->market_sylive_activity_model->get(['activityId'=>$this->a_id]);
if(!$row){
throw new Hd_exception('参数错误',400);
$row = $this->market_sylive_activity_model->get(['activityId' => $this->a_id]);
if (!$row) {
throw new Hd_exception('参数错误', 400);
}
$jsondata = json_decode($row['jsondata'],true);
$jsondata = json_decode($row['jsondata'], true);
$bottoms = [];
if($jsondata['bottoms']){
foreach ($jsondata['bottoms'] as $key=>$val) {
if ($jsondata['bottoms']) {
foreach ($jsondata['bottoms'] as $key => $val) {
$temp = [
'title' => $val['title'],
'icon' => build_qiniu_image_url($val['icon'])
];
if($val['urlType']=='miniProgram'){
if ($val['urlType'] == 'miniProgram') {
$temp['type'] = 2;
$temp['wechat_ghid'] = $val['miniProgramId'];
$temp['wechat_path'] = $val['url'];
}else{
} else if ($val['urlType'] == 'enroll') { //报名
$temp['type'] = 3;
} else if ($val['urlType'] == 'appoint') { //订阅
$temp['type'] = 4;
} else {
$temp['type'] = 1;
$temp['url'] = $val['url'];
}
@@ -58,24 +65,24 @@ class Act extends Wx {
}
}
$info['menu'] = $bottoms;
$user = $this->user_model->get(['userId'=>$this->uid],'unionid,nickname,headimg');
$user = $this->user_model->get(['userId' => $this->uid], 'unionid,nickname,headimg');
$timeStart = strtotime($row['timeStart']);
$info['s_time'] = time() < $timeStart ? $timeStart-time() : 0;
$info['s_time'] = time() < $timeStart ? $timeStart - time() : 0;
$info['bg'] = $row['bgImg'] ? build_qiniu_image_url($row['bgImg']) : '';
$info['content'] = $row['introduction'];
$act_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$this->a_id]);
$act_user = $this->act_user_model->get(['userId' => $this->uid, 'activityId' => $this->a_id]);
//一次性订阅
$re_s = $this->mdSytSubscribemsg->get(array('activityId' => $this->a_id, 'userId' => $this->uid));
$is_show_code = false; //是否显示二维码
if ($re_s) {
$subscribemsg = '已订阅直播';
$p_user = [];
$act_user['channelId'] && $p_user = $this->user_model->get(['userId'=>$act_user['channelId']]);
$act_user['channelId'] && $p_user = $this->user_model->get(['userId' => $act_user['channelId']]);
$p_user['teamId'] && $is_show_code = true;
} else {
if(!$user['nickname'] && !$user['headimg']){
$subscribemsg = http_host_com('home')."/h5/market/sylive2/act/userinfo?skey={$this->skey}&type=sub";
}else{
if (!$user['nickname'] && !$user['headimg']) {
$subscribemsg = http_host_com('home') . "/h5/market/sylive2/act/userinfo?skey={$this->skey}&type=sub";
} else {
$this->load->config('wechat');
$config = $this->config->item('hdy');
$sub_redirect_url = urlencode(http_host_com('home') . '/h5/market/sylive2/act/subscribemsg?skey=' . $this->skey
@@ -84,15 +91,15 @@ class Act extends Wx {
}
}
//浏览
$params = array('a_id' => $this->a_id, 'uid' => $this->uid,'cf_uid' => $act_user['channelId'], 'kpi' => 'browse');
$params = array('a_id' => $this->a_id, 'uid' => $this->uid, 'cf_uid' => $act_user['channelId'], 'kpi' => 'browse');
$this->sylive2_entity->kpi_log($params);
$live_status = 0; //直播未开始
if(time()>strtotime($row['timeStart']) && time()<=strtotime($row['timeEnd'])){ //直播期间人数
$row['liveStatus']!=1 && $this->market_sylive_activity_model->update(['liveStatus'=>1],['activityId'=>$this->a_id]); //更新直播间状态
if (time() > strtotime($row['timeStart']) && time() <= strtotime($row['timeEnd'])) { //直播期间人数
$row['liveStatus'] != 1 && $this->market_sylive_activity_model->update(['liveStatus' => 1], ['activityId' => $this->a_id]); //更新直播间状态
$live_status = 1; //直播中
}
if(time()>strtotime($row['timeEnd'])){ //直播结束
$row['liveStatus']!=2 && $this->market_sylive_activity_model->update(['liveStatus'=>2],['activityId'=>$this->a_id]); //更新直播间状态
if (time() > strtotime($row['timeEnd'])) { //直播结束
$row['liveStatus'] != 2 && $this->market_sylive_activity_model->update(['liveStatus' => 2], ['activityId' => $this->a_id]); //更新直播间状态
$live_status = 2; //直播结束
}
$share_skey = "a_id=" . $this->a_id . "&cf_uid=" . $this->uid;
@@ -101,44 +108,47 @@ class Act extends Wx {
$info['a_id'] = $this->a_id;
$info['subscribemsg'] = $subscribemsg;
$info['statisticsurl'] = $info['shareurl'] = $info['code'] = '';
if($act_user['groupsId']){
$info['shareurl'] = '/h5/market/sylive2/act/share?skey='.$info['skey'];
if ($act_user['groupsId']) {
$info['shareurl'] = '/h5/market/sylive2/act/share?skey=' . $info['skey'];
$info['statisticsurl'] = "/h5/market/sylive2/stic?a_id={$this->a_id}";
$info['rankingurl'] = "/h5/market/sylive2/stic/ranking?a_id={$this->a_id}";
}
$info['channelImg'] = build_qiniu_image_url($row['channelImg']);
$userid = $user['unionid'] ? $user['unionid'] : $this->uid;
$ts = time()*1000;
$sign = md5($this->secretkey.$userid.$this->secretkey.$ts);
if(!$user['nickname'] && !$user['headimg']){
$info['live_url'] = http_host_com('home').'/h5/market/sylive2/act/userinfo?skey='.$this->skey;
}else{
$ts = time() * 1000;
$sign = md5($this->secretkey . $userid . $this->secretkey . $ts);
if (!$user['nickname'] && !$user['headimg']) {
$info['live_url'] = http_host_com('home') . '/h5/market/sylive2/act/userinfo?skey=' . $this->skey;
} else {
$info['live_url'] = "https://live.haodian.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}";
}
$info['my_url'] = http_host_com('home')."/h5/market/sylive2/act/userinfo?skey={$this->skey}&type=my";
$info['my_url'] = http_host_com('home') . "/h5/market/sylive2/act/userinfo?skey={$this->skey}&type=my";
$info['show_code'] = $is_show_code ? 1 : 0;
$info['alert_code'] = $alert_code ? 1 : 0;
$info['appoint_mobile'] = false;
$info['is_appoint'] = false;
$auth_url = '';
if($jsondata['signBespeak']['status']){
//判断是否已报名
$where = ['activityId' => $this->a_id, 'userId' => $this->uid];
$appoint = $this->market_sylive_customer_model->get($where);
$info['is_appoint'] = $appoint ? true : false;
if ($jsondata['signBespeak']['status']) {
$info['appoint_mobile'] = true;
//判断是否已报名
$where = ['activityId'=>$this->a_id,'userId'=>$this->uid];
$appoint = $this->market_sylive_customer_model->get($where);
$info['is_appoint'] = $appoint ? true : false;
if(!$user['nickname'] && !$user['headimg']) {
if (!$user['nickname'] && !$user['headimg']) {
$auth_url = http_host_com('home') . "/h5/market/sylive2/act/userinfo?skey={$this->skey}&type=apt";
}
}
$pay_item_id = intval($jsondata['signBespeak']['payItemId']);
$pay_skey = $this->myencryption->base64url_encode("a_id={$this->a_id}&itemId={$pay_item_id}");
$info['auth_url'] = $auth_url;
$info['apt'] = $apt ? true : false; //是否弹窗报名
$info['ukey'] = $appoint ? $appoint['ukey'] : ''; //是否弹窗报名
$info['appoint_title'] = $jsondata['signBespeak']['title'] ? $jsondata['signBespeak']['title'] : '';
$info['appoint_msg'] = $jsondata['signBespeak']['content'] ? $jsondata['signBespeak']['content'] : '';
$info['notice_color'] = $jsondata['barrage']['color'] ? '#fff' : '#333';
$info['notice_color'] = $jsondata['barrage']['color'] ? '#fff' : '#333';
$info['btn_text'] = $jsondata['button']['title'] ? $jsondata['button']['title'] : '开播提醒';
$info['pay_item_url'] = $pay_item_id ? http_host_com('home') . "/h5/market/sylive2/item/detail?skey={$pay_skey}" : '';
$this->data['info'] = $info;
//微信分享
$wx_info = $this->share_info($row);
@@ -150,7 +160,8 @@ class Act extends Wx {
}
//获取最新订阅用户
public function subscribemsg_lists(){
public function subscribemsg_lists()
{
$map_kpi_name = [
'browse' => '进入了直播间', 'subscribe' => '订阅了直播通知'
];
@@ -162,27 +173,27 @@ class Act extends Wx {
'activityId' => $a_id,
'kpi' => 'subscribe'
];
if($live_status){
if ($live_status) {
$where['kpi'] = 'browse';
}
$rows = $this->mdSytActivityKpiData->select($where,'id desc',1,30,$field);
if($rows){
$act_row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]);
$jsondata = json_decode($act_row['jsondata'],true);
$rows = $this->mdSytActivityKpiData->select($where, 'id desc', 1, 30, $field);
if ($rows) {
$act_row = $this->market_sylive_activity_model->get(['activityId' => $a_id]);
$jsondata = json_decode($act_row['jsondata'], true);
$users = [];
$uids = implode(',',array_unique(array_column($rows,'userId')));
if($uids){
$uids = implode(',', array_unique(array_column($rows, 'userId')));
if ($uids) {
$where = [
"userId in ($uids)" => null,
];
$users = $this->user_model->map('userId','nickname',$where,'','','','userId,nickname');
$users = $this->user_model->map('userId', 'nickname', $where, '', '', '', 'userId,nickname');
}
foreach ($rows as $item) {
$nickname = $users[$item['userId']] ? $users[$item['userId']] : "用户{$item['userId']}";
//报名使用自定标题
if($jsondata['signBespeak']['status'] && !$live_status && $jsondata['barrage']['title']){
if ($jsondata['signBespeak']['status'] && !$live_status && $jsondata['barrage']['title']) {
$tip = $jsondata['barrage']['title'];
}else{
} else {
$tip = $map_kpi_name[$item['kpi']];
}
$lists[] = [
@@ -192,7 +203,7 @@ class Act extends Wx {
}
}
$data['lists'] = $lists;
$this->show_json($data,200);
$this->show_json($data, 200);
}
/**
@@ -222,11 +233,11 @@ class Act extends Wx {
$add_data['status'] = 0;
$id = $this->mdSytSubscribemsg->add($add_data);
if ($id) {
$act_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$a_id]);
$act_user = $this->act_user_model->get(['userId' => $this->uid, 'activityId' => $a_id]);
//订阅用户加统计
$params = array('a_id' => $a_id, 'uid' => $this->uid,'cf_uid' => $act_user['channelId'], 'kpi' => 'subscribe');
$params = array('a_id' => $a_id, 'uid' => $this->uid, 'cf_uid' => $act_user['channelId'], 'kpi' => 'subscribe');
$req = $this->sylive2_entity->kpi_log($params);
debug_log("[info]# " . json_encode($req,JSON_UNESCAPED_UNICODE), 'market/sylive','subscribemsg.log');
debug_log("[info]# " . json_encode($req, JSON_UNESCAPED_UNICODE), 'market/sylive', 'subscribemsg.log');
// $p_user = [];
// $act_user['channelId'] && $p_user = $this->user_model->get(['userId'=>$act_user['channelId']]);
// $p_user['teamId'] && $show_code = 1;
@@ -237,40 +248,41 @@ class Act extends Wx {
redirect($url);
}
public function share(){
$row = $this->market_sylive_activity_model->get(['activityId'=>$this->a_id]);
if(!$row){
throw new Hd_exception('参数错误',400);
public function share()
{
$row = $this->market_sylive_activity_model->get(['activityId' => $this->a_id]);
if (!$row) {
throw new Hd_exception('参数错误', 400);
}
$shareImg = json_decode($row['shareImg'],true);
$shareTitle = $row['shareTitle'] ? json_decode($row['shareTitle'],true) : [];
$shareImg = json_decode($row['shareImg'], true);
$shareTitle = $row['shareTitle'] ? json_decode($row['shareTitle'], true) : [];
$lists = [];
if($shareImg){
if ($shareImg) {
$share_skey = "a_id=" . $this->a_id . "&cf_uid=" . $this->uid;
$share_url = http_host_com('home') . "/h5/market/sylive2/act?skey=" . $this->myencryption->base64url_encode($share_skey);
$errorCorrectionLevel = 'L'; //容错级别
$matrixPointSize = 5; //生成图片大小
//生成二维码图片
$file_name = md5($share_url).'.png';
$file_name = md5($share_url) . '.png';
$file_path = "temp/{$file_name}";
if (!file_exists(FCPATH.'temp/')) {
if (!file_exists(FCPATH . 'temp/')) {
$oldumask = umask(0);
mkdir(FCPATH.'temp/', 0777, true);
mkdir(FCPATH . 'temp/', 0777, true);
umask($oldumask);
}
QRcode::png($share_url, FCPATH.$file_path, $errorCorrectionLevel, $matrixPointSize, 1);
$res = $this->qiniu->save($file_name, file_get_contents(FCPATH.$file_path));
if($res['url']){
@unlink(FCPATH.$file_path);
QRcode::png($share_url, FCPATH . $file_path, $errorCorrectionLevel, $matrixPointSize, 1);
$res = $this->qiniu->save($file_name, file_get_contents(FCPATH . $file_path));
if ($res['url']) {
@unlink(FCPATH . $file_path);
$qr_code = build_qiniu_image_url($res['url']);
}else{
} else {
$qr_code = '/h5/market/sylive2/myqrcode/get?url=' . $share_url;
}
foreach ($shareImg as $item) {
$img_url = build_qiniu_image_url($item);
$img_info = file_get_contents($img_url.'?imageInfo');
if($img_info){
$img_info = json_decode($img_info,true);
$img_info = file_get_contents($img_url . '?imageInfo');
if ($img_info) {
$img_info = json_decode($img_info, true);
}
$lists[] = [
"img" => $img_url,
@@ -280,17 +292,17 @@ class Act extends Wx {
];
}
}
$user = $this->user_model->get(['userId'=>$this->uid],'uname,nickname');
$act_row = $this->act_user_model->get(['id'=>$this->act_uid],'groupsId');
if($act_row['groupsId']){
$group_lists = $this->sylive2_entity->get_group_lists($act_row['groupsId'],$this->a_id);
$user = $this->user_model->get(['userId' => $this->uid], 'uname,nickname');
$act_row = $this->act_user_model->get(['id' => $this->act_uid], 'groupsId');
if ($act_row['groupsId']) {
$group_lists = $this->sylive2_entity->get_group_lists($act_row['groupsId'], $this->a_id);
$this->data['posterTip'] = "{$group_lists[0]['groupsName']}{$user['uname']}诚挚邀请您参与";
}else{
} else {
$this->data['posterTip'] = "{$user['nickname']}诚挚邀请您参与";
}
$jsondata = json_decode($row['jsondata'], true);
$this->data['fillStyle'] = $jsondata['barrage']['color'] ? '#fff' : '#333';;
$this->data['fillStyle'] = $jsondata['barrage']['color'] ? '#fff' : '#333';
$this->data['lists'] = $lists;
$this->data['shareTitle'] = $shareTitle;
//微信分享
@@ -300,27 +312,29 @@ class Act extends Wx {
$this->show_view('h5/market/sylive2/act/share');
}
public function item(){
public function item()
{
$skey = $this->input->get('skey');
$param = $this->myencryption->base64url_decode($skey);
$a_id = intval($param['a_id']);//活动id
$row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]);
if(!$row){
throw new Hd_exception('参数错误',400);
$row = $this->market_sylive_activity_model->get(['activityId' => $a_id]);
if (!$row) {
throw new Hd_exception('参数错误', 400);
}
$jsondata = json_decode($row['jsondata'],true);
$item = $jsondata['item'] ? $jsondata['item'] : [];
$is_pay = $this->market_sylive_order_model->count(['itemId'=>$a_id,'status'=>1,'userId'=>$this->uid,'type'=>0]);
if($is_pay){
$url = http_host_com('home').'/h5/market/sylive2/ucenter/mygift?skey='.$skey;
redirect($url);exit;
$jsondata = json_decode($row['jsondata'], true);
$item = $jsondata['item'] ? $jsondata['item'] : [];
$is_pay = $this->market_sylive_order_model->count(['itemId' => $a_id, 'status' => 1, 'userId' => $this->uid, 'type' => 0]);
if ($is_pay) {
$url = http_host_com('home') . '/h5/market/sylive2/ucenter/mygift?skey=' . $skey;
redirect($url);
exit;
}
$e_time = time() < strtotime($row['timeEnd']) ? strtotime($row['timeEnd']) - time() : 0;
$banner = $this->item_banner;
$validity = '';
if($item['useTimeStart'] || $item['useTimeEnd']){
$useTimeStart = date('Y-m-d',strtotime($item['useTimeStart']));
$useTimeEnd = date('Y-m-d',strtotime($item['useTimeEnd']));
if ($item['useTimeStart'] || $item['useTimeEnd']) {
$useTimeStart = date('Y-m-d', strtotime($item['useTimeStart']));
$useTimeEnd = date('Y-m-d', strtotime($item['useTimeEnd']));
$validity = "有效期 {$useTimeStart} - {$useTimeEnd}";
}
$info = [
@@ -344,7 +358,8 @@ class Act extends Wx {
}
//支付
public function post_pay(){
public function post_pay()
{
$redis = load_cache('redis');
$redis_obj = $redis->redis();
$skey = $this->input->post('skey');
@@ -352,100 +367,101 @@ class Act extends Wx {
$mobile = $this->input->post('telPhone');
$param = $this->myencryption->base64url_decode($skey);
$a_id = intval($param['a_id']);//活动id
$row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]);
if(!$row){
$this->show_json('',400,'参数错误');
$row = $this->market_sylive_activity_model->get(['activityId' => $a_id]);
if (!$row) {
$this->show_json('', 400, '参数错误');
}
$mb_key = 'SYLIVE_ITEM_AID_'.$a_id;
if(!mobile_valid($mobile)){
$this->show_json('',400,'请输入正确手机号');
$mb_key = 'SYLIVE_ITEM_AID_' . $a_id;
if (!mobile_valid($mobile)) {
$this->show_json('', 400, '请输入正确手机号');
}
$jsondata = json_decode($row['jsondata'],true);
$item = $jsondata['item'] ? $jsondata['item'] : [];
$jsondata = json_decode($row['jsondata'], true);
$item = $jsondata['item'] ? $jsondata['item'] : [];
//判断是否已支付
$o_row = $this->market_sylive_order_model->get(['itemId'=>$a_id,'status'=>1,'userId'=>$this->uid,'type'=>0]);
if($o_row){
$this->show_json('',400,'已支付,请勿重复支付');
$o_row = $this->market_sylive_order_model->get(['itemId' => $a_id, 'status' => 1, 'userId' => $this->uid, 'type' => 0]);
if ($o_row) {
$this->show_json('', 400, '已支付,请勿重复支付');
}
$pay_price = $item['price'];
if($pay_price<=0){
$this->show_json('',400,'无需支付');
if ($pay_price <= 0) {
$this->show_json('', 400, '无需支付');
}
if($row['stock']<=0){
$this->show_json('',400,'已售罄');
if ($row['stock'] <= 0) {
$this->show_json('', 400, '已售罄');
}
$unpay = $this->market_sylive_order_model->get(['itemId'=>$a_id,'status'=>0,'userId'=>$this->uid,'expireTime>'=>time(),'type'=>0]);
if(!$unpay){
$unpay = $this->market_sylive_order_model->get(['itemId' => $a_id, 'status' => 0, 'userId' => $this->uid, 'expireTime>' => time(), 'type' => 0]);
if (!$unpay) {
$mb_count = $redis_obj->sCard($mb_key); //获取集合中用户数量
if($mb_count && $mb_count>$row['stock']+10){
if ($mb_count && $mb_count > $row['stock'] + 10) {
$mb = $redis_obj->sMembers($mb_key);
$this->show_json('',400,'已售罄:'.json_encode($mb,JSON_UNESCAPED_UNICODE));
$this->show_json('', 400, '已售罄:' . json_encode($mb, JSON_UNESCAPED_UNICODE));
}
try {
$act_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$a_id]);
$act_user = $this->act_user_model->get(['userId' => $this->uid, 'activityId' => $a_id]);
$p_user = [];
$act_user['channelId'] && $p_user = $this->user_model->get(['userId'=>$act_user['channelId']]);
$act_user['channelId'] && $p_user = $this->user_model->get(['userId' => $act_user['channelId']]);
$this->market_sylive_order_model->db->trans_begin();
//限购一件
$u_row = $this->market_sylive_order_model->get(['itemId'=>$a_id,'status>='=>0,'userId'=>$this->uid]);
if($u_row){
$u_row = $this->market_sylive_order_model->get(['itemId' => $a_id, 'status>=' => 0, 'userId' => $this->uid]);
if ($u_row) {
throw new Exception('限购一件');
}
$this->load->helper('order');
$unpay = [
'sid' => create_order_no('350200','market'),
'sid' => create_order_no('350200', 'market'),
'userId' => $this->uid,
'itemId' => $a_id,
'itemTitle' => $item['title'],
'totalPrice' => $pay_price,
'expireTime' => time()+5*60,//订单过期时间
'expireTime' => time() + 5 * 60,//订单过期时间
'createTime' => date('Y-m-d H:i:s')
];
$name && $unpay['uname'] = $name;
$mobile && $unpay['mobile'] = $mobile;
$p_user['teamId'] && $unpay['cfrom'] = 1;
$oid = $this->market_sylive_order_model->add($unpay);
if(!is_numeric($oid)){
if (!is_numeric($oid)) {
$this->market_sylive_order_model->db->trans_rollback();
throw new Exception('创建订单失败');
}
$this->market_sylive_activity_model->update(['stock = stock-1' =>null],['activityId'=>$a_id,'stock>'=>0]);
$this->market_sylive_activity_model->update(['stock = stock-1' => null], ['activityId' => $a_id, 'stock>' => 0]);
$res = $this->market_sylive_activity_model->db->affected_rows();
if(!$res){
if (!$res) {
throw new Exception('已售罄');
}
$this->market_sylive_order_model->db->trans_commit();
$redis_obj->sRem($mb_key,$this->uid); //删除集合
}catch (Exception $e){
$redis_obj->sRem($mb_key,$this->uid); //删除集合
$redis_obj->sRem($mb_key, $this->uid); //删除集合
} catch (Exception $e) {
$redis_obj->sRem($mb_key, $this->uid); //删除集合
$this->market_sylive_order_model->db->trans_rollback();
$this->show_json('',400,$e->getMessage());
$this->show_json('', 400, $e->getMessage());
}
}
$user = $this->user_model->get(['userId'=>$this->uid]);
$notify_url = http_host_com('home').'/h5/market/sylive2/notify';
$user = $this->user_model->get(['userId' => $this->uid]);
$notify_url = http_host_com('home') . '/h5/market/sylive2/notify';
$other_data = [];
$pay_config = $this->market_sylive_activity_model->pay_config($row['mchId']);
$pay_config && $other_data['pay_config'] = $pay_config;
$result = $this->unorder($unpay['sid'],$unpay['totalPrice'],$user['openid'],$unpay['itemTitle'],$notify_url,$unpay['expireTime'],$other_data);
if(!$result['code']){
$this->show_json('',400,$result['msg']);
$result = $this->unorder($unpay['sid'], $unpay['totalPrice'], $user['openid'], $unpay['itemTitle'], $notify_url, $unpay['expireTime'], $other_data);
if (!$result['code']) {
$this->show_json('', 400, $result['msg']);
}
$this->show_json($result['data'],200,'操作成功');
$this->show_json($result['data'], 200, '操作成功');
}
//获取微信用户信息
public function userinfo(){
$ret = $this->set_auth('',1);
if($ret){
public function userinfo()
{
$ret = $this->set_auth('', 1);
if ($ret) {
$update = [
"sex" => $ret['sex'] ? 1 : 0,
];
$ret['nickname'] && $update['nickname'] = strval($ret['nickname']);
$ret['headimgurl'] && $update['headimg'] = strval($ret['headimgurl']);
$ret['unionid'] && $update['unionid'] = $ret['unionid'];
$this->user_model->update($update,['userId'=>$this->uid,'openid'=>$ret['openid']]);
$_SESSION[self::SESSION_KEY]['all_info'] =1;
$this->user_model->update($update, ['userId' => $this->uid, 'openid' => $ret['openid']]);
$_SESSION[self::SESSION_KEY]['all_info'] = 1;
}
$skey = $this->input->get('skey');
$type = $this->input->get('type');
@@ -457,95 +473,100 @@ class Act extends Wx {
if (!$a_id) {
throw new Hd_exception("参数错误", 400);
}
$row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]);
if(!$row){
throw new Hd_exception('参数错误',400);
$row = $this->market_sylive_activity_model->get(['activityId' => $a_id]);
if (!$row) {
throw new Hd_exception('参数错误', 400);
}
if($type=='sub'){ //订阅跳转
if ($type == 'sub') { //订阅跳转
$this->load->config('wechat');
$config = $this->config->item('hdy');
$sub_redirect_url = urlencode(http_host_com('home') . '/h5/market/sylive2/act/subscribemsg?skey=' . $skey
. '&s_time=' . $row['timeStart']);
$subscribemsg = "https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid={$config['appid']}&scene=0&template_id={$this->template_id}&redirect_url={$sub_redirect_url}&reserved=test#wechat_redirect";
redirect($subscribemsg);
}elseif($type=='my'){ //跳转我的
$my_url = http_host_com('home')."/h5/market/sylive2/ucenter?skey={$skey}";
} elseif ($type == 'my') { //跳转我的
$my_url = http_host_com('home') . "/h5/market/sylive2/ucenter?skey={$skey}";
redirect($my_url);
}elseif($type=='item'){
$my_url = http_host_com('home')."/h5/market/sylive2/item/detail?skey={$skey}&click=1";
} elseif ($type == 'item') {
$my_url = http_host_com('home') . "/h5/market/sylive2/item/detail?skey={$skey}&click=1";
redirect($my_url);
}elseif ($type=='apt'){
$my_url = http_host_com('home')."/h5/market/sylive2/act?skey={$skey}&apt=1";
} elseif ($type == 'apt') {
$my_url = http_host_com('home') . "/h5/market/sylive2/act?skey={$skey}&apt=1";
redirect($my_url);
}else{
$user = $this->user_model->get(['userId'=>$this->uid],'unionid,nickname,headimg');
} else {
$user = $this->user_model->get(['userId' => $this->uid], 'unionid,nickname,headimg');
$userid = $user['unionid'] ? $user['unionid'] : $this->uid;
$ts = time()*1000;
$sign = md5($this->secretkey.$userid.$this->secretkey.$ts);
$ts = time() * 1000;
$sign = md5($this->secretkey . $userid . $this->secretkey . $ts);
$live_url = "https://live.haodian.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}";
redirect($live_url);
}
}
//进入直播间统计
public function golive(){
public function golive()
{
$params = $this->input->get();
$a_id = $params['a_id'];
$row = $this->market_sylive_activity_model->get(['activityId'=>$a_id]);
if($row && time()>strtotime($row['timeStart']) && time()<=strtotime($row['timeEnd'])){
$act_user = $this->act_user_model->get(['userId'=>$this->uid,'activityId'=>$a_id]);
$this->sylive2_entity->kpi_log(['a_id' => $a_id, 'uid' => $this->uid,'cf_uid' => $act_user['channelId'], 'kpi' => 'watch']);
$this->show_json([],200,'操作成功');
}else{
$this->show_json([],400,'参数错误');
$row = $this->market_sylive_activity_model->get(['activityId' => $a_id]);
if ($row && time() > strtotime($row['timeStart']) && time() <= strtotime($row['timeEnd'])) {
$act_user = $this->act_user_model->get(['userId' => $this->uid, 'activityId' => $a_id]);
$this->sylive2_entity->kpi_log(['a_id' => $a_id, 'uid' => $this->uid, 'cf_uid' => $act_user['channelId'], 'kpi' => 'watch']);
$this->show_json([], 200, '操作成功');
} else {
$this->show_json([], 400, '参数错误');
}
}
//获取验证码
public function get_code(){
public function get_code()
{
$mobile = $this->input->post('mobile');
if(!mobile_valid($mobile)){
$this->show_json('',400,'请输入正确的手机号码');
if (!mobile_valid($mobile)) {
$this->show_json('', 400, '请输入正确的手机号码');
}
$redis = &load_cache('redis');
$key = "sylive_appointment_code_".$mobile;
$key = "sylive_appointment_code_" . $mobile;
$code = $redis->get($key);
if(!$code){
if (!$code) {
$this->load->helper('string');
$code = random_string('numeric', 4);
$redis->save($key, $code, 60*5);
$redis->save($key, $code, 60 * 5);
}
$content = "【好店云】您的验证码为: {$code},五分钟之内有效,请勿泄露于他人,!";
b2m_send_sms($mobile,$content);
$this->show_json('',200, '验证码已发送');
b2m_send_sms($mobile, $content);
$this->show_json('', 200, '验证码已发送');
}
//预约
public function appointment(){
public function appointment()
{
$mobile = $this->input->post('mobile');
$code = $this->input->post('code');
$a_id = $this->input->post('a_id');
if(!$a_id){
$this->show_json('',400, '参数错误');
if (!$a_id) {
$this->show_json('', 400, '参数错误');
}
$redis = &load_cache('redis');
$key = "sylive_appointment_code_".$mobile;
$key = "sylive_appointment_code_" . $mobile;
$c_code = $redis->get($key);
if(!$code || $code!=$c_code){
$this->show_json('',400, '请输入正确的验证码');
if (!$code || $code != $c_code) {
$this->show_json('', 400, '请输入正确的验证码');
}
$row = $this->market_sylive_customer_model->get(['activityId'=>$this->a_id,'mobile'=>$mobile]);
if($row){
$row = $this->market_sylive_customer_model->get(['activityId' => $this->a_id, 'mobile' => $mobile]);
if ($row) {
$update = [
'ifAppointment' => 1
];
!$row['userId'] && $update['userId'] = $this->uid;
$this->market_sylive_customer_model->update($update,['customerId'=>$row['customerId']]);
}else{
$ac_row = $this->market_sylive_activity_model->get(['activityId'=>$a_id],'jsondata');
$jsondata = json_decode($ac_row['jsondata'],true);
$act_user_row = $this->act_user_model->get(['id'=>$this->act_uid]);
$p_user = $this->act_user_model->get(['userId'=>$act_user_row['channelId'],'activityId' => $a_id]);
$this->market_sylive_customer_model->update($update, ['customerId' => $row['customerId']]);
} else {
$ac_row = $this->market_sylive_activity_model->get(['activityId' => $a_id], 'jsondata');
$jsondata = json_decode($ac_row['jsondata'], true);
$act_user_row = $this->act_user_model->get(['id' => $this->act_uid]);
$p_user = $this->act_user_model->get(['userId' => $act_user_row['channelId'], 'activityId' => $a_id]);
$ukey = md5($a_id.$mobile);
$ukey = md5($a_id . $mobile);
$add_data = [
'activityId' => $a_id,
'userId' => $this->uid,
@@ -563,12 +584,12 @@ class Act extends Wx {
$p_user['levelId3'] && $add_data['levelId3'] = $p_user['levelId3'];
$add_data['cfUserId'] && $add_data['status'] = 1;
$this->market_sylive_customer_model->add($add_data);
if($jsondata['signBespeak']['status'] && $jsondata['signBespeak']['itemId']){ //绑定新增商品订单
if ($jsondata['signBespeak']['status'] && $jsondata['signBespeak']['itemId']) { //绑定新增商品订单
$itemId = $jsondata['signBespeak']['itemId'];
$item = $this->market_sylive_items_model->get(['itemId'=>$itemId]);
$item = $this->market_sylive_items_model->get(['itemId' => $itemId]);
$this->load->helper('order');
$unpay = [
'sid' => create_order_no('350200','market'),
'sid' => create_order_no('350200', 'market'),
'activityId' => $a_id,
'userId' => $this->uid,
'itemId' => $itemId,
@@ -587,9 +608,9 @@ class Act extends Wx {
$p_user['levelId3'] && $unpay['levelId3'] = $p_user['levelId3'];
$p_user['userId'] && $unpay['cfUserId'] = $p_user['userId'];
$order_id = $this->market_sylive_order_model->add($unpay);
if(is_numeric($order_id)){
if (is_numeric($order_id)) {
//添加kpi
$params = ['a_id' => $a_id, 'uid' => $this->uid,'cf_uid' => $act_user_row['channelId'], 'kpi' => 'beforeOrder'];
$params = ['a_id' => $a_id, 'uid' => $this->uid, 'cf_uid' => $act_user_row['channelId'], 'kpi' => 'beforeOrder'];
$order_id && $params['tagId'] = intval($order_id);
$params['itemId'] = $itemId;
$params['jsondata'] = [
@@ -617,17 +638,17 @@ class Act extends Wx {
// $syt->Tj($dlrCode,"活动客户",$mobile,$mediaCaName,$leadNo);
// }
if($a_id == 27){
if ($a_id == 27) {
//生产地址
$url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
//获取意向网点编码
if($p_user){
$user = $this->user_model->get(['userId'=>$act_user_row['channelId']]);
$biz = $this->market_sylive_organization_model->get(['organizationId'=>$user['bizId']]);
if ($p_user) {
$user = $this->user_model->get(['userId' => $act_user_row['channelId']]);
$biz = $this->market_sylive_organization_model->get(['organizationId' => $user['bizId']]);
}
if($biz['comments']){
if ($biz['comments']) {
$data[] = array(
'cusSource3' => '023410',
'customerName' => "活动客户",
@@ -661,11 +682,11 @@ class Act extends Wx {
$response = curl_exec($ch);
curl_close($ch);
debug_log("[info]# " . $data."\n".$response, 'neta.log','market/sylive');
debug_log("[info]# " . $data . "\n" . $response, 'neta.log', 'market/sylive');
}
}
}
$redis->delete($key);
$this->show_json(array('ukey' => $ukey),200, '预约成功');
$this->show_json(array('ukey' => $ukey), 200, '预约成功');
}
}
+86 -48
View File
@@ -45,24 +45,40 @@
</wx-open-launch-weapp>
</div>
</div>
<div v-else-if="item.type==3" @click="enroll">
<img class="imgsize-50X50" :src="item.icon" alt="#">
<div class="space-nowrap con-min60 font-22">{{item.title}}</div>
</div>
<div v-else-if="item.type==4" @click="goSubscribemsg()">
<img class="imgsize-50X50" :src="item.icon" alt="#">
<div class="space-nowrap con-min60 font-22">{{item.title}}</div>
</div>
</div>
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="goSubscribemsg()" v-if="info.a_id == 21 && info.live_status == 0">
<img class="imgsize-50X50" src="https://img.liche.cn/liche/market/202310/p_812aba80492024d60ca31c5049235182.png"
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="goSubscribemsg()"
v-if="info.a_id == 21 && info.live_status == 0">
<img class="imgsize-50X50"
src="https://img.liche.cn/liche/market/202310/p_812aba80492024d60ca31c5049235182.png"
alt="#">
<div class="space-nowrap con-min60 font-22">订阅直播</div>
</a>
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="showCode" v-if="info.a_id == 23 && info.live_status == 0">
<img class="imgsize-50X50" src="https://img.liche.cn/liche/market/202310/p_812aba80492024d60ca31c5049235182.png"
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="showCode"
v-if="info.a_id == 23 && info.live_status == 0">
<img class="imgsize-50X50"
src="https://img.liche.cn/liche/market/202310/p_812aba80492024d60ca31c5049235182.png"
alt="#">
<div class="space-nowrap con-min60 font-22">领取家电好物礼</div>
</a>
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="showCode" v-if="info.a_id == 25 && info.live_status == 0">
<img class="imgsize-50X50" src="https://img.liche.cn/liche/market/202310/p_812aba80492024d60ca31c5049235182.png"
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="showCode"
v-if="info.a_id == 25 && info.live_status == 0">
<img class="imgsize-50X50"
src="https://img.liche.cn/liche/market/202310/p_812aba80492024d60ca31c5049235182.png"
alt="#">
<div class="space-nowrap con-min60 font-22">预约试驾</div>
</a>
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="goSubscribemsg()" v-if="info.a_id == 28 && info.live_status == 0">
<img class="imgsize-50X50" src="https://img.liche.cn/liche/market/202403/p_73c97c1b5f171438fd7afb360b8b9c15.png"
<a class="fn-flex-item pl20 pr20" flexsize="0" href="javascript:;" @click="goSubscribemsg()"
v-if="info.a_id == 28 && info.live_status == 0">
<img class="imgsize-50X50"
src="https://img.liche.cn/liche/market/202403/p_73c97c1b5f171438fd7afb360b8b9c15.png"
alt="#">
<div class="space-nowrap con-min60 font-22">预约直播</div>
</a>
@@ -75,23 +91,28 @@
<template v-if="info.live_status<2">
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20"
v-if="info.live_status==1" href="javascript:;" @click="goLive">进入直播间</a>
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20" v-else-if="info.a_id == 21"
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20"
v-else-if="info.a_id == 21"
href="https://www.liche.cn/h5/market/sylive2/item/detail?skey=YV9pZD0yMSZpdGVtSWQ9Mjc">
{{info.btn_text}}
</a>
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20" v-else-if="info.a_id == 23"
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20"
v-else-if="info.a_id == 23"
href="https://www.liche.cn/h5/market/sylive2/item/detail?skey=YV9pZD0yMyZpdGVtSWQ9MzA">
立即支付99元权益金
</a>
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20" v-else-if="info.a_id == 25"
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20"
v-else-if="info.a_id == 25"
href="https://www.liche.cn/h5/market/sylive2/item/detail?skey=YV9pZD0yNSZpdGVtSWQ9MzM">
立即支付10元宠爱金
</a>
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20" v-else-if="info.a_id == 26"
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20"
v-else-if="info.a_id == 26"
href="https://www.liche.cn/h5/market/sylive2/item/detail?skey=YV9pZD0yNiZpdGVtSWQ9MzU">
支付9.9元瓜分百万红包
</a>
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20" v-else-if="info.a_id == 28"
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r20"
v-else-if="info.a_id == 28"
href="https://www.liche.cn/h5/market/sylive2/item/detail?skey=YV9pZD0yOCZpdGVtSWQ9Mzg">
99元下定赢免单
</a>
@@ -160,14 +181,15 @@
<div class="msgMain">
<div class="content">
<div class="word">
<div class="pt10 pb10 text-center font-36 color-000"> 百万现金马上分 </div>
<div class="pt10 pb10 text-center font-36 color-000">{{info.appoint_title}}</div>
<div class="mt20 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">
<div><input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="number"
v-model="vCode" placeholder="请输入验证码" oninput="if(value.length>4)value=value.slice(0,4)" maxlength="4"/></div>
v-model="vCode" placeholder="请输入验证码"
oninput="if(value.length>4)value=value.slice(0,4)" maxlength="4"/></div>
<a :class="[codeState ?'color-333':'color-999','absolute right-0 mr20 box-middle font-30']"
@click="getcode()">{{codeTx}}</a>
</div>
@@ -185,14 +207,16 @@
<div class="msg fn-hide" :style="msgisShowSuccess?'display:block':'display:none'" v-if="msgisShowSuccess">
<div class="msgBg" @click="msgisShowSuccess = false"></div>
<div class="msgMain">
<img class="absolute top-0 right-0 mt30 mr25 imgsize-32X32" @click="msgisShowSuccess = false" src="https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-colse.png" alt="关闭" />
<img class="absolute top-0 right-0 mt30 mr25 imgsize-32X32" @click="msgisShowSuccess = false"
src="https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-colse.png" alt="关闭"/>
<div class="content">
<div>
<div class="pt10 pb10 text-center font-28">{{succesTx.title}}</div>
<div class="inner30 text-break font-22 line-height-17 color-666" v-html="succesTx.content"></div>
</div>
<div class="opt pl20 pr20 text-center ">
<a class="inline-block relative wp80 bg-ff0000 pt20 pb20 text-center font-32 color-fff ulib-r750" href="javascript:">
<a class="inline-block relative wp80 bg-ff0000 pt20 pb20 text-center font-32 color-fff ulib-r750"
href="javascript:">
<i class="iconfont icon-tixing mr10"></i>
马上去抽奖
<div class="absolute top-0 left-0 right-0 bottom-0 overflowhidden z-index-1">
@@ -217,14 +241,16 @@
<div class="msg fn-hide" :style="subShowSuccess?'display:block':'display:none'" v-if="subShowSuccess">
<div class="msgBg" @click="subShowSuccess = false"></div>
<div class="msgMain">
<img class="absolute top-0 right-0 mt30 mr25 imgsize-32X32" @click="subShowSuccess = false" src="https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-colse.png" alt="关闭" />
<img class="absolute top-0 right-0 mt30 mr25 imgsize-32X32" @click="subShowSuccess = false"
src="https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-colse.png" alt="关闭"/>
<div class="content">
<div>
<div class="pt10 pb10 text-center font-36">{{succesTx.title}}</div>
<div class="inner30 text-break font-22 line-height-17 color-666" v-html="succesTx.content"></div>
</div>
<div class="opt pl20 pr20 text-center ">
<a class="inline-block relative wp80 bg-1a1a1a pt20 pb20 text-center font-32 color-fff ulib-r750" href="javascript:" @click="goSubscribemsg()">
<a class="inline-block relative wp80 bg-1a1a1a pt20 pb20 text-center font-32 color-fff ulib-r750"
href="javascript:" @click="goSubscribemsg()">
<i class="iconfont icon-tixing mr10"></i>开播提醒
</a>
</div>
@@ -255,8 +281,8 @@
msgisShowSuccess: false,//报名成功
succesTx: '',//报名成功提示
subShowSuccess:false,
ukeyPath:'',
subShowSuccess: false,
ukeyPath: '',
},
created() {
@@ -269,7 +295,7 @@
if (this.info.alert_code) {
mDialog.msg({content: '预约成功'});
}
if (this.info.apt){
if (this.info.apt) {
this.msgisShowReg = true
}
},
@@ -279,34 +305,42 @@
clearTimeout(this.noticeTime);
},
methods: {
showSub:function (){
showSub: function () {
// this.subShowSuccess = true
this.goSubscribemsg()
},
showCode: function () {
var that = this
if(that.info.appoint_mobile){
if(that.info.is_appoint){
//提交成功
that.msgisShowSuccess = true
that.ukeyPath = '/pages/lottery/index?encrypt=2711aed73199217a59b968b74883710e&weshop_key=k44f71a&liche_ukey='+ that.info.ukey
that.succesTx = {
title: that.info.appoint_title,
content:that.info.appoint_msg,
}
}else{
if(that.info.auth_url){
window.location.href = that.info.auth_url;
}else{
that.msgisShowReg = true
}
if (that.info.appoint_mobile) {
that.enroll()
} else {
if (that.info.pay_item_url) {
window.location.href = that.info.pay_item_url;
}
}
},
enroll: function () {
var that = this
if (that.info.is_appoint) {
//提交成功
that.msgisShowSuccess = true
that.ukeyPath = '/pages/lottery/index?encrypt=2711aed73199217a59b968b74883710e&weshop_key=k44f71a&liche_ukey=' + that.info.ukey
that.succesTx = {
title: that.info.appoint_title,
content: that.info.appoint_msg,
}
} else {
if (that.info.auth_url) {
window.location.href = that.info.auth_url;
} else {
that.msgisShowReg = true
}
}
},
closeCode: function () {
this.msgisShowCode = false
},
goSubscribemsg:function (){
goSubscribemsg: function () {
var that = this
if (that.info.subscribemsg == '已订阅直播') {
mDialog.msg({content: that.info.subscribemsg});
@@ -429,16 +463,16 @@
} else {
//按钮倒计时
var that = this;
$.post('/h5/market/sylive2/act/get_code',{'mobile':this.telPhone},function (response){
$.post('/h5/market/sylive2/act/get_code', {'mobile': this.telPhone}, function (response) {
mDialog.msg({
duration: 250,
pause: 2000,
content: response.msg
});
if(response.code==200){
if (response.code == 200) {
that.countDownTime(91)
}
},'json')
}, 'json')
}
},
@@ -461,18 +495,22 @@
} else {
this.isSubmiting = true
var that = this;
$.post('/h5/market/sylive2/act/appointment',{'mobile':this.telPhone,'code':this.vCode,'a_id': this.info.a_id},function (response){
$.post('/h5/market/sylive2/act/appointment', {
'mobile': this.telPhone,
'code': this.vCode,
'a_id': this.info.a_id
}, function (response) {
that.isSubmiting = false
if(response.code==200){
if (response.code == 200) {
that.info.is_appoint = 1
that.msgisShowReg = false
//提交成功
that.msgisShowSuccess = true
that.ukeyPath = '/pages/lottery/index?encrypt=2711aed73199217a59b968b74883710e&weshop_key=k44f71a&liche_ukey='+response.data.ukey
that.ukeyPath = '/pages/lottery/index?encrypt=2711aed73199217a59b968b74883710e&weshop_key=k44f71a&liche_ukey=' + response.data.ukey
that.succesTx = {
title: that.info.appoint_title,
content:that.info.appoint_msg,
content: that.info.appoint_msg,
}
// mDialog.msg({
@@ -483,14 +521,14 @@
// window.location.href = that.info.subscribemsg;
// }
// });
}else{
} else {
mDialog.msg({
duration: 250,
pause: 2000,
content: response.msg
})
}
},'json')
}, 'json')
}
},
+31 -27
View File
@@ -6,11 +6,14 @@
<div class="detail-banner relative p-swiper">
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide bg-size-cover" v-for="item in list" >
<div class="swiper-slide bg-size-cover" v-for="item in list">
<div class="relative">
<img class="wp100 block" style="pointer-events:none;" :src="item.img" />
<div class="absolute left-0 right-0 bottom-0 mb30 text-center font-24 color-fff">{{posterTip}}</div>
<img class="absolute right-0 bottom-0 mr40 mb80 imgsize-160X160" style="pointer-events:none;" :src="item.code" />
<img class="wp100 block" style="pointer-events:none;" :src="item.img"/>
<div class="absolute left-0 right-0 bottom-0 mb30 text-center font-24"
:style="'color:'+fillStyle">{{posterTip}}
</div>
<img class="absolute right-0 bottom-0 mr40 mb80 imgsize-160X160"
style="pointer-events:none;" :src="item.code"/>
</div>
</div>
</div>
@@ -45,10 +48,11 @@
<div style="display:none;">
<canvas id="canvas"></canvas>
</div>
<div v-if="posterSrc"><img class="wp100 ulib-r20" :src='posterSrc' alt="" /></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 imgsize-42X42 text-middle" src="https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-finger.png" alt="" />
<img class="inline-block imgsize-42X42 text-middle"
src="https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-finger.png" alt=""/>
<span class="ml10 text-middle">长按图片保存到手机发送给好友</span>
</div>
</div>
@@ -60,15 +64,15 @@
var app = new Vue({
el: '#app',
data: {
list:<?=json_encode($lists,JSON_UNESCAPED_UNICODE)?>,
list: <?=json_encode($lists, JSON_UNESCAPED_UNICODE)?>,
msgisShowPoster: false,
canW:750,
canH:0,
activeIndex:0,
posterSrc:'',
posterTip:'<?=$posterTip?>',
fillStyle:'<?=$fillStyle?>',
shareTx:<?=json_encode($shareTitle,JSON_UNESCAPED_UNICODE)?>,
canW: 750,
canH: 0,
activeIndex: 0,
posterSrc: '',
posterTip: '<?=$posterTip?>',
fillStyle: '<?=$fillStyle?>',
shareTx: <?=json_encode($shareTitle, JSON_UNESCAPED_UNICODE)?>,
},
mounted() {
//复制文字
@@ -96,18 +100,18 @@
prevEl: '.swiper-button-prev',
},
on: {
slideChangeTransitionEnd: function(){
slideChangeTransitionEnd: function () {
that.activeIndex = this.activeIndex
},
},
});
},
methods: {
showPoster: function() {
this.posterSrc= ''
showPoster: function () {
this.posterSrc = ''
this.draw()
},
closePoster: function() {
closePoster: function () {
this.msgisShowPoster = false
},
@@ -119,7 +123,7 @@
text: "生成中...",
offset: ["35%", "40%"],
});
that.canH = that.list[that.activeIndex].height/that.list[that.activeIndex].width*that.canW
that.canH = that.list[that.activeIndex].height / that.list[that.activeIndex].width * that.canW
$("#canvas").attr({
'width': that.canW,
'height': that.canH,
@@ -127,19 +131,19 @@
let canvas = document.getElementById('canvas');
let ctx = canvas.getContext("2d");
let imgBg = new Image();
imgBg.setAttribute("crossOrigin",'Anonymous')//如果二维码图片域名跨域,则保留此代码
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.setAttribute("crossOrigin", 'Anonymous')//如果二维码图片域名跨域,则保留此代码
codeimg.src = that.list[that.activeIndex].code
codeimg.onload = function () {
ctx.fillStyle=that.fillStyle;
ctx.textAlign="center";
ctx.font="24px Georgia";
ctx.fillText(that.posterTip,that.canW/2,that.canH-34,);
ctx.drawImage(codeimg,that.canW-200, that.canH-240, 160, 160)
ctx.fillStyle = that.fillStyle;
ctx.textAlign = "center";
ctx.font = "24px Georgia";
ctx.fillText(that.posterTip, that.canW / 2, that.canH - 34,);
ctx.drawImage(codeimg, that.canW - 200, that.canH - 240, 160, 160)
setTimeout(function () {
that.posterSrc = canvas.toDataURL("image/jpg")
that.msgisShowPoster = true;
@@ -152,5 +156,5 @@
},
})
</script>
<?=$this->load->view('h5/market/sylive/share_script')?>
<?= $this->load->view('h5/market/sylive/share_script') ?>
</body>
+2 -4
View File
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
@@ -66,7 +66,7 @@ class Activity extends BaseController
$coupon = ['img' => [], 'title' => '', 'rules' => '', 'price' => '', 'dateRange' => ''];
$draw = ['bgImg' => [], 'sms' => '', 'screenDisplay' => 1, 'winNum' => [], 'winType' => []];
$pay = ['way' => 1, 'price' => '', 'img' => []];
$signBespeak = ['status' => 0, 'title' => '', 'content' => '', 'itemId' => ''];
$signBespeak = ['status' => 0, 'title' => '', 'content' => '', 'itemId' => '', 'payItemId' => ''];
$barrage = ['color' => 0, 'title' => ''];
$button = ['title' => ''];
$v['shareTitle'] && $shareTitle = json_decode($v['shareTitle'], true);
@@ -269,7 +269,6 @@ class Activity extends BaseController
}
$jsondata['bottoms'] = $setBottoms;
$jsondata['blacklist'] = intval($this->input_param('blacklist'));
!$signBespeak['status'] && $signBespeak = ['status' => 0, 'title' => '', 'content' => '', 'itemId' => ''];
$jsondata['signBespeak'] = $signBespeak;
$jsondata['barrage'] = $this->input_param('barrage');
$jsondata['button'] = $this->input_param('button');
@@ -369,7 +368,6 @@ class Activity extends BaseController
$jsondata['banner'] = $banner;
$jsondata['serviceLink'] = $serviceLink;
$jsondata['blacklist'] = intval($this->input_param('blacklist'));
!$signBespeak['status'] && $signBespeak = ['status' => 0, 'title' => '', 'content' => '', 'itemId' => ''];
$jsondata['signBespeak'] = $signBespeak;
$jsondata['barrage'] = $this->input_param('barrage');
$jsondata['button'] = $this->input_param('button');
+10 -2
View File
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
@@ -90,10 +90,18 @@ class Goods extends BaseController
$activityId = intval($this->input_param('activityId'));
$type = $this->input_param('type');
$price = $this->input_param('price');
$price_type = $this->input_param('price_type');
$where['status>='] = 0;
$where['activityId'] = $activityId;
strlen($type) && $where['type'] = $type;
strlen($price) && $where['price'] = $price;
if ($price_type) {
switch ($price_type) {
case 'gt':
$where['price>'] = $price;
}
} else {
strlen($price) && $where['price'] = $price;
}
$list = $this->mdSyliveItems->select($where, 'sort asc,itemId desc', 0, 0, 'itemId,title');
$this->return_response_list($list);
}