@@ -0,0 +1,35 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/4 | |||
* Time: 15:49 | |||
*/ | |||
namespace app\admin\service; | |||
use app\admin\command\Util; | |||
use app\admin\model\Admin; | |||
use think\Exception; | |||
class AdminDao | |||
{ | |||
/** | |||
* 获取管理员信息 | |||
* @param int $id | |||
* @return array | |||
*/ | |||
public function getInfoById(int $id) { | |||
try{ | |||
$model = new Admin(); | |||
$info = $model->where(["id"=>$id])->find()->toArray(); | |||
if ($info == null) { | |||
return Util::returnArrEr("获取管理员信息失败:".$id); | |||
} | |||
return Util::returnArrSu($info); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("获取管理员信息失败:".$e->getMessage()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/4 | |||
* Time: 15:20 | |||
*/ | |||
namespace app\admin\service; | |||
use app\admin\command\Util; | |||
use app\admin\model\CfChannelInfo; | |||
use think\Exception; | |||
class CfChannelInfoDao | |||
{ | |||
/** | |||
* 获取渠道信息 | |||
* @param int $id | |||
* @return array | |||
*/ | |||
public function getInfoById(int $id) { | |||
try{ | |||
$model = new CfChannelInfo(); | |||
$info = $model->where(["id"=>$id])->find()->toArray(); | |||
if ($info == null) { | |||
return Util::returnArrEr("获取渠道信息失败:".$id); | |||
} | |||
return Util::returnArrSu($info); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("获取渠道信息失败:".$e->getMessage()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/4 | |||
* Time: 16:03 | |||
*/ | |||
namespace app\admin\service; | |||
use app\admin\command\Util; | |||
use app\admin\model\CfSuplierInfo; | |||
use think\Exception; | |||
class CfSuplierInfoDao | |||
{ | |||
/** | |||
* 获取供应商详情 | |||
* @param int $id | |||
* @return array | |||
*/ | |||
public function getInfoById(int $id) { | |||
try{ | |||
$model = new CfSuplierInfo(); | |||
$info = $model->where(["id"=>$id])->find()->toArray(); | |||
if ($info == null) { | |||
return Util::returnArrEr("获取供应商信息失败:".$id); | |||
} | |||
return Util::returnArrSu($info); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("获取供应商信息失败:".$e->getMessage()); | |||
} | |||
} | |||
} |
@@ -25,11 +25,23 @@ class OrderMainDao | |||
*/ | |||
public function save($param) { | |||
try{ | |||
//1、获取渠道 | |||
$channelDao = new CfChannelInfoDao(); | |||
$channelRe = $channelDao->getInfoById($param['channel_id']); | |||
if (!$channelRe['flag']) { | |||
return $channelRe; | |||
} | |||
//2.获取专员 | |||
$adminDao = new AdminDao(); | |||
$adminRe = $adminDao->getInfoById($param['commissioner_id']); | |||
if (!$adminRe['flag']) { | |||
return $adminRe; | |||
} | |||
$data = [ | |||
"commissioner_id"=>empty($param['commissioner_id'])?0:$param['commissioner_id'], | |||
"commissioner"=>$param["commissioner"], | |||
"commissioner_id"=>$param['commissioner_id'], | |||
"commissioner"=>$adminRe["data"]['nickname'], | |||
"channel_id"=>$param["channel_id"], | |||
"channel_name"=>$param["channel_name"], | |||
"channel_name"=>$channelRe['data']['channel_name'], | |||
"channel_order_no"=>$param["channel_order_no"], | |||
"user_name"=>$param["user_name"], | |||
"user_phone"=>$param["user_phone"], | |||
@@ -45,6 +45,7 @@ class OrderMainService | |||
$purchasePriceDao->delete($orderId); | |||
//循环子订单 | |||
foreach ($param['subOrderList'] as $subOrderParam) { | |||
$subOrderParam['group_id'] = $param['group_id']; | |||
/** | |||
* 2.添加子订单 有则激活更新、无则添加 | |||
*/ | |||
@@ -24,20 +24,32 @@ class PurchaseDao | |||
*/ | |||
public function saveHotelPurchase($param,$hotelOrder):array { | |||
try { | |||
//1.获取供应商名称 | |||
$suplierDao = new CfSuplierInfoDao(); | |||
$suplierRe = $suplierDao->getInfoById($param['supplier_id']); | |||
if (!$suplierRe['flag']) { | |||
return $suplierRe; | |||
} | |||
//2.获取负责人昵称 | |||
$adminDao = new AdminDao(); | |||
$adminRe = $adminDao->getInfoById($param['purchase_user_id']); | |||
if (!$adminRe['flag']) { | |||
return $adminRe; | |||
} | |||
$data = [ | |||
"order_id" => $hotelOrder['order_id'], | |||
"prod_type" => 'hotel', | |||
"order_detail_id" => $hotelOrder['id'], | |||
"group_id" => empty($param['group_id']), | |||
"group_id" => $param['group_id'], | |||
"pro_name" => $hotelOrder['hotel_name'], | |||
"item_name" => $hotelOrder['room_name'], | |||
"item_unit" => $hotelOrder['plan_name'], | |||
"check_in_date" => $param['check_in_date'], | |||
"check_out_date" => $param['check_out_date'], | |||
"supplier_id" => empty($param['supplier_id'])?0:$param['supplier_id'], | |||
"supplier_name" => empty($param['supplier_name'])?"":$param['supplier_name'], | |||
"purchase_user_id" => empty($param['purchase_user_id'])?0:$param['purchase_user_id'], | |||
"purchase_user" => empty($param['purchase_user'])?"":$param['purchase_user'], | |||
"supplier_id" => $param['supplier_id'], | |||
"supplier_name" => $suplierRe['data']['supplier_name'], | |||
"purchase_user_id" => $param['purchase_user_id'], | |||
"purchase_user" => $adminRe['data']['nickname'], | |||
"del_flag"=>0 | |||
]; | |||
@@ -62,6 +74,18 @@ class PurchaseDao | |||
*/ | |||
public function saveItemPurchase($param, $itemOrder):array { | |||
try { | |||
//1.获取供应商名称 | |||
$suplierDao = new CfSuplierInfoDao(); | |||
$suplierRe = $suplierDao->getInfoById($param['supplier_id']); | |||
if (!$suplierRe['flag']) { | |||
return $suplierRe; | |||
} | |||
//2.获取负责人昵称 | |||
$adminDao = new AdminDao(); | |||
$adminRe = $adminDao->getInfoById($param['purchase_user_id']); | |||
if (!$adminRe['flag']) { | |||
return $adminRe; | |||
} | |||
$data = [ | |||
"order_id" => $itemOrder['order_id'], | |||
"prod_type" => 'hotel', | |||
@@ -73,9 +97,9 @@ class PurchaseDao | |||
"check_in_date" => $param['check_in_date'], | |||
"check_out_date" => $param['check_out_date'], | |||
"supplier_id" => $param['supplier_id'], | |||
"supplier_name" => $param['supplier_name'], | |||
"supplier_name" => $suplierRe['data']['supplier_name'], | |||
"purchase_user_id" => $param['purchase_user_id'], | |||
"purchase_user" => $param['purchase_user'], | |||
"purchase_user" => $adminRe['data']['nickname'], | |||
"del_flag"=>0 | |||
]; | |||
$model = new Purchase(); | |||