edit-sylive-under_order
This commit is contained in:
@@ -201,7 +201,7 @@ class Sylive_entity{
|
||||
];
|
||||
$area_id && $addData['area_id'] = $area_id;
|
||||
$biz_id && $addData['biz_id'] = $biz_id;
|
||||
$jsondata = array();
|
||||
$jsondata = $params['jsondata'] ? $params['jsondata'] : [];
|
||||
$jsondata && $addData['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
$id = $this->ci->mdSytActivityKpiData->add($addData);
|
||||
if (!$id) {
|
||||
|
||||
@@ -328,6 +328,8 @@ class Act extends Wx {
|
||||
|
||||
//支付
|
||||
public function post_pay(){
|
||||
$redis = load_cache('redis');
|
||||
$redis_obj = $redis->redis();
|
||||
$skey = $this->input->post('skey');
|
||||
$name = $this->input->post('name');
|
||||
$mobile = $this->input->post('telPhone');
|
||||
@@ -337,6 +339,7 @@ class Act extends Wx {
|
||||
if(!$row){
|
||||
$this->show_json('',400,'参数错误');
|
||||
}
|
||||
$mb_key = 'SYLIVE_ITEM_AID_'.$a_id;
|
||||
if(!mobile_valid($mobile)){
|
||||
$this->show_json('',400,'请输入正确手机号');
|
||||
}
|
||||
@@ -351,37 +354,56 @@ class Act extends Wx {
|
||||
if($pay_price<=0){
|
||||
$this->show_json('',400,'无需支付');
|
||||
}
|
||||
if($row['stock']<=0){
|
||||
$this->show_json('',400,'已售罄');
|
||||
}
|
||||
$unpay = $this->market_sylive_order_model->get(['item_id'=>$a_id,'status'=>0,'uid'=>$this->uid,'expire_time>'=>time()]);
|
||||
if(!$unpay){
|
||||
$this->market_sylive_order_model->db->trans_begin();
|
||||
$this->load->helper('order');
|
||||
$unpay = [
|
||||
'sid' => create_order_no('350200','market'),
|
||||
'uid' => $this->uid,
|
||||
'item_id' => $a_id,
|
||||
'item_title' => $item['title'],
|
||||
'total_price' => $pay_price,
|
||||
'expire_time' => time()+30*60,//订单过期时间
|
||||
'createTime' => date('Y-m-d H:i:s')
|
||||
];
|
||||
$name && $unpay['uname'] = $name;
|
||||
$mobile && $unpay['mobile'] = $mobile;
|
||||
$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']]);
|
||||
$p_user['teamId'] && $unpay['cfrom'] = 1;
|
||||
$oid = $this->market_sylive_order_model->add($unpay);
|
||||
if(!is_numeric($oid)){
|
||||
$this->market_sylive_order_model->db->trans_rollback();
|
||||
$this->show_json('',400,'创建订单失败');
|
||||
$mb_count = $redis_obj->sCard($mb_key); //获取集合中用户数量
|
||||
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->market_sylive_activity_model->update(['stock = stock-1' =>null],['activityId'=>$a_id]);
|
||||
$res = $this->market_sylive_activity_model->db->affected_rows();
|
||||
if(!$res){
|
||||
try {
|
||||
$this->market_sylive_order_model->db->trans_begin();
|
||||
//限购一件
|
||||
$u_row = $this->market_sylive_order_model->get(['item_id'=>$a_id,'status>='=>0,'uid'=>$this->uid]);
|
||||
if($u_row){
|
||||
throw new Exception('限购一件');
|
||||
}
|
||||
$this->load->helper('order');
|
||||
$unpay = [
|
||||
'sid' => create_order_no('350200','market'),
|
||||
'uid' => $this->uid,
|
||||
'item_id' => $a_id,
|
||||
'item_title' => $item['title'],
|
||||
'total_price' => $pay_price,
|
||||
'expire_time' => time()+5*60,//订单过期时间
|
||||
'createTime' => date('Y-m-d H:i:s')
|
||||
];
|
||||
$name && $unpay['uname'] = $name;
|
||||
$mobile && $unpay['mobile'] = $mobile;
|
||||
$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']]);
|
||||
$p_user['teamId'] && $unpay['cfrom'] = 1;
|
||||
$oid = $this->market_sylive_order_model->add($unpay);
|
||||
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]);
|
||||
$res = $this->market_sylive_activity_model->db->affected_rows();
|
||||
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); //删除集合
|
||||
$this->market_sylive_order_model->db->trans_rollback();
|
||||
$this->show_json('',400,'已售罄');
|
||||
$this->show_json('',400,$e->getMessage());
|
||||
}
|
||||
$this->market_sylive_order_model->db->trans_commit();
|
||||
}
|
||||
$user = $this->user_model->get(['userId'=>$this->uid]);
|
||||
$notify_url = http_host_com('home').'/h5/market/sylive/notify';
|
||||
|
||||
@@ -55,7 +55,14 @@ class Notify extends CI_Controller {
|
||||
$res = $this->order_model->update(['status'=>1,'pay_time'=>date('Y-m-d H:i:s')],['id'=>$order['id']]);
|
||||
if($res){
|
||||
$act_user = $this->act_user_model->get(['userId'=>$order['uid'],'activityId'=>$order['item_id']]);
|
||||
$sy_res = $this->sylive_entity->kpi_log(['a_id' => $order['item_id'], 'uid' => $order['uid'],'cf_uid' => $act_user['channelId'], 'kpi' => 'order']);
|
||||
$params = [
|
||||
'a_id' => $order['item_id'],
|
||||
'uid' => $order['uid'],
|
||||
'cf_uid' => $act_user['channelId'],
|
||||
'kpi' => 'order',
|
||||
'jsondata'=> ['order_id'=>$order['id'],'sid'=>$sid]
|
||||
];
|
||||
$sy_res = $this->sylive_entity->kpi_log($params);
|
||||
debug_log("[info] ". __FUNCTION__ . ":私域通增加记录-".json_encode($sy_res,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
|
||||
debug_log("[success] ". __FUNCTION__ . ":操作成功", $this->log_file,$this->log_dir);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class Stic extends Admin{
|
||||
$this->load->model('market/market_sylive_activity_model');
|
||||
$this->load->model('market/market_sylive_activity_biz_model','mdSytActivityBiz');
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
|
||||
$this->load->model('market/market_sylive_order_model');
|
||||
$this->load->model('live/Live_polyv_session_model', 'mdPolyvSession');
|
||||
$this->load->library('market/sylive_entity');
|
||||
$this->group_id = $this->sylive_entity->get_level($this->session['org_id']);
|
||||
@@ -108,8 +108,8 @@ class Stic extends Admin{
|
||||
$where['kpi'] = 'subscribe';
|
||||
$all_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据
|
||||
$all = [
|
||||
['title' => '访问用户', 'num' => "{$all_browse_count}人",'url'=>"/h5/market/sylive/stic/users?type=all&kpi=browse&a_id={$a_id}"],
|
||||
['title' => '预约用户', 'num' => "{$all_subscribe_count}人",'url'=>"/h5/market/sylive/stic/users?type=all&kpi=subscribe&a_id={$a_id}"],
|
||||
['title' => '访问用户', 'num' => "{$all_browse_count}人",'url'=>""],
|
||||
['title' => '预约用户', 'num' => "{$all_subscribe_count}人",'url'=>""],
|
||||
['title' => '预约率', 'num' => $all_browse_count ? round($all_subscribe_count/$all_browse_count*100,2)."%" : 0],
|
||||
];
|
||||
}else{
|
||||
@@ -126,8 +126,8 @@ class Stic extends Admin{
|
||||
$where['kpi'] = 'subscribe';
|
||||
$a_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据
|
||||
$area = [
|
||||
['title' => '访问用户', 'num' => "{$a_browse_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=browse&a_id={$a_id}"],
|
||||
['title' => '预约用户', 'num' => "{$a_subscribe_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=subscribe&a_id={$a_id}"],
|
||||
['title' => '访问用户', 'num' => "{$a_browse_count}人",'url'=>""],
|
||||
['title' => '预约用户', 'num' => "{$a_subscribe_count}人",'url'=>""],
|
||||
['title' => '预约率', 'num' => $a_browse_count ? round($a_subscribe_count/$a_browse_count*100,2)."%" : 0],
|
||||
];
|
||||
}
|
||||
@@ -230,8 +230,8 @@ class Stic extends Admin{
|
||||
$where['kpi'] = 'order';
|
||||
$all_order_count = $this->mdSytActivityKpiData->count($where); //下单数据
|
||||
$all = [
|
||||
['title' => '观看用户', 'num' => "{$all_view_count}人",'url'=>'/h5/market/sylive/stic/users?type=all&kpi=watch&a_id='.$a_id],
|
||||
['title' => '下单用户', 'num' => "{$all_order_count}人",'url'=>'/h5/market/sylive/stic/users?type=all&kpi=order&a_id='.$a_id],
|
||||
['title' => '观看用户', 'num' => "{$all_view_count}人",'url'=>''],
|
||||
['title' => '下单用户', 'num' => "{$all_order_count}人",'url'=>''],
|
||||
['title' => '转化率', 'num' => $all_view_count ? round($all_order_count/$all_view_count*100,2)."%" : 0],
|
||||
];
|
||||
}else{
|
||||
@@ -248,8 +248,8 @@ class Stic extends Admin{
|
||||
$where['kpi'] = 'order';
|
||||
$a_order_count = $this->mdSytActivityKpiData->count($where); //下单数据
|
||||
$area = [
|
||||
['title' => '观看用户', 'num' => "{$a_view_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=watch&a_id={$a_id}"],
|
||||
['title' => '下单用户', 'num' => "{$a_order_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=order&a_id={$a_id}"],
|
||||
['title' => '观看用户', 'num' => "{$a_view_count}人",'url'=>""],
|
||||
['title' => '下单用户', 'num' => "{$a_order_count}人",'url'=>""],
|
||||
['title' => '转化率', 'num' => $a_view_count ? round($a_order_count/$a_view_count*100,2)."%" : 0],
|
||||
];
|
||||
}
|
||||
@@ -471,7 +471,7 @@ class Stic extends Admin{
|
||||
$tab = [
|
||||
['id'=>1,'title'=>'客户列表']
|
||||
];
|
||||
if($this->group_id==2){ //店长
|
||||
if($this->group_id==2 || ($params['type']=='biz'&&$params['type_id'])){ //店长
|
||||
$tab[] = ['id'=>2,'title'=>'顾问数据'];
|
||||
}
|
||||
$this->data['title'] = $title;
|
||||
@@ -507,7 +507,7 @@ class Stic extends Admin{
|
||||
$total = $this->mdSytActivityKpiData->count($where);
|
||||
$lists = [];
|
||||
if($total){
|
||||
$rows = $this->mdSytActivityKpiData->select($where,'id desc',$page,20,'uid,cf_uid,c_time');
|
||||
$rows = $this->mdSytActivityKpiData->select($where,'id desc',$page,20,'uid,cf_uid,c_time,jsondata');
|
||||
$uids_arr = array_column($rows,'uid');
|
||||
if($this->group_id==2){
|
||||
$gw_uids_arr = array_column($rows,'cf_uid');
|
||||
@@ -522,18 +522,28 @@ class Stic extends Admin{
|
||||
$users = $this->user_model->map('userId','',$where,'','','','userId,uname,nickname,headimg');
|
||||
}
|
||||
foreach ($rows as $key => $item) {
|
||||
$jsondata = json_decode($item['jsondata'],true);
|
||||
$user = $users[$item['uid']] ? $users[$item['uid']][0] : [];
|
||||
$nickname = $user['nickname'] ? $user['nickname'] : '用户'.$user['userId'];
|
||||
$headimg = $user['headimg'] ? $user['headimg'] : 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q3auHgzwzM483tlYWFg5RWQ1Xat94ib82prnDSicm2GHuxI49swU08N2I1aHb7B1gmicyxXF8R1BsVWahU9SiaPEzA/132';
|
||||
$cf_uname = '';
|
||||
if($this->group_id==2){ //店长
|
||||
$cf_user = $users[$item['cf_uid']] ? $users[$item['cf_uid']][0] : [];
|
||||
$cf_uname = $cf_user['uname'] ? "({$cf_user['uname']})" : "";
|
||||
$cf_uname = $cf_user['uname'] ? $cf_user['uname'] : "";
|
||||
}
|
||||
$mobile = $name = '';
|
||||
if($params['kpi']=='order' && $jsondata['order_id']){
|
||||
$order = $this->market_sylive_order_model->get(['id'=>$jsondata['order_id']],'uname,mobile');
|
||||
$name = $order['uname'] ? $order['uname'] : '';
|
||||
$mobile = $order['mobile'] ? $order['mobile'] : '';
|
||||
}
|
||||
$lists[] = [
|
||||
'nickname' => $nickname,
|
||||
'name' => $name,
|
||||
'mobile' => $mobile,
|
||||
'headimg' => $headimg,
|
||||
'time' => $cf_uname.friendly_date($item['c_time'],'normal',1)
|
||||
'cf_uname' => $cf_uname,
|
||||
'time' => friendly_date($item['c_time'],'normal',1)
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -546,7 +556,12 @@ class Stic extends Admin{
|
||||
|
||||
public function gw_lists(){
|
||||
$params = $this->input->get();
|
||||
$res = $this->sylive_entity->top_biz_user($params['a_id'],$this->session['org_id'],$this->uid,$params['kpi']);
|
||||
if($params['type']=='biz'&&$params['type_id']){
|
||||
$biz_id = $params['type_id'];
|
||||
}else{
|
||||
$biz_id = $this->session['org_id'];
|
||||
}
|
||||
$res = $this->sylive_entity->top_biz_user($params['a_id'],$biz_id,$this->uid,$params['kpi']);
|
||||
$lists = [];
|
||||
if($res['lists']){
|
||||
foreach ($res['lists'] as $item) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<a class="block bg-1a1a1a pt20 pb20 text-center font-36 color-fff ulib-r10" v-else href="javascript:;" @click="showCode">点击这里预约直播</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a class="block bg-999 pt20 pb20 text-center font-36 color-fff ulib-r10" href="<?=$info['live_url']?>">查看回放</a>
|
||||
<a class="block bg-999 pt20 pb20 text-center font-36 color-fff ulib-r10" href="javascript:;">活动已结束</a>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -173,6 +173,9 @@
|
||||
content: "请输入正确手机号"
|
||||
});
|
||||
}else{
|
||||
if(that.isSubmit){
|
||||
return ''
|
||||
}
|
||||
that.isSubmiting = true
|
||||
$.post('/h5/market/sylive/act/post_pay',{'skey':'<?=$info['skey']?>','name':that.name,'telPhone':that.telPhone},function (res){
|
||||
that.isSubmiting = false
|
||||
|
||||
@@ -21,13 +21,31 @@
|
||||
<template v-else>
|
||||
<div class="pt10 pb20 text-center"><b class="font-40 text-italic" v-html="title"></b></div>
|
||||
</template>
|
||||
<div class="pt30 pb20 fn-flex font-28 color-666" v-for="(item,index) in list">
|
||||
<div class="fn-flex-item text-nowrap" flexsize="3">
|
||||
<img class="imgsize-32X32 text-middle ulib-r750 bds-1-eee" :src="item.headimg" alt="#" />
|
||||
<span class="text-middle">{{item.nickname}}</span>
|
||||
<?if($params['kpi']=='order'){?>
|
||||
<div v-for="(item,index) in list">
|
||||
<div class="pt30 pb20 fn-flex font-28 color-666" >
|
||||
<div class="fn-flex-item text-nowrap" flexsize="3">
|
||||
<img class="imgsize-32X32 text-middle ulib-r750 bds-1-eee" :src="item.headimg" alt="#" />
|
||||
<span class="text-middle">{{item.nickname}}</span>
|
||||
</div>
|
||||
<div class="fn-flex-item text-right" flexsize="5">{{item.cf_uname}}</div>
|
||||
</div>
|
||||
<div class="pb20 fn-flex font-28 color-666" >
|
||||
<div class="fn-flex-item text-nowrap" flexsize="5">
|
||||
{{item.name}} {{item.mobile}}
|
||||
</div>
|
||||
<div class="fn-flex-item text-right" flexsize="3">{{item.time}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fn-flex-item text-right" flexsize="5">{{item.time}}</div>
|
||||
</div>
|
||||
<?}else{?>
|
||||
<div class="pt30 pb20 fn-flex font-28 color-666" v-for="(item,index) in list">
|
||||
<div class="fn-flex-item text-nowrap" flexsize="3">
|
||||
<img class="imgsize-32X32 text-middle ulib-r750 bds-1-eee" :src="item.headimg" alt="#" />
|
||||
<span class="text-middle">{{item.nickname}}</span>
|
||||
</div>
|
||||
<div class="fn-flex-item text-right" flexsize="5">{{item.cf_uname}} {{item.time}}</div>
|
||||
</div>
|
||||
<?}?>
|
||||
<mugen-scroll :handler="fetchData" :should-handle="!loading" scroll-container="app">
|
||||
<div class="pt100 pb100 text-center color-ccc" v-if="isNoData"></i><span class="text-middle font-22">暂无数据</span></div>
|
||||
<div class="pt20 pb20 text-center color-ccc" v-else-if="loading"><i class="iconfont icon-jiazai text-middle"></i><span class="text-middle font-22">请稍等...</span></div>
|
||||
|
||||
Reference in New Issue
Block a user