diff --git a/admin/controllers/items/Transfer.php b/admin/controllers/items/Transfer.php index 9f50185c..c00448d6 100644 --- a/admin/controllers/items/Transfer.php +++ b/admin/controllers/items/Transfer.php @@ -299,12 +299,27 @@ class Transfer extends HD_Controller if ($jsondata['transport']) { $transport = $jsondata['transport']; $imgs = []; + $start_mileage = $end_mileage = ['value' => '', 'imgs' => []]; if ($transport['imgs']) { foreach ($transport['imgs'] as $key => $value) { $value && $imgs[] = ['src' => build_qiniu_image_url($value), 'value' => $value]; } } + if ($transport['start_mileage']) {//发车里程数 + $start_mileage = $transport['start_mileage']; + foreach ($start_mileage['imgs'] as $key => $value) { + $value && $start_mileage['imgs'][$key] = ['src' => build_qiniu_image_url($value), 'value' => $value]; + } + } + if ($transport['end_mileage']) {//接车里程数 + $end_mileage = $transport['end_mileage']; + foreach ($end_mileage['imgs'] as $key => $value) { + $value && $end_mileage['imgs'][$key] = ['src' => build_qiniu_image_url($value), 'value' => $value]; + } + } $transport['imgs'] = $imgs; + $transport['start_mileage'] = $start_mileage; + $transport['end_mileage'] = $end_mileage; } if ($re['arti_id']) { $res_a = $this->mdArticle->select(["id in ({$re['arti_id']})" => null], 'id desc', 0, 0, 'title'); @@ -770,6 +785,21 @@ class Transfer extends HD_Controller if (!$opt_btn['type']) { return $this->show_json(SYS_CODE_FAIL, '确认失败'); } + if ($opt_btn['type'] == 1) { + if (!$transport['start_mileage']['value']) { + return $this->show_json(SYS_CODE_FAIL, '请输入发车里程数'); + } + if (!$transport['start_mileage']['imgs']) { + return $this->show_json(SYS_CODE_FAIL, '请上传发车里程数照片'); + } + } else if ($opt_btn['type'] == 2) { + if (!$transport['end_mileage']['value']) { + return $this->show_json(SYS_CODE_FAIL, '请输入接车里程数'); + } + if (!$transport['end_mileage']['imgs']) { + return $this->show_json(SYS_CODE_FAIL, '请上传接车里程数照片'); + } + } $tran_id = $opt_btn['tran_id']; $re_tr = $this->mdTransfer->get(['id' => $tran_id]); $item_id = intval($re_tr['item_id']); @@ -779,7 +809,7 @@ class Transfer extends HD_Controller //更新异常 $jsondata = $re_tr['jsondata'] ? json_decode($re_tr['jsondata'], true) : []; $jsondata['abnormal']['note'] = $abnormal['note'] ? $abnormal['note'] : ''; - $abnor_imgs = ''; + $abnor_imgs = ''; if ($abnormal['imgs']) { foreach ($abnormal['imgs'] as $key => $value) { $abnor_imgs[] = $value['value']; @@ -799,6 +829,20 @@ class Transfer extends HD_Controller } $transport_json = $jsondata['transport'] ? $jsondata['transport'] : []; $transport_json['imgs'] = $tran_imgs; + if ($opt_btn['type'] == 1) {//发车里程数 + $start_mileage_imgs = ''; + foreach ($transport['start_mileage']['imgs'] as $key => $value) { + $start_mileage_imgs[] = $value['value']; + } + $transport_json['start_mileage'] = ['value' => $transport['start_mileage']['value'], 'imgs' => $start_mileage_imgs]; + } + if ($opt_btn['type'] == 2) {//接车里程数 + $end_mileage_imgs = ''; + foreach ($transport['end_mileage']['imgs'] as $key => $value) { + $end_mileage_imgs[] = $value['value']; + } + $transport_json['end_mileage'] = ['value' => $transport['end_mileage']['value'], 'imgs' => $end_mileage_imgs]; + } $jsondata['transport'] = $transport_json; $this->mdTransfer->update(['abnormal' => $set_abnormal, 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)], ['id' => $tran_id]); $ret = ''; diff --git a/admin/views/items/transfer/get.php b/admin/views/items/transfer/get.php index 5f131318..9215effb 100644 --- a/admin/views/items/transfer/get.php +++ b/admin/views/items/transfer/get.php @@ -63,7 +63,8 @@ 上传运输单号 -
+
+
+ + + + + + + +
发车里程数:{{transport.start_mileage.value}}km + +
+
+
+
+
+ + + +
+
+
+
+ + + + + + + +
接车里程数:{{transport.start_mileage.value}}km + +
+
+
+
+
+ + + + +
+
+
diff --git a/api/controllers/wxapp/licheb/Sytactivity.php b/api/controllers/wxapp/licheb/Sytactivity.php index 9ec269f6..c92ddf6d 100644 --- a/api/controllers/wxapp/licheb/Sytactivity.php +++ b/api/controllers/wxapp/licheb/Sytactivity.php @@ -43,7 +43,7 @@ class Sytactivity extends Wxapp $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['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)); return $data; diff --git a/api/controllers/wxapp/licheb/Transfer.php b/api/controllers/wxapp/licheb/Transfer.php index 3c30a827..c6ca600a 100644 --- a/api/controllers/wxapp/licheb/Transfer.php +++ b/api/controllers/wxapp/licheb/Transfer.php @@ -191,23 +191,45 @@ class Transfer extends Wxapp if ($re_m['type'] == 1 || $re_m['type'] == 2) { $btn[] = ['title' => '确认发车', 'id' => $id, 'type' => 2]; } else { - $btn[] = ['title' => '确认接车', 'id' => $id, 'type' => 2]; + $btn[] = ['title' => '确认接车', 'id' => $id, 'type' => 3]; } } } + //$tran_id = 56; $re = $this->mdTransfer->get(['id' => $tran_id]); if (!$re) { throw new Exception('车辆调拨不存在', ERR_PARAMS_ERROR); } $jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : []; $transport_imgs = []; - if ($jsondata['transport']['imgs']) {//运输单 - foreach ($jsondata['transport']['imgs'] as $key => $value) { - $value && $transport_imgs[] = ['value' => $value, 'src' => build_qiniu_image_url($value)]; + $start_mileage = $end_mileage = ''; + if ($jsondata['transport']) { + $transport = $jsondata['transport']; + if ($transport['imgs']) {//运输单 + foreach ($jsondata['transport']['imgs'] as $key => $value) { + $value && $transport_imgs[] = ['value' => $value, 'src' => build_qiniu_image_url($value)]; + } + } + if ($transport['start_mileage']) {//发车里程数 + $start_mileage = $transport['start_mileage']; + $start_mileage['title'] = '发车里程数'; + $start_mileage['tag'] = 'km'; + foreach ($start_mileage['imgs'] as $key => $value) { + $value && $start_mileage['imgs'][$key] = ['src' => build_qiniu_image_url($value), 'value' => $value]; + } + } + if ($transport['end_mileage']) {//接车里程数 + $end_mileage = $transport['end_mileage']; + $end_mileage['title'] = '接车里程数'; + $end_mileage['tag'] = 'km'; + foreach ($end_mileage['imgs'] as $key => $value) { + $value && $end_mileage['imgs'][$key] = ['src' => build_qiniu_image_url($value), 'value' => $value]; + } } } $data['transport'] = ['title' => '运输负责人', 'name' => $jsondata['transport']['name'] - , 'mobile' => $jsondata['transport']['mobile'], 'cardid' => $jsondata['transport']['cardid'], 'imgs' => $transport_imgs]; + , 'mobile' => $jsondata['transport']['mobile'], 'cardid' => $jsondata['transport']['cardid'], 'imgs' => $transport_imgs + , 'start_mileage' => $start_mileage, 'end_mileage' => $end_mileage]; $this->db->from('lc_items_transfer_remind'); $this->db->join('lc_app_licheb_users', "lc_app_licheb_users.id = lc_items_transfer_remind.uid", 'left'); $this->db->select('lc_items_transfer_remind.type,lc_app_licheb_users.uname'); @@ -296,7 +318,26 @@ class Transfer extends Wxapp throw new Exception('无操作权限', ERR_PARAMS_ERROR); } $tran_id = $re_m['tran_id']; + //$tran_id = 56; + $re_tr = $this->mdTransfer->get(['id' => $tran_id]); + if (!$re_tr) { + throw new Exception('数据不存在', ERR_PARAMS_ERROR); + } + $jsondata = $re_tr['jsondata'] ? json_decode($re_tr['jsondata'], true) : []; + $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']) { + throw new Exception('请输入发车里程数', ERR_PARAMS_ERROR); + } + if (!$start_mileage['imgs']) { + 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]; $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]);//信息员已完成 @@ -321,6 +362,18 @@ class Transfer extends Wxapp } } } else {//确认接车 + $end_mileage = $this->input_param('end_mileage'); + if (!$end_mileage['value']) { + throw new Exception('请输入接车里程数', ERR_PARAMS_ERROR); + } + if (!$end_mileage['imgs']) { + 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]; $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']; @@ -353,6 +406,8 @@ class Transfer extends Wxapp } } if ($ret) { + $jsondata['transport'] = $transport_json; + $this->mdTransfer->update(['jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)], ['id' => $tran_id]); throw new Exception('确认成功', API_CODE_SUCCESS); } else { throw new Exception('确认失败', ERR_PARAMS_ERROR); diff --git a/common/libraries/Polyv.php b/common/libraries/Polyv.php new file mode 100644 index 00000000..dd175323 --- /dev/null +++ b/common/libraries/Polyv.php @@ -0,0 +1,160 @@ +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']; + $this->timestamp = time() * 1000; + } + + /** + * Notes:查询频道某段时间的直播观看详情数据 + * https://help.polyv.net/index.html#/live/api/channel/viewdata/summary + * Created on: 2022/2/8 17:45 + * Created by: dengbw + * @param array $params ['channelId' => '2797712', 'startDay' => '2022-01-01', 'endDay' => '2022-02-08'] + * @return bool|string + */ + function summary($params = []) + { + $params_sign = array( + 'appId' => $this->app_id, + 'timestamp' => $this->timestamp, + 'startDay' => $params['startDay'], + 'endDay' => $params['endDay'], + ); + $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}"; + return $this->curlGet($url); + } + + /** + * Notes:查询频道直播观看详情数据 + * https://help.polyv.net/index.html#/live/api/channel/viewdata/viewlog_2 + * Created on: 2022/2/8 16:08 + * Created by: dengbw + * @param array $params ['channelId' => '2797712', 'currentDay' => '2022-01-28'] + * @return bool|string + */ + function viewLog($params = []) + { + $params_sign = array( + 'appId' => $this->app_id, + 'timestamp' => $this->timestamp, + 'currentDay' => $params['currentDay'], + 'userId' => $this->user_id, + 'param1' => $this->user_id, + ); + $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}"; + return $this->curlGet($url); + } + + /** + * Notes:获取频道 + * Created on: 2022/2/8 15:54 + * Created by: dengbw + * @return bool|string //{"status":"success","result":[2797712]} + */ + function channels() + { + $sign = $this->getSign(); + $url = "http://api.polyv.net/live/v1/users/" . $this->user_id . "/channels?appId=" . $this->app_id . "×tamp=" . $this->timestamp . "&sign=" . $sign; + return $this->curlGet($url); + } + + /** + * Notes:获取签名 + * Created on: 2022/2/8 15:50 + * Created by: dengbw + * @param $params + * @return string + */ + function getSign($params = '') + { + if (!$params) { + $params = array( + 'appId' => $this->app_id, + 'timestamp' => $this->timestamp + ); + } + // 1. 对加密数组进行字典排序 + foreach ($params as $key => $value) { + $arr[$key] = $key; + } + sort($arr); + $str = $this->app_secret; + foreach ($arr as $k => $v) { + $str = $str . $arr[$k] . $params[$v]; + } + $restr = $str . $this->app_secret; + $sign = strtoupper(md5($restr)); + return $sign; + } + + /** + * Notes:Get请求 + * Created on: 2022/2/8 15:51 + * Created by: dengbw + * @param string $url + * @return bool|string + */ + public function curlGet($url = '') + { + $ch = curl_init() or die (curl_error()); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 360); + $data = curl_exec($ch); + curl_close($ch); + return $data; + } + + /** + * Notes:Post请求 + * Created on: 2022/2/8 15:51 + * Created by: dengbw + * @param string $url + * @param string $postData + * @param array $options + * @return bool|string + */ + public function curlPost($url = '', $postData = '', $options = array()) + { + if (is_array($postData)) { + $postData = http_build_query($postData); + } + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); + curl_setopt($ch, CURLOPT_TIMEOUT, 30); //设置cURL允许执行的最长秒数 + if (!empty($options)) { + curl_setopt_array($ch, $options); + } + //https请求 不验证证书和host + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + $data = curl_exec($ch); + curl_close($ch); + return $data; + } +} + diff --git a/home/views/h5/syt/special.php b/home/views/h5/syt/special.php index 34478b2f..d6ebe421 100644 --- a/home/views/h5/syt/special.php +++ b/home/views/h5/syt/special.php @@ -19,42 +19,6 @@ - - - - - - -
@@ -221,15 +185,12 @@
- - -
- Powered by - - 好店云 -
- +
+ Powered by + + 狸车科技 +