增加:配送商关联商户列表信息接口

This commit is contained in:
wuhui_zzw 2024-06-18 10:58:07 +08:00
parent 616204376d
commit afedf06e01
3 changed files with 52 additions and 4 deletions

View File

@ -4,7 +4,9 @@ namespace app\common\repositories\marketing\agent;
use app\common\dao\marketing\agent\AgentDeliveryDao;
use app\common\model\marketing\agent\AgentDelivery;
use app\common\model\system\merchant\Merchant;
use app\common\repositories\BaseRepository;
use app\common\repositories\marketing\AgentRepository;
use app\common\repositories\store\order\StoreOrderCreateRepository;
use app\common\repositories\store\order\StoreOrderRepository;
use crmeb\services\LockService;
@ -78,12 +80,37 @@ class AgentDeliveryRepository extends BaseRepository{
*/
public function createPaymentRecord($params){
return AgentDelivery::insertGetId([
'agent_id' => $params['agent_id'] ?? 0,
'price' => $params['money'] ?? 0,
'agent_id' => $params['agent_id'] ?? 0,
'price' => $params['money'] ?? 0,
'title_quota' => $params['title_quota'] ?? 0,
'other_quota' => $params['other_quota'] ?? 0,
]);
}
/**
* Common: 获取配送商相关的商户信息
* Author: wu-hui
* Time: 2024/06/18 9:47
* @param array $params
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getMerList(array $params,int $page,int $limit){
$query = Merchant::where('agent_id',(int)$params['agent_id'])
->field('mer_id,mer_name,mer_phone,mer_address,mer_avatar')
->when(isset($params['search_text']) && $params['search_text'] !== '',function($query) use ($params){
$query->whereLike('mer_name|mer_phone', "%{$params['search_text']}%");
})
->order("mer_id DESC");
$count = $query->count();
$list = $query->page($page,$limit)->select()->toArray();
return compact('count','list');
}

View File

@ -66,10 +66,29 @@ class Delivery extends BaseController{
if($res) return $res;
else return app('json')->success("操作成功");
}
// 缴费记录获取
public function paymentRecord(){}
/**
* Common: 获取相关商户
* Author: wu-hui
* Time: 2024/06/18 9:47
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function merList(){
// 参数处理
[$page,$limit] = $this->getPage();
$params = $this->request->params([
['agent_id',0],
['search_text',''],
]);
// 信息列表获取
$data = $this->repository->getMerList((array)$params,(int)$page,(int)$limit);
return app('json')->success($data);
}

View File

@ -423,6 +423,8 @@ Route::group('api/', function () {
Route::post('delivery/create_order', 'Delivery/createOrder');// 生成支付订单
Route::get('delivery/payment_record', 'Delivery/paymentRecord');// 缴费记录
Route::get('delivery/mer_list', 'Delivery/merList');// 绑定商户
})->prefix('api.marketing.agent.');