pull/5/head
zengyyh 4 months ago
parent 4d2513a17a
commit 8ca65deade
  1. 6
      app/admin/controller/RetailDescribe.php
  2. 114
      app/api/controller/Retail.php
  3. 12
      app/api/service/Notify.php
  4. 2
      app/api/service/Retail/PaySuccess.php
  5. 10
      app/api/service/Retail/Payment.php
  6. 4
      app/api/service/Store.php
  7. 14
      app/common/enum/OrderType.php
  8. 4
      app/common/enum/RetailDescribeEnum.php
  9. 8
      app/common/enum/user/balanceLog/Scene.php

@ -12,6 +12,7 @@ declare (strict_types=1);
namespace app\admin\controller; namespace app\admin\controller;
use app\store\model\RetailDescribe as retDescribeModel; use app\store\model\RetailDescribe as retDescribeModel;
use app\common\enum\RetailDescribeEnum;
class RetailDescribe extends Controller class RetailDescribe extends Controller
{ {
@ -47,4 +48,9 @@ class RetailDescribe extends Controller
return $this->renderError($model->getError() ?: '删除失败'); return $this->renderError($model->getError() ?: '删除失败');
} }
public function getPlate(){
$list = RetailDescribeEnum::$version;
return $this->renderSuccess(compact('list'));
}
} }

