This commit is contained in:
dengbw
2022-02-10 11:18:45 +08:00
parent 4337f7d72a
commit 3b1695262c
6 changed files with 93 additions and 37 deletions
+8 -4
View File
@@ -786,18 +786,22 @@ class Transfer extends HD_Controller
return $this->show_json(SYS_CODE_FAIL, '确认失败');
}
if ($opt_btn['type'] == 1) {
if (!$transport['start_mileage']['value']) {
$start_mileage_value = myTrim($transport['start_mileage']['value']);
if (!$start_mileage_value) {
return $this->show_json(SYS_CODE_FAIL, '请输入发车里程数');
}
$transport['start_mileage']['value'] = $start_mileage_value;
if (!$transport['start_mileage']['imgs']) {
return $this->show_json(SYS_CODE_FAIL, '请上传发车里程数照片');
return $this->show_json(SYS_CODE_FAIL, '请上传发车仪表盘里程数照片');
}
} else if ($opt_btn['type'] == 2) {
if (!$transport['end_mileage']['value']) {
$end_mileage_value = myTrim($transport['end_mileage']['value']);
if (!$end_mileage_value) {
return $this->show_json(SYS_CODE_FAIL, '请输入接车里程数');
}
$transport['end_mileage']['value'] = $end_mileage_value;
if (!$transport['end_mileage']['imgs']) {
return $this->show_json(SYS_CODE_FAIL, '请上传接车里程数照片');
return $this->show_json(SYS_CODE_FAIL, '请上传接车仪表盘里程数照片');
}
}
$tran_id = $opt_btn['tran_id'];
+2 -2
View File
@@ -94,7 +94,7 @@
data-field="img_rheight"
data-params-source="vue_obj.transport.start_mileage.imgs"
style="margin-left: 8px;">
<i class="am-icon-cloud-upload"></i> 上传发车里程数照片
<i class="am-icon-cloud-upload"></i> 上传发车仪表盘里程数照片
</button>
</td>
</tr>
@@ -130,7 +130,7 @@
data-field="img_rheight"
data-params-source="vue_obj.transport.end_mileage.imgs"
style="margin-left: 8px;">
<i class="am-icon-cloud-upload"></i> 上传接车里程数照片
<i class="am-icon-cloud-upload"></i> 上传接车仪表盘里程数照片
</button>
</td>
</tr>
+22 -19
View File
@@ -40,12 +40,12 @@ class Sytactivity extends Wxapp
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?v=220207';
$data['menus'] = array(array('title' => '报名', 'value' => $bm_count), array('title' => '到店', 'value' => $dd_count),
array('title' => '下定', 'value' => $xd_count));
// $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['menus'] = array(array('title' => '报名', 'value' => $bm_count), array('title' => '到店', 'value' => $dd_count),
// array('title' => '下定', 'value' => $xd_count));
return $data;
}
@@ -116,20 +116,20 @@ class Sytactivity extends Wxapp
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]);
}
$share_count = $this->mdSytActivityKpiData->count(['kpi' => 'share', 'a_id' => $id, 'biz_id' => $this->biz_id]);
$browse_count = $this->mdSytActivityKpiData->count(['kpi' => 'browse', 'a_id' => $id, 'biz_id' => $this->biz_id]);
$enroll_count = $this->mdSytActivityKpiData->count(['kpi' => 'enroll', 'a_id' => $id, 'biz_id' => $this->biz_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['ranking'] = ['title' => '当前门店排名', 'value' => $ranking, 'url' => '/pages/siyutong/activityRanking/index?id=' . $id];
$data['bg_color'] = $jsondata['bg_color'] ? $jsondata['bg_color'] : '#000e66';
$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]];
//生成分享连接
@@ -160,7 +160,7 @@ class Sytactivity extends Wxapp
throw new Hd_exception('参数错误!', API_CODE_INVILD_PARAM);
}
$lists = array();
$where = array('a_id' => $id, 'kpi<>' => 'share');
$where = array('a_id' => $id, 'biz_id' => $this->biz_id);
$total = $this->mdSytActivityKpiData->count($where);
if ($total) {
$res = $this->mdSytActivityKpiData->select($where, 'id DESC', $page, $size, 'uid,cf_uid,kpi,biz_id,c_time');
@@ -170,10 +170,13 @@ class Sytactivity extends Wxapp
$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']}进入活动页";
$content = '';
if ($value['kpi'] == 'browse') {
$content = "{$cf_uids[$value['cf_uid']][0]['uname']}新增浏览用户{$uids[$value['uid']][0]['nickname']}";
} else if ($value['kpi'] == 'share') {
$content = "{$cf_uids[$value['cf_uid']][0]['uname']}新增分享用户{$uids[$value['uid']][0]['nickname']}";
} else if ($value['kpi'] == 'enroll') {
$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');
+8 -6
View File
@@ -327,17 +327,18 @@ class Transfer extends Wxapp
$transport_json = $jsondata['transport'] ? $jsondata['transport'] : [];
if ($re_m['type'] == 1 || $re_m['type'] == 2) {//确认提车
$start_mileage = $this->input_param('start_mileage');
if (!$start_mileage['value']) {
$start_mileage_value = myTrim($start_mileage['value']);
if (!$start_mileage_value) {
throw new Exception('请输入发车里程数', ERR_PARAMS_ERROR);
}
if (!$start_mileage['imgs']) {
throw new Exception('请上传发车里程数照片', ERR_PARAMS_ERROR);
throw new Exception('请上传发车仪表盘里程数照片', ERR_PARAMS_ERROR);
}
$start_mileage_imgs = '';
foreach ($start_mileage['imgs'] as $key => $value) {
$start_mileage_imgs[] = $value['value'];
}
$transport_json['start_mileage'] = ['value' => $start_mileage['value'], 'imgs' => $start_mileage_imgs];
$transport_json['start_mileage'] = ['value' => $start_mileage_value, 'imgs' => $start_mileage_imgs];
$ret = $this->mdTransferRemind->update(['status' => 2], ['tran_id' => $tran_id, 'type in(1,2)' => null]);//门店已完成
if ($ret) {
$this->mdTransferAdmin->update(['status' => 2], ['tran_id' => $tran_id, 'type in(1,2)' => null]);//信息员已完成
@@ -363,17 +364,18 @@ class Transfer extends Wxapp
}
} else {//确认接车
$end_mileage = $this->input_param('end_mileage');
if (!$end_mileage['value']) {
$end_mileage_value = myTrim($end_mileage['value']);
if (!$end_mileage_value) {
throw new Exception('请输入接车里程数', ERR_PARAMS_ERROR);
}
if (!$end_mileage['imgs']) {
throw new Exception('请上传接车里程数照片', ERR_PARAMS_ERROR);
throw new Exception('请上传接车仪表盘里程数照片', ERR_PARAMS_ERROR);
}
$end_mileage_imgs = '';
foreach ($end_mileage['imgs'] as $key => $value) {
$end_mileage_imgs[] = $value['value'];
}
$transport_json['end_mileage'] = ['value' => $end_mileage['value'], 'imgs' => $end_mileage_imgs];
$transport_json['end_mileage'] = ['value' => $end_mileage_value, 'imgs' => $end_mileage_imgs];
$biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']);
if ($this->session['group_id'] == 4) {//渠道操作时调用数据库的 biz_id
$biz_id = $re_m['biz_id'];
+19
View File
@@ -1119,3 +1119,22 @@ if (!function_exists('getMonth')) {
return [$firstday, $seconday, $lastday];
}
}
if (!function_exists('myTrim')) {
/**
* Notes:过滤所有的空白字符(空格、全角空格、换行等)
* Created on: 2022/2/10 10:43
* Created by: dengbw
* @param $str
* @return string|string[]
*/
function myTrim($str)
{
if ($str) {
$search = array(" ", " ", "\n", "\r", "\t");
$replace = array("", "", "", "", "");
$str = str_replace($search, $replace, $str);
}
return $str;
}
}
+34 -6
View File
@@ -7,9 +7,11 @@
class Polyv
{
protected $user_id = "2a3b848cd4";
protected $app_id = "g45uep0s6v";
protected $app_secret = "447d5ce803d84f599794a3274177f796";
protected $url = "http://api.polyv.net/live";
protected $user_id = "549cf353c6";//2a3b848cd4
protected $app_id = "fr0myucldj";//g45uep0s6v
protected $app_secret = "4919b95df21e4afd80fe14ae8a722b1c";//447d5ce803d84f599794a3274177f796
protected $channel_id = "2005999";//2797712
protected $timestamp;//时间戳
public function __construct($param = [])
@@ -17,9 +19,35 @@ class Polyv
if ($param['app_id'] != '') $this->app_id = $param['app_id'];
if ($param['app_secret'] != '') $this->app_secret = $param['app_secret'];
if ($param['user_id'] != '') $this->user_id = $param['user_id'];
if ($param['channel_id'] != '') $this->channel_id = $param['channel_id'];
$this->timestamp = time() * 1000;
}
/**
* Notes:查询频道多场次概览统计数据
* https://help.polyv.net/index.html#/live/api/channel/viewdata/get_session_stats
* Created on: 2022/2/9 16:40
* Created by: dengbw
* @param array $params ['sessionIds' => 'g6uy09qeuq', 'startTime' => '1644310918000', 'endTime' => '1644318322000']
* @return bool|string
*/
function getSessionStats($params = [])
{
$params_sign = array(
'appId' => $this->app_id,
'timestamp' => $this->timestamp,
'userId' => $this->user_id,
'channelId' => $params['channelId'] ? $params['channelId'] : $this->channel_id,
);
$params['sessionIds'] && $params_sign['sessionIds'] = $params['sessionIds'];
$params['startTime'] && $params_sign['startTime'] = $params['startTime'];
$params['endTime'] && $params_sign['endTime'] = $params['endTime'];
$sign = $this->getSign($params_sign);
$parts = http_build_query($params_sign);
$url = $this->url . "/v3/channel/statistics/get-session-stats?{$parts}&sign={$sign}";
return $this->curlGet($url);
}
/**
* Notes:查询频道某段时间的直播观看详情数据
* https://help.polyv.net/index.html#/live/api/channel/viewdata/summary
@@ -38,7 +66,7 @@ class Polyv
);
$sign = $this->getSign($params_sign);
$parts = http_build_query($params_sign);
$url = "http://api.polyv.net/live/v2/statistics/{$params['channelId']}/summary?{$parts}&sign={$sign}";
$url = $this->url . "/v2/statistics/{$params['channelId']}/summary?{$parts}&sign={$sign}";
return $this->curlGet($url);
}
@@ -61,7 +89,7 @@ class Polyv
);
$sign = $this->getSign($params_sign);
$parts = http_build_query($params_sign);
$url = "http://api.polyv.net/live/v1/statistics/{$params['channelId']}/viewlog?{$parts}&sign={$sign}";
$url = $this->url . "/v1/statistics/{$params['channelId']}/viewlog?{$parts}&sign={$sign}";
return $this->curlGet($url);
}
@@ -74,7 +102,7 @@ class Polyv
function channels()
{
$sign = $this->getSign();
$url = "http://api.polyv.net/live/v1/users/" . $this->user_id . "/channels?appId=" . $this->app_id . "&timestamp=" . $this->timestamp . "&sign=" . $sign;
$url = $this->url . "/v1/users/" . $this->user_id . "/channels?appId=" . $this->app_id . "&timestamp=" . $this->timestamp . "&sign=" . $sign;
return $this->curlGet($url);
}