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

edit

上级 0a55c373
......@@ -425,6 +425,33 @@ class SynJdRapidController extends BaseController
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)
{
$ch = curl_init();
......
......@@ -213,6 +213,7 @@ class GoodsBrandController extends BaseController
$gbList = RedisService::redisGet('gbList');
if($session['admin_groupnew'] !=7) {
$gbList = CommonService::arrayFilterFieldValue($gbList, [['company_id' => $session['company_id']]]);
$gbList = CommonService::resetListKey($gbList);
}
return $this->success('获取成功',$gbList);
//return $cdList;
......@@ -223,6 +224,7 @@ class GoodsBrandController extends BaseController
RedisService::redisSet('gbList',$gbList);
if($session['admin_groupnew'] !=7) {
$gbLists = CommonService::arrayFilterFieldValue($gbLists, [['company_id' => $session['company_id']]]);
$gbLists = CommonService::resetListKey($gbLists);
}
return $this->success('获取成功',$gbLists);
}
......
......@@ -334,12 +334,37 @@ class BservissController extends BaseController
$serid = CommonService::dataToArray($serid);
if (!in_array($session['admin_groupnew'],[7,8])) {
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{
$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{
$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()){
$list = CommonService::dataToArray($list);
......@@ -593,6 +618,7 @@ class BservissController extends BaseController
$listArr[$vv]['bs_min'] = $vs['bs_min'];
$listArr[$vv]['bs_creactime'] = date('Y-m-d H:i:s');
$listArr[$vv]['bs_creactid'] = $request->get('session_token')['admin_name'];
$listArr[$vv]['bs_company_id'] = $request->get('session_token')['company_id'];
$vv++;
} else {
DB::rollback();
......@@ -610,6 +636,7 @@ class BservissController extends BaseController
$listArr[$vv]['bs_min'] = $vs['bs_min'];
$listArr[$vv]['bs_creactime'] = date('Y-m-d H:i:s');
$listArr[$vv]['bs_creactid'] = $request->get('session_token')['admin_name'];
$listArr[$vv]['bs_company_id'] = $request->get('session_token')['company_id'];
$vv++;
} else {
DB::rollback();
......
......@@ -37,6 +37,7 @@ use App\Services\CategoryService;
use App\Services\CommonService;
use App\Services\InstallPersonService;
use App\Services\OrderListService;
use App\Services\Api\MobileWeb\OrderListService as WebOrderListService;
use \App\Services\Api\MobileWeb\OrderListService as MobileOrderListService;
use App\Services\OrderService;
use App\Services\PlatformService;
......@@ -585,6 +586,9 @@ class OrderListController extends BaseController
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 $this->success('接单成功',[]);exit;
}else{
......@@ -680,6 +684,9 @@ class OrderListController extends BaseController
}
} */
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 $this->success('接单成功2',[]);exit;
}else{
......
......@@ -89,10 +89,23 @@ class LoginController extends BaseController
$input['com_name'] = trim($parameter['com_name']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
$input['company_id'] = trim($result['company_id']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
if($result['admin_groupnew']!=7){
$retCom = $this->checkCompany($input);
if($retCom->original['ErrorCode']!=1){
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
$input['com_name'] = trim($parameter['com_name']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
$input['company_id'] = trim($result['company_id']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
if($result['admin_groupnew']!=7){
$retCom = $this->checkCompany($input);
if($retCom->original['ErrorCode']!=1){
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
$input['com_name'] = trim($parameter['com_name']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
$input['company_id'] = trim($result['company_id']);
$input['admin_groupnew'] = trim($result['admin_groupnew']);
if($result['admin_groupnew']!=7){
$retCom = $this->checkCompany($input);
if($retCom->original['ErrorCode']!=1){
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
if(!$com){
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);
}
$time = date('Y-m-d H:i:s');
......
......@@ -13,7 +13,7 @@ class Admin extends Model
public $timestamps=false;
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(){
return $this->hasOne(Pt::class,'id','ptid')->select('id','pt_name');
......
......@@ -2,6 +2,8 @@
namespace App\Services\Api\MobileWeb;
use App\Http\Controllers\Api\SynJdPurchaseController;
use App\Http\Controllers\Api\SynJdRapidController;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Redis;
......@@ -505,6 +507,11 @@ class OrderListService extends Model
$dou=SettlementList::insertGetId($arr);
if($restult==1 && $dou){
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);
if($dou){
self::calculates($dou,$orderListArr,$supply_price,$supply_price,$session);//计算奖惩金额以及评分
......@@ -548,6 +555,74 @@ class OrderListService extends Model
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)
......
......@@ -100,10 +100,13 @@ class ServiceProviderService extends Service
$query->where('admin_infor.verstorename', 'like', Request()->input('verstorename') . '%');//京东名称
}
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])) {
$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();
$totalPage = 1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论