提交 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{
......
......@@ -177,13 +177,13 @@ class ServiceProviderController extends BaseController
'admin.admin_acc AS admin_acc',
'admin.admin_name AS admin_name',
'admin.admin_groupnew AS admin_groupnew',
'admin.type AS type',
'admin.invoice AS invoice',
'admin.company_name AS company_name',
'admin_infor.inf_type AS type',
'admin_infor.inf_invoice AS invoice',
'admin_infor.inf_company_name AS company_name',
'admin.ptid AS ptid',
'admin.mouth_pay AS mouth_pay',
'admin.enable AS enable',
'admin.agent_brand as agent_brand',
'admin_infor.inf_mouth_pay AS mouth_pay',
'admin_infor.inf_enable AS enable',
'admin_infor.inf_agent_brand as agent_brand',
'admin.is_sord AS is_sord',
'admin.unified AS unified',
'admin.reward AS reward',
......@@ -205,7 +205,7 @@ class ServiceProviderController extends BaseController
'is_fsix',
'ad_alias',
'brand_service',
'ad_brand',
'admin_infor.inf_ad_brand as ad_brand',
'ad_project'
];
......@@ -572,17 +572,17 @@ class ServiceProviderController extends BaseController
$add_ware['company_id'] = $company_id;
$ware_id = DB::table('warehouse')->insertGetId($add_ware);
}
$adminData = DB::table('admin')
$adminDatas = DB::table('admin')
->where('admin_acc', $request['admin_acc'])
->first();
$adminData = CommonService::dataToArray($adminData);
$adminDatas = CommonService::dataToArray($adminDatas);
$adminID = false;
$addcer = false;
if($adminData){
if($adminDatas){
if(isset($request['repeat_acc']) && $request['repeat_acc']!=1){
return $this->error('登录名已存在,对应门店【'.$adminData['company_name'].'】,确认为同一店铺请点击确认,非同一门店请修改登录名后重新提交', 6300);
return $this->error('登录名已存在,对应门店【'.$adminDatas['company_name'].'】,确认为同一店铺请点击确认,非同一门店请修改登录名后重新提交', 6300);
}
$adminID = $adminData['id'];
$adminID = $adminDatas['id'];
}
// $adminID = DB::table('admin')
// ->where('admin_acc', $request['admin_acc'])
......@@ -708,7 +708,7 @@ class ServiceProviderController extends BaseController
$adminData['admin_groupnew'] = $request->input('admin_groupnew',2);//2服务商3经销商
$adminData['mouth_pay'] = $request->input('mouth_pay', 1);//结算状态
$adminData['unified'] = $request->input('unified', 1);//价格状态
$adminData['reward'] = $request->input('reward', 1);//奖惩设置
$adminData['reward'] = $request->input('reward', 2);//奖惩设置
$adminData['admin_group'] = 2;//旧版服务商
//经营品牌
......@@ -827,6 +827,17 @@ class ServiceProviderController extends BaseController
return $this->error('数据不存在', ErrorInc::DATA_EMPTY);
}
$result = $result->toArray();
$session = $request->get('session_token');
$resy = AdminInfor::where('admin_id', $id)->where('inf_company_id',$session['company_id'])->first();
$result['company_name'] = $resy['inf_company_name'];
$result['mouth_pay'] = $resy['inf_mouth_pay'];
$result['enable'] = $resy['inf_enable'];
$result['ad_brand'] = $resy['inf_ad_brand'];
$result['agent_brand'] = $resy['inf_agent_brand'];
$result['company_id'] = $resy['inf_company_id'];
$result['invoice'] = $resy['inf_invoice'];
$result['deduct'] = $resy['inf_deduct'];
$result['type'] = $resy['inf_type'];
if ($result['invoice'] == 3) {//不开票
$result['is_ice'] = '2';
} else {
......@@ -888,7 +899,6 @@ class ServiceProviderController extends BaseController
$result['ser_yycode'] = '';
$result['certification_num'] = '';
}
$resy = AdminInfor::where('admin_id', $id)->first();
if ($resy) {
$resy = $resy->toarray();
if ($resy['admin_longitude'] && $resy['admin_latitude']) {
......@@ -1023,6 +1033,7 @@ class ServiceProviderController extends BaseController
return $this->error($error, ErrorInc::INVALID_PARAM);
}
}
$company_id = Admin::where("id",$id)->value('company_id');
$session = $request->get('session_token');
$admin_acc = Admin::where("admin_acc",$request->input('admin_acc'))->where("company_id",$session['company_id'])->where("id","!=",$id )->first();
if($admin_acc){
......@@ -1036,7 +1047,6 @@ class ServiceProviderController extends BaseController
$poss['back_pass'] = $request->input('admin_password');
}
$post['enable'] = $request->input('enable');//是否启用
$post['is_lidao'] = $request->input('is_lidao');//是否为立到门店
$post['admin_name'] = $request->input('admin_name');//姓名
$post['admin_acc'] = $request->input('admin_acc');
......@@ -1060,26 +1070,69 @@ class ServiceProviderController extends BaseController
}
$poss['phone'] = $request->input('phone');//电话
$poss['qq'] = $request->input('qq');//QQ
if($company_id == $session['company_id']) {
$post['company_name'] = trimall($request->input('company_name'));//服务中心名称
$post['mouth_pay'] = $request->input('mouth_pay');//结算对象
$post['enable'] = $request->input('enable');//是否启用
$post['type'] = $request->input('type');//结算对象
if ($request->input('ad_brand')) {
$post['ad_brand'] = ","; //经营品牌
foreach ($request->input('ad_brand') as $kb => $vb) {
$post['ad_brand'] .= $vb . ",";
}
$post['ad_brand'] = trim($post['ad_brand'],',');
}
if ($request->input('agent_brand')) {
$post['agent_brand'] = ",";//代理品牌
foreach ($request->input('agent_brand') as $kb => $vb) {
$post['agent_brand'] .= $vb . ",";
}
$post['agent_brand'] = trim($post['agent_brand'],',');
}
if ($request->input('is_ice') == 1) {
$post['deduct'] = $request->input('fdeduct') . ',' . $request->input('deduct');//扣点数值.
$post['invoice'] = $request->input('invoice');//增\普票
}
if ($request->input('is_ice') == 2) {
$post['deduct'] = '0,' . $request->input('deduct');//扣点数值.
$post['invoice'] = 3;//增\普票(不开票)
}
}
$poss['inf_company_name'] = trimall($request->input('company_name'));//服务中心名称
$poss['inf_mouth_pay'] = $request->input('mouth_pay');//结算对象
$poss['inf_enable'] = $request->input('enable');//是否启用
$poss['inf_type'] = $request->input('type');//结算对象
if ($request->input('ad_brand')) {
$post['ad_brand'] = ","; //经营品牌
$poss['inf_ad_brand'] = ","; //经营品牌
foreach ($request->input('ad_brand') as $kb => $vb) {
$post['ad_brand'] .= $vb . ",";
$poss['inf_ad_brand'] .= $vb . ",";
}
$poss['inf_ad_brand'] = trim($poss['inf_ad_brand'],',');
}
if ($request->input('agent_brand')) {
$post['agent_brand'] = ",";//代理品牌
$poss['inf_agent_brand'] = ",";//代理品牌
foreach ($request->input('agent_brand') as $kb => $vb) {
$post['agent_brand'] .= $vb . ",";
$poss['inf_agent_brand'] .= $vb . ",";
}
$poss['inf_agent_brand'] = trim($poss['inf_agent_brand'],',');
}
if ($request->input('is_ice') == 1) {
$poss['inf_deduct'] = $request->input('fdeduct') . ',' . $request->input('deduct');//扣点数值.
$poss['inf_invoice'] = $request->input('invoice');//增\普票
}
if ($request->input('is_ice') == 2) {
$poss['inf_deduct'] = '0,' . $request->input('deduct');//扣点数值.
$poss['inf_invoice'] = 3;//增\普票(不开票)
}
if ($request->input('ad_project')) {
$post['ad_project'] = ",";//经营项目
foreach ($request->input('ad_project') as $kp => $vp) {
$post['ad_project'] .= $vp . ",";
}
$post['ad_project'] = trim($post['ad_project'],',');
}
if ($request->input('ad_urgent')) {//特殊订单类型
......@@ -1088,23 +1141,12 @@ class ServiceProviderController extends BaseController
foreach ($request->input('ad_urgent') as $ku => $vu) {
$post['ad_urgent'] .= $vu . ",";
}
$post['ad_urgent'] = trim($post['ad_urgent'],',');
} else {
$post['ad_urgent'] = "";
}
}
$post['company_name'] = trimall($request->input('company_name'));//服务中心名称
if ($request->input('is_ice') == 1) {
$poss['service_name'] = trimall($request->input('service_name'));//公司
$post['deduct'] = $request->input('fdeduct') . ',' . $request->input('deduct');//扣点数值.
$post['invoice'] = $request->input('invoice');//增\普票
}
if ($request->input('is_ice') == 2) {
$poss['service_name'] = trimall($request->input('service_name'));//公司
$post['deduct'] = '0,' . $request->input('deduct');//扣点数值.
$post['invoice'] = 3;//增\普票(不开票)
}
$post['type'] = $request->input('type');//结算对象
$post['mouth_pay'] = $request->input('mouth_pay');//结算对象
$poss['service_name'] = trimall($request->input('service_name'));//公司
$post['brand_service'] = $request->input('brand_service');//品牌服务
if(is_array($request->input('service_type'))){
$post['service_type'] = implode(',',$request->input('service_type'));//门店服务类型
......@@ -1134,7 +1176,7 @@ class ServiceProviderController extends BaseController
DB::beginTransaction(); //开启事务
$upAdm = Admin::where('id', $id)->update($post);
$upInf = AdminInfor::where('admin_id', $id)->update($poss);
$upInf = AdminInfor::where('admin_id', $id)->where('inf_company_id',$session['company_id'])->update($poss);
$adRes = DB::table('admin_address')->where('admin_id', $id)->delete();
if ($upAdm || $upInf || $adRes) {
......
......@@ -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)
......
......@@ -1579,7 +1579,12 @@ class OrderService extends Service
$drid = '';
$shiid = '';
$region = new Region();
if ($input['xian'] != '市、县级市') {
if (in_array($sheng, $shengs) && strpos($shi, $sheng) === false) {
$shr_xian = $region->whereRaw("reg_level=3 and (reg_name like '%" . $shi . "%' or reg_alias like '%" . $shi . "%') and reg_blnum='" . $shr_shi['reg_num'] . "'")->first();
if ($shr_xian) {
$drid = $shr_xian['reg_id'];
}
}else if ($input['xian'] != '市、县级市') {
$shr_xian = $region->whereRaw("reg_level=3 and (reg_name like '%" . $input['xian'] . "%' or reg_alias like '%" . $input['xian'] . "%') and reg_blnum='" . $shr_shi['reg_num'] . "'")->first();
if ($shr_xian) {
$drid = $shr_xian['reg_id'];
......@@ -1603,9 +1608,9 @@ class OrderService extends Service
$xian = 2;
}
if ($xian == 1) {
$serPro = Bserviss::leftJoin('admin','admin.id','=','bservisnew.bs_serid')->whereRaw("find_in_set('" . $dress['are_id'] . "',bs_areid) and bs_status='1' and enable=1 and (company_id = '".$session['company_id']."') or admin_groupnew=3")->get();
$serPro = Bserviss::leftJoin('admin','admin.id','=','bservisnew.bs_serid')->leftJoin('admin_infor','admin_infor.admin_id','=','bservisnew.bs_serid')->whereRaw("find_in_set('" . $dress['are_id'] . "',bs_areid) and bs_status='1' and inf_enable=1 and (inf_company_id = '".$session['company_id']."') or admin_groupnew=3")->get();
} else {
$serPro = Bserviss::leftJoin('admin','admin.id','=','bservisnew.bs_serid')->whereRaw("bs_sid='" . $dress['are_sid'] . "' and bs_status='1' and enable=1 and (company_id = '".$session['company_id']."') or admin_groupnew=3")->get();
$serPro = Bserviss::leftJoin('admin','admin.id','=','bservisnew.bs_serid')->leftJoin('admin_infor','admin_infor.admin_id','=','bservisnew.bs_serid')->whereRaw("bs_sid='" . $dress['are_sid'] . "' and bs_status='1' and inf_enable=1 and (inf_company_id = '".$session['company_id']."') or admin_groupnew=3")->get();
}
if ($serPro) {
$serPro = $serPro->toarray();
......@@ -1657,8 +1662,8 @@ class OrderService extends Service
/*--------------------------------------验证订单客户地址结束------------------------------------------*/
/*--------------------------------------获取对应服务商信息开始--------------------------------------------*/
$where = ['id_searchin'=>$admin_id,'enable'=>1,'ad_project_findinset'=>$category];
$admin_id = array_unique($admin_id);
$where = ['gone_admin.id_searchin'=>$admin_id,'inf_enable'=>1,'ad_project_findinset'=>$category];
// if($pt_id == 453)
$pt_id_arr = PlatformService::getPtIdByPtType();
if(in_array($pt_id, $pt_id_arr))
......@@ -1676,20 +1681,26 @@ class OrderService extends Service
// $where['admin_groupnew'] = 2;
if($session['company_id']==14){
$wherecompany1['company_id'] = $session['company_id'];
$wherecompany1['gone_admin_infor.inf_company_id'] = $session['company_id'];
$wherecompany1['company_type'] = 1;
$wherecompany1['admin_groupnew'] = 2;
$wherecompany2['id_searchin'] = [91,101];
$wherecompany2['gone_admin.id_searchin'] = [91,101];
$where['wherecompany_searchor']['wherecompany1_next_level'] = $wherecompany1;
$where['wherecompany_searchor']['wherecompany2_next_level'] = $wherecompany2;
}else {
$where['company_id'] = $session['company_id'];
$where['gone_admin_infor.inf_company_id'] = $session['company_id'];
$where['company_type'] = 1;
$where['admin_groupnew'] = 2;
}
}
$list = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner','children_id','ad_brand','ad_project','brand_service'],['is_sord'=>'DESC']);
$where = CommonService::jointWhere($where);
$list = DB::table('admin')
->leftJoin('admin_infor', 'admin.id', '=', 'admin_infor.admin_id')
->whereRaw($where)
->select('admin.id','admin_infor.inf_company_name as company_name','is_lidao','owner','children_id','admin_infor.inf_ad_brand as ad_brand','ad_project','brand_service', 'admin_infor.inf_company_id as company_id','admin_infor.inf_mouth_pay as mouth_pay','admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid')
->orderBy('is_sord','DESC')
->get()->toArray();
// $list = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner','children_id','ad_brand','ad_project','brand_service'],['is_sord'=>'DESC']);
if($list){
$children_id = [];
......@@ -1705,29 +1716,31 @@ class OrderService extends Service
}else{
return ['Data' => '', 'ErrorMessage' => '暂无推荐数据admin', 'ErrorCode' => ErrorInc::DATA_EMPTY];
}
if($children_id){
$children_id=implode(',',$children_id);
$admin_infor = new AdminInfor();
$inforsearch = ['admin_id_searchin'=>$children_id,'admin_province_rlike'=>$sheng,'admin_city_rlike'=>$shi];
if($input['xian']!='市、县级市'){
$inforsearch = array_merge($inforsearch,['admin_county_rlike'=>$input['xian']]);
}
$children = CommonService::getMysqlData($admin_infor, $inforsearch , ['admin_id']);
if($children){
$cadmin_id = array_column($children, 'admin_id');
$admin_id = array_merge($admin_id,$cadmin_id);
$lists = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner','children_id','ad_brand','ad_project','brand_service'],['is_sord'=>'DESC']);
if($lists){
$list = array_merge($list,$lists);
}
}
}
$admin_infor = new AdminInfor();
$children = CommonService::getMysqlData($admin_infor, ['admin_id_searchin'=>$admin_id] , ['admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid']);
$admin_list = [];
if($children){
$admin_list = CommonService::jointArrayKey($children, 'admin_id');
}
//逻辑存在问题
// if($children_id){
// $children_id=implode(',',$children_id);
// $admin_infor = new AdminInfor();
// $inforsearch = ['admin_id_searchin'=>$children_id,'admin_province_rlike'=>$sheng,'admin_city_rlike'=>$shi];
// if($input['xian']!='市、县级市'){
// $inforsearch = array_merge($inforsearch,['admin_county_rlike'=>$input['xian']]);
// }
// $children = CommonService::getMysqlData($admin_infor, $inforsearch , ['admin_id']);
// if($children){
// $cadmin_id = array_column($children, 'admin_id');
// $admin_id = array_merge($admin_id,$cadmin_id);
// $lists = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner','children_id','ad_brand','ad_project','brand_service'],['is_sord'=>'DESC']);
// if($lists){
// $list = array_merge($list,$lists);
// }
// }
// }
// $admin_infor = new AdminInfor();
// $children = CommonService::getMysqlData($admin_infor, ['admin_id_searchin'=>$admin_id] , ['admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid']);
// $admin_list = [];
// if($children){
// $admin_list = CommonService::jointArrayKey($children, 'admin_id');
// }
/*--------------------------------------获取对应服务商信息结束--------------------------------------------*/
if($list){
......@@ -1740,10 +1753,10 @@ class OrderService extends Service
}else{
$brand_serviceshow = '';
}
$adminInfo = $admin_list[$vri['id']];
$list[$kri]['verstorename'] = $adminInfo['verstorename']??'';
$list[$kri]['verstoreid'] = ''; //$adminInfo['verstoreid']??'';
$list[$kri]['dress'] = $adminInfo['admin_province']." ".$adminInfo['admin_city']." ".$adminInfo['admin_county']." ".$adminInfo['admin_dressi'];
// $adminInfo = $admin_list[$vri['id']];
$list[$kri]['verstorename'] = $vri['verstorename']??'';
$list[$kri]['verstoreid'] = ''; //$vri['verstoreid']??'';
$list[$kri]['dress'] = $vri['admin_province']." ".$vri['admin_city']." ".$vri['admin_county']." ".$vri['admin_dressi'];
if(in_array($vri['id'], $ser_ids)){
$zhichi="支持";
if(isset($flag) && $flag=='4'){
......@@ -1753,14 +1766,14 @@ class OrderService extends Service
}else{
$list[$kri]['company_name']=$vri['company_name'].$brand_serviceshow;
}
$city = $adminInfo['admin_province'];
if($adminInfo['admin_longitude'] && $adminInfo['admin_latitude']){
$start = $adminInfo['admin_longitude'].','.$adminInfo['admin_latitude'];
$city = $vri['admin_province'];
if($vri['admin_longitude'] && $vri['admin_latitude']){
$start = $vri['admin_longitude'].','.$vri['admin_latitude'];
}else{
$address = $adminInfo['admin_dressi'];
$start = CommonService::jingwei($adminInfo['admin_province'],$address);
$address = $vri['admin_dressi'];
$start = CommonService::jingwei($vri['admin_province'],$address);
}
if($adminInfo['admin_dressi']=='' || $start ==''){
if($vri['admin_dressi']=='' || $start ==''){
$list[$kri]['juli'] = '';
$list[$kri]['jl'] = 100000;
$lists[] = $list[$kri];
......@@ -1825,8 +1838,8 @@ class OrderService extends Service
$verstorename_id = array_column($verstorename_id, 'admin_id');
$company_name_or['id_searchin'] = $verstorename_id;
}
$company_name_or['company_name_like'] = $input['company_name'];
$where = ['company_name_searchor'=>$company_name_or,'enable'=>1,'ad_project_findinset'=>$category];
$company_name_or['inf_company_name_like'] = $input['company_name'];
$where = ['company_name_searchor'=>$company_name_or,'inf_enable'=>1,'ad_project_findinset'=>$category];
$pt_id_arr = PlatformService::getPtIdByPtType();
if(in_array($pt_id, $pt_id_arr))
......@@ -1837,28 +1850,35 @@ class OrderService extends Service
if ($session && $session['admin_groupnew'] != 7) {//管理员可以看全部
if($session['company_id']==14){
$wherecompany1['company_id'] = $session['company_id'];
$wherecompany1['inf_company_id'] = $session['company_id'];
$wherecompany1['company_type'] = 1;
$wherecompany1['admin_groupnew'] = 2;
$wherecompany2['id_searchin'] = [91,101];
$wherecompany2['gone_admin.id_searchin'] = [91,101];
$where['wherecompany_searchor']['wherecompany1_next_level'] = $wherecompany1;
$where['wherecompany_searchor']['wherecompany2_next_level'] = $wherecompany2;
}else {
$where['company_id'] = $session['company_id'];
$where['inf_company_id'] = $session['company_id'];
$where['company_type'] = 1;
$where['admin_groupnew'] = 2;
}
}
CommonService::startmysql();
$list = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner','children_id','ad_brand','ad_project','brand_service'],['is_sord'=>'DESC']);
// CommonService::startmysql();
// $list = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner','children_id','ad_brand','ad_project','brand_service'],['is_sord'=>'DESC']);
$where = CommonService::jointWhere($where);
$list = DB::table('admin')
->leftJoin('admin_infor', 'admin.id', '=', 'admin_infor.admin_id')
->whereRaw($where)
->select('admin.id','admin_infor.inf_company_name as company_name','is_lidao','owner','children_id','admin_infor.inf_ad_brand as ad_brand','ad_project','brand_service', 'admin_infor.inf_company_id as company_id','admin_infor.inf_mouth_pay as mouth_pay','admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid')
->orderBy('is_sord','DESC')
->get()->toArray();
if($list){
$admin_id = array_column($list, 'id');
$admin_infor = new AdminInfor();
$children = CommonService::getMysqlData($admin_infor, ['admin_id_searchin'=>$admin_id] , ['admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid']);
$admin_list = [];
if($children){
$admin_list = CommonService::jointArrayKey($children, 'admin_id');
}
// $admin_infor = new AdminInfor();
// $children = CommonService::getMysqlData($admin_infor, ['admin_id_searchin'=>$admin_id] , ['admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid']);
// $admin_list = [];
// if($children){
// $admin_list = CommonService::jointArrayKey($children, 'admin_id');
// }
$lists = [];
$jingwei = [];
$end = CommonService::jingwei($input['sheng'],$input['sheng'].$input['shi'].$input['xian'].$input['address']);
......@@ -1868,8 +1888,8 @@ class OrderService extends Service
}else{
$brand_serviceshow = '';
}
$adminInfo = $admin_list[$vri['id']];
$list[$kri]['verstorename'] = $adminInfo['verstorename']??'';
// $adminInfo = $admin_list[$vri['id']];
$list[$kri]['verstorename'] = $vri['verstorename']??'';
$list[$kri]['verstoreid'] = ''; //$adminInfo['verstoreid']??'';
if(in_array($vri['id'], $ser_ids)){
$zhichi="支持";
......@@ -1880,14 +1900,14 @@ class OrderService extends Service
}else{
$list[$kri]['company_name']=$vri['company_name'].$brand_serviceshow;
}
$city = $adminInfo['admin_province'];
if($adminInfo['admin_longitude'] && $adminInfo['admin_latitude'] && $vri['is_lidao']=='2'){
$start = $adminInfo['admin_longitude'].','.$adminInfo['admin_latitude'];
$city = $vri['admin_province'];
if($vri['admin_longitude'] && $vri['admin_latitude'] && $vri['is_lidao']=='2'){
$start = $vri['admin_longitude'].','.$vri['admin_latitude'];
}else{
$address = $adminInfo['admin_dressi'];
$start = CommonService::jingwei($adminInfo['admin_province'],$address);
$address = $vri['admin_dressi'];
$start = CommonService::jingwei($vri['admin_province'],$address);
}
if($adminInfo['admin_dressi']=='' || $start ==''){
if($vri['admin_dressi']=='' || $start ==''){
$list[$kri]['juli'] = '';
$list[$kri]['jl'] = 100000;
$lists[] = $list[$kri];
......@@ -1946,7 +1966,16 @@ class OrderService extends Service
if($checkKey['code']!=1){
return ['Data' => '', 'ErrorMessage' => '参数'.$checkKey['data'].'未填写,或值为空', 'ErrorCode' => ErrorInc::INVALID_PARAM];
}
$where['id'] = $input['service_id'];
$where['inf_company_id'] = $session['company_id'];
$where['company_type'] = 1;
$where = CommonService::jointWhere($where);
$list = DB::table('admin')
->leftJoin('admin_infor', 'admin.id', '=', 'admin_infor.admin_id')
->whereRaw($where)
->select('admin.id','admin_infor.inf_company_name as company_name','is_lidao','owner','children_id','admin_infor.inf_ad_brand as ad_brand','ad_project','brand_service', 'admin_infor.inf_company_id as company_id','admin_infor.inf_mouth_pay as mouth_pay')
->orderBy('is_sord','DESC')
->get()->toArray();
$list = AdminsService::getAdmins(['id'=>$input['service_id'],'company_id'=>$session['company_id'],'company_type'=>1],['id','company_name','is_lidao','owner','children_id','ad_brand','ad_project','brand_service'],['is_sord'=>'DESC']);
if($list){
foreach( $list as $kri => $vri ){
......@@ -1970,15 +1999,15 @@ class OrderService extends Service
if($checkKey['code']!=1){
return ['Data' => '', 'ErrorMessage' => '参数'.$checkKey['data'].'未填写,或值为空', 'ErrorCode' => ErrorInc::INVALID_PARAM];
}
$where = ['enable'=>1,'ad_project_findinset'=>$category];
$where = ['inf_enable'=>1,'ad_project_findinset'=>$category];
if(isset($input['company_name']) && !empty($input['company_name'])) {
$where['company_name_like'] = $input['company_name'];
$where['inf_company_name_like'] = $input['company_name'];
}
if(isset($session['company_id'])){
$where['company_id'] = $session['company_id'];
$where['inf_company_id'] = $session['company_id'];
}else {
$where['company_id'] = $input['company_id'];
$where['inf_company_id'] = $input['company_id'];
}
$where['company_type'] = 2;
$pt_id_arr = PlatformService::getPtIdByPtType();
......@@ -1987,28 +2016,35 @@ class OrderService extends Service
{
$where['service_type_findinset'] = '3';
}
$list = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner'],['is_sord'=>'DESC']);
$where = CommonService::jointWhere($where);
$list = DB::table('admin')
->leftJoin('admin_infor', 'admin.id', '=', 'admin_infor.admin_id')
->whereRaw($where)
->select('admin.id','admin_infor.inf_company_name as company_name','is_lidao','owner','children_id','admin_infor.inf_ad_brand as ad_brand','ad_project','brand_service', 'admin_infor.inf_company_id as company_id','admin_infor.inf_mouth_pay as mouth_pay','admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid')
->orderBy('is_sord','DESC')
->get()->toArray();
// $list = AdminsService::getAdmins($where,['id','company_name','is_lidao','owner'],['is_sord'=>'DESC']);
if($list){
$admin_id = array_column($list, 'id');
$admin_infor = new AdminInfor();
$children = CommonService::getMysqlData($admin_infor, ['admin_id_searchin'=>$admin_id] , ['admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid']);
$admin_list = [];
if($children){
$admin_list = CommonService::jointArrayKey($children, 'admin_id');
}
// $admin_id = array_column($list, 'id');
// $admin_infor = new AdminInfor();
// $children = CommonService::getMysqlData($admin_infor, ['admin_id_searchin'=>$admin_id] , ['admin_id','admin_longitude','admin_latitude','admin_province','admin_city','admin_county','admin_dressi','verstorename','verstoreid']);
// $admin_list = [];
// if($children){
// $admin_list = CommonService::jointArrayKey($children, 'admin_id');
// }
$lists = [];
$jingwei = [];
$end = CommonService::jingwei($input['sheng'],$input['sheng'].$input['shi'].$input['xian'].$input['address']);
foreach( $list as $kri => $vri ){
$adminInfo = $admin_list[$vri['id']];
$city = $adminInfo['admin_province'];
if($adminInfo['admin_longitude'] && $adminInfo['admin_latitude'] && $vri['is_lidao']=='2'){
$start = $adminInfo['admin_longitude'].','.$adminInfo['admin_latitude'];
// $adminInfo = $admin_list[$vri['id']];
$city = $vri['admin_province'];
if($vri['admin_longitude'] && $vri['admin_latitude'] && $vri['is_lidao']=='2'){
$start = $vri['admin_longitude'].','.$vri['admin_latitude'];
}else{
$address = $adminInfo['admin_dressi'];
$start = CommonService::jingwei($adminInfo['admin_province'],$address);
$address = $vri['admin_dressi'];
$start = CommonService::jingwei($vri['admin_province'],$address);
}
if($adminInfo['admin_dressi']=='' || $start ==''){
if($vri['admin_dressi']=='' || $start ==''){
$list[$kri]['juli'] = '';
$list[$kri]['jl'] = 100000;
$lists[] = $list[$kri];
......
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论