提交 080db232 authored 作者: 窦斌's avatar 窦斌

edit

上级 0a55c373
...@@ -425,6 +425,33 @@ class SynJdRapidController extends BaseController ...@@ -425,6 +425,33 @@ class SynJdRapidController extends BaseController
return ["code"=>"201","msg"=>"获取订单信息失败","data"=>"获取订单信息失败"]; return ["code"=>"201","msg"=>"获取订单信息失败","data"=>"获取订单信息失败"];
} }
/**|---------------------------------------------------------------------------------
* @name 拣货完成且商家自送接口
* @param string orderId 订单单号
* @param string access_token token
* @param string app_key appkey
* @param string app_secret appsecret
* @retrun \Illuminate\Http\JsonResponse /multitype:array
* @author dou 2026/6/30 13:50
* |---------------------------------------------------------------------------------
*/
public function orderSerllerDelivery ( $data ){
$json['orderId'] = $data['orderId'];
$json['operator'] = 'admin';
$sysParams["jd_param_json"]=json_encode($json);
$sysParams['token']=$data['access_token'];
$sysParams['app_key']=$data['app_key'];
$sysParams['format']='json';
$sysParams['timestamp']=date("Y-m-d H:i:s");
$sysParams['v']='2.0';
$sysParams["sign"] = JdDataService::generateSign($sysParams,$data['app_secret']);
$apiParams=$sysParams;
$url="https://openapi.jddj.com/djapi/bm/open/api/order/OrderSerllerDelivery";
$resp = $this->curl($url,$apiParams);
return $resp;
}
public function curl($url, $postFields = null) public function curl($url, $postFields = null)
{ {
$ch = curl_init(); $ch = curl_init();
......
...@@ -213,6 +213,7 @@ class GoodsBrandController extends BaseController ...@@ -213,6 +213,7 @@ class GoodsBrandController extends BaseController
$gbList = RedisService::redisGet('gbList'); $gbList = RedisService::redisGet('gbList');
if($session['admin_groupnew'] !=7) { if($session['admin_groupnew'] !=7) {
$gbList = CommonService::arrayFilterFieldValue($gbList, [['company_id' => $session['company_id']]]); $gbList = CommonService::arrayFilterFieldValue($gbList, [['company_id' => $session['company_id']]]);
$gbList = CommonService::resetListKey($gbList);
} }
return $this->success('获取成功',$gbList); return $this->success('获取成功',$gbList);
//return $cdList; //return $cdList;
...@@ -223,6 +224,7 @@ class GoodsBrandController extends BaseController ...@@ -223,6 +224,7 @@ class GoodsBrandController extends BaseController
RedisService::redisSet('gbList',$gbList); RedisService::redisSet('gbList',$gbList);
if($session['admin_groupnew'] !=7) { if($session['admin_groupnew'] !=7) {
$gbLists = CommonService::arrayFilterFieldValue($gbLists, [['company_id' => $session['company_id']]]); $gbLists = CommonService::arrayFilterFieldValue($gbLists, [['company_id' => $session['company_id']]]);
$gbLists = CommonService::resetListKey($gbLists);
} }
return $this->success('获取成功',$gbLists); return $this->success('获取成功',$gbLists);
} }
......
...@@ -334,12 +334,37 @@ class BservissController extends BaseController ...@@ -334,12 +334,37 @@ class BservissController extends BaseController
$serid = CommonService::dataToArray($serid); $serid = CommonService::dataToArray($serid);
if (!in_array($session['admin_groupnew'],[7,8])) { if (!in_array($session['admin_groupnew'],[7,8])) {
if($session['company_id']==14) { if($session['company_id']==14) {
$list = DB::table('admin')->whereIn('admin_groupnew', [2, 3])->whereRaw("(company_id = '" . $session['company_id'] . "' or admin_groupnew=3)")->where('company_name', 'like', '%' . $company_name . '%')->select('id', 'company_name')->orderBy('id', 'ASC')->limit('10')->get();//->whereNotIn('id', $serid) $list = DB::table('admin')
->leftJoin('admin_infor','admin_infor.admin_id','=','admin.id')
->whereIn('admin_groupnew', [2, 3])
->whereRaw("(inf_company_id = '" . $session['company_id'] . "' or admin_groupnew=3)")
->where('inf_company_name', 'like', '%' . $company_name . '%')
->select('admin.id', 'company_name')
->orderBy('admin.id', 'ASC')
->limit('10')
->get();//->whereNotIn('id', $serid)
}else{ }else{
$list = DB::table('admin')->where('admin_groupnew', 8)->where("company_id", $session['company_id'])->where('company_name', 'like', '%' . $company_name . '%')->select('id', 'company_name')->orderBy('id', 'ASC')->limit('10')->get(); $list = DB::table('admin')
->leftJoin('admin_infor','admin_infor.admin_id','=','admin.id')
->where('admin_groupnew', 2)
->where("inf_company_id", $session['company_id'])
->where('inf_company_name', 'like', '%' . $company_name . '%')
->select('admin.id', 'company_name')
->orderBy('admin.id', 'ASC')
->limit('10')
->get();
} }
}else{ }else{
$list = DB::table('admin')->whereIn('admin_groupnew', [2,3])->whereIn('company_id', $session['all_company'])->where('company_name', 'like', '%' . $company_name . '%')->select('id', 'company_name')->orderBy('id', 'ASC')->limit('10')->get();//->whereNotIn('id', $serid) $list = DB::table('admin')
->leftJoin('admin_infor','admin_infor.admin_id','=','admin.id')
->whereIn('admin_groupnew', [2,3])
->whereIn('inf_company_id', $session['all_company'])
->where('inf_company_name', 'like', '%' . $company_name . '%')
->select('admin.id', 'company_name')
->groupBy('admin.id')
->orderBy('admin.id', 'ASC')
->limit('10')
->get();//->whereNotIn('id', $serid)
} }
if (!$list->isEmpty()){ if (!$list->isEmpty()){
$list = CommonService::dataToArray($list); $list = CommonService::dataToArray($list);
...@@ -593,6 +618,7 @@ class BservissController extends BaseController ...@@ -593,6 +618,7 @@ class BservissController extends BaseController
$listArr[$vv]['bs_min'] = $vs['bs_min']; $listArr[$vv]['bs_min'] = $vs['bs_min'];
$listArr[$vv]['bs_creactime'] = date('Y-m-d H:i:s'); $listArr[$vv]['bs_creactime'] = date('Y-m-d H:i:s');
$listArr[$vv]['bs_creactid'] = $request->get('session_token')['admin_name']; $listArr[$vv]['bs_creactid'] = $request->get('session_token')['admin_name'];
$listArr[$vv]['bs_company_id'] = $request->get('session_token')['company_id'];
$vv++; $vv++;
} else { } else {
DB::rollback(); DB::rollback();
...@@ -610,6 +636,7 @@ class BservissController extends BaseController ...@@ -610,6 +636,7 @@ class BservissController extends BaseController
$listArr[$vv]['bs_min'] = $vs['bs_min']; $listArr[$vv]['bs_min'] = $vs['bs_min'];
$listArr[$vv]['bs_creactime'] = date('Y-m-d H:i:s'); $listArr[$vv]['bs_creactime'] = date('Y-m-d H:i:s');
$listArr[$vv]['bs_creactid'] = $request->get('session_token')['admin_name']; $listArr[$vv]['bs_creactid'] = $request->get('session_token')['admin_name'];
$listArr[$vv]['bs_company_id'] = $request->get('session_token')['company_id'];
$vv++; $vv++;
} else { } else {
DB::rollback(); DB::rollback();
......
...@@ -37,6 +37,7 @@ use App\Services\CategoryService; ...@@ -37,6 +37,7 @@ use App\Services\CategoryService;
use App\Services\CommonService; use App\Services\CommonService;
use App\Services\InstallPersonService; use App\Services\InstallPersonService;
use App\Services\OrderListService; use App\Services\OrderListService;
use App\Services\Api\MobileWeb\OrderListService as WebOrderListService;
use \App\Services\Api\MobileWeb\OrderListService as MobileOrderListService; use \App\Services\Api\MobileWeb\OrderListService as MobileOrderListService;
use App\Services\OrderService; use App\Services\OrderService;
use App\Services\PlatformService; use App\Services\PlatformService;
...@@ -585,6 +586,9 @@ class OrderListController extends BaseController ...@@ -585,6 +586,9 @@ class OrderListController extends BaseController
DB::commit(); DB::commit();
// if($orderListArr['p_id']=='39' || $orderListArr['p_id']=='44' || $orderListArr['p_id']=='50'){
WebOrderListService::syncExpress($orderListArr['order_num'], $orderListArr['p_id']);
// }
return 5;exit; return 5;exit;
//return $this->success('接单成功',[]);exit; //return $this->success('接单成功',[]);exit;
}else{ }else{
...@@ -680,6 +684,9 @@ class OrderListController extends BaseController ...@@ -680,6 +684,9 @@ class OrderListController extends BaseController
} }
} */ } */
DB::commit(); DB::commit();
// if($orderListArr['p_id']=='39' || $orderListArr['p_id']=='44' || $orderListArr['p_id']=='50'){
WebOrderListService::syncExpress($orderListArr['order_num'], $orderListArr['p_id']);
// }
return 8;exit; return 8;exit;
//return $this->success('接单成功2',[]);exit; //return $this->success('接单成功2',[]);exit;
}else{ }else{
......
...@@ -89,10 +89,23 @@ class LoginController extends BaseController ...@@ -89,10 +89,23 @@ class LoginController extends BaseController
$input['com_name'] = trim($parameter['com_name']); $input['com_name'] = trim($parameter['com_name']);
$input['admin_groupnew'] = trim($result['admin_groupnew']); $input['admin_groupnew'] = trim($result['admin_groupnew']);
$input['company_id'] = trim($result['company_id']); $input['company_id'] = trim($result['company_id']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
if($result['admin_groupnew']!=7){ if($result['admin_groupnew']!=7){
$retCom = $this->checkCompany($input); $retCom = $this->checkCompany($input);
if($retCom->original['ErrorCode']!=1){ if($retCom->original['ErrorCode']!=1){
return $retCom; return $retCom;
}else{
if($result['admin_groupnew']==2){
$result['company_id'] = $retCom->original['Data'];
$admin_infor = AdminInfor::where('admin_id',$result['id'])
->where('inf_company_id',$result['company_id'])
->value('inf_enable');
if(!$admin_infor){
return $this->error('公司不正确', ErrorInc::MYSQL_FAILED,$result['company_id']);
}
$result['enable'] = $admin_infor;
}
} }
} }
...@@ -144,10 +157,23 @@ class LoginController extends BaseController ...@@ -144,10 +157,23 @@ class LoginController extends BaseController
$input['com_name'] = trim($parameter['com_name']); $input['com_name'] = trim($parameter['com_name']);
$input['admin_groupnew'] = trim($result['admin_groupnew']); $input['admin_groupnew'] = trim($result['admin_groupnew']);
$input['company_id'] = trim($result['company_id']); $input['company_id'] = trim($result['company_id']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
if($result['admin_groupnew']!=7){ if($result['admin_groupnew']!=7){
$retCom = $this->checkCompany($input); $retCom = $this->checkCompany($input);
if($retCom->original['ErrorCode']!=1){ if($retCom->original['ErrorCode']!=1){
return $retCom; return $retCom;
}else{
if($result['admin_groupnew']==2){
$result['company_id'] = $retCom->original['Data'];
$admin_infor = AdminInfor::where('admin_id',$input['id'])
->where('inf_company_id',$result['company_id'])
->value('inf_enable');
if(!$admin_infor){
return $this->error('公司不正确', ErrorInc::MYSQL_FAILED);
}
$result['enable'] = $admin_infor;
}
} }
} }
...@@ -190,10 +216,23 @@ class LoginController extends BaseController ...@@ -190,10 +216,23 @@ class LoginController extends BaseController
$input['com_name'] = trim($parameter['com_name']); $input['com_name'] = trim($parameter['com_name']);
$input['admin_groupnew'] = trim($result['admin_groupnew']); $input['admin_groupnew'] = trim($result['admin_groupnew']);
$input['company_id'] = trim($result['company_id']); $input['company_id'] = trim($result['company_id']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
if($result['admin_groupnew']!=7){ if($result['admin_groupnew']!=7){
$retCom = $this->checkCompany($input); $retCom = $this->checkCompany($input);
if($retCom->original['ErrorCode']!=1){ if($retCom->original['ErrorCode']!=1){
return $retCom; return $retCom;
}else{
if($result['admin_groupnew']==2){
$result['company_id'] = $retCom->original['Data'];
$admin_infor = AdminInfor::where('admin_id',$input['id'])
->where('inf_company_id',$result['company_id'])
->value('inf_enable');
if(!$admin_infor){
return $this->error('公司不正确', ErrorInc::MYSQL_FAILED);
}
$result['enable'] = $admin_infor;
}
} }
} }
...@@ -484,7 +523,7 @@ class LoginController extends BaseController ...@@ -484,7 +523,7 @@ class LoginController extends BaseController
if(!$com){ if(!$com){
return $this->error('公司不存在', ErrorInc::MYSQL_FAILED); return $this->error('公司不存在', ErrorInc::MYSQL_FAILED);
} }
if($com['com_id']!=$input['company_id']){ if($com['com_id']!=$input['company_id'] && $input['admin_groupnew']!=2){
return $this->error('公司不正确', ErrorInc::MYSQL_FAILED); return $this->error('公司不正确', ErrorInc::MYSQL_FAILED);
} }
$time = date('Y-m-d H:i:s'); $time = date('Y-m-d H:i:s');
......
...@@ -13,7 +13,7 @@ class Admin extends Model ...@@ -13,7 +13,7 @@ class Admin extends Model
public $timestamps=false; public $timestamps=false;
public function admininfor(){ public function admininfor(){
return $this->hasOne(AdminInfor::class,'admin_id','id')->select('id','admin_id','phone','accountname','account','opeaccline','qq'); return $this->hasOne(AdminInfor::class,'admin_id','id')->select('id','admin_id','phone','accountname','account','opeaccline','qq','inf_company_name','inf_mouth_pay','inf_enable','inf_ad_brand','inf_agent_brand','inf_company_id','inf_invoice','inf_deduct','inf_type');
} }
public function pt(){ public function pt(){
return $this->hasOne(Pt::class,'id','ptid')->select('id','pt_name'); return $this->hasOne(Pt::class,'id','ptid')->select('id','pt_name');
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace App\Services\Api\MobileWeb; namespace App\Services\Api\MobileWeb;
use App\Http\Controllers\Api\SynJdPurchaseController;
use App\Http\Controllers\Api\SynJdRapidController;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Redis;
...@@ -505,6 +507,11 @@ class OrderListService extends Model ...@@ -505,6 +507,11 @@ class OrderListService extends Model
$dou=SettlementList::insertGetId($arr); $dou=SettlementList::insertGetId($arr);
if($restult==1 && $dou){ if($restult==1 && $dou){
DB::commit(); DB::commit();
// if($orderListArr['p_id']=='39' || $orderListArr['p_id']=='44' || $orderListArr['p_id']=='50' || $orderListArr['order_num']=='3545412002269559'){
// $filename = 'jdOrderEx' . date('Ym');
// CommonService::addLog('出库', $orderListArr['p_id'], $orderListArr['order_num'], $filename);
self::syncExpress($orderListArr['order_num'], $orderListArr['p_id']);
// }
Management::where('trace_code',$orderListArr['serial_number'])->update($info); Management::where('trace_code',$orderListArr['serial_number'])->update($info);
if($dou){ if($dou){
self::calculates($dou,$orderListArr,$supply_price,$supply_price,$session);//计算奖惩金额以及评分 self::calculates($dou,$orderListArr,$supply_price,$supply_price,$session);//计算奖惩金额以及评分
...@@ -548,6 +555,74 @@ class OrderListService extends Model ...@@ -548,6 +555,74 @@ class OrderListService extends Model
return ['ErrorCode' => ErrorInc::MYSQL_FAILED, 'ErrorMessage' => '操作失败', 'Data' => []]; return ['ErrorCode' => ErrorInc::MYSQL_FAILED, 'ErrorMessage' => '操作失败', 'Data' => []];
} }
} }
// 出库
public static function syncExpress($order_num,$pt_id)
{
try {
$filename = 'jdOrderEx' . date('Ym');
$token = DB::table('jdpop_token')->where('status', 1)->where('pt_id', $pt_id)->select('app_key', 'app_secret', 'access_token', 'pt_id', 'appName', 'type')->first();
if ($token) {
if ($token['type'] == 1) {
$url_ex = "http://116.196.75.172/index.php/GetOrder/syncExpress";//出库
$res_ex = [];
$res_ex['appKey'] = $token['app_key']; //appkey
$res_ex['appSecret'] = $token['app_secret'];//secret
$res_ex['accessToken'] = $token['access_token']; //token
$res_ex['skb_bh'] = $order_num;//$vv['orderId'];
$res_ex['jdid'] = 1274;
$res_ex['kd_number'] = '';
$res_ex['estimateDate'] = date("Y-m-d H:i:s");
$result = CommonService::requestPost($url_ex, $res_ex);
//出库同步
CommonService::addLog('出库', json_encode($res_ex), $order_num, $filename);
$reta = json_decode($result, true);
if ($reta['jingdong_pop_order_shipment_responce']['sopjosshipment_result']['success'] == true) {
CommonService::addLog('派单成功出库', $result, $order_num, $filename);
} else {
CommonService::addLog('派单出库失败', $result, $order_num, $filename);
}
}elseif ($token['type'] == 3 && $order_num=='202606301725'){
$data['order_num'] = $order_num;
$data['accessToken'] = $token['access_token'];
$data['appKey'] = $token['app_key'];
$data['appsecret'] = $token['app_secret'];
$SynJdPurchaseController = new SynJdPurchaseController();
$result = $SynJdPurchaseController->jdOrderEx($data);
//出库同步
$filename = 'jdOrderEx' . date('Ym');
CommonService::addLog('出库', json_encode($data), $order_num, $filename);
$reta = json_decode($result, true);
if ($reta['jingdong_purchase_order_stock_out_responce']['result']['code'] == 1) {
CommonService::addLog('派单成功出库', $result, $order_num, $filename);
} else {
CommonService::addLog('派单出库失败', $result, $order_num, $filename);
}
}elseif ($token['type'] == 4){
$data['orderId'] = $order_num;
$data['access_token'] = $token['access_token'];
$data['app_key'] = $token['app_key'];
$data['app_secret'] = $token['app_secret'];
$SynJdRapidController = new SynJdRapidController();
$result = $SynJdRapidController->orderSerllerDelivery($data);
//出库同步
$filename = 'jdOrderEx' . date('Ym');
CommonService::addLog('出库', json_encode($data), $order_num, $filename);
$reta = json_decode($result, true);
if ($reta['code'] == 0) {
CommonService::addLog('派单成功出库', $result, $order_num, $filename);
} else {
CommonService::addLog('派单出库失败', $result, $order_num, $filename);
}
}
}
return true;
}catch (Exception $e)
{
CommonService::addLog('操作异常', $e->getMessage(), $order_num.'---'.$pt_id, $filename);
return true;
}
}
// 拒单 // 拒单
public static function refuse($request,$ip) public static function refuse($request,$ip)
......
...@@ -100,10 +100,13 @@ class ServiceProviderService extends Service ...@@ -100,10 +100,13 @@ class ServiceProviderService extends Service
$query->where('admin_infor.verstorename', 'like', Request()->input('verstorename') . '%');//京东名称 $query->where('admin_infor.verstorename', 'like', Request()->input('verstorename') . '%');//京东名称
} }
if (!in_array($session['admin_groupnew'],[7,8])) { if (!in_array($session['admin_groupnew'],[7,8])) {
$query->where('admin.company_id', $session['company_id']); $query->where('admin_infor.inf_company_id', $session['company_id']);
} }
if (in_array($session['admin_groupnew'],[8])) { if (in_array($session['admin_groupnew'],[8])) {
$query->whereIn('admin.company_id', $session['all_company']); $query->whereIn('admin_infor.inf_company_id', $session['all_company']);
}
if (in_array($session['admin_groupnew'],[7,8])) {
$query->groupBy('admin.id');
} }
$count = $query->count(); $count = $query->count();
$totalPage = 1; $totalPage = 1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论