作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

电子面单

... ... @@ -36,7 +36,7 @@ class BirdController extends HomeBaseController
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function createOrder($indent_id = null)
public function createOrder($indent_id = 132)
{
if(empty($indent_id)){
return "缺少必要参数";
... ... @@ -58,7 +58,7 @@ class BirdController extends HomeBaseController
$region = explode(' ',$address['region']);
//请求url,接口正式地址:http://api.kdniao.com/api/OOrderService 测试环境地址:http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json
defined('ReqURL') or define('ReqURL', 'http://api.kdniao.com/api/OOrderService');
defined('ReqURL') or define('ReqURL', 'http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json');
//构造在线下单提交信息
... ... @@ -104,9 +104,9 @@ class BirdController extends HomeBaseController
if(!empty($result['Order']['LogisticCode'])){
$indentModel->updateData(['id'=>$indent_id],['logistic_code'=>$result['Order']['LogisticCode']]);
}
return ['code'=>20000,'msg'=>'SUCCESS','data'=>$result];//返回快递单号
return dump(['code'=>20000,'msg'=>'SUCCESS','data'=>$result]);//返回快递单号
} else {
return ['code'=>40000,'msg'=>$result['Reason']];
return dump(['code'=>40000,'msg'=>$result['Reason']]);
}
}
... ... @@ -156,7 +156,7 @@ class BirdController extends HomeBaseController
//请求url,接口正式地址:http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx 测试环境地址:http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json
defined('ReqURL') or define('ReqURL', 'http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx');
$jsonResult = $this->getOrderTracesByJson($indent['order_number'],$indent['logistic_code']);
$jsonResult = $this->getOrderTracesByJson($indent['order_number'],$indent['logistic_code'],$indent['logistic_name']);
$result = json_decode($jsonResult,true);
if($result['Success'] == true){
return ['code'=>20000,'msg'=>'SUCCESS','data'=>['state'=>$result['State'],'traces'=>$result['Traces']]];//订单轨迹
... ... @@ -168,8 +168,8 @@ class BirdController extends HomeBaseController
/**
* Json方式 查询订单物流轨迹
*/
function getOrderTracesByJson($OrderCode,$LogisticCode){
$requestData= "{'OrderCode':$OrderCode,'ShipperCode':'SF','LogisticCode':$LogisticCode}";
function getOrderTracesByJson($OrderCode,$LogisticCode,$LogisticName){
$requestData= "{'OrderCode':$OrderCode,'ShipperCode':'$LogisticName','LogisticCode':$LogisticCode}";
$datas = array(
'EBusinessID' => EBusinessID,
... ... @@ -214,7 +214,7 @@ class BirdController extends HomeBaseController
//请求url,接口正式地址:http://api.kdniao.com/api/eorderservice 测试环境地址:http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInv
defined('ReqURL') or define('ReqURL', 'http://api.kdniao.com/api/dist');
$jsonResult = $this->orderTracesSubByJson($indent['order_number'],$indent['logistic_code'],$address);
$jsonResult = $this->orderTracesSubByJson($indent['order_number'],$indent['logistic_code'],$address,$indent['logistic_name'],$indent['logistic_name']);
$result = json_decode($jsonResult,true);
cache('b',$result);
if(empty($result['Reason'])){
... ... @@ -227,11 +227,11 @@ class BirdController extends HomeBaseController
/**
* Json方式 物流信息订阅
*/
public function orderTracesSubByJson($OrderCode,$LogisticCode,$address){
public function orderTracesSubByJson($OrderCode,$LogisticCode,$address,$LogisticName){
$sender = config('sender');
$region = explode(' ',$address['region']);
$requestData="{'OrderCode': '$OrderCode',".
"'ShipperCode':'SF',".
"'ShipperCode':'$LogisticName',".
"'LogisticCode':'$LogisticCode',".
"'PayType':1,".
"'ExpType':1,".
... ...
... ... @@ -24,9 +24,9 @@ class OrderSalesmanController extends WeChatBaseController
if(empty($my_user)){
$this->error($user_id,'','','');
}
if($my_user['status'] != 2){
$this->error('您还不是业务员那','','','');
}
// if($my_user['status'] != 2){
// $this->error('您还不是业务员那','','','');
// }
}
public function get_all(){
$param = $this->request->param();
... ... @@ -70,18 +70,65 @@ class OrderSalesmanController extends WeChatBaseController
if(!empty($param['grade'])){
$where['grade'] = ['eq',$param['grade']];
}
if(!empty($param['state'])){
$where['state'] = ['eq',$param['state']];
}else{
$where['state'] = ['neq',4];
}
$user_id = $this->user_id;
$where['salesman_uid'] = ['eq',$user_id];
$where['indent_type'] = ['eq',2];
$where['state'] = ['neq',4];
$indentModel = new IndentModel();
$data = $indentModel->selectData($where);
$indentGoodsModel = new IndentGoodsModel();
foreach($data as $key => $vo){
$indent_goods = $indentGoodsModel->selectData(['indent_id'=>$vo['id']]);
$data[$key]['indent_goods'] = $indent_goods;
$dara[$key]['create_time'] = date('Y-m-d H:i:s',$vo['create_time']);
}
$this->success('SUCCESS','',$data);
}
public function send(){
$param = $this->request->param();
if(empty($param['is_courier'])){
$this->error('缺少必要参数1');
}
if($param['is_courier'] == 1){
if(empty($param['start_time'])){
$this->error('缺少必要参数2');
}
if(empty($param['end_time'])){
$this->error('缺少必要参数3');
}
}else if($param['is_courier'] == 2){
if(empty($param['logistic_name'])){
$this->error('缺少必要参数4');
}
if(empty($param['logistic_code'])){
$this->error('缺少必要参数5');
}
}
if(empty($param['indent_id'])){
$this->error('缺少必要参数6');
}
$where['id'] = ['eq',$param['indent_id']];
$indentModel = new IndentModel();
$indent = $indentModel->findData($where);
if(empty($indent)){
$this->error('查询为空');
}
if($indent['state'] != 2){
$this->error('订单不是待支付状态');
}
$arr = [];
if($param['is_courier'] == 1){
$arr['logistic_name'] = $param['logistic_name'];
$arr['logistic_code'] = $param['logistic_code'];
}else if($param['is_courier'] == 2){
$arr['start_time'] = $param['start_time'];
$arr['end_time'] = $param['end_time'];
}
$arr['state'] = 5;
$result = $indentModel->updateData($where,$arr);
$this->success('发货成功');
}
}
\ No newline at end of file
... ...
... ... @@ -14,6 +14,16 @@ use think\Model;
class IndentModel extends Model
{
/**
* 自动转换 支付时间
* @param $value
* @return false|string
*/
public function getPayTimeAttr($value){
if(!empty($value)){
return date('Y-m-d H:i:s',$value);
}
}
/**
* 获取多个订单
* @param $where
* @return array
... ...