|
|
|
<?php
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: 萤火科技 <admin@yiovo.com>
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
declare (strict_types=1);
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
use think\response\Json;
|
|
|
|
use app\api\model\Retail as RetailModel;
|
|
|
|
use app\api\model\RetailOrder as RetailOrderModel;
|
|
|
|
use app\api\model\Agreement as AgreementModel;
|
|
|
|
use app\common\model\RetailDescribe as RetailDescribeModel;
|
|
|
|
use app\api\service\order\Checkout as CheckoutService;
|
|
|
|
use app\api\service\User as UserService;
|
|
|
|
use app\common\enum\RetailDescribeEnum;
|
|
|
|
|
|
|
|
class Retail extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取零售批发会员列表
|
|
|
|
* @param int $retailType
|
|
|
|
* @return Json
|
|
|
|
*/
|
|
|
|
public function list(int $retailType): Json
|
|
|
|
{
|
|
|
|
$list = RetailModel::withoutGlobalScope()->where('retail_type',$retailType)->where('retail_status',10)->select();
|
|
|
|
return $this->renderSuccess(compact('list'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取软件付费协议
|
|
|
|
* @return Json
|
|
|
|
*/
|
|
|
|
public function getSoftAgreement(): Json
|
|
|
|
{
|
|
|
|
$params = $this->request->param();
|
|
|
|
if (empty($params['type'])) {
|
|
|
|
return $this->renderSuccess("参数错误");
|
|
|
|
}
|
|
|
|
$detail = AgreementModel::detail(['type' => $params['type']]);
|
|
|
|
if (!empty($detail->content)) {
|
|
|
|
$detail->content = str_ireplace('nowrap', 'inherit', $detail->content);
|
|
|
|
}
|
|
|
|
return $this->renderSuccess(compact('detail'));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取零售批发会员列表
|
|
|
|
* @param int $retailType
|
|
|
|
* @return Json
|
|
|
|
*/
|
|
|
|
public function retailPayList(): Json
|
|
|
|
{
|
|
|
|
$client = $this->request->post();
|
|
|
|
if (!$client['client']) {
|
|
|
|
return $this->renderError('客户端不能为空');
|
|
|
|
}
|
|
|
|
$model =new \app\api\service\Retail();
|
|
|
|
$list = $model->userCenter($client);
|
|
|
|
$list['retail'] = '<p style="text-wrap: wrap;">
|
|
|
|
1、客户直接在商城查看价格,快速比价、下单
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
2、所有会员、分销数字化管理
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
3、所有订单,调货记录,物流状态实时查询
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
4、供应链资源快速对接
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
5、商品数据快速上架,商城之间数据实时传输
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
6、商品市场价实时自动更新
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
7、货款到账时间支持当天或隔天,支付费率低
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
至千分之2.x
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
8、支持到店自提、同城闪送
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
9、促进清洗、安装、维修、回收、租赁服务与产品销售一体化
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
10、促进本地商家联盟数字化平台化发展
|
|
|
|
</p>
|
|
|
|
<p style="text-align: left;">
|
|
|
|
<br/>
|
|
|
|
</p>';
|
|
|
|
$list['wholesale'] = '<p style="text-wrap: wrap;">
|
|
|
|
1、客户直接在商城查看价格,快速比价、下单
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
2、所有会员、分销数字化管理
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
3、所有订单,调货记录,物流状态实时查询
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
4、供应链资源快速对接
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
5、商品数据快速上架,商城之间数据实时传输
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
6、商品市场价实时自动更新
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
7、货款到账时间支持当天或隔天,支付费率低
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
至千分之2.x
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
8、支持到店自提、同城闪送
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
9、促进清洗、安装、维修、回收、租赁服务与产品销售一体化
|
|
|
|
</p>
|
|
|
|
<p style="text-wrap: wrap;">
|
|
|
|
10、促进本地商家联盟数字化平台化发展
|
|
|
|
</p>
|
|
|
|
<p style="text-align: left;">
|
|
|
|
<br/>
|
|
|
|
</p>';
|
|
|
|
return $this->renderSuccess(compact('list'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function submit(): Json
|
|
|
|
{
|
|
|
|
$method = $this->request->post('method');
|
|
|
|
if (!$method) {
|
|
|
|
return $this->renderError('支付方式不能为空');
|
|
|
|
}
|
|
|
|
$client = $this->request->post('client');
|
|
|
|
if (!$client) {
|
|
|
|
return $this->renderError('客户端不能为空');
|
|
|
|
}
|
|
|
|
$retailPriceId = intval($this->request->post('retail_price_id'));
|
|
|
|
if (!$retailPriceId) {
|
|
|
|
return $this->renderError('缺少必要参数');
|
|
|
|
}
|
|
|
|
$service = new \app\api\service\Retail();
|
|
|
|
$data = $service->setMethod($method)
|
|
|
|
->setClient($client)
|
|
|
|
->orderPay($retailPriceId);
|
|
|
|
return $this->renderSuccess($data, $service->getMessage() ?: '下单成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商厂权限
|
|
|
|
*/
|
|
|
|
public function describe()
|
|
|
|
{
|
|
|
|
$type = $this->request->get('type')??10;
|
|
|
|
$list = RetailDescribeModel::withoutGlobalScope()->where(['description_status' =>10,'type' => $type])->select();
|
|
|
|
$group = [];
|
|
|
|
foreach($list as $item){
|
|
|
|
|
|
|
|
$group[$item['plate_id']]['list'][] = $item;
|
|
|
|
$group[$item['plate_id']]['name'] = RetailDescribeEnum::$version[$item['plate_id']] ?? "" ;
|
|
|
|
}
|
|
|
|
return $this->renderSuccess(compact('group'));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|