Commit 661e2cd8 by 王召彬

Merge branch 'master' of http://139.199.22.180/tencent/services

parents ae52de85 5e413177
......@@ -29,14 +29,14 @@ class {daoName}
return ${varEntityName};
}
public function selectInfoByCondition($condition, $field)
public function selectInfoByCondition(array $condition, array $option)
{
return {entityName}::findAll($condition, ['fields' => $field])->getResult();
return {entityName}::findAll($condition, $option)->getResult();
}
public function getInfoByCondition($condition, $field)
public function getInfoByCondition(array $condition, array $option)
{
return {entityName}::findOne($condition, ['fields' => $field])->getResult();
return {entityName}::findOne($condition, $option)->getResult();
}
/**
......@@ -45,7 +45,7 @@ class {daoName}
* @param $updateInfo
* @return mixed
*/
public function updateByCondition($condition, $updateInfo)
public function updateByCondition(array $condition, array $updateInfo)
{
return {entityName}::updateAll($updateInfo, $condition)->getResult();
}
......@@ -57,9 +57,19 @@ class {daoName}
* @param $updateInfo
* @return mixed
*/
public function updateOne($condition, $updateInfo)
public function updateOne(array $condition, array $updateInfo)
{
return {entityName}::updateOne($updateInfo, $condition)->getResult();
}
public function delOne(array $condition)
{
return {entityName}::deleteOne($condition)->getResult();
}
public function delAll(array $condition)
{
return {entityName}::deleteAll($condition)->getResult();
}
}
\ No newline at end of file
......@@ -112,7 +112,7 @@ class GenerateCommand
private function generateDao($output,$daoName, $entityName)
{
if ( empty($entityName) ) {
$output->writeln("the en option is required", true, true);
$output->writeln("the entity name is required", true, true);
}
$daoName = empty($daoName)?$entityName.'Dao':$daoName;
......
......@@ -7,6 +7,7 @@
*/
namespace Hdll\Services\Common\Entity;
use Hdll\Services\Common\Bean\Collector\SplitCollector;
use Swoft\App;
use Swoft\Core\RequestContext;
use Swoft\Db\Bean\Collector\EntityCollector;
......@@ -78,7 +79,7 @@ class CommonEntity extends Model
/**
* 获取分库表名
*
* @return string|void
* @return string
* @throws Exception
* @throws \ReflectionException
*/
......@@ -89,8 +90,6 @@ class CommonEntity extends Model
return;
}
$request = RequestContext::getRequest();
//获取注解里的table
$res = new \ReflectionClass(static::class);
$commentString = $res->getDocComment();
......@@ -127,7 +126,10 @@ class CommonEntity extends Model
throw new Exception("店铺id获取失败");
}
return $store % 100;
$splitCollector = SplitCollector::getCollector();
$splitNum = $splitCollector[static::class]['num'];
return $store % $splitNum;
}
......
<?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 coupon
*
* @Bean()
*/
class CouponPoolConfig extends PoolProperties
{
public function __construct()
{
// 区别本地和线上的RPC服务地址
$this->uri = explode(',', env('RPC_COUPON_URI', 'coupon:8099'));
}
protected $name = 'coupon';
/**
* 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 = 200;
/**
* 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 = '';
}
<?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;
use Swoft\Bean\Annotation\Value;
/**
* @Bean()
* the config of service bargain
*/
class CustomerProfilesConfig extends PoolProperties
{
public function __construct()
{
// 区别本地和线上的RPC服务地址
$this->uri = explode(',', env('RPC_CUSTOMERPROFILES_URI', 'customerprofiles:8099'));
}
protected $name = 'customerprofiles';
/**
* 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 = 200;
/**
* the addresses of connection
*
* <pre>
* [
* '127.0.0.1:88',
* '127.0.0.1:88'
* ]
* </pre>
* @Value(name="", env="${RPC_BARGAIN_URI}")
* @var array
*/
protected $uri = [
'customerprofiles:8099',
];
/**
* 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/24
* Time: 15:28
*/
namespace Hdll\Services\Coupon\Enum;
class CouponEnum
{
// 优惠券状态:
const STATE_NOT_USED = 1; // 表示优惠券还未使用
const STATE_ORDER_HOLD = 2; // 表示订单下单时已占用,但还未真正使用
const STATE_USED = 3; // 表示优惠券已被使用
}
\ No newline at end of file
<?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\Coupon\Lib;
use Swoft\Core\ResultInterface;
/**
* The interface of coupon service
*
* @method ResultInterface deferCheckCoupon(int $buyerId, int $storeId, int $couponId, int $itemId)
* @method ResultInterface deferGetCouponRecvdList(int $buyerId, int $storeId, int $subStoreId = 0, int $itemId = 0)
* @method ResultInterface deferGetDataByCouponId(int $buyerId, int $storeId, int $couponId)
*/
interface CouponInterface
{
// 优惠券服务的字段说明:
// storeId
// subStoreId
// buyerId 买家ID
// state 状态,1未使用,2已下单还未付款,3已使用过
// couponId 当时领取的原始优惠券Id
// couponName 当时领取的原始优惠券名字
// parValue 优惠券面值
// allowItems 优惠券允许使用的商品列表
// addTime 领取时间
// usedTime 被使用的时间
/**
* 校验优惠券是否可用
*
* @param integer $buyerId
* @param integer $storeId
* @param integer $couponId
* @param integer $itemId
* @return int|boolen 如果可用返回优惠券的面值,不可用返回false
*/
public function checkCoupon(int $buyerId, int $storeId, int $couponId, int $itemId);
/**
* 更新优惠券状态
*
* @param integer $buyerId
* @param integer $storeId
* @param integer $couponId
* @param integer $state 优惠券的状态
* @return int 返回受影响的行数
*/
public function updateCouponState(int $buyerId, int $storeId, int $couponId, int $state);
/**
* 获取顾客领取的优惠券列表
*
* @param integer $buyerId
* @param integer $storeId
* @param integer $subStoreId
* @param integer $itemId
* @return array
*/
public function getCouponRecvdList(int $buyerId, int $storeId, int $subStoreId = 0, int $itemId = 0);
/**
* 根据优惠券ID获取信息
*
* @param integer $buyerId
* @param integer $storeId
* @param integer $couponId
* @return array
*/
public function getDataByCouponId(int $buyerId, int $storeId, int $couponId);
}
\ No newline at end of file
<?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\CustomerProfiles\Lib;
use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @method ResultInterface deferAddOrder($storeId, $orderId, $goodsId, $goodsName, $orderPrice, $orderType, $orderTime, $consigneeName, $consigneePhone, $buyerId,$activityName)
*/
interface ProfileInterface
{
/**
* 档案和消费信息入库
* @param $storeId
* @param $orderId
* @param $goodsId
* @param $goodsName
* @param $orderPrice
* @param $orderType
* @return mixed
*/
public function AddOrder($storeId, $orderId, $goodsId, $goodsName, $orderPrice, $orderType, $orderTime, $consigneeName, $consigneePhone, $buyerId,$activityName);
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/10/22
* Time: 14:11
*/
namespace Hdll\Services\Notice\Enum;
class NoticeRecordEnum
{
const TYPE_TENCENT_SMS = 1;
const STATE_SUCCESS = 1;
const STATE_FAIL = 2;
}
\ No newline at end of file
......@@ -13,4 +13,9 @@ class RedisKeyEnum
const ORDER_RESERVATION = self::PREFIX."order_reservation_";
const ORDER_RESERVATION_NOTICE = self::PREFIX."order_reservation_notice_";
}
\ No newline at end of file
......@@ -21,20 +21,24 @@ class TencentSMS implements SenderInterface
private $param;
public function __construct(string $phone, string $template, array $param)
private $storeId;
public function __construct(string $phone, string $template, array $param, int $storeId)
{
$this->phone = $phone;
$this->template = $template;
$this->param = $param;
$this->storeId = $storeId;
}
public function format()
{
$this->data[$this->sendType] = [
[
'templateId' => $this->template,
'storeId' => $this->storeId,
'templateId' => $this->template,
'phoneNumber' => $this->phone,
'param' => $this->param,
'param' => $this->param,
]
];
......
......@@ -22,11 +22,11 @@ class NoticeExtension
/**
* 发送消息通知
*
* @param int $sendTime
* @param $sendTime
* @param mixed ...$senders
* @return bool|mixed
*/
public function send(int $sendTime, ... $senders)
public function send($sendTime, ... $senders)
{
$data = [];
......
......@@ -15,8 +15,8 @@ use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @method ResultInterface deferSend(int $storeId, array $sendTypes, array $data, int $sendTime, string $redisKey) :bool
* @method ResultInterface deferCancelSend(int $storeId, array $sendTypes, array $data, int $sendTime, string $redisKey) :bool
* @method ResultInterface deferSend(int $storeId, array $sendTypes, array $data, $sendTime, string $redisKey) :bool
* @method ResultInterface deferCancelSend(string $redisKey):bool
*/
interface NoticeInterface
{
......@@ -50,6 +50,7 @@ interface NoticeInterface
* 短信发送消息数据结构
$data[NoticeEnum::TYPE_TENCENT_SMS] = [
[
'storeId' => 198
"templateId" => "178822", //模板id
"phoneNumber" => "17558430002",
"param" => [ //模板变量名
......@@ -80,11 +81,11 @@ interface NoticeInterface
*
* @param array $sendTypes
* @param array $data
* @param int $sendTime //发送时间,立即返送填0
* @param $sendTime //如果需要多个时间段发送则填写时间戳数组例如:[15800000,1580000]
* @param string $redisKey //发送事件的redis key(如果定时发送消息,中途需要取消则需要传入此项)
* @return mixed
*/
public function send(array $sendTypes, array $data, int $sendTime, string $redisKey='') :bool;
public function send(array $sendTypes, array $data, $sendTime, string $redisKey='') :bool;
/**
......
......@@ -15,8 +15,7 @@ use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @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 = '',string $message = '');
* @method ResultInterface deferGetOrderInfoBySn(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = [])
* @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 $message = ''); * @method ResultInterface deferGetOrderInfoBySn(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = [])
* @method ResultInterface deferGetOrderInfo(int $storeId,int $orderId)
* @method ResultInterface deferUpdateInfoById(int $storeId,int $orderId, array $updateInfo)
* @method ResultInterface deferGetSimpleList($storeId, $condition, $fields = ['*'])
......@@ -44,26 +43,24 @@ interface OrderInterface
* @param string $activityName
* @param int $goodsId
* @param int $goodsPrice
* @param string $reservation_time
* @param string $message
* @return mixed
*/
public function createOrder(
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 = '',
string $message = ''
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 $message = ''
);
public function getOrderInfo(int $storeId,int $orderId);
......
......@@ -22,7 +22,6 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferModifyReservById(int $storeId, int $id, array $data)
* @method ResultInterface defermarkReservFinished(int $storeId, int $orderId)
* @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, string $memo)
*/
interface ReservationInterface
......@@ -97,15 +96,6 @@ interface ReservationInterface
public function addReservation(int $storeId, int $orderId, int $buyerId, int $cmanId, int $reservTime, string $memo, int $type);
/**
* 取消某个预约
*
* @param integer $storeId
* @param integer $id
* @return boolean 返回取消结果
*/
public function cancelReservById(int $storeId, int $id);
/**
* 根据订单id取消该订单下的所有预约
*
* @param integer $storeId
......
......@@ -34,10 +34,10 @@ interface SubStoreInterface
* 获取storeId获取所有子店铺列表
*
* @param int $storeId
* @param int $state 子店铺状态筛选,0表示正常,1表示关闭,10表示列出所有
* @param int $state 子店铺状态筛选,1表示正常,2表示关闭,0表示列出所有
* @return array
*/
public function getSubStoreList(int $storeId, int $state = 0);
public function getSubStoreList(int $storeId, int $state = 1);
/**
* 修改子店铺信息
......@@ -48,7 +48,7 @@ interface SubStoreInterface
* $data字段说明:
* subStoreName // 门店名称
* mobile // 门店联系手机
* state // 0表示正常状态,1关闭状态
* state // 1表示正常状态,2关闭状态
* storeAddr // 店铺地址
* lntLat // 店铺坐标
* storeHours // 营业时间
......
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