home_tranfer_120_2
This commit is contained in:
@@ -452,7 +452,7 @@ class Transfer extends HD_Controller
|
||||
$item_info = $this->item_info($value['item_id'], 1);
|
||||
if ($res_r) {//门店调拨短信提醒
|
||||
$send_uids = array_unique(array_column($res_r, 'uid'));
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info]);
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info, 'tran_id' => $value['id']]);
|
||||
}
|
||||
if ($res_a) {//信息员调拨短信提醒
|
||||
$send_admins = array_unique(array_column($res_a, 'uid'));
|
||||
@@ -603,7 +603,7 @@ class Transfer extends HD_Controller
|
||||
}
|
||||
$item_info = $this->input->post('items_info');
|
||||
//门店调拨短信提醒
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info]);
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info, 'tran_id' => $id]);
|
||||
//信息员调拨短信提醒
|
||||
$this->send_alisms(['uids' => $send_admins, 'type' => 2, 'item_info' => $item_info]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功', "/items/transfer");
|
||||
@@ -671,7 +671,7 @@ class Transfer extends HD_Controller
|
||||
$item_info = $this->item_info($re_tr['item_id'], 1);
|
||||
if ($res_r) {//门店调拨短信提醒
|
||||
$send_uids = array_unique(array_column($res_r, 'uid'));
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info]);
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info, 'tran_id' => $tran_id]);
|
||||
}
|
||||
if ($res_a) {//信息员调拨短信提醒
|
||||
$send_admins = array_unique(array_column($res_a, 'uid'));
|
||||
@@ -993,17 +993,34 @@ class Transfer extends HD_Controller
|
||||
{
|
||||
$uids = $params['uids'];
|
||||
$type = $params['type'];
|
||||
|
||||
$item_info = $params['item_info'];
|
||||
$car = $item_info['title'];
|
||||
$item_info['cor'] && $car .= '-' . $item_info['cor'];
|
||||
if ($uids && (count($uids) > 0)) {
|
||||
if ($type == 1) { //门店调拨短信提醒
|
||||
if ($params['tran_id']) {//小程序配置
|
||||
$this->load->model('app/app_model', 'mdApp');
|
||||
$wxconfig = $this->mdApp->appConfig()[2]['wx'];
|
||||
$this->load->library('hdwechat', $wxconfig);
|
||||
}
|
||||
$uids_str = implode(',', $uids);
|
||||
$res_u = $this->mdUsers->select(["id in({$uids_str})" => null], 'id desc', 0, 0, 'mobile');
|
||||
$res_u = $this->mdUsers->select(["id in({$uids_str})" => null], 'id desc', 0, 0, 'id,mobile');
|
||||
foreach ($res_u as $key => $value) {
|
||||
send_alisms(array('mobile' => $value['mobile'], 'template' => 'SMS_230960539'
|
||||
, 'param' => ['car' => $car, 'vin' => $item_info['vin']]));
|
||||
$code = '';
|
||||
if ($params['tran_id']) {
|
||||
$re_remind = $this->mdTransferRemind->get(["uid" => $value['id'], "tran_id" => $params['tran_id'], 'status' => 1]);
|
||||
if ($re_remind['id']) {//查找调拨提醒id
|
||||
$url_params = array('path' => '/pages/allot/detail/index', 'query' => 'id=' . $re_remind['id'],
|
||||
'is_expire' => true, 'expire_time' => strtotime('+30 day'));
|
||||
$result = $this->hdwechat->urlscheme($url_params);//获取小程序scheme码
|
||||
if ($result['openlink']) {
|
||||
$openlinks = explode("?t=", $result['openlink']); //weixin://dl/business/?t=xPihcWTrp3m
|
||||
$openlinks[1] && $code = $openlinks[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
send_alisms(array('mobile' => $value['mobile'], 'template' => 'SMS_232907986'
|
||||
, 'param' => ['car' => $car, 'vin' => $item_info['vin'], 'code' => $code]));
|
||||
}
|
||||
} else if ($type == 2) { //信息员调拨短信提醒
|
||||
$uids_str = implode(',', $uids);
|
||||
|
||||
@@ -313,7 +313,7 @@ class Transfer extends Wxapp
|
||||
$item_info = $this->item_info($re_t['item_id']);
|
||||
if ($res_r) {//门店调拨短信提醒
|
||||
$send_uids = array_unique(array_column($res_r, 'uid'));
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info]);
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info, 'tran_id' => $tran_id]);
|
||||
}
|
||||
if ($res_a) {//信息员调拨短信提醒
|
||||
$send_admins = array_unique(array_column($res_a, 'uid'));
|
||||
@@ -470,10 +470,28 @@ class Transfer extends Wxapp
|
||||
if ($uids && (count($uids) > 0)) {
|
||||
if ($type == 1) { //门店调拨短信提醒
|
||||
$uids_str = implode(',', $uids);
|
||||
$res_u = $this->mdUsers->select(["id in({$uids_str})" => null], 'id desc', 0, 0, 'mobile');
|
||||
$res_u = $this->mdUsers->select(["id in({$uids_str})" => null], 'id desc', 0, 0, 'id,mobile');
|
||||
if ($params['tran_id']) {//小程序配置
|
||||
$this->load->model('app/app_model', 'mdApp');
|
||||
$wxconfig = $this->mdApp->appConfig()[2]['wx'];
|
||||
$this->load->library('hdwechat', $wxconfig);
|
||||
}
|
||||
foreach ($res_u as $key => $value) {
|
||||
send_alisms(array('mobile' => $value['mobile'], 'template' => 'SMS_230960539'
|
||||
, 'param' => ['car' => $car, 'vin' => $item_info['vin']]));
|
||||
$code = '';
|
||||
if ($params['tran_id']) {
|
||||
$re_remind = $this->mdTransferRemind->get(["uid" => $value['id'], "tran_id" => $params['tran_id'], 'status' => 1]);
|
||||
if ($re_remind['id']) {//查找调拨提醒id
|
||||
$url_params = array('path' => '/pages/allot/detail/index', 'query' => 'id=' . $re_remind['id'],
|
||||
'is_expire' => true, 'expire_time' => strtotime('+30 day'));
|
||||
$result = $this->hdwechat->urlscheme($url_params);//获取小程序scheme码
|
||||
if ($result['openlink']) {
|
||||
$openlinks = explode("?t=", $result['openlink']); //weixin://dl/business/?t=xPihcWTrp3m
|
||||
$openlinks[1] && $code = $openlinks[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
send_alisms(array('mobile' => $value['mobile'], 'template' => 'SMS_232907986'
|
||||
, 'param' => ['car' => $car, 'vin' => $item_info['vin'], 'code' => $code]));
|
||||
}
|
||||
} else if ($type == 2) { //信息员调拨短信提醒
|
||||
$uids_str = implode(',', $uids);
|
||||
|
||||
@@ -57,6 +57,37 @@ class Hdwechat
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取小程序scheme码
|
||||
* Created on: 2021/3/5 17:00
|
||||
* Created by: dengbw
|
||||
* 文档 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
function urlscheme($params = array()){
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
$pre_url = 'https://api.weixin.qq.com/wxa/generatescheme?access_token=';
|
||||
$url = $pre_url . $access_token;
|
||||
$data = array(
|
||||
'jump_wxa' => array('path'=>$params['path'],'query'=>$params['query']),//跳转到的目标小程序信息
|
||||
'is_expire' => $params['is_expire'],//到期失效:true,永久有效:false
|
||||
'expire_time' => $params['expire_time'],//失效时间
|
||||
);
|
||||
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);
|
||||
}
|
||||
return array('openlink' => $ret['openlink']);
|
||||
}
|
||||
|
||||
function activityid($unionid)
|
||||
{
|
||||
$access_token = $this->access_token();
|
||||
|
||||
Reference in New Issue
Block a user