@ -11,12 +11,14 @@
declare (strict_types=1); declare (strict_types=1);
namespace app\api\controller; namespace app\api\controller;
use app\admin\controller\RetailDescribe;
use think\response\Json; use think\response\Json;
use app\api\model\Retail as RetailModel; use app\api\model\Retail as RetailModel;
use app\api\model\RetailOrder as RetailOrderModel; use app\api\model\RetailOrder as RetailOrderModel;
use app\api\model\Agreement as AgreementModel; use app\api\model\Agreement as AgreementModel;
use app\common\model\RetailDescribe as RetailDescribeModel; use app\common\model\RetailDescribe as RetailDescribeModel;
use app\api\service\order\Checkout as CheckoutService; use app\api\service\order\Checkout as CheckoutService;
use app\api\service\Retail as RetailService;
use app\api\service\User as UserService; use app\api\service\User as UserService;
use app\common\enum\RetailDescribeEnum; use app\common\enum\RetailDescribeEnum;
@ -65,77 +67,71 @@ class Retail extends Controller
} }
$model =new \app\api\service\Retail(); $model =new \app\api\service\Retail();
$list = $model->userCenter($client); $list = $model->userCenter($client);
$list['retail'] = '<p style="text-wrap: wrap;"> $list['retail'] = '<p>
1客户直接在商城查看价格,快速比价、下单 1-客户直接在商城查看价格,快速比价、下单
</p> </p>
<p style="text-wrap: wrap;"> <p>
2所有会员、分销数字化管理 2-所有会员、分销数字化管理
</p> </p>
<p style="text-wrap: wrap;"> <p>
3所有订单,调货记录,物流状态实时查询 3-所有订单,调货记录,物流状态实时查询
</p> </p>
<p style="text-wrap: wrap;"> <p>
4供应链资源快速对接 4-供应链资源快速对接
</p> </p>
<p style="text-wrap: wrap;"> <p>
5商品数据快速上架,商城之间数据实时传输 5-商品数据快速上架,商城之间数据实时传输
</p> </p>
<p style="text-wrap: wrap;"> <p>
6商品市场价实时自动更新 6-商品市场价实时自动更新
</p> </p>
<p style="text-wrap: wrap;"> <p>
7货款到账时间支持当天或隔天,支付费率低&nbsp; &nbsp;&nbsp; 7-货款到账时间支持当天或隔天,支付费率低&nbsp; &nbsp;&nbsp;
</p> </p>
<p style="text-wrap: wrap;"> <p>
&nbsp; &nbsp;至千分之2.x &nbsp; &nbsp;至千分之2.x
</p> </p>
<p style="text-wrap: wrap;"> <p>
8支持到店自提、同城闪送 8-支持到店自提、同城闪送
</p> </p>
<p style="text-wrap: wrap;"> <p>
9促进清洗、安装、维修、回收、租赁服务与产品销售一体化 9-促进清洗、安装、维修、回收、租赁服务与产品销售一体化
</p> </p>
<p style="text-wrap: wrap;"> <p>
10、促进本地商家联盟数字化平台化发展 10-促进本地商家联盟数字化平台化发展
</p>
<p style="text-align: left;">
<br/>
</p>'; </p>';
$list['wholesale'] = '<p style="text-wrap: wrap;"> $list['wholesale'] = '<p>
1、客户直接在商城查看价格,快速比价、下单 1-采购代发商家实名注册认证,在线直接下单
</p>
<p style="text-wrap: wrap;">
2、所有会员、分销数字化管理
</p> </p>
<p style="text-wrap: wrap;"> <p>
3、所有订单,调货记录,物流状态实时查询 2-认证商家、服务商数字化管理
</p> </p>
<p style="text-wrap: wrap;"> <p>
4、供应链资源快速对接 3-所有订单,发货记录,物流状态实时查询
</p> </p>
<p style="text-wrap: wrap;"> <p>
5、商品数据快速上架,商城之间数据实时传输 4-所有调货记录在线实时查看
</p> </p>
<p style="text-wrap: wrap;"> <p>
6、商品市场价实时自动更新 5-审单实时做电话、地址校验比对,避免平台单
</p> </p>
<p style="text-wrap: wrap;"> <p>
7、货款到账时间支持当天或隔天,支付费率低&nbsp; &nbsp;&nbsp; 6-供应链资源快速对接
</p> </p>
<p style="text-wrap: wrap;"> <p>
&nbsp; &nbsp;至千分之2.x 7-商品数据快速上架,商城之间商品数据实时传输
</p> </p>
<p style="text-wrap: wrap;"> <p>
8、支持到店自提、同城闪送 8-商品市场价实时自动更新
</p> </p>
<p style="text-wrap: wrap;"> <p>
9、促进清洗、安装、维修、回收、租赁服务与产品销售一体化 9-货款到账时间支持当天或隔天,支付费率低&nbsp; &nbsp;&nbsp;
</p> </p>
<p style="text-wrap: wrap;"> <p>
10、促进本地商家联盟数字化平台化发展 &nbsp; &nbsp;至千分之2.x
</p> </p>
<p style="text-align: left;"> <p>
<br/> 10-供应商、服务商入驻,销售和推广效益提升
</p>'; </p>';
return $this->renderSuccess(compact('list')); return $this->renderSuccess(compact('list'));
} }
@ -179,4 +175,24 @@ class Retail extends Controller
} }
/**
* 交易查询
* @param string $outTradeNo 商户订单号
* @param string $method 支付方式
* @param string $client 指定的客户端
* @return Json
* @throws \cores\exception\BaseException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function tradeQuery(string $outTradeNo, string $method, string $client): Json
{
$RechargeService = new RetailService;
$result = $RechargeService->setMethod($method)->setClient($client)->tradeQuery($outTradeNo);
$message = $result ? '恭喜您,余额充值成功' : ($RechargeService->getError() ?: '很抱歉,订单未支付,请重新发起');
return $this->renderSuccess(['isPay' => $result], $message);
}
} }

@ -83,6 +83,7 @@ class Notify
$platformCertificateFilePath = PaymentTemplateModel::realPathCertFile( $platformCertificateFilePath = PaymentTemplateModel::realPathCertFile(
PaymentMethodEnum::WECHAT, $fileName, $templateInfo['store_id'] PaymentMethodEnum::WECHAT, $fileName, $templateInfo['store_id']
); );
// 验证异步通知是否合法并获取第三方支付交易订单号 // 验证异步通知是否合法并获取第三方支付交易订单号
$V3 = new WechatPaymentV3(); $V3 = new WechatPaymentV3();
$outTradeNo = $V3->notify($apiv3Key, $platformCertificateFilePath); $outTradeNo = $V3->notify($apiv3Key, $platformCertificateFilePath);
@ -211,6 +212,17 @@ class Notify
->setPaymentData($paymentData) ->setPaymentData($paymentData)
->handle(); ->handle();
} }
//订单支付成功事件(开通商城(批发零售商城))
if ($tradeInfo['order_type'] == OrderTypeEnum::RETAIL || $tradeInfo['order_type'] == OrderTypeEnum::SALE) {
$service = new Retail\PaySuccess();
$service->setOrderNo($tradeInfo['order_no'])
->setMethod($tradeInfo['pay_method'])
->setTradeId($tradeInfo['trade_id'])
->setPaymentData($paymentData)
->handle();
}
Log::append('Notify-orderPaySucces', ['message' => '订单支付成功']); Log::append('Notify-orderPaySucces', ['message' => '订单支付成功']);
} catch (\Throwable $e) { } catch (\Throwable $e) {
// 记录错误日志 // 记录错误日志

@ -220,7 +220,7 @@ class PaySuccess extends BaseService
UserModel::setDecBalance((int)$orderInfo['user_id'], (float)$orderInfo['pay_price']); UserModel::setDecBalance((int)$orderInfo['user_id'], (float)$orderInfo['pay_price']);
// 新增余额变动记录 // 新增余额变动记录
$type = SceneEnum::BUY_SHOP; $type = SceneEnum::BUY_SHOP;
if ($this->type == IdentityEnum::DEALER) { if ($this->type == SceneEnum::DEALER) {
$type = SceneEnum::DEALER; $type = SceneEnum::DEALER;
} }
BalanceLogModel::add($type, [ BalanceLogModel::add($type, [

@ -100,11 +100,11 @@ class Payment extends BaseService
// 构建第三方支付请求的参数 // 构建第三方支付请求的参数
$payment = $this->unifiedorder($extra); $payment = $this->unifiedorder($extra);
// 记录第三方交易信息 // 记录第三方交易信息
// $order_type = OrderTypeEnum::MEMBER;//开通会员 $order_type = OrderTypeEnum::RETAIL;//开通零售商城
// if ($this->orderInfo['order_type'] == IdentityEnum::DEALER) { if ($this->orderInfo['order_type'] == 20) {
// $order_type = OrderTypeEnum::DEALER;//开通分销商 $order_type = OrderTypeEnum::SALE;//开通批发商城
// } }
// $this->recordPaymentTrade($payment, $order_type); $this->recordPaymentTrade($payment, $order_type);
// 返回结果 // 返回结果
return compact('payment'); return compact('payment');
} }

@ -196,7 +196,9 @@ class Store extends BaseService
public function getStore() public function getStore()
{ {
$storeList = Db::query('select shop_id,shop_name,longitude,latitude from yoshop_store_shop where status = 1 and is_delete= 0'); $storeId = $this->storeId;
$storeList = Db::query('select shop_id,shop_name,longitude,latitude from yoshop_store_shop where status = 1 and is_delete= 0 AND store_id = ?',
[$storeId]);
return $storeList; return $storeList;
} }

@ -40,6 +40,12 @@ class OrderType extends EnumBasics
// 余额充值订单 // 余额充值订单
const RECHARGE = 100; const RECHARGE = 100;
//零售商城
const RETAIL = 70;
//批发商城
const SALE = 80;
/** /**
* 获取订单类型值 * 获取订单类型值
@ -75,6 +81,14 @@ class OrderType extends EnumBasics
self::WHOLESALER => [ self::WHOLESALER => [
'name' => '开通采购商订单', 'name' => '开通采购商订单',
'value' => self::WHOLESALER, 'value' => self::WHOLESALER,
],
self::RETAIL => [
'name' => '开通零售商城订单',
'value' => self::RETAIL,
],
self::SALE => [
'name' => '开通采批发商城订单',
'value' => self::SALE,
] ]
]; ];
} }

@ -18,6 +18,8 @@ class RetailDescribeEnum extends EnumBasics
const MULTI_MERCHANT = 11; const MULTI_MERCHANT = 11;
const CONTENT_MANAGEMENT = 12; const CONTENT_MANAGEMENT = 12;
const OTHER_FEATURES = 13; const OTHER_FEATURES = 13;
const BUYER = 14; // 采购商
const SERVICE_PROVIDER = 15; // 服务商
public static $version = [ public static $version = [
self::GOODS => "商品", self::GOODS => "商品",
@ -33,6 +35,8 @@ class RetailDescribeEnum extends EnumBasics
self::MULTI_MERCHANT => "多商户", self::MULTI_MERCHANT => "多商户",
self::CONTENT_MANAGEMENT => "内容管理", self::CONTENT_MANAGEMENT => "内容管理",
self::OTHER_FEATURES => "其他功能", self::OTHER_FEATURES => "其他功能",
self::BUYER => "采购商",
self::SERVICE_PROVIDER => "服务商"
]; ];
private function __construct() { private function __construct() {

@ -33,6 +33,9 @@ class Scene extends EnumBasics
// 订单退款 // 订单退款
const REFUND = 40; const REFUND = 40;
//购买商城
const BUY_SHOP = 50;
//开通分销商 //开通分销商
const DEALER = 70; const DEALER = 70;
@ -69,6 +72,11 @@ class Scene extends EnumBasics
'value' => self::REFUND, 'value' => self::REFUND,
'describe' => '订单退款:%s', 'describe' => '订单退款:%s',
], ],
self::BUY_SHOP => [
'name' => '购买商城',
'value' => self::BUY_SHOP,
'describe' => '购买商城:%s',
],
self::DEALER => [ self::DEALER => [
'name' => '开通分销商', 'name' => '开通分销商',
'value' => self::DEALER, 'value' => self::DEALER,

Loading…
Cancel
Save