Commit 79a37aea by 王召彬

Merge branch 'master' of http://git.2b3.cn/tencent/services

parents 461fde4f 5c22f5f7
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/29
* Time: 12:03
*/
namespace Hdll\Services\Auth\Enum;
class AuthEnum
{
const SCOPE_BUYER = 1; //买家
const SCOPE_CMAN = 2; //手艺人
const SCOPE_SELLER = 3; //卖家
const SCOPE_ADMIN = 4;//管理员
}
\ No newline at end of file
......@@ -13,6 +13,12 @@ class BargainEnum
//订单状态
const STATUS_NORMAL = 10; //待支付
//paystatus
const HAVE_PAY =2;
const PAY_EXCEPTION = 3;
}
\ No newline at end of file
......@@ -10,14 +10,14 @@
namespace Hdll\Services\Bargain\Lib;
use Hdll\Services\Bargain\Enum\BargainEnum;
use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @method ResultInterface deferGetgoodsinfo( int $limit_id)
* @method ResultInterface deferGetBargainInfo( int $limit_id)
* @method ResultInterface deferGetgoodsinfo(int $limit_id)
* @method ResultInterface deferGetBargainInfo(int $limit_id)
*/
interface BargainInterface
{
......@@ -25,19 +25,18 @@ interface BargainInterface
/**
* 获取砍价商品的 商品信息
* @param int $bargain_id
* @return {
"name" 名称
"image" 图片
"price" 价格
"activityName" 活动名称
* @return {
* "name" 名称
* "image" 图片
* "price" 价格
* "activityName" 活动名称
* }
*/
public function getGoodsInfo(
int $stordId,int $bargain_id
int $stordId, int $bargain_id
);
/**
* 通过商品id 获取是否 有砍价活动
* @param int $storeId
......@@ -45,10 +44,23 @@ interface BargainInterface
* @return bool
*
*/
public function getBargainInfo(
int $storeId,int $goodsId
public function getBargainInfo(
int $storeId, int $goodsId
);
/**
* 支付 状态 回馈接口
* @param string $storeId //
* @param int $bargainbranchId // 砍价活动id
* @param int $status // BargainEnum::HAVE_PAY 成功支付 BargainEnum::PAY_EXCEPTION:未支付 (已经过期或者支付异常)
* @return mixed
*/
public function payStatus(
string $storeId,
int $bargainbranchId,
int $status , //
int $orderId);
}
......
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/31
* Time: 17:25
*/
namespace Hdll\Services\Buyer\Enum;
class BillEnum
{
const STATE_BALANCE_FALSE = 1; //未入账
const STATE_BALANCE_TRUE = 2; //已入账
}
\ No newline at end of file
......@@ -39,5 +39,16 @@ interface BillInterface{
public function getListByOrderId(int $storeId, int $orderId);
public function updateByCondition(int $storeId, array $condition, array $info);
/**
* 退款成功逻辑
*
* @param $storeId
* @param $orderId
* @return mixed
*/
public function refundSuccess($storeId, $orderId);
}
\ No newline at end of file
......@@ -52,4 +52,13 @@ interface CommissionInterface
*/
public function addTotalCommission($storeId, $buyerId, $money);
/**
* 增加冻结金额
*
* @param int $storeId
* @param int $orderId
* @return mixed
*/
public function addExpectCommission(int $storeId, int $orderId);
}
\ No newline at end of file
......@@ -26,10 +26,8 @@ class Upload
public function __construct(array $config = [])
{
if (empty($config)) {
/**@var Config */
$bConfig = \Swoft\App::getBean('config');
$bConfig->load('@vendor/hdll/services/src/Common/Config');
$config = $bConfig->get('qCloud');
$config = include alias('@vendor/hdll/services/src/Common/Config').'/config.php';
$config = $config['qCloud'];
}
$this->Bucket = $config['Bucket'];
$this->Region = $config['Region'];
......@@ -68,4 +66,27 @@ class Upload
}
return $result;
}
public function uploadStream($stream, $name = '')
{
$cosClient = new Client(
[
'region' => $this->Region,
'credentials' => [
'secretId' => $this->SecretId,
'secretKey' => $this->SecretKey,
]
]
);
try {
$result = $cosClient->Upload(
$this->Bucket,
$name,
$stream
);
} catch (\Exception $e) {
throw new CommonException(['msg' => $e->getMessage()]);
}
return $result;
}
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ class BuyerPoolConfig extends PoolProperties
public function __construct()
{
// 区别本地和线上的RPC服务地址
$this->uri = explode(',', env('RPC_AUTH_URI', 'buyer:8099'));
$this->uri = explode(',', env('RPC_BUYER_URI', 'buyer:8099'));
}
/**
......
<?php
/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://doc.swoft.org
* @contact group@swoft.org
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Hdll\Services\Common\Pool\Config;
use Swoft\Bean\Annotation\Bean;
use Swoft\Pool\PoolProperties;
/**
* the config of service WithdrawCash
*
* @Bean()
*/
class TransferPoolConfig extends PoolProperties
{
public function __construct()
{
$this->uri=explode(',',env('RPC_TRANSFER_URI','transfer:8099'));
}
protected $name = 'transfer';
/**
* Minimum active number of connections
*
* @var int
*/
protected $minActive = 5;
/**
* the maximum number of active connections
*
* @var int
*/
protected $maxActive = 50;
/**
* the maximum number of wait connections
*
* @var int
*/
protected $maxWait = 100;
/**
* Maximum waiting time
*
* @var int
*/
protected $maxWaitTime = 3;
/**
* Maximum idle time
*
* @var int
*/
protected $maxIdleTime = 60;
/**
* the time of connect timeout
*
* @var int
*/
protected $timeout = 5;
/**
* the addresses of connection
*
* <pre>
* [
* '127.0.0.1:88',
* '127.0.0.1:88'
* ]
* </pre>
*
* @var array
*/
protected $uri = [];
/**
* whether to user provider(consul/etcd/zookeeper)
*
* @var bool
*/
protected $useProvider = false;
/**
* the default balancer is random balancer
*
* @var string
*/
protected $balancer = '';
/**
* the default provider is consul provider
*
* @var string
*/
protected $provider = '';
}
......@@ -12,6 +12,8 @@ use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferGet($storeId, $id)
* @method ResultInterface deferIncSales($storeId, $goodsId)
* @method ResultInterface deferDecSales($storeId, $goodsId)
* Interface GoodsInterface
* @package Hdll\Services\Goods\Lib
*/
......@@ -39,4 +41,25 @@ interface GoodsInterface
*/
public function get($storeId, $id);
/**
* 增加商品销量
* 减少商品库存
* @param $storeId
* @param $goodsId
* @return mixed
* @author Administrator
*/
public function incSales($storeId, $goodsId);
/**
* 减少商品销量
* 增加商品库存
* @param $storeId
* @param $goodsId
* @return mixed
* @author Administrator
*/
public function decSales($storeId, $goodsId);
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ use Swoft\Core\ResultInterface;
interface GroupBookingInterface{
public function paySuccess($orderId);
public function paySuccess($orderId,$storeId);
public function hasActivity($storeId,$goodsId);
......
......@@ -44,10 +44,10 @@ interface LimitTimeBuyInterface
* 获取限时购商品的 商品信息
* @param int $limit_id
* @return {
"name" 名称
"image" 图片
"price" 价格
"activityName" 活动名称
* "name" 名称
* "image" 图片
* "price" 价格
* "activityName" 活动名称
* }
*/
public function getLimitGoods(
......@@ -66,4 +66,16 @@ interface LimitTimeBuyInterface
);
// /**
// * 支付 状态 回馈接口
// * @param string $store_id
// * @param int $limit_id
// * @param int $status // status :1 成功支付 2:未支付 (已经过期或者支付异常)
// * @return mixed
// */
// public function paystatus(
// string $store_id,
// int $limit_id,
// int $status,
// int $orderId);
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/4
* Time: 10:46
*/
namespace Hdll\Services\Notice\Common;
class WxMiniNotice
{
/**
* 微信小程序page生成
*
* 用法:
* WxMiniNotice::generatePage("pages/orderShow/orderShow",['orderId' => $orderInfo['id'], 'storeId' => $orderInfo['storeId']])
* 生成
* pages/orderShow/orderShow?orderId=1&storeId=7
* @param string $page
* @param array $param
* @return string
*/
public static function generatePage(string $page, array $param)
{
$param['origin'] = $param['origin']??'notice';
$param = http_build_query($param);
return $page.$param;
}
}
\ No newline at end of file
......@@ -46,15 +46,16 @@ interface NoticeInterface
*
* 短信发送消息数据结构
$data[NoticeEnum::TENCENT_SMS] = [
$data[NoticeEnum::TYPE_TENCENT_SMS] = [
[
"templateId" => "178822", //模板id
"phoneNumber" => "18812345678",
"param" => [ //模板变量名
"phoneNumber" => "17558430002",
"param" => [ //模板变量名
"1580",
"5"
]
];
]
];
*
* @param array $sendTypes
* @param array $data
......
......@@ -22,6 +22,7 @@ class OrderEnum
const STATUS_CLOSED = 70; //已关闭
const STATUS_REFUNDING = 80; //退款中
const STATUS_EVALUATION = 90; //已评价
const STATUS_COLLECTION = 100; //团购进行中
//订单类型
const TYPE_GOODS = 0; //商品订单
......@@ -36,7 +37,19 @@ class OrderEnum
self::TYPE_COLLECTION,
];
const PAID_STATUS = [
//可以直接预约的订单类型
const CAN_RESERVE = [
self::TYPE_GOODS,
self::TYPE_CUT_PRICE,
self::TYPE_LIMIT,
];
const PAY_STATUS = [ //支付状态
self::STATUS_PAID,
self::STATUS_COLLECTION
];
const PAID_STATUS = [ //支付后的所有状态数组
self::STATUS_PAID,
self::STATUS_DELIVERY,
self::STATUS_DELIVERED,
......
......@@ -15,43 +15,49 @@ use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @method ResultInterface deferCreateOrder( string $token,int $consignee_id,int $activity_id,int $selected_num,int $order_type,float $total,float $goods_price,string $goods_name,string $goods_image,string $activity_name,int $goodsId,string $reservation_time = '')
* @method ResultInterface deferCreateOrder(int $buyerId,int $storeId,int $consigneeId,int $itemId,int $selectedNum,int $orderType,int $total,int $activityPrice,string $goodsName,string $goodsImage,string $activityName,int $goodsId,int $goodsPrice,string $reservation_time = '');
* @method ResultInterface deferGetOrderInfoBySn(int $storeId, string $orderSn)
* @method ResultInterface deferGetOrderInfo(int $storeId,int $orderId)
* @method ResultInterface deferUpdateInfoById(int $storeId,int $orderId, array $updateInfo)
* @method ResultInterface deferGetSimpleList($storeId, $condition, $fields = ['*'])
* @method ResultInterface deferUpdateInfoByIds(int $storeId,array $orderIds, array $updateInfo)
* @method ResultInterface deferCollectionClose(int $storeId, int $orderId);
*/
interface OrderInterface
{
/**
* 创建订单
*
* @param int $buyerId
* @param int $storeId
* @param int $consignee_id
* @param int $item_id
* @param int $selected_num
* @param int $order_type
* @param float $total
* @param float $goods_price
* @param string $goods_name
* @param string $goods_image
* @param string $activity_name
* @param int $goodsId,
* @param int $consigneeId
* @param int $itemId
* @param int $selectedNum
* @param int $orderType
* @param int $total
* @param int $activityPrice
* @param string $goodsName
* @param string $goodsImage
* @param string $activityName
* @param int $goodsId
* @param int $goodsPrice
* @param string $reservation_time
* @return mixed
*/
public function createOrder(
int $buyerId,
int $storeId,
int $consignee_id,
int $item_id,
int $selected_num,
int $order_type,
float $total,
float $goods_price,
string $goods_name,
string $goods_image,
string $activity_name,
int $consigneeId,
int $itemId,
int $selectedNum,
int $orderType,
int $total,
int $activityPrice,
string $goodsName,
string $goodsImage,
string $activityName,
int $goodsId,
int $goodsPrice,
string $reservation_time = '');
public function getOrderInfo(int $storeId,int $orderId);
......@@ -59,4 +65,74 @@ interface OrderInterface
public function getOrderInfoBySn(int $storeId, string $orderSn);
public function updateInfoById(int $storeId,int $orderId, array $updateInfo);
public function closeOrder(int $storeId,int $orderId);
/**
* 获取订单数据
* 字段值
* `id`,
`orderSn`,
`paySn`,
`orderType` '订单类型:0普通商品,1活动',
`storeId`, 店铺id
`buyerId` ,买家id
`itemId` '0',
`consigneeId` '付款人(收货人)ID,当线下订单时为空',
`goodsAmount` ,
`orderAmount` '订单应付款',
`actualAmount` '订单实付款',
`refundAmount` '退款金额',
`state` '订单状态:0(已取消)10(默认):未付款;20:已付款;30:已发货/已预约;40:已收货/已核销;50-申请退款;60退款成功,70 已关闭,80,退款中,90,已评价',
`refundState` '0' COMMENT '退款状态:0是无退款,1是部分退款,2是全部退款',
`refundMsg`'退款原因',
`lockState` '锁定状态:0是正常,大于0是锁定',
`lockMsg` '订单锁定原因',
`balanceState` '对账状态:0-未对账,1-已对账',
`balanceTime` '对账时间',
`message` ,
`reservationTime` ,
`createTime` 创建时间,
`updateTime` 更新时间,
`deleteTime` 删除时间,
`sellerId` '卖家id',
`deliveredTime` '核销时间',
*
*
* @param $storeId
* @param $condition
* @param array $fields
* @return mixed
*/
public function getSimpleList($storeId, $condition, $fields = ['*']);
/**
* 退款成功
*
* @param int $storeId
* @param array $orderInfo
* @return mixed
*/
public function refundSuccess(int $storeId, array $orderInfo);
/**
* 拼团关闭订单,含退款
*
* @param int $storeId
* @param int $orderId
* @return mixed
*/
public function collectionClose(int $storeId, int $orderId);
/**
* 批量更新
*
* @param int $storeId
* @param array $orderIds
* @param array $updateInfo
* @return mixed
*/
public function updateInfoByIds(int $storeId,array $orderIds, array $updateInfo);
}
\ No newline at end of file
......@@ -12,13 +12,53 @@ use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferCreateOrder(int $storeId, int $orderId, int $openId)
* @method ResultInterface deferGenerateSellerSign(int $storeId, int $orderId, string $openId)
* @method ResultInterface deferRePay(int $storeId, int $orderId, int $buyerId)
* @method ResultInterface deferSellerRePay(int $storeId, int $orderId, int $sellerId)
*
* Interface PayInterface
* @package Hdll\Services\Pay\Lib
*/
interface PayInterface
{
/**
* 买家生成签名
*
* @param int $storeId
* @param int $orderId
* @param string $openId
* @return mixed
*/
public function generateSign(int $storeId, int $orderId, string $openId);
/**
* 卖家生成签名
*
* @param int $storeId
* @param int $orderId
* @param string $openId
* @return mixed
*/
public function generateSellerSign(int $storeId, int $orderId, string $openId);
/**
* 卖家重新支付生成签名
*
* @param int $storeId
* @param int $orderId
* @param int $sellerId
* @return mixed
*/
public function sellerRePay(int $storeId, int $orderId, int $sellerId);
/**
* 买家重新支付,生成签名
*
* @param int $storeId
* @param int $orderId
* @param int $buyerId
* @return mixed
*/
public function rePay(int $storeId, int $orderId, int $buyerId);
}
......@@ -18,6 +18,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferAddTotal($seller, $money)
* @method ResultInterface deferReduceTotal($seller, $money)
* @method ResultInterface deferAddExpectFund($seller, $money)
* @method ResultInterface deferReduceExpectFund($seller, $money)
* @method ResultInterface deferAddFund($seller, $money)
* Interface SellerInterface
* @package App\Lib
......@@ -85,6 +86,15 @@ interface SellerFundInterface
public function addExpectFund($sellerId,$money);
/**
* 减少冻结金额
* @param $sellerId
* @param $money
* @return mixed
* @author Administrator
*/
public function reduceExpectFund($sellerId, $money);
/**
* 增加金额
* @param $sellerId
* @param $balanceFund 可提现金额
......
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/28
* Time: 10:15
*/
namespace Hdll\Services\Transfer\Lib;
use Swoft\Core\ResultInterface;
/**
* 提现服务
*
* @method ResultInterface deferWithdraw($paySn, $openId, $realName, $amount, $type, $storeId, $withdrawId)
* Interface WithdrawInterface
* @package Hdll\Services\Transfor\Lib
*/
interface WithdrawInterface
{
public function withdraw($paySn, $openId, $realName, $amount, $type, $storeId, $withdrawId);
}
\ No newline at end of file
......@@ -12,16 +12,13 @@ use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferOpenVip($storeId,$orderId,$money)
* @method ResultInterface deferUpdate($storeId,$condition, $data)
* Interface SellerInterface
* @package App\Lib
*/
interface VipInterface
{
public function openVip($storeId,$orderId,$money);
public function openVip($storeId,$orderId);
public function update($storeId,$condition, $data);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment