Commit 5bc6be65 by 王召彬

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

parents b418745a 8e2c234d
......@@ -9,12 +9,6 @@ namespace Hdll\Services\Auth\Enum;
class AuthError
{
const PARAMETER_ERR = ["msg" => "参数错误", "code" => 500, "errorCode" => 25001];
const TOKEN_ERROR = ["msg" => "token写入失败", "code" => 500, "errorCode" => 25100];
const WX_ERROR = ["msg" => "获取信息失败", "code" => 500, "errorCode" => 25101];
const CONFIG_ERROR = ["msg" => "配置不正确", "code" => 500, "errorCode" => 25102];
const GET_TOKEN_ERROR = ["msg" => "获取token失败", "code" => 500, "errorCode" => 25103];
const NOT_FOUND_USER = ["msg" => "获取用户信息失败", "code" => 404, "errorCode" => 25104];
......
......@@ -11,4 +11,8 @@ class BuyerEnum
{
const SCORE = 0;
//state
const STATE_NORMAL = 0;
const STATE_FREEZE = 0;
}
\ No newline at end of file
......@@ -20,19 +20,19 @@ interface BillInterface{
/**
* 保存账单数据
* @param int $order_id
* @param int $buyer_id
* @param int $store_id
* @param string $order_sn
* @param int $money
* @param int $orderId //订单id
* @param int $buyerId // 买家id
* @param int $storeId // 店铺id
* @param string $orderSn //订单号
* @param int $money //订单金额
* @return mixed
* @author Administrator
*/
public function saveBill(
int $order_id,
int $buyer_id,
int $store_id,
string $order_sn,
int $orderId,
int $buyerId,
int $storeId,
string $orderSn,
int $money
);
......
......@@ -17,9 +17,63 @@ use Swoft\Core\ResultInterface;
*/
interface BuyerInterface
{
/**
* 获取用户信息
*
* @param int $storeId
* @param int $buyerId
* @return mixed
array(8) {
["id"]=> int(1) //买家id
["unionId"]=>string(28) "oyDnT5OYVCQUC9X9ErkDHBNrad90"
["storeId"]=>int(0)//店铺id
["referId"]=>int(0)//推荐人ID
["state"]=>int(0)//买家状态
["nickName"]=>string(0) ""买家昵称
["profile"]=>
array(4) {
["realName"]=>string(12) "真实姓名"
["gender"]=>int(1)//性别
["phoneNumber"]=>string(11) "18812345678"//手机号
["birthday"]=>int(0) //生日
}
["commission"]=>
array(3) {
["totalCommission"]=>int(10)//总共提现
["balanceCommission"]=>int(10)//可提现金额
["expectCommission"]=>int(20)//冻结提现金额
}
}
*
*/
public function getUser(int $storeId, int $buyerId);
/**
* 更新用户信息
* $updateInfo = [
"realName" => "真实姓名",
"gender" => "性别",
"phoneNumber" => "手机号",
"birthday" => "生日"
];
* @param string $token
* @param array $data
* @return mixed
*/
public function updateProfile(string $token, array $data);
/**
* 是否已经注册用户
* @param $storeId
* @param $unionid
* @return mixed
*
* 返回值:
* array(3) {
["id"]=> int(1)//买家id
["storeId"]=> int(1) //店铺id
["referId"]=> int(0) //推荐人id
}
*/
public function hasUser($storeId,$unionid);
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ interface CommissionInterface
* @param $storeId
* @param $buyerId
* @param $money
* @return mixed|bool
* @return bool
*/
public function reduceBalanceCommission($storeId, $buyerId, $money);
......
......@@ -96,7 +96,7 @@ class CommonEntity extends Model
$res = new \ReflectionClass(static::class);
self::$commentString = $res->getDocComment();
if ( false !== strpos(self::$commentString,"{split}") && App::$isInTest) {
if ( false !== strpos(self::$commentString,"{split}") && !App::$isInTest) {
$dbNum = self::getDbNum();
$tableName = self::getTableName().'_'.$dbNum;
self::setTableName($tableName);
......
<?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 user
*
* @Bean()
*/
class GoodsPoolConfig extends PoolProperties
{
protected $name = 'seller';
/**
* 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 = [
'192.168.3.39:8400',
];
/**
* 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 = '';
}
......@@ -20,7 +20,7 @@ use Swoft\Pool\PoolProperties;
class OrderPoolConfig extends PoolProperties
{
protected $name = 'buyer';
protected $name = 'order';
/**
* Minimum active number of connections
......
<?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 user
*
* @Bean()
*/
class ReservationPoolConfig extends PoolProperties
{
protected $name = 'reservation';
/**
* 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 = [
'192.168.3.23:8095',
'192.168.3.23:8095',
];
/**
* 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 = '';
}
<?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 user
*
* @Bean()
*/
class SchedulePoolConfig extends PoolProperties
{
protected $name = 'schedule';
/**
* 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 = [
'192.168.3.23:8096',
'192.168.3.23:8096',
];
/**
* 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 = '';
}
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/8
* Time: 10:43
*/
namespace Hdll\Services\Goods\Lib;
use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferGet($storeId,$id)
* Interface GoodsInterface
* @package Hdll\Services\Goods\Lib
*/
interface GoodsInterface{
/**
* 获取商品
* @param $storeId
* 'gcId', 'asId', 'stock', 'name', 'image', 'price', 'state', 'body', 'originalPrice'
* @return [
* 'gcId' 商品类ID
* 'asId' 服务ID
* 'stock' 库存
* 'name' 名称
* 'image' 图片
* 'price' 价格
* 'state' 状态
* 'body' 描述
* 'originalPrice' 原价
* 'sales' 销量
* ]
* @param $id
* @return mixed
* @author Administrator
*/
public function get($storeId,$id);
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/8
* Time: 10:43
*/
namespace Hdll\Services\GroupBooking\Lib;
use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferPaySuccess($orderId)
* Interface GoodsInterface
* @package Hdll\Services\Goods\Lib
*/
interface GroupBookingInterface{
public function paySuccess($orderId);
}
\ No newline at end of file
......@@ -24,8 +24,9 @@ class OrderEnum
//订单类型
const TYPE_GOODS = 0; //商品订单
const TYPE_KANJIA = 1; //砍价订单
const TYPE_CUT_PRICE = 1; //砍价订单
const TYPE_LIMIT = 2; //限时购订单
const TYPE_COLLECTION = 3; //限时购订单
//对账状态
const BALANCE_STATE_FALSE = 0; //未对账
......
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/7/20
* Time: 11:13
*/
namespace Hdll\Services\Order\Enum;
class OrderError
{
//common
const PARAMETER_ERR = ["msg" => "参数错误", "code" => 400, "errorCode" => 22001];
const PERMISSION_DENIED = ["msg" => "没有权限,%s", "code" => 401, "errorCode" => 22104];
//validator
const UNDEFINED_VALIDATOR = ["msg" => "未定义验证其验证器%s","code" => 500, "errorCode" => 22100];
const EMPTY_COMPARE_VALUE = ["msg" => "对比数值不能为空", "code" => 500, "errorCode" => 22101];
const UNKONW_OPERATION = ["msg" => "未知操作符%s", "code" => 500, "errorCode" => 22102];
//联系人
const NO_FOUND_CONSIGNEE = ["msg" => "未找到联系人信息", "code" => 404, "errorCode" => 22103];
//预约
const RESERVATION_OVERRUN = ["msg" => "预约时间不能早于当前时间", "code" => 400, "errorCode" => 22105];
const RES_IS_REST = ["msg" => "休息日不能添加预约", "code" => 400, "errorCode" => 22106];
//买家
const FREEZE = ["msg" => "休息日不能添加预约", "code" => 400, "errorCode" => 22107];
//order
const O_PRICE_ABNORMAL = ["msg" => "价格异常,请重新购买", "code" => 400, "errorCode" => 22108];
const O_TYPE_ERR = ["msg" => "订单类型不正确", "code" => 400, "errorCode" => 22109];
const O_CREATE_ERR = ["msg" => "创建订单失败", "code" => 500, "errorCode" => 22110];
const O_GOODS_SAVE_ERR = ["msg" => "商品订单存入失败", "code" => 500, "errorCode" => 22111];
const O_CUT_PRICE_SAVE_ERR = ["msg" => "砍价订单存入失败", "code" => 500, "errorCode" => 22115];
const O_NOT_FOUND = ["msg" => "订单不存在", "code" => 404, "errorCode" => 22116];
const O_STATUS_ERR = ["msg" => "订单状态错误,无法操作", "code" => 400, "errorCode" => 22117];
const DB_ERROR = ["msg" => "数据库操作错误", "code" => 500, "errorCode" => 22118];
public static function atranslate($message,$param)
{
if ( empty($param) ) {
return $message;
}
array_unshift($param,$message);
return sprintf(...$param);
}
}
\ No newline at end of file
......@@ -16,13 +16,15 @@ 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,string $reservation_time = '')
* @method ResultInterface deferGetOrderInfoBySn(int $storeId, string $orderSn)
* @method ResultInterface deferGetOrderInfo(int $storeId,int $orderId)
*/
interface OrderInterface
{
/**
* 创建订单
* @param string $token
* @param int $buyerId
* @param int $storeId
* @param int $consignee_id
* @param int $item_id
* @param int $selected_num
......@@ -36,7 +38,8 @@ interface OrderInterface
* @return mixed
*/
public function createOrder(
string $token,
int $buyerId,
int $storeId,
int $consignee_id,
int $item_id,
int $selected_num,
......@@ -49,4 +52,6 @@ interface OrderInterface
string $reservation_time = '');
public function getOrderInfo(int $storeId,int $orderId);
public function getOrderInfoBySn(int $storeId, string $orderSn);
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/9
* Time: 13:44
*/
namespace Hdll\Services\Pay\Lib;
use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferCreateOrder(int $storeId, int $orderId, int $openId)
* Interface PayInterface
* @package Hdll\Services\Pay\Lib
*/
interface PayInterface
{
public function generateSign(int $storeId, int $orderId, int $openId);
}
......@@ -16,60 +16,80 @@ use Swoft\Core\ResultInterface;
/**
* The interface of Reservation service
*
* @method ResultInterface deferGetReservById(int $id)
* @method ResultInterface deferGetReservByDateId(int $storeId, int $dateId)
* @method ResultInterface deferGetReservListByOrderId(int $storeId, $orderId)
* @method ResultInterface deferModifyReservById(int $id)
* @method ResultInterface deferCancelReservById(int $id)
* @method ResultInterface deferGetReservById(int $storeId, int $id)
* @method ResultInterface deferGetReservListByOrderId(int $storeId, int $orderId, int $state = 0, int $type = 1)
* @method ResultInterface deferModifyReservById(int $storeId, int $id, array $data)
* @method ResultInterface deferAddReservation(int $storeId, int $orderId, int $buyerId, int $cmanId, int $reservTime, string $memo, int $type)
* @method ResultInterface deferCancelReservById(int $storeId, int $id)
* @method ResultInterface deferCancelReservByOrderId(int $storeId, int $orderId)
*/
interface ReservationInterface
{
/**
* 获取某个预约的信息
*
* @param integer $storeId,
* @param integer $id
* @return array
*/
public function getReservById(int $id);
/**
* 根据日期id,获取商家某一天的所有预约
*
* @param integer $storeId
* @param integer $dateId
* @return array
*/
public function getReservByDateId(int $storeId, int $dateId);
public function getReservById(int $storeId, int $id);
/**
* 根据订单id,获取商家某个订单包含的所有预约
*
* @param integer $storeId
* @param integer $orderId
* @return void
* @param integer $state
* @param integer $type
* @return array
*/
public function getReservListByOrderId(int $storeId, int $orderId);
public function getReservListByOrderId(int $storeId, int $orderId, int $state = 0, int $type = 1);
/**
* 修改某个预约信息
*
* @param integer $storeId,
* @param integer $id
* @param array $data
* $data 字段说明:
* ['state'] => 预约状态,默认0,如果正常结束则为1
* ['type'] => 预约类型,备用
* ['reservTime'] => 预约时间,时间戳格式
* ['isConfirm'] => 1表示商家确认预约
* ['reservTime'] => 预约时间,整形,时间戳格式
* ['memo'] => 预约备注
* @return int 返回成功修改的条数
*/
public function modifyReservById(int $id, array $data);
public function modifyReservById(int $storeId, int $id, array $data);
/**
* 添加预约
*
* @param integer $storeId
* @param integer $orderId
* @param integer $buyerId
* @param integer $cmanId 手艺人id
* @param integer $reservTime 预约的时间
* @param string $memo 预约备注
* @param integer $type 预约类型,备用
* @return integer 添加成功则返回记录id
*/
public function addReservation(int $storeId, int $orderId, int $buyerId, int $cmanId, int $reservTime, string $memo, int $type = 1);
/**
* 取消某个预约
*
* @param integer $storeId
* @param integer $id
* @return boolean 返回取消结果
*/
public function cancelReservById(int $id);
public function cancelReservById(int $storeId, int $id);
/**
* 根据订单id取消该订单下的所有预约
*
* @param integer $storeId
* @param integer $orderId
* @return boolean 返回取消结果
*/
public function cancelReservByOrderId(int $storeId, int $orderId);
}
\ No newline at end of file
......@@ -13,12 +13,53 @@ use Swoft\Core\ResultInterface;
/**
*
* @method ResultInterface deferGetFund($sellerId)
* @method ResultInterface deferAddBalance($sellerId)
* @method ResultInterface deferReduceBalance($sellerId)
* @method ResultInterface deferAddTotal($sellerId)
* @method ResultInterface deferReduceTotal($sellerId)
* Interface SellerInterface
* @package App\Lib
*/
interface SellerFundInterface
{
/**
* 增加提现金额
* @param $seller
* @param $money
* @return mixed
* @author Administrator
*/
public function addBalance($seller, $money);
/**
* 减少提现金额
* @param $seller
* @param $money
* @return mixed
* @author Administrator
*/
public function reduceBalance($seller, $money);
/**
* 增加总提现金额
* @param $seller
* @param $money
* @return mixed
* @author Administrator
*/
public function addTotal($seller, $money);
/**
* 减少总提现金额
* @param $seller
* @param $money
* @return mixed
* @author Administrator
*/
public function reduceTotal($seller, $money);
/**
*
* @param $sellerId
......
......@@ -11,6 +11,10 @@ use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferSaveBill($orderId, $sellerId, $money)
* @method ResultInterface deferGetCommission($sellerId)
* method ResultInterface deferAddBalance($sellerId, $money)
* method ResultInterface deferReduceBalance($sellerId, $money)
* method ResultInterface deferAddTotal($sellerId, $money)
* method ResultInterface deferReduceTotal($sellerId, $money)
* Interface SellerDistributionInterface
* @package App\Lib
*/
......@@ -39,4 +43,40 @@ interface SellerDistributionInterface{
* @author Administrator
*/
public function getCommission($sellerId);
/**
* 增加佣金
* @param $sellerId
* @param $money
* @return mixed
* @author Administrator
*/
public function addBalance($sellerId, $money);
/**
* 减少佣金
* @param $sellerId
* @param $money
* @return mixed
* @author Administrator
*/
public function reduceBalance($sellerId, $money);
/**
* 增加累计佣金
* @param $sellerId
* @param $money
* @return mixed
* @author Administrator
*/
public function addTotal($sellerId, $money);
/**
* 减少累计佣金
* @param $sellerId
* @param $money
* @return mixed
* @author Administrator
*/
public function reduceTotal($sellerId, $money);
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/10
* Time: 14:14
*/
namespace Hdll\Services\Transfer\Enum;
class TransferEnum
{
const SUCCESS = 0;
const FAIL = 1;
const RETRY = 2;
}
\ 